mpi.Comm: java object members as parameters
This commit was SVN r30738.
Этот коммит содержится в:
родитель
d06e5ab42e
Коммит
7c1802e933
@ -359,66 +359,49 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_createIntercomm(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_send(
|
||||
JNIEnv *env, jobject jthis, jobject buf, jint offset,
|
||||
jint count, jobject jType, jint dest, jint tag)
|
||||
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
|
||||
jint count, jlong jType, jint baseType, jint dest, jint tag)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int baseType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
|
||||
void *bufPtr, *bufBase;
|
||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
|
||||
|
||||
int rc = MPI_Send(bufPtr, count, type, dest, tag, comm);
|
||||
ompi_java_exceptionCheck(env, rc);
|
||||
ompi_java_releaseReadBufPtr(env, buf, bufBase, baseType);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_recv(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject buf, jint offset, jint count, jobject jType,
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jobject buf, jint offset, jint count, jlong jType, jint baseType,
|
||||
jint source, jint tag, jobject jStatus)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int baseType = (*env)->GetIntField(env,
|
||||
jType, ompi_java.DatatypeBaseType);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
void *bufPtr, *bufBase;
|
||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
|
||||
|
||||
MPI_Status status;
|
||||
int rc = MPI_Recv(bufPtr, count, type, source, tag, comm, &status);
|
||||
|
||||
ompi_java_exceptionCheck(env, rc);
|
||||
ompi_java_releaseBufPtr(env, buf, bufBase, baseType);
|
||||
ompi_java_status_set(&status, env, jStatus);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_sendRecv(
|
||||
JNIEnv *env, jobject jthis,
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jobject sBuf, jint sOffset, jint sCount,
|
||||
jobject sjType, jint dest, jint sTag,
|
||||
jlong sjType, jint sBaseType, jint dest, jint sTag,
|
||||
jobject rBuf, jint rOffset, jint rCount,
|
||||
jobject rjType, jint source, jint rTag, jobject jStatus)
|
||||
jlong rjType, jint rBaseType, jint source, jint rTag, jobject jStatus)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype sType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, sjType, ompi_java.DatatypeHandle));
|
||||
MPI_Datatype rType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, rjType, ompi_java.DatatypeHandle));
|
||||
|
||||
int sBaseType = (*env)->GetIntField(env,
|
||||
sjType, ompi_java.DatatypeBaseType);
|
||||
int rBaseType = (*env)->GetIntField(env,
|
||||
rjType, ompi_java.DatatypeBaseType);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype sType = (MPI_Datatype)sjType;
|
||||
MPI_Datatype rType = (MPI_Datatype)rjType;
|
||||
|
||||
void *sBufPtr, *sBufBase,
|
||||
*rBufPtr, *rBufBase;
|
||||
@ -438,18 +421,12 @@ JNIEXPORT void JNICALL Java_mpi_Comm_sendRecv(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_sendRecvReplace(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject buf, jint offset, jint count, jobject jType,
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jobject buf, jint offset, jint count, jlong jType, jint baseType,
|
||||
jint dest, jint sTag, jint source, jint rTag, jobject jStatus)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int baseType = (*env)->GetIntField(env,
|
||||
jType, ompi_java.DatatypeBaseType);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
MPI_Status status;
|
||||
void *bufPtr, *bufBase;
|
||||
@ -464,17 +441,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_sendRecvReplace(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_bSend(
|
||||
JNIEnv *env, jobject jthis, jobject buf, jint offset,
|
||||
jint count, jobject jType, jint dest, jint tag)
|
||||
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
|
||||
jint count, jlong jType, jint baseType, jint dest, jint tag)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int baseType = (*env)->GetIntField(env,
|
||||
jType, ompi_java.DatatypeBaseType);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
void *bufPtr, *bufBase;
|
||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
|
||||
@ -485,18 +456,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_bSend(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_sSend(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject buf, jint offset, jint count,
|
||||
jobject jType, jint dest, jint tag)
|
||||
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
|
||||
jint count, jlong jType, jint baseType, jint dest, jint tag)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int baseType = (*env)->GetIntField(env,
|
||||
jType, ompi_java.DatatypeBaseType);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
void *bufPtr, *bufBase;
|
||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
|
||||
@ -507,18 +471,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_sSend(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_rSend(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject buf, jint offset, jint count,
|
||||
jobject jType, jint dest, jint tag)
|
||||
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
|
||||
jint count, jlong jType, jint baseType, jint dest, jint tag)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int baseType = (*env)->GetIntField(env,
|
||||
jType, ompi_java.DatatypeBaseType);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
void *bufPtr, *bufBase;
|
||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
|
||||
@ -669,17 +626,12 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_recvInit(
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mpi_Comm_pack(
|
||||
JNIEnv *env, jobject jthis, jobject inBuf, jint offset,
|
||||
jint inCount, jobject jType, jbyteArray outBuf, jint position)
|
||||
JNIEnv *env, jobject jthis, jlong jComm, jobject inBuf, jint offset,
|
||||
jint inCount, jlong jType, jint bType, jbyteArray outBuf, jint position)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType),
|
||||
outSize = (*env)->GetArrayLength(env,outBuf);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
int outSize = (*env)->GetArrayLength(env, outBuf);
|
||||
|
||||
void *oBufPtr, *iBufPtr, *iBufBase;
|
||||
oBufPtr = (*env)->GetPrimitiveArrayCritical(env, outBuf, NULL);
|
||||
@ -700,17 +652,13 @@ JNIEXPORT jint JNICALL Java_mpi_Comm_pack(
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mpi_Comm_unpack(
|
||||
JNIEnv *env, jobject jthis, jbyteArray inBuf, jint position,
|
||||
jobject outBuf, jint offset, jint outCount, jobject jType)
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jbyteArray inBuf, jint position, jobject outBuf,
|
||||
jint offset, jint outCount, jlong jType, jint bType)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, jType, ompi_java.DatatypeHandle));
|
||||
|
||||
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType),
|
||||
inSize = (*env)->GetArrayLength(env, inBuf);
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
int inSize = (*env)->GetArrayLength(env, inBuf);
|
||||
|
||||
void *iBufPtr, *oBufPtr, *oBufBase;
|
||||
iBufPtr = (*env)->GetPrimitiveArrayCritical(env, inBuf, NULL);
|
||||
@ -878,20 +826,16 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iBarrier(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_bcast(
|
||||
JNIEnv *env, jobject jthis, jobject buf, jint offset,
|
||||
jint count, jobject type, jint root)
|
||||
JNIEnv *env, jobject jthis, jlong jComm, jobject buf,
|
||||
jint offset, jint count, jlong jType, jint baseType, jint root)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
|
||||
MPI_Datatype mpiType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, type, ompi_java.DatatypeHandle));
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
MPI_Datatype type = (MPI_Datatype)jType;
|
||||
|
||||
void *bufPtr, *bufBase;
|
||||
int baseType = (*env)->GetIntField(env, type, ompi_java.DatatypeBaseType);
|
||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
|
||||
|
||||
int rc = MPI_Bcast(bufPtr, count, mpiType, root, comm);
|
||||
int rc = MPI_Bcast(bufPtr, count, type, root, comm);
|
||||
ompi_java_exceptionCheck(env, rc);
|
||||
ompi_java_releaseBufPtr(env, buf, bufBase, baseType);
|
||||
}
|
||||
@ -911,13 +855,13 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iBcast(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_gather(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject sendBuf, jint sOffset, jint sCount, jobject sJType,
|
||||
jobject recvBuf, jint rOffset, jint rCount, jobject rJType,
|
||||
jint root)
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jobject sendBuf, jint sOffset, jint sCount,
|
||||
jlong sjType, jint sBType,
|
||||
jobject recvBuf, jint rOffset, jint rCount,
|
||||
jlong rjType, jint rBType, jint root)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
int id;
|
||||
int rc = MPI_Comm_rank(comm, &id);
|
||||
int rootOrInter = id == root || isInter(env, comm);
|
||||
@ -927,27 +871,21 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gather(
|
||||
|
||||
void *sPtr, *sBase, *rPtr = NULL, *rBase;
|
||||
MPI_Datatype sType;
|
||||
int sBType, rBType;
|
||||
|
||||
if(sJType == NULL)
|
||||
if(sjType == 0)
|
||||
{
|
||||
assert(sendBuf == NULL);
|
||||
sType = MPI_DATATYPE_NULL;
|
||||
sBType = 0;
|
||||
sPtr = MPI_IN_PLACE;
|
||||
sBase = NULL;
|
||||
sType = MPI_DATATYPE_NULL;
|
||||
sPtr = MPI_IN_PLACE;
|
||||
sBase = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, sJType, ompi_java.DatatypeHandle));
|
||||
|
||||
sBType = (*env)->GetIntField(env, sJType, ompi_java.DatatypeBaseType);
|
||||
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
|
||||
sType = (MPI_Datatype)sjType;
|
||||
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
|
||||
}
|
||||
|
||||
MPI_Datatype rType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, rJType, ompi_java.DatatypeHandle));
|
||||
MPI_Datatype rType = (MPI_Datatype)rjType;
|
||||
|
||||
if(rootOrInter || sPtr == MPI_IN_PLACE)
|
||||
{
|
||||
@ -961,8 +899,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gather(
|
||||
* in all processes, notwithstanding what the spec says.)
|
||||
*/
|
||||
|
||||
rBType = (*env)->GetIntField(env, rJType, ompi_java.DatatypeBaseType);
|
||||
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
|
||||
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
|
||||
|
||||
if(!rootOrInter)
|
||||
{
|
||||
@ -1049,13 +986,12 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iGather(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_gatherv(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject sendBuf, jint sOffset, jint sCount, jobject sJType,
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jobject sendBuf, jint sOffset, jint sCount, jlong sjType, jint sBType,
|
||||
jobject recvBuf, jint rOffset, jintArray rCounts,
|
||||
jintArray displs, jobject rJType, jint root)
|
||||
jintArray displs, jlong rjType, jint rBType, jint root)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
int id;
|
||||
int rc = MPI_Comm_rank(comm, &id);
|
||||
int rootOrInter = id == root || isInter(env, comm);
|
||||
@ -1065,40 +1001,31 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gatherv(
|
||||
|
||||
void *sPtr, *sBase, *rPtr = NULL, *rBase;
|
||||
MPI_Datatype sType;
|
||||
int sBType;
|
||||
|
||||
if(sJType == NULL)
|
||||
if(sjType == 0)
|
||||
{
|
||||
assert(sendBuf == NULL);
|
||||
sType = MPI_DATATYPE_NULL;
|
||||
sBType = 0;
|
||||
sPtr = MPI_IN_PLACE;
|
||||
sBase = NULL;
|
||||
sType = MPI_DATATYPE_NULL;
|
||||
sPtr = MPI_IN_PLACE;
|
||||
sBase = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, sJType, ompi_java.DatatypeHandle));
|
||||
|
||||
sBType = (*env)->GetIntField(env, sJType, ompi_java.DatatypeBaseType);
|
||||
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
|
||||
sType = (MPI_Datatype)sjType;
|
||||
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
|
||||
}
|
||||
|
||||
jint *jRCounts = NULL, *jDispls = NULL;
|
||||
int *cRCounts = NULL, *cDispls = NULL;
|
||||
MPI_Datatype rType = sType;
|
||||
int rBType;
|
||||
|
||||
if(rootOrInter)
|
||||
{
|
||||
ompi_java_getIntArray(env, rCounts, &jRCounts, &cRCounts);
|
||||
ompi_java_getIntArray(env, displs, &jDispls, &cDispls);
|
||||
|
||||
rType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, rJType, ompi_java.DatatypeHandle));
|
||||
|
||||
rBType = (*env)->GetIntField(env, rJType, ompi_java.DatatypeBaseType);
|
||||
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
|
||||
rType = (MPI_Datatype)rjType;
|
||||
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
|
||||
}
|
||||
|
||||
rc = MPI_Gatherv(sPtr, sCount, sType, rPtr, cRCounts,
|
||||
@ -1176,12 +1103,13 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iGatherv(
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_mpi_Comm_scatter(
|
||||
JNIEnv *env, jobject jthis,
|
||||
jobject sendBuf, jint sOffset, jint sCount, jobject sJType,
|
||||
jobject recvBuf, jint rOffset, jint rCount, jobject rJType, jint root)
|
||||
JNIEnv *env, jobject jthis, jlong jComm,
|
||||
jobject sendBuf, jint sOffset, jint sCount,
|
||||
jlong sjType, jint sBType,
|
||||
jobject recvBuf, jint rOffset, jint rCount,
|
||||
jlong rjType, jint rBType, jint root)
|
||||
{
|
||||
MPI_Comm comm = (MPI_Comm)((*env)->GetLongField(
|
||||
env, jthis, ompi_java.CommHandle));
|
||||
MPI_Comm comm = (MPI_Comm)jComm;
|
||||
int id;
|
||||
int rc = MPI_Comm_rank(comm, &id);
|
||||
int rootOrInter = id == root || isInter(env, comm);
|
||||
@ -1191,31 +1119,24 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatter(
|
||||
|
||||
void *sPtr = NULL, *sBase, *rPtr, *rBase;
|
||||
MPI_Datatype sType, rType;
|
||||
int sBType, rBType;
|
||||
|
||||
if(rJType == NULL)
|
||||
if(rjType == 0)
|
||||
{
|
||||
assert(recvBuf == NULL);
|
||||
rType = MPI_DATATYPE_NULL;
|
||||
rPtr = MPI_IN_PLACE;
|
||||
rBType = 0;
|
||||
rType = MPI_DATATYPE_NULL;
|
||||
rPtr = MPI_IN_PLACE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, rJType, ompi_java.DatatypeHandle));
|
||||
|
||||
rBType = (*env)->GetIntField(env, rJType, ompi_java.DatatypeBaseType);
|
||||
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
|
||||
rType = (MPI_Datatype)rjType;
|
||||
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
|
||||
}
|
||||
|
||||
sType = (MPI_Datatype)((*env)->GetLongField(
|
||||
env, sJType, ompi_java.DatatypeHandle));
|
||||
sType = (MPI_Datatype)sjType;
|
||||
|
||||
if(rootOrInter || rPtr == MPI_IN_PLACE)
|
||||
{
|
||||
sBType = (*env)->GetIntField(env, sJType, ompi_java.DatatypeBaseType);
|
||||
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
|
||||
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
|
||||
|
||||
if(!rootOrInter)
|
||||
{
|
||||
|
@ -247,12 +247,12 @@ public final void send(Object buf, int count, Datatype type, int dest, int tag)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
send(buf, off, count, type, dest, tag);
|
||||
send(handle, buf, off, count, type.handle, type.baseType, dest, tag);
|
||||
}
|
||||
|
||||
private native void send(Object buf, int offset, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
throws MPIException;
|
||||
private native void send(
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int baseType, int dest, int tag) throws MPIException;
|
||||
|
||||
/**
|
||||
* Blocking receive operation.
|
||||
@ -279,13 +279,14 @@ public final Status recv(Object buf, int count,
|
||||
}
|
||||
|
||||
Status stat = new Status();
|
||||
recv(buf, off, count, type, source, tag, stat);
|
||||
recv(handle, buf, off, count, type.handle, type.baseType, source, tag, stat);
|
||||
return stat;
|
||||
}
|
||||
|
||||
private native void recv(
|
||||
Object buf, int offset, int count, Datatype type,
|
||||
int source, int tag, Status stat) throws MPIException;
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int basetype, int source, int tag, Status stat)
|
||||
throws MPIException;
|
||||
|
||||
// Send-Recv
|
||||
|
||||
@ -331,17 +332,20 @@ public final Status sendRecv(
|
||||
|
||||
Status stat = new Status();
|
||||
|
||||
sendRecv(sendbuf, sendoff, sendcount, sendtype, dest, sendtag,
|
||||
recvbuf, recvoff, recvcount, recvtype, source, recvtag, stat);
|
||||
sendRecv(handle, sendbuf, sendoff, sendcount,
|
||||
sendtype.handle, sendtype.baseType, dest, sendtag,
|
||||
recvbuf, recvoff, recvcount,
|
||||
recvtype.handle, recvtype.baseType, source, recvtag, stat);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
private native void sendRecv(Object sbuf, int soffset, int scount,
|
||||
Datatype stype, int dest, int stag,
|
||||
Object rbuf, int roffset, int rcount,
|
||||
Datatype rtype, int source, int rtag,
|
||||
Status stat) throws MPIException;
|
||||
private native void sendRecv(
|
||||
long comm, Object sbuf, int soffset, int scount,
|
||||
long sType, int sBaseType, int dest, int stag,
|
||||
Object rbuf, int roffset, int rcount,
|
||||
long rType, int rBaseType, int source, int rtag,
|
||||
Status stat) throws MPIException;
|
||||
|
||||
/**
|
||||
* Execute a blocking send and receive operation,
|
||||
@ -375,14 +379,15 @@ public final Status sendRecvReplace(
|
||||
|
||||
Status stat = new Status();
|
||||
|
||||
sendRecvReplace(buf, off, count, type, dest,
|
||||
sendtag, source, recvtag, stat);
|
||||
sendRecvReplace(handle, buf, off, count, type.handle, type.baseType,
|
||||
dest, sendtag, source, recvtag, stat);
|
||||
return stat;
|
||||
}
|
||||
|
||||
private native void sendRecvReplace(
|
||||
Object buf, int offset, int count, Datatype type, int dest,
|
||||
int stag, int source, int rtag, Status stat) throws MPIException;
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int baseType, int dest, int stag,
|
||||
int source, int rtag, Status stat) throws MPIException;
|
||||
|
||||
// Communication Modes
|
||||
|
||||
@ -395,7 +400,7 @@ private native void sendRecvReplace(
|
||||
* @param dest rank of destination
|
||||
* @param tag message tag
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final void bSend(Object buf, int count, Datatype type, int dest, int tag)
|
||||
throws MPIException
|
||||
@ -409,12 +414,13 @@ public final void bSend(Object buf, int count, Datatype type, int dest, int tag)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
bSend(buf, off, count, type, dest, tag);
|
||||
bSend(handle, buf, off, count, type.handle, type.baseType, dest, tag);
|
||||
}
|
||||
|
||||
private native void bSend(Object buf, int offset, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
throws MPIException;
|
||||
private native void bSend(
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int baseType, int dest, int tag) throws MPIException;
|
||||
|
||||
/**
|
||||
* Send in synchronous mode.
|
||||
* <p>Java binding of the MPI operation {@code MPI_SSEND}.
|
||||
@ -424,7 +430,7 @@ private native void bSend(Object buf, int offset, int count,
|
||||
* @param dest rank of destination
|
||||
* @param tag message tag
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final void sSend(Object buf, int count, Datatype type, int dest, int tag)
|
||||
throws MPIException
|
||||
@ -438,12 +444,12 @@ public final void sSend(Object buf, int count, Datatype type, int dest, int tag)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
sSend(buf, off, count, type, dest, tag);
|
||||
sSend(handle, buf, off, count, type.handle, type.baseType, dest, tag);
|
||||
}
|
||||
|
||||
private native void sSend(Object buf, int offset, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
throws MPIException;
|
||||
private native void sSend(
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int baseType, int dest, int tag) throws MPIException;
|
||||
|
||||
/**
|
||||
* Send in ready mode.
|
||||
@ -454,7 +460,7 @@ private native void sSend(Object buf, int offset, int count,
|
||||
* @param dest rank of destination
|
||||
* @param tag message tag
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final void rSend(Object buf, int count, Datatype type, int dest, int tag)
|
||||
throws MPIException
|
||||
@ -468,12 +474,12 @@ public final void rSend(Object buf, int count, Datatype type, int dest, int tag)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
rSend(buf, off, count, type, dest, tag);
|
||||
rSend(handle, buf, off, count, type.handle, type.baseType, dest, tag);
|
||||
}
|
||||
|
||||
private native void rSend(Object buf, int offset, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
throws MPIException;
|
||||
private native void rSend(
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int baseType, int dest, int tag) throws MPIException;
|
||||
|
||||
// Nonblocking communication
|
||||
|
||||
@ -487,7 +493,7 @@ private native void rSend(Object buf, int offset, int count,
|
||||
* @param tag message tag
|
||||
* @return communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Request iSend(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -515,7 +521,7 @@ protected final native long iSend(
|
||||
* @param tag message tag
|
||||
* @return communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Request ibSend(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -543,7 +549,7 @@ protected final native long ibSend(
|
||||
* @param tag message tag
|
||||
* @return communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Request isSend(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -571,7 +577,7 @@ protected final native long isSend(
|
||||
* @param tag message tag
|
||||
* @return communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Request irSend(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -630,7 +636,7 @@ protected final native long iRecv(
|
||||
* @param tag message tag
|
||||
* @return persistent communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Prequest sendInit(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -655,7 +661,7 @@ private native long sendInit(
|
||||
* @param tag message tag
|
||||
* @return persistent communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Prequest bSendInit(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -680,7 +686,7 @@ private native long bSendInit(
|
||||
* @param tag message tag
|
||||
* @return persistent communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Prequest sSendInit(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -705,7 +711,7 @@ private native long sSendInit(
|
||||
* @param tag message tag
|
||||
* @return persistent communication request
|
||||
* @throws MPIException
|
||||
* @see mpi.Comm#send(Object, int, int, Datatype, int, int)
|
||||
* @see mpi.Comm#send(Object, int, Datatype, int, int)
|
||||
*/
|
||||
public final Prequest rSendInit(Buffer buf, int count,
|
||||
Datatype type, int dest, int tag)
|
||||
@ -776,12 +782,14 @@ public final int pack(Object inbuf, int incount, Datatype type,
|
||||
inbuf = ((Buffer)inbuf).array();
|
||||
}
|
||||
|
||||
return pack(inbuf, offset, incount, type, outbuf, position);
|
||||
return pack(handle, inbuf, offset, incount,
|
||||
type.handle, type.baseType, outbuf, position);
|
||||
}
|
||||
|
||||
private native int pack(Object inbuf, int offset, int incount,
|
||||
Datatype type, byte[] outbuf, int position)
|
||||
throws MPIException;
|
||||
private native int pack(
|
||||
long comm, Object inbuf, int offset, int incount,
|
||||
long type, int baseType, byte[] outbuf, int position)
|
||||
throws MPIException;
|
||||
|
||||
/**
|
||||
* Unpacks message in receive buffer {@code outbuf} into space specified in
|
||||
@ -812,12 +820,13 @@ public final int unpack(byte[] inbuf, int position,
|
||||
outbuf = ((Buffer)outbuf).array();
|
||||
}
|
||||
|
||||
return unpack(inbuf, position, outbuf, offset, outcount, type);
|
||||
return unpack(handle, inbuf, position, outbuf,
|
||||
offset, outcount, type.handle, type.baseType);
|
||||
}
|
||||
|
||||
private native int unpack(byte[] inbuf, int position, Object outbuf,
|
||||
int offset, int outcount, Datatype type)
|
||||
throws MPIException;
|
||||
private native int unpack(
|
||||
long comm, byte[] inbuf, int position, Object outbuf,
|
||||
int offset, int outcount, long type, int baseType) throws MPIException;
|
||||
|
||||
/**
|
||||
* Returns an upper bound on the increment of {@code position} effected
|
||||
@ -1093,12 +1102,12 @@ public final void bcast(Object buf, int count, Datatype type, int root)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
bcast(buf, off, count, type, root);
|
||||
bcast(handle, buf, off, count, type.handle, type.baseType, root);
|
||||
}
|
||||
|
||||
private native void bcast(Object buf, int offset, int count,
|
||||
Datatype type, int root)
|
||||
throws MPIException;
|
||||
private native void bcast(
|
||||
long comm, Object buf, int offset, int count,
|
||||
long type, int basetype, int root) throws MPIException;
|
||||
|
||||
/**
|
||||
* Broadcast a message from the process with rank {@code root}
|
||||
@ -1157,8 +1166,10 @@ public final void gather(
|
||||
recvbuf = ((Buffer)recvbuf).array();
|
||||
}
|
||||
|
||||
gather(sendbuf, sendoff, sendcount, sendtype,
|
||||
recvbuf, recvoff, recvcount, recvtype, root);
|
||||
gather(handle, sendbuf, sendoff, sendcount,
|
||||
sendtype.handle, sendtype.baseType,
|
||||
recvbuf, recvoff, recvcount,
|
||||
recvtype.handle, recvtype.baseType, root);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1185,12 +1196,15 @@ public final void gather(Object buf, int count, Datatype type, int root)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
gather(null, 0, 0, null, buf, off, count, type, root);
|
||||
gather(handle, null, 0, 0, 0, 0,
|
||||
buf, off, count, type.handle, type.baseType, root);
|
||||
}
|
||||
|
||||
private native void gather(
|
||||
Object sendbuf, int sendoff, int sendcount, Datatype sendtype,
|
||||
Object recvbuf, int recvoff, int recvcount, Datatype recvtype, int root)
|
||||
long comm, Object sendBuf, int sendOff, int sendCount,
|
||||
long sendType, int sendBaseType,
|
||||
Object recvBuf, int recvOff, int recvCount,
|
||||
long recvType, int recvBaseType, int root)
|
||||
throws MPIException;
|
||||
|
||||
/**
|
||||
@ -1282,8 +1296,10 @@ public final void gatherv(Object sendbuf, int sendcount, Datatype sendtype,
|
||||
recvbuf = ((Buffer)recvbuf).array();
|
||||
}
|
||||
|
||||
gatherv(sendbuf, sendoff, sendcount, sendtype,
|
||||
recvbuf, recvoff, recvcount, displs, recvtype, root);
|
||||
gatherv(handle, sendbuf, sendoff, sendcount,
|
||||
sendtype.handle, sendtype.baseType,
|
||||
recvbuf, recvoff, recvcount, displs,
|
||||
recvtype.handle, recvtype.baseType, root);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1312,8 +1328,8 @@ public final void gatherv(Object recvbuf, int[] recvcount, int[] displs,
|
||||
recvbuf = ((Buffer)recvbuf).array();
|
||||
}
|
||||
|
||||
gatherv(null, 0, 0, null,
|
||||
recvbuf, recvoff, recvcount, displs, recvtype, root);
|
||||
gatherv(handle, null, 0, 0, 0, 0, recvbuf, recvoff, recvcount,
|
||||
displs, recvtype.handle, recvtype.baseType, root);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1341,14 +1357,16 @@ public final void gatherv(Object sendbuf, int sendcount,
|
||||
sendbuf = ((Buffer)sendbuf).array();
|
||||
}
|
||||
|
||||
gatherv(sendbuf, sendoff, sendcount, sendtype,
|
||||
null, 0, null, null, null, root);
|
||||
gatherv(handle, sendbuf, sendoff, sendcount,
|
||||
sendtype.handle, sendtype.baseType,
|
||||
null, 0, null, null, 0, 0, root);
|
||||
}
|
||||
|
||||
private native void gatherv(
|
||||
Object sendbuf, int sendoffset, int sendcount, Datatype sendtype,
|
||||
Object recvbuf, int recvoffset, int[] recvcount, int[] displs,
|
||||
Datatype recvtype, int root) throws MPIException;
|
||||
long comm, Object sendBuf, int sendOffset, int sendCount,
|
||||
long sendType, int sendBaseType,
|
||||
Object recvBuf, int recvOffset, int[] recvCount, int[] displs,
|
||||
long recvType, int recvBaseType, int root) throws MPIException;
|
||||
|
||||
/**
|
||||
* Extends functionality of {@code gather} by allowing varying
|
||||
@ -1467,8 +1485,10 @@ public final void scatter(
|
||||
recvbuf = ((Buffer)recvbuf).array();
|
||||
}
|
||||
|
||||
scatter(sendbuf, sendoff, sendcount, sendtype,
|
||||
recvbuf, recvoff, recvcount, recvtype, root);
|
||||
scatter(handle, sendbuf, sendoff, sendcount,
|
||||
sendtype.handle, sendtype.baseType,
|
||||
recvbuf, recvoff, recvcount,
|
||||
recvtype.handle, recvtype.baseType, root);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1495,13 +1515,15 @@ public final void scatter(Object buf, int count, Datatype type, int root)
|
||||
buf = ((Buffer)buf).array();
|
||||
}
|
||||
|
||||
scatter(buf, off, count, type, null, 0, 0, null, root);
|
||||
scatter(handle, buf, off, count, type.handle, type.baseType,
|
||||
null, 0, 0, 0, 0, root);
|
||||
}
|
||||
|
||||
private native void scatter(
|
||||
Object sendbuf, int sendoffset, int sendcount, Datatype sendtype,
|
||||
Object recvbuf, int recvoffset, int recvcount, Datatype recvtype,
|
||||
int root) throws MPIException;
|
||||
long comm, Object sendBuf, int sendOffset, int sendCount,
|
||||
long sendType, int sendBaseType,
|
||||
Object recvBuf, int recvOffset, int recvCount,
|
||||
long recvType, int recvBaseType, int root) throws MPIException;
|
||||
|
||||
/**
|
||||
* Inverse of the operation {@code gather}.
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user