1
1
This commit was SVN r30745.
Этот коммит содержится в:
Oscar Vega-Gisbert 2014-02-16 22:58:01 +00:00
родитель ea0217c337
Коммит 86e40c568a
9 изменённых файлов: 513 добавлений и 390 удалений

Просмотреть файл

@ -60,13 +60,14 @@ extern ompi_java_globals_t ompi_java;
void ompi_java_init_native_Datatype(JNIEnv *env);
void* ompi_java_getBufPtr(
void** bufBase, JNIEnv *env, jobject buf, int baseType, int offset);
void** bufBase, JNIEnv *env,
jobject buf, jboolean db, int baseType, int offset);
void ompi_java_releaseBufPtr(
JNIEnv *env, jobject buf, void* bufBase, int baseType);
JNIEnv *env, jobject buf, jboolean db, void* bufBase, int baseType);
void ompi_java_releaseReadBufPtr(
JNIEnv *env, jobject buf, void *bufBase, int baseType);
JNIEnv *env, jobject buf, jboolean db, void *bufBase, int baseType);
void* ompi_java_getDirectBufferAddress(JNIEnv *env, jobject buf);

Просмотреть файл

@ -132,7 +132,7 @@ static void releaseArrayPtr(JNIEnv *e, jobject buf, void *bufBase,
}
void* ompi_java_getBufPtr(void** bufBase, JNIEnv *env, jobject buf,
int baseType, int offset)
jboolean db, int baseType, int offset)
{
if(buf == NULL)
{
@ -140,33 +140,29 @@ void* ompi_java_getBufPtr(void** bufBase, JNIEnv *env, jobject buf,
*bufBase = NULL;
return NULL;
}
else
else if(db)
{
*bufBase = (*env)->GetDirectBufferAddress(env, buf);
if(*bufBase != NULL)
{
assert(offset == 0);
return *bufBase;
}
else
{
return getArrayPtr(bufBase, env, buf, baseType, offset);
}
assert(offset == 0);
return *bufBase;
}
else
{
return getArrayPtr(bufBase, env, buf, baseType, offset);
}
}
void ompi_java_releaseBufPtr(JNIEnv *env, jobject buf,
void ompi_java_releaseBufPtr(JNIEnv *env, jobject buf, jboolean db,
void* bufBase, int baseType)
{
if(buf != NULL && (*env)->GetDirectBufferAddress(env, buf) == NULL)
if(buf != NULL && !db)
releaseArrayPtr(env, buf, bufBase, baseType, 0);
}
void ompi_java_releaseReadBufPtr(
JNIEnv *env, jobject buf, void *bufBase, int baseType)
void ompi_java_releaseReadBufPtr(JNIEnv *env, jobject buf, jboolean db,
void *bufBase, int baseType)
{
if(buf != NULL && (*env)->GetDirectBufferAddress(env, buf) == NULL)
if(buf != NULL && !db)
releaseArrayPtr(env, buf, bufBase, baseType, JNI_ABORT);
}
@ -212,13 +208,19 @@ static void* getArrayCritical(void** bufBase, JNIEnv *env,
}
}
static void* getBufCritical(void** bufBase, JNIEnv *env,
jobject buf, int baseType, int offset)
static void* getBufCritical(
void** bufBase, JNIEnv *env,
jobject buf, jboolean db, int baseType, int offset)
{
*bufBase = (*env)->GetDirectBufferAddress(env, buf);
if(*bufBase != NULL)
if(buf == NULL)
{
/* Allow NULL buffers to send/recv 0 items as control messages. */
*bufBase = NULL;
return NULL;
}
else if(db)
{
*bufBase = (*env)->GetDirectBufferAddress(env, buf);
assert(offset == 0);
return *bufBase;
}
@ -228,9 +230,10 @@ static void* getBufCritical(void** bufBase, JNIEnv *env,
}
}
static void releaseBufCritical(JNIEnv *env, jobject buf, void* bufBase)
static void releaseBufCritical(
JNIEnv *env, jobject buf, jboolean db, void* bufBase)
{
if((*env)->GetDirectBufferAddress(env, buf) == NULL)
if(buf != NULL && !db)
(*env)->ReleasePrimitiveArrayCritical(env, buf, bufBase, 0);
}
@ -359,44 +362,46 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_createIntercomm(
}
JNIEXPORT void JNICALL Java_mpi_Comm_send(
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
jint count, jlong jType, jint baseType, jint dest, jint tag)
JNIEnv *env, jobject jthis, jlong jComm,
jobject buf, jboolean db, jint offset, jint count,
jlong jType, jint baseType, jint dest, jint tag)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype type = (MPI_Datatype)jType;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, baseType, offset);
int rc = MPI_Send(bufPtr, count, type, dest, tag, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, bufBase, baseType);
ompi_java_releaseReadBufPtr(env, buf, db, bufBase, baseType);
}
JNIEXPORT void JNICALL Java_mpi_Comm_recv(
JNIEnv *env, jobject jthis, jlong jComm,
jobject buf, jint offset, jint count, jlong jType, jint baseType,
jobject buf, jboolean db, jint offset, jint count,
jlong jType, jint baseType,
jint source, jint tag, jobject jStatus)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype type = (MPI_Datatype)jType;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, 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_releaseBufPtr(env, buf, db, bufBase, baseType);
ompi_java_status_set(&status, env, jStatus);
}
JNIEXPORT void JNICALL Java_mpi_Comm_sendRecv(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sBuf, jint sOffset, jint sCount,
jobject sBuf, jboolean sdb, jint sOffset, jint sCount,
jlong sjType, jint sBaseType, jint dest, jint sTag,
jobject rBuf, jint rOffset, jint rCount,
jobject rBuf, jboolean rdb, jint rOffset, jint rCount,
jlong rjType, jint rBaseType, jint source, jint rTag, jobject jStatus)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -406,8 +411,8 @@ JNIEXPORT void JNICALL Java_mpi_Comm_sendRecv(
void *sBufPtr, *sBufBase,
*rBufPtr, *rBufBase;
sBufPtr = ompi_java_getBufPtr(&sBufBase, env, sBuf, sBaseType, sOffset);
rBufPtr = ompi_java_getBufPtr(&rBufBase, env, rBuf, rBaseType, rOffset);
sBufPtr = ompi_java_getBufPtr(&sBufBase, env, sBuf, sdb, sBaseType, sOffset);
rBufPtr = ompi_java_getBufPtr(&rBufBase, env, rBuf, rdb, rBaseType, rOffset);
MPI_Status status;
int rc = MPI_Sendrecv(sBufPtr, sCount, sType, dest, sTag,
@ -415,14 +420,15 @@ JNIEXPORT void JNICALL Java_mpi_Comm_sendRecv(
comm, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, sBuf, sBufBase, sBaseType);
ompi_java_releaseBufPtr(env, rBuf, rBufBase, rBaseType);
ompi_java_releaseReadBufPtr(env, sBuf, sdb, sBufBase, sBaseType);
ompi_java_releaseBufPtr(env, rBuf, rdb, rBufBase, rBaseType);
ompi_java_status_set(&status, env, jStatus);
}
JNIEXPORT void JNICALL Java_mpi_Comm_sendRecvReplace(
JNIEnv *env, jobject jthis, jlong jComm,
jobject buf, jint offset, jint count, jlong jType, jint baseType,
jobject buf, jboolean db, jint offset,
jint count, jlong jType, jint baseType,
jint dest, jint sTag, jint source, jint rTag, jobject jStatus)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -430,59 +436,62 @@ JNIEXPORT void JNICALL Java_mpi_Comm_sendRecvReplace(
MPI_Status status;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, baseType, offset);
int rc = MPI_Sendrecv_replace(bufPtr, count, type, dest,
sTag, source, rTag, comm, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, bufBase, baseType);
ompi_java_releaseBufPtr(env, buf, db, bufBase, baseType);
ompi_java_status_set(&status, env, jStatus);
}
JNIEXPORT void JNICALL Java_mpi_Comm_bSend(
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
JNIEnv *env, jobject jthis, jlong jComm,
jobject buf, jboolean db, jint offset,
jint count, jlong jType, jint baseType, jint dest, jint tag)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype type = (MPI_Datatype)jType;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, baseType, offset);
int rc = MPI_Bsend(bufPtr, count, type, dest, tag, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, bufBase, baseType);
ompi_java_releaseReadBufPtr(env, buf, db, bufBase, baseType);
}
JNIEXPORT void JNICALL Java_mpi_Comm_sSend(
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
JNIEnv *env, jobject jthis, jlong jComm,
jobject buf, jboolean db, jint offset,
jint count, jlong jType, jint baseType, jint dest, jint tag)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype type = (MPI_Datatype)jType;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, baseType, offset);
int rc = MPI_Ssend(bufPtr, count, type, dest, tag, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, bufBase, baseType);
ompi_java_releaseReadBufPtr(env, buf, db, bufBase, baseType);
}
JNIEXPORT void JNICALL Java_mpi_Comm_rSend(
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jint offset,
JNIEnv *env, jobject jthis, jlong jComm,
jobject buf, jboolean db, jint offset,
jint count, jlong jType, jint baseType, jint dest, jint tag)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype type = (MPI_Datatype)jType;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, baseType, offset);
int rc = MPI_Rsend(bufPtr, count, type, dest, tag, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, bufBase, baseType);
ompi_java_releaseReadBufPtr(env, buf, db, bufBase, baseType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iSend(
@ -626,7 +635,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_recvInit(
}
JNIEXPORT jint JNICALL Java_mpi_Comm_pack(
JNIEnv *env, jobject jthis, jlong jComm, jobject inBuf, jint offset,
JNIEnv *env, jobject jthis, jlong jComm,
jobject inBuf, jboolean indb, jint offset,
jint inCount, jlong jType, jint bType, jbyteArray outBuf, jint position)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -635,7 +645,7 @@ JNIEXPORT jint JNICALL Java_mpi_Comm_pack(
void *oBufPtr, *iBufPtr, *iBufBase;
oBufPtr = (*env)->GetPrimitiveArrayCritical(env, outBuf, NULL);
iBufPtr = getBufCritical(&iBufBase, env, inBuf, bType, offset);
iBufPtr = getBufCritical(&iBufBase, env, inBuf, indb, bType, offset);
if(inCount != 0 && outSize != position)
{
@ -646,14 +656,14 @@ JNIEXPORT jint JNICALL Java_mpi_Comm_pack(
ompi_java_exceptionCheck(env, rc);
}
releaseBufCritical(env, inBuf, iBufBase);
releaseBufCritical(env, inBuf, indb, iBufBase);
(*env)->ReleasePrimitiveArrayCritical(env, outBuf, oBufPtr, 0);
return position;
}
JNIEXPORT jint JNICALL Java_mpi_Comm_unpack(
JNIEnv *env, jobject jthis, jlong jComm,
jbyteArray inBuf, jint position, jobject outBuf,
jbyteArray inBuf, jint position, jobject outBuf, jboolean outdb,
jint offset, jint outCount, jlong jType, jint bType)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -662,14 +672,14 @@ JNIEXPORT jint JNICALL Java_mpi_Comm_unpack(
void *iBufPtr, *oBufPtr, *oBufBase;
iBufPtr = (*env)->GetPrimitiveArrayCritical(env, inBuf, NULL);
oBufPtr = getBufCritical(&oBufBase, env, outBuf, bType, offset);
oBufPtr = getBufCritical(&oBufBase, env, outBuf, outdb, bType, offset);
int rc = MPI_Unpack(iBufPtr, inSize, &position,
oBufPtr, outCount, type, comm);
ompi_java_exceptionCheck(env, rc);
(*env)->ReleasePrimitiveArrayCritical(env, inBuf, iBufPtr, 0);
releaseBufCritical(env, outBuf, oBufBase);
releaseBufCritical(env, outBuf, outdb, oBufBase);
return position;
}
@ -826,18 +836,18 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iBarrier(
}
JNIEXPORT void JNICALL Java_mpi_Comm_bcast(
JNIEnv *env, jobject jthis, jlong jComm, jobject buf,
JNIEnv *env, jobject jthis, jlong jComm, jobject buf, jboolean db,
jint offset, jint count, jlong jType, jint baseType, jint root)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype type = (MPI_Datatype)jType;
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, baseType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, baseType, offset);
int rc = MPI_Bcast(bufPtr, count, type, root, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, bufBase, baseType);
ompi_java_releaseBufPtr(env, buf, db, bufBase, baseType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iBcast(
@ -856,9 +866,9 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iBcast(
JNIEXPORT void JNICALL Java_mpi_Comm_gather(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jint sCount,
jobject sendBuf, jboolean sdb, jint sOffset, jint sCount,
jlong sjType, jint sBType,
jobject recvBuf, jint rOffset, jint rCount,
jobject recvBuf, jboolean rdb, jint rOffset, jint rCount,
jlong rjType, jint rBType, jint root)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -882,7 +892,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gather(
else
{
sType = (MPI_Datatype)sjType;
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
}
MPI_Datatype rType = (MPI_Datatype)rjType;
@ -899,7 +909,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gather(
* in all processes, notwithstanding what the spec says.)
*/
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
if(!rootOrInter)
{
@ -918,10 +928,10 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gather(
ompi_java_exceptionCheck(env, rc);
if(rootOrInter || sendBuf == NULL)
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, sBType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iGather(
@ -987,8 +997,9 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iGather(
JNIEXPORT void JNICALL Java_mpi_Comm_gatherv(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jint sCount, jlong sjType, jint sBType,
jobject recvBuf, jint rOffset, jintArray rCounts,
jobject sendBuf, jboolean sdb, jint sOffset,
jint sCount, jlong sjType, jint sBType,
jobject recvBuf, jboolean rdb, jint rOffset, jintArray rCounts,
jintArray displs, jlong rjType, jint rBType, jint root)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1012,7 +1023,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gatherv(
else
{
sType = (MPI_Datatype)sjType;
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
}
jint *jRCounts = NULL, *jDispls = NULL;
@ -1025,7 +1036,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gatherv(
ompi_java_getIntArray(env, displs, &jDispls, &cDispls);
rType = (MPI_Datatype)rjType;
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
}
rc = MPI_Gatherv(sPtr, sCount, sType, rPtr, cRCounts,
@ -1034,11 +1045,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_gatherv(
ompi_java_exceptionCheck(env, rc);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, sBType);
if(rootOrInter)
{
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
ompi_java_forgetIntArray(env, rCounts, jRCounts, cRCounts);
ompi_java_forgetIntArray(env, displs, jDispls, cDispls);
}
@ -1104,9 +1115,9 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iGatherv(
JNIEXPORT void JNICALL Java_mpi_Comm_scatter(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jint sCount,
jobject sendBuf, jboolean sdb, jint sOffset, jint sCount,
jlong sjType, jint sBType,
jobject recvBuf, jint rOffset, jint rCount,
jobject recvBuf, jboolean rdb, jint rOffset, jint rCount,
jlong rjType, jint rBType, jint root)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1129,14 +1140,14 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatter(
else
{
rType = (MPI_Datatype)rjType;
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
}
sType = (MPI_Datatype)sjType;
if(rootOrInter || rPtr == MPI_IN_PLACE)
{
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
if(!rootOrInter)
{
@ -1155,10 +1166,10 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatter(
ompi_java_exceptionCheck(env, rc);
if(rootOrInter || recvBuf == NULL)
ompi_java_releaseBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseBufPtr(env, sendBuf, sdb, sBase, sBType);
if(recvBuf != NULL)
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iScatter(
@ -1214,9 +1225,9 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iScatter(
JNIEXPORT void JNICALL Java_mpi_Comm_scatterv(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jintArray sCounts,
jobject sendBuf, jboolean sdb, jint sOffset, jintArray sCounts,
jintArray displs, jlong sjType, jint sBType,
jobject recvBuf, jint rOffset, jint rCount,
jobject recvBuf, jboolean rdb, jint rOffset, jint rCount,
jlong rjType, jint rBType, jint root)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1240,7 +1251,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatterv(
else
{
rType = (MPI_Datatype)rjType;
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
}
jint *jSCounts = NULL, *jDispls = NULL;
@ -1253,7 +1264,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatterv(
ompi_java_getIntArray(env, displs, &jDispls, &cDispls);
sType = (MPI_Datatype)sjType;
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
}
rc = MPI_Scatterv(sPtr, cSCounts, cDispls, sType,
@ -1262,11 +1273,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatterv(
ompi_java_exceptionCheck(env, rc);
if(recvBuf != NULL)
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
if(rootOrInter)
{
ompi_java_releaseBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseBufPtr(env, sendBuf, sdb, sBase, sBType);
ompi_java_forgetIntArray(env, sCounts, jSCounts, cSCounts);
ompi_java_forgetIntArray(env, displs, jDispls, cDispls);
}
@ -1331,8 +1342,10 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iScatterv(
JNIEXPORT void JNICALL Java_mpi_Comm_allGather(
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)
jobject sendBuf, jboolean sdb, jint sOffset,
jint sCount, jlong sjType, jint sBType,
jobject recvBuf, jboolean rdb, jint rOffset,
jint rCount, jlong rjType, jint rBType)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype sType;
@ -1348,18 +1361,18 @@ JNIEXPORT void JNICALL Java_mpi_Comm_allGather(
else
{
sType = (MPI_Datatype)sjType;
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
}
MPI_Datatype rType = (MPI_Datatype)rjType;
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
int rc = MPI_Allgather(sPtr, sCount, sType, rPtr, rCount, rType, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, sBType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllGather(
@ -1393,9 +1406,10 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllGather(
JNIEXPORT void JNICALL Java_mpi_Comm_allGatherv(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jint sCount, jlong sjType, jint sBType,
jobject recvBuf, jint rOffset, jintArray rCounts, jintArray displs,
jlong rjType, jint rBType)
jobject sendBuf, jboolean sdb, jint sOffset,
jint sCount, jlong sjType, jint sBType,
jobject recvBuf, jboolean rdb, jint rOffset,
jintArray rCounts, jintArray displs, jlong rjType, jint rBType)
{
MPI_Comm comm = (MPI_Comm)jComm;
void *sPtr, *sBase, *rPtr, *rBase;
@ -1411,7 +1425,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_allGatherv(
else
{
sType = (MPI_Datatype)sjType;
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
}
MPI_Datatype rType = (MPI_Datatype)rjType;
@ -1420,16 +1434,16 @@ JNIEXPORT void JNICALL Java_mpi_Comm_allGatherv(
ompi_java_getIntArray(env, rCounts, &jRCounts, &cRCounts);
ompi_java_getIntArray(env, displs, &jDispls, &cDispls);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
int rc = MPI_Allgatherv(sPtr, sCount, sType, rPtr,
cRCounts, cDispls, rType, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, sBType);
ompi_java_forgetIntArray(env, rCounts, jRCounts, cRCounts);
ompi_java_forgetIntArray(env, displs, jDispls, cDispls);
@ -1473,22 +1487,24 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllGatherv(
JNIEXPORT void JNICALL Java_mpi_Comm_allToAll(
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)
jobject sendBuf, jboolean sdb, jint sOffset,
jint sCount, jlong sjType, jint sBType,
jobject recvBuf, jboolean rdb, jint rOffset,
jint rCount, jlong rjType, jint rBType)
{
MPI_Comm comm = (MPI_Comm)jComm;
MPI_Datatype sType = (MPI_Datatype)sjType;
MPI_Datatype rType = (MPI_Datatype)rjType;
void *sPtr, *sBase, *rPtr, *rBase;
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
int rc = MPI_Alltoall(sPtr, sCount, sType, rPtr, rCount, rType, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, sBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllToAll(
@ -1511,9 +1527,9 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllToAll(
JNIEXPORT void JNICALL Java_mpi_Comm_allToAllv(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jintArray sCount,
jobject sendBuf, jboolean sdb, jint sOffset, jintArray sCount,
jintArray sDispls, jlong sjType, jint sBType,
jobject recvBuf, jint rOffset, jintArray rCount,
jobject recvBuf, jboolean rdb, jint rOffset, jintArray rCount,
jintArray rDispls, jlong rjType, jint rBType)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1528,15 +1544,15 @@ JNIEXPORT void JNICALL Java_mpi_Comm_allToAllv(
ompi_java_getIntArray(env, rDispls, &jRDispls, &cRDispls);
void *sPtr, *sBase, *rPtr, *rBase;
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sBType, sOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, rBType, rOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, sBType, sOffset);
int rc = MPI_Alltoallv(sPtr, cSCount, cSDispls, sType,
rPtr, cRCount, cRDispls, rType, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, sBType);
ompi_java_releaseBufPtr(env, recvBuf, rBase, rBType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, sBType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, rBType);
ompi_java_forgetIntArray(env, sCount, jSCount, cSCount);
ompi_java_forgetIntArray(env, rCount, jRCount, cRCount);
@ -1575,7 +1591,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllToAllv(
JNIEXPORT void JNICALL Java_mpi_Comm_reduce(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jobject recvBuf, jint rOffset,
jobject sendBuf, jboolean sdb, jint sOffset,
jobject recvBuf, jboolean rdb, jint rOffset,
jint count, jlong jType, jint baseType, jobject op, jint root)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1592,11 +1609,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduce(
if(sendBuf == NULL)
sPtr = MPI_IN_PLACE;
else
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, baseType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, baseType, sOffset);
if(rootOrInter || sendBuf == NULL)
{
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, baseType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, baseType, rOffset);
if(!rootOrInter)
{
@ -1614,10 +1631,10 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduce(
ompi_java_exceptionCheck(env, rc);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, baseType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, baseType);
if(rootOrInter || sendBuf == NULL)
ompi_java_releaseBufPtr(env, recvBuf, rBase, baseType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, baseType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduce(
@ -1666,7 +1683,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduce(
JNIEXPORT void JNICALL Java_mpi_Comm_allReduce(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sendOffset, jobject recvBuf, jint recvOffset,
jobject sendBuf, jboolean sdb, jint sendOffset,
jobject recvBuf, jboolean rdb, jint recvOffset,
jint count, jlong jType, jint baseType, jobject op)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1676,17 +1694,17 @@ JNIEXPORT void JNICALL Java_mpi_Comm_allReduce(
if(sendBuf == NULL)
sPtr = MPI_IN_PLACE;
else
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, baseType, sendOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, baseType, sendOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, baseType, recvOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, baseType, recvOffset);
MPI_Op mpiOp = ompi_java_op_getHandle(env, op, baseType);
int rc = MPI_Allreduce(sPtr, rPtr, count, type, mpiOp, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, baseType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, baseType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, baseType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, baseType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllReduce(
@ -1714,7 +1732,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllReduce(
JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatter(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jobject recvBuf, jint rOffset,
jobject sendBuf, jboolean sdb, jint sOffset,
jobject recvBuf, jboolean rdb, jint rOffset,
jintArray rCounts, jlong jType, jint bType, jobject op)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1724,9 +1743,9 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatter(
if(sendBuf == NULL)
sPtr = MPI_IN_PLACE;
else
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, bType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, bType, sOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, bType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, bType, rOffset);
MPI_Op mpiOp = ompi_java_op_getHandle(env, op, bType);
jint *jRCounts;
@ -1736,11 +1755,11 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatter(
int rc = MPI_Reduce_scatter(sPtr, rPtr, cRCounts, type, mpiOp, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, bType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, bType);
ompi_java_forgetIntArray(env, rCounts, jRCounts, cRCounts);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, bType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, bType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduceScatter(
@ -1773,7 +1792,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduceScatter(
JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatterBlock(
JNIEnv *env, jobject jthis, jlong jComm,
jobject sendBuf, jint sOffset, jobject recvBuf, jint rOffset,
jobject sendBuf, jboolean sdb, jint sOffset,
jobject recvBuf, jboolean rdb, jint rOffset,
jint count, jlong jType, jint bType, jobject op)
{
MPI_Comm comm = (MPI_Comm)jComm;
@ -1783,18 +1803,18 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatterBlock(
if(sendBuf == NULL)
sPtr = MPI_IN_PLACE;
else
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, bType, sOffset);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, bType, sOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, bType, rOffset);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, bType, rOffset);
MPI_Op mpiOp = ompi_java_op_getHandle(env, op, bType);
int rc = MPI_Reduce_scatter_block(sPtr, rPtr, count, type, mpiOp, comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, bType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, bType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, bType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, bType);
}
JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduceScatterBlock(
@ -1820,21 +1840,21 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduceScatterBlock(
}
JNIEXPORT void JNICALL Java_mpi_Comm_reduceLocal(
JNIEnv *env, jclass clazz, jobject inBuf, jint inOff,
jobject inOutBuf, jint inOutOff, jint count,
JNIEnv *env, jclass clazz, jobject inBuf, jboolean idb, jint inOff,
jobject inOutBuf, jboolean iodb, jint inOutOff, jint count,
jlong jType, jint bType, jobject op)
{
MPI_Datatype type = (MPI_Datatype)jType;
void *inPtr, *inBase, *inOutPtr, *inOutBase;
inPtr = getBufCritical(&inBase, env, inBuf, bType, inOff);
inOutPtr = getBufCritical(&inOutBase, env, inOutBuf, bType, inOutOff);
inPtr = getBufCritical(&inBase, env, inBuf, idb, bType, inOff);
inOutPtr = getBufCritical(&inOutBase, env, inOutBuf, iodb, bType, inOutOff);
int rc = MPI_Reduce_local(inPtr, inOutPtr, count, type,
ompi_java_op_getHandle(env, op, bType));
ompi_java_exceptionCheck(env, rc);
releaseBufCritical(env, inBuf, inBase);
releaseBufCritical(env, inOutBuf, inOutBase);
releaseBufCritical(env, inBuf, idb, inBase);
releaseBufCritical(env, inOutBuf, iodb, inOutBase);
}
JNIEXPORT void JNICALL Java_mpi_Comm_setName(

Просмотреть файл

@ -116,81 +116,84 @@ JNIEXPORT void JNICALL Java_mpi_File_setView(
JNIEXPORT void JNICALL Java_mpi_File_readAt(
JNIEnv *env, jobject jthis, jlong fh, jlong fileOffset,
jobject buf, jint offset, jint count, jobject jType, jobject stat)
jobject buf, jboolean db, jint offset, jint count,
jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
env, jType, ompi_java.DatatypeHandle));
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_read_at((MPI_File)fh, (MPI_Offset)fileOffset,
ptr, count, (MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, base, bType);
ompi_java_releaseBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_readAtAll(
JNIEnv *env, jobject jthis, jlong fh, jlong fileOffset,
jobject buf, jint offset, jint count, jobject jType, jobject stat)
jobject buf, jboolean db, jint offset, jint count,
jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
env, jType, ompi_java.DatatypeHandle));
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_read_at_all((MPI_File)fh, (MPI_Offset)fileOffset,
ptr, count, (MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, base, bType);
ompi_java_releaseBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_writeAt(
JNIEnv *env, jobject jthis, jlong fh, jlong fileOffset,
jobject buf, jint offset, jint count, jobject jType, jobject stat)
jobject buf, jboolean db, jint offset, jint count,
jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
env, jType, ompi_java.DatatypeHandle));
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_write_at((MPI_File)fh, (MPI_Offset)fileOffset,
ptr, count, (MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, base, bType);
ompi_java_releaseReadBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_writeAtAll(
JNIEnv *env, jobject jthis, jlong fh, jlong fileOffset,
jobject buf, jint offset, jint count, jobject jType, jobject stat)
jobject buf, jboolean db, jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
env, jType, ompi_java.DatatypeHandle));
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_write_at_all((MPI_File)fh, (MPI_Offset)fileOffset,
ptr, count, (MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, base, bType);
ompi_java_releaseReadBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
@ -223,7 +226,7 @@ JNIEXPORT jlong JNICALL Java_mpi_File_iWriteAt(
}
JNIEXPORT void JNICALL Java_mpi_File_read(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -231,19 +234,19 @@ JNIEXPORT void JNICALL Java_mpi_File_read(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_read((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, base, bType);
ompi_java_releaseBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_readAll(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -251,19 +254,19 @@ JNIEXPORT void JNICALL Java_mpi_File_readAll(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_read_all((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, base, bType);
ompi_java_releaseBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_write(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -271,19 +274,19 @@ JNIEXPORT void JNICALL Java_mpi_File_write(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_write((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, base, bType);
ompi_java_releaseReadBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_writeAll(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -291,14 +294,14 @@ JNIEXPORT void JNICALL Java_mpi_File_writeAll(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_write_all((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, base, bType);
ompi_java_releaseReadBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
@ -356,7 +359,7 @@ JNIEXPORT jlong JNICALL Java_mpi_File_getByteOffset(
}
JNIEXPORT void JNICALL Java_mpi_File_readShared(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -364,19 +367,19 @@ JNIEXPORT void JNICALL Java_mpi_File_readShared(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_read_shared((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, base, bType);
ompi_java_releaseBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_writeShared(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -384,14 +387,14 @@ JNIEXPORT void JNICALL Java_mpi_File_writeShared(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_write_shared((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, base, bType);
ompi_java_releaseReadBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
@ -424,7 +427,7 @@ JNIEXPORT jlong JNICALL Java_mpi_File_iWriteShared(
}
JNIEXPORT void JNICALL Java_mpi_File_readOrdered(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -432,19 +435,19 @@ JNIEXPORT void JNICALL Java_mpi_File_readOrdered(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_read_ordered((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, buf, base, bType);
ompi_java_releaseBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}
JNIEXPORT void JNICALL Java_mpi_File_writeOrdered(
JNIEnv *env, jobject jthis, jlong fh, jobject buf,
JNIEnv *env, jobject jthis, jlong fh, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
@ -452,14 +455,14 @@ JNIEXPORT void JNICALL Java_mpi_File_writeOrdered(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *ptr, *base;
ptr = ompi_java_getBufPtr(&base, env, buf, bType, offset);
ptr = ompi_java_getBufPtr(&base, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_File_write_ordered((MPI_File)fh, ptr, count,
(MPI_Datatype)type, &status);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseReadBufPtr(env, buf, base, bType);
ompi_java_releaseReadBufPtr(env, buf, db, base, bType);
ompi_java_status_set(&status, env, stat);
}

Просмотреть файл

@ -177,7 +177,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Intracomm_createDistGraphAdjacent(
JNIEXPORT void JNICALL Java_mpi_Intracomm_scan(
JNIEnv *env, jobject jthis, jlong comm,
jobject sendBuf, jint sendOff, jobject recvBuf, jint recvOff,
jobject sendBuf, jboolean sdb, jint sendOff,
jobject recvBuf, jboolean rdb, jint recvOff,
jint count, jlong type, jint baseType, jobject op)
{
void *sPtr, *sBase, *rPtr, *rBase;
@ -185,19 +186,19 @@ JNIEXPORT void JNICALL Java_mpi_Intracomm_scan(
if(sendBuf == NULL)
sPtr = MPI_IN_PLACE;
else
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, baseType, sendOff);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, baseType, sendOff);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, baseType, recvOff);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, baseType, recvOff);
int rc = MPI_Scan(sPtr, rPtr, count, (MPI_Datatype)type,
ompi_java_op_getHandle(env, op, baseType),
(MPI_Comm)comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, baseType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, baseType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, baseType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, baseType);
}
JNIEXPORT jlong JNICALL Java_mpi_Intracomm_iScan(
@ -225,7 +226,8 @@ JNIEXPORT jlong JNICALL Java_mpi_Intracomm_iScan(
JNIEXPORT void JNICALL Java_mpi_Intracomm_exScan(
JNIEnv *env, jobject jthis, jlong comm,
jobject sendBuf, jint sendOff, jobject recvBuf, jint recvOff,
jobject sendBuf, jboolean sdb, jint sendOff,
jobject recvBuf, jboolean rdb, jint recvOff,
jint count, jlong type, int bType, jobject op)
{
void *sPtr, *sBase, *rPtr, *rBase;
@ -233,19 +235,19 @@ JNIEXPORT void JNICALL Java_mpi_Intracomm_exScan(
if(sendBuf == NULL)
sPtr = MPI_IN_PLACE;
else
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, bType, sendOff);
sPtr = ompi_java_getBufPtr(&sBase, env, sendBuf, sdb, bType, sendOff);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, bType, recvOff);
rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rdb, bType, recvOff);
int rc = MPI_Exscan(sPtr, rPtr, count, (MPI_Datatype)type,
ompi_java_op_getHandle(env, op, bType),
(MPI_Comm)comm);
ompi_java_exceptionCheck(env, rc);
ompi_java_releaseBufPtr(env, recvBuf, rBase, bType);
ompi_java_releaseBufPtr(env, recvBuf, rdb, rBase, bType);
if(sendBuf != NULL)
ompi_java_releaseReadBufPtr(env, sendBuf, sBase, bType);
ompi_java_releaseReadBufPtr(env, sendBuf, sdb, sBase, bType);
}
JNIEXPORT jlong JNICALL Java_mpi_Intracomm_iExScan(

Просмотреть файл

@ -50,8 +50,8 @@ JNIEXPORT jobject JNICALL Java_mpi_Message_imProbe(
}
JNIEXPORT void JNICALL Java_mpi_Message_mRecv(
JNIEnv *env, jobject jthis, jobject buf, jint offset, jint count,
jobject jType, jobject stat)
JNIEnv *env, jobject jthis, jobject buf, jboolean db,
jint offset, jint count, jobject jType, jobject stat)
{
MPI_Message msg = (MPI_Message)((*env)->GetLongField(
env, jthis, ompi_java.MessageHandle));
@ -61,7 +61,7 @@ JNIEXPORT void JNICALL Java_mpi_Message_mRecv(
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
void *bufPtr, *bufBase;
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, bType, offset);
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, bType, offset);
MPI_Status status;
int rc = MPI_Mrecv(bufPtr, count, type, &msg, &status);
@ -72,7 +72,7 @@ JNIEXPORT void JNICALL Java_mpi_Message_mRecv(
ompi_java_status_set(&status, env, stat);
}
ompi_java_releaseBufPtr(env, buf, bufBase, bType);
ompi_java_releaseBufPtr(env, buf, db, bufBase, bType);
}
JNIEXPORT jlong JNICALL Java_mpi_Message_imRecv(

Просмотреть файл

@ -23,7 +23,6 @@
package mpi;
import java.nio.*;
import static mpi.MPI.isHeapBuffer;
import static mpi.MPI.assertDirectBuffer;
/**
@ -240,18 +239,19 @@ public final void send(Object buf, int count, Datatype type, int dest, int tag)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
send(handle, buf, off, count, type.handle, type.baseType, dest, tag);
send(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
}
private native void send(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int baseType, int dest, int tag) throws MPIException;
/**
@ -271,20 +271,24 @@ public final Status recv(Object buf, int count,
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
recv(handle, buf, off, count, type.handle, type.baseType, source, tag, stat);
recv(handle, buf, db, off, count,
type.handle, type.baseType, source, tag, stat);
return stat;
}
private native void recv(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int basetype, int source, int tag, Status stat)
throws MPIException;
@ -317,14 +321,17 @@ public final Status sendRecv(
int sendoff = 0,
recvoff = 0;
boolean sdb = false,
rdb = false;
if(isHeapBuffer(sendbuf))
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
@ -332,18 +339,18 @@ public final Status sendRecv(
Status stat = new Status();
sendRecv(handle, sendbuf, sendoff, sendcount,
sendRecv(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType, dest, sendtag,
recvbuf, recvoff, recvcount,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType, source, recvtag, stat);
return stat;
}
private native void sendRecv(
long comm, Object sbuf, int soffset, int scount,
long comm, Object sbuf, boolean sdb, int soffset, int scount,
long sType, int sBaseType, int dest, int stag,
Object rbuf, int roffset, int rcount,
Object rbuf, boolean rdb, int roffset, int rcount,
long rType, int rBaseType, int source, int rtag,
Status stat) throws MPIException;
@ -370,8 +377,9 @@ public final Status sendRecvReplace(
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
@ -379,13 +387,13 @@ public final Status sendRecvReplace(
Status stat = new Status();
sendRecvReplace(handle, buf, off, count, type.handle, type.baseType,
sendRecvReplace(handle, buf, db, off, count, type.handle, type.baseType,
dest, sendtag, source, recvtag, stat);
return stat;
}
private native void sendRecvReplace(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int baseType, int dest, int stag,
int source, int rtag, Status stat) throws MPIException;
@ -407,18 +415,19 @@ public final void bSend(Object buf, int count, Datatype type, int dest, int tag)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
bSend(handle, buf, off, count, type.handle, type.baseType, dest, tag);
bSend(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
}
private native void bSend(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int baseType, int dest, int tag) throws MPIException;
/**
@ -437,18 +446,19 @@ public final void sSend(Object buf, int count, Datatype type, int dest, int tag)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
sSend(handle, buf, off, count, type.handle, type.baseType, dest, tag);
sSend(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
}
private native void sSend(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int baseType, int dest, int tag) throws MPIException;
/**
@ -467,18 +477,19 @@ public final void rSend(Object buf, int count, Datatype type, int dest, int tag)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
rSend(handle, buf, off, count, type.handle, type.baseType, dest, tag);
rSend(handle, buf, db, off, count, type.handle, type.baseType, dest, tag);
}
private native void rSend(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int baseType, int dest, int tag) throws MPIException;
// Nonblocking communication
@ -775,19 +786,20 @@ public final int pack(Object inbuf, int incount, Datatype type,
{
MPI.check();
int offset = 0;
boolean indb = false;
if(isHeapBuffer(inbuf))
if(inbuf instanceof Buffer && !(indb = ((Buffer)inbuf).isDirect()))
{
offset = ((Buffer)inbuf).arrayOffset();
inbuf = ((Buffer)inbuf).array();
}
return pack(handle, inbuf, offset, incount,
return pack(handle, inbuf, indb, offset, incount,
type.handle, type.baseType, outbuf, position);
}
private native int pack(
long comm, Object inbuf, int offset, int incount,
long comm, Object inbuf, boolean indb, int offset, int incount,
long type, int baseType, byte[] outbuf, int position)
throws MPIException;
@ -813,19 +825,20 @@ public final int unpack(byte[] inbuf, int position,
{
MPI.check();
int offset = 0;
boolean outdb = false;
if(isHeapBuffer(outbuf))
if(outbuf instanceof Buffer && !(outdb = ((Buffer)outbuf).isDirect()))
{
offset = ((Buffer)outbuf).arrayOffset();
outbuf = ((Buffer)outbuf).array();
}
return unpack(handle, inbuf, position, outbuf,
return unpack(handle, inbuf, position, outbuf, outdb,
offset, outcount, type.handle, type.baseType);
}
private native int unpack(
long comm, byte[] inbuf, int position, Object outbuf,
long comm, byte[] inbuf, int position, Object outbuf, boolean outdb,
int offset, int outcount, long type, int baseType) throws MPIException;
/**
@ -1095,18 +1108,19 @@ public final void bcast(Object buf, int count, Datatype type, int root)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
bcast(handle, buf, off, count, type.handle, type.baseType, root);
bcast(handle, buf, db, off, count, type.handle, type.baseType, root);
}
private native void bcast(
long comm, Object buf, int offset, int count,
long comm, Object buf, boolean db, int offset, int count,
long type, int basetype, int root) throws MPIException;
/**
@ -1154,21 +1168,24 @@ public final void gather(
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
gather(handle, sendbuf, sendoff, sendcount,
gather(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType, root);
}
@ -1189,21 +1206,22 @@ public final void gather(Object buf, int count, Datatype type, int root)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
gather(handle, null, 0, 0, 0, 0,
buf, off, count, type.handle, type.baseType, root);
gather(handle, null, false, 0, 0, 0, 0,
buf, db, off, count, type.handle, type.baseType, root);
}
private native void gather(
long comm, Object sendBuf, int sendOff, int sendCount,
long comm, Object sendBuf, boolean sdb, int sendOff, int sendCount,
long sendType, int sendBaseType,
Object recvBuf, int recvOff, int recvCount,
Object recvBuf, boolean rdb, int recvOff, int recvCount,
long recvType, int recvBaseType, int root)
throws MPIException;
@ -1283,22 +1301,25 @@ public final void gatherv(Object sendbuf, int sendcount, Datatype sendtype,
int sendoff = 0,
recvoff = 0;
boolean sdb = false,
rdb = false;
if(isHeapBuffer(sendbuf))
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
gatherv(handle, sendbuf, sendoff, sendcount,
gatherv(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount, displs,
recvbuf, rdb, recvoff, recvcount, displs,
recvtype.handle, recvtype.baseType, root);
}
@ -1321,14 +1342,15 @@ public final void gatherv(Object recvbuf, int[] recvcount, int[] displs,
{
MPI.check();
int recvoff = 0;
boolean rdb = false;
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
gatherv(handle, null, 0, 0, 0, 0, recvbuf, recvoff, recvcount,
gatherv(handle, null, false, 0, 0, 0, 0, recvbuf, rdb, recvoff, recvcount,
displs, recvtype.handle, recvtype.baseType, root);
}
@ -1350,23 +1372,25 @@ public final void gatherv(Object sendbuf, int sendcount,
{
MPI.check();
int sendoff = 0;
boolean sdb = false;
if(isHeapBuffer(sendbuf))
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
gatherv(handle, sendbuf, sendoff, sendcount,
gatherv(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
null, 0, null, null, 0, 0, root);
null, false, 0, null, null, 0, 0, root);
}
private native void gatherv(
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;
long comm, Object sendBuf, boolean sdb, int sendOffset,
int sendCount, long sendType, int sendBaseType,
Object recvBuf, boolean rdb, int recvOffset,
int[] recvCount, int[] displs, long recvType, int recvBaseType,
int root) throws MPIException;
/**
* Extends functionality of {@code gather} by allowing varying
@ -1473,21 +1497,24 @@ public final void scatter(
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
scatter(handle, sendbuf, sendoff, sendcount,
scatter(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType, root);
}
@ -1508,21 +1535,22 @@ public final void scatter(Object buf, int count, Datatype type, int root)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
scatter(handle, buf, off, count, type.handle, type.baseType,
null, 0, 0, 0, 0, root);
scatter(handle, buf, db, off, count, type.handle, type.baseType,
null, false, 0, 0, 0, 0, root);
}
private native void scatter(
long comm, Object sendBuf, int sendOffset, int sendCount,
long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
long sendType, int sendBaseType,
Object recvBuf, int recvOffset, int recvCount,
Object recvBuf, boolean rdb, int recvOffset, int recvCount,
long recvType, int recvBaseType, int root) throws MPIException;
/**
@ -1601,21 +1629,24 @@ public final void scatterv(
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
scatterv(handle, sendbuf, sendoff, sendcount, displs,
scatterv(handle, sendbuf, sdb, sendoff, sendcount, displs,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType, root);
}
@ -1637,16 +1668,17 @@ public final void scatterv(Object sendbuf, int[] sendcount, int[] displs,
{
MPI.check();
int sendoff = 0;
boolean sdb = false;
if(isHeapBuffer(sendbuf))
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
scatterv(handle, sendbuf, sendoff, sendcount, displs,
scatterv(handle, sendbuf, sdb, sendoff, sendcount, displs,
sendtype.handle, sendtype.baseType,
null, 0, 0, 0, 0, root);
null, false, 0, 0, 0, 0, root);
}
/**
@ -1666,22 +1698,23 @@ public final void scatterv(Object recvbuf, int recvcount,
{
MPI.check();
int recvoff = 0;
boolean rdb = false;
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
scatterv(handle, null, 0, null, null, 0, 0,
recvbuf, recvoff, recvcount,
scatterv(handle, null, false, 0, null, null, 0, 0,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType, root);
}
private native void scatterv(
long comm, Object sendBuf, int sendOffset,
long comm, Object sendBuf, boolean sdb, int sendOffset,
int[] sendCount, int[] displs, long sendType, int sendBaseType,
Object recvBuf, int recvOffset, int recvCount,
Object recvBuf, boolean rdb, int recvOffset, int recvCount,
long recvType, int recvBaseType, int root)
throws MPIException;
@ -1784,21 +1817,24 @@ public final void allGather(Object sendbuf, int sendcount, Datatype sendtype,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
allGather(handle, sendbuf, sendoff, sendcount,
allGather(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType);
}
@ -1816,21 +1852,22 @@ public final void allGather(Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
allGather(handle, null, 0, 0, 0, 0,
buf, off, count, type.handle, type.baseType);
allGather(handle, null, false, 0, 0, 0, 0,
buf, db, off, count, type.handle, type.baseType);
}
private native void allGather(
long comm, Object sendBuf, int sendOffset, int sendCount,
long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
long sendType, int sendBaseType,
Object recvBuf, int recvOffset, int recvCount,
Object recvBuf, boolean rdb, int recvOffset, int recvCount,
long recvType, int recvBaseType) throws MPIException;
/**
@ -1901,21 +1938,24 @@ public final void allGatherv(
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
allGatherv(handle, sendbuf, sendoff, sendcount,
allGatherv(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount, displs,
recvbuf, rdb, recvoff, recvcount, displs,
recvtype.handle, recvtype.baseType);
}
@ -1935,22 +1975,24 @@ public final void allGatherv(Object recvbuf, int[] recvcount,
{
MPI.check();
int recvoff = 0;
boolean rdb = false;
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
allGatherv(handle, null, 0, 0, 0, 0, recvbuf, recvoff, recvcount,
allGatherv(handle, null, false, 0, 0, 0, 0,
recvbuf, rdb, recvoff, recvcount,
displs, recvtype.handle, recvtype.baseType);
}
private native void allGatherv(
long comm, Object sendBuf, int sendOffset, int sendCount,
long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
long sendType, int sendBaseType,
Object recvBuf, int recvOffset, int[] recvCount, int[] displs,
long recvType, int recvBasetype) throws MPIException;
Object recvBuf, boolean rdb, int recvOffset, int[] recvCount,
int[] displs, long recvType, int recvBasetype) throws MPIException;
/**
* Similar to {@code gatherv}, but all processes receive the result.
@ -2026,28 +2068,31 @@ public final void allToAll(Object sendbuf, int sendcount, Datatype sendtype,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
allToAll(handle, sendbuf, sendoff, sendcount,
allToAll(handle, sendbuf, sdb, sendoff, sendcount,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount,
recvbuf, rdb, recvoff, recvcount,
recvtype.handle, recvtype.baseType);
}
private native void allToAll(
long comm, Object sendBuf, int sendOffset, int sendCount,
long comm, Object sendBuf, boolean sdb, int sendOffset, int sendCount,
long sendType, int sendBaseType,
Object recvBuf, int recvOffset, int recvCount,
Object recvBuf, boolean rdb, int recvOffset, int recvCount,
long recvType, int recvBaseType) throws MPIException;
/**
@ -2103,28 +2148,31 @@ public final void allToAllv(
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
allToAllv(handle, sendbuf, sendoff, sendcount, sdispls,
allToAllv(handle, sendbuf, sdb, sendoff, sendcount, sdispls,
sendtype.handle, sendtype.baseType,
recvbuf, recvoff, recvcount, rdispls,
recvbuf, rdb, recvoff, recvcount, rdispls,
recvtype.handle, recvtype.baseType);
}
private native void allToAllv(
long comm, Object sendBuf, int sendOffset,
long comm, Object sendBuf, boolean sdb, int sendOffset,
int[] sendCount, int[] sdispls, long sendType, int sendBaseType,
Object recvBuf, int recvOffset,
Object recvBuf, boolean rdb, int recvOffset,
int[] recvCount, int[] rdispls, long recvType, int recvBaseType)
throws MPIException;
@ -2191,20 +2239,23 @@ public final void reduce(Object sendbuf, Object recvbuf, int count,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
reduce(handle, sendbuf, sendoff, recvbuf, recvoff, count,
type.handle, type.baseType, op, root);
reduce(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op, root);
}
/**
@ -2226,19 +2277,21 @@ public final void reduce(Object buf, int count, Datatype type, Op op, int root)
MPI.check();
op.setDatatype(type);
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
reduce(handle, null, 0, buf, off, count,
reduce(handle, null, false, 0, buf, db, off, count,
type.handle, type.baseType, op, root);
}
private native void reduce(
long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff,
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff,
int count, long type, int baseType, Op op, int root)
throws MPIException;
@ -2319,20 +2372,23 @@ public final void allReduce(Object sendbuf, Object recvbuf,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
allReduce(handle, sendbuf, sendoff, recvbuf, recvoff, count,
type.handle, type.baseType, op);
allReduce(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op);
}
/**
@ -2352,18 +2408,21 @@ public final void allReduce(Object buf, int count, Datatype type, Op op)
MPI.check();
op.setDatatype(type);
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
allReduce(handle, null, 0, buf, off, count, type.handle, type.baseType, op);
allReduce(handle, null, false, 0, buf, db, off,
count, type.handle, type.baseType, op);
}
private native void allReduce(
long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff,
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff,
int count, long type, int baseType, Op op) throws MPIException;
/**
@ -2439,20 +2498,23 @@ public final void reduceScatter(Object sendbuf, Object recvbuf,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
reduceScatter(handle, sendbuf, sendoff, recvbuf, recvoff, recvcounts,
type.handle, type.baseType, op);
reduceScatter(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
recvcounts, type.handle, type.baseType, op);
}
/**
@ -2473,19 +2535,21 @@ public final void reduceScatter(Object buf, int[] counts, Datatype type, Op op)
MPI.check();
op.setDatatype(type);
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
reduceScatter(handle, null, 0, buf, off, counts,
type.handle, type.baseType, op);
reduceScatter(handle, null, false, 0, buf, db, off,
counts, type.handle, type.baseType, op);
}
private native void reduceScatter(
long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff,
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff,
int[] recvcounts, long type, int baseType, Op op) throws MPIException;
/**
@ -2562,20 +2626,23 @@ public final void reduceScatterBlock(Object sendbuf, Object recvbuf,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
}
reduceScatterBlock(handle, sendbuf, sendoff, recvbuf, recvoff, recvcount,
type.handle, type.baseType, op);
reduceScatterBlock(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
recvcount, type.handle, type.baseType, op);
}
/**
@ -2595,19 +2662,21 @@ public final void reduceScatterBlock(
MPI.check();
op.setDatatype(type);
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
reduceScatterBlock(handle, null, 0, buf, off, count,
type.handle, type.baseType, op);
reduceScatterBlock(handle, null, false, 0, buf, db, off,
count, type.handle, type.baseType, op);
}
private native void reduceScatterBlock(
long comm, Object sendBuf, int sOffset, Object recvBuf, int rOffset,
long comm, Object sendBuf, boolean sdb, int sOffset,
Object recvBuf, boolean rdb, int rOffset,
int rCount, long type, int baseType, Op op) throws MPIException;
/**
@ -2682,24 +2751,28 @@ public static void reduceLocal(
int inOff = 0,
inOutOff = 0;
if(isHeapBuffer(inBuf))
boolean idb = false,
iodb = false;
if(inBuf instanceof Buffer && !(idb = ((Buffer)inBuf).isDirect()))
{
inOff = ((Buffer)inBuf).arrayOffset();
inBuf = ((Buffer)inBuf).array();
}
if(isHeapBuffer(inOutBuf))
if(inOutBuf instanceof Buffer && !(iodb = ((Buffer)inOutBuf).isDirect()))
{
inOutOff = ((Buffer)inOutBuf).arrayOffset();
inOutBuf = ((Buffer)inOutBuf).array();
}
reduceLocal(inBuf, inOff, inOutBuf, inOutOff, count,
reduceLocal(inBuf, idb, inOff, inOutBuf, iodb, inOutOff, count,
type.handle, type.baseType, op);
}
private static native void reduceLocal(
Object inBuf, int inOff, Object inOutBuf, int inOutOff,
Object inBuf, boolean idb, int inOff,
Object inOutBuf, boolean iodb, int inOutOff,
int count, long type, int baseType, Op op) throws MPIException;
/**

Просмотреть файл

@ -236,20 +236,21 @@ public Status readAt(long offset, Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
readAt(handle, offset, buf, off, count, type, stat);
readAt(handle, offset, buf, db, off, count, type, stat);
return stat;
}
private native void readAt(
long fh, long fileOffset, Object buf, int offset,
long fh, long fileOffset, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -266,20 +267,21 @@ public Status readAtAll(long offset, Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
readAtAll(handle, offset, buf, off, count, type, stat);
readAtAll(handle, offset, buf, db, off, count, type, stat);
return stat;
}
private native void readAtAll(
long fh, long fileOffset, Object buf, int offset,
long fh, long fileOffset, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -296,20 +298,21 @@ public Status writeAt(long offset, Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
writeAt(handle, offset, buf, off, count, type, stat);
writeAt(handle, offset, buf, db, off, count, type, stat);
return stat;
}
private native void writeAt(
long fh, long fileOffset, Object buf, int offset,
long fh, long fileOffset, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -326,20 +329,21 @@ public Status writeAtAll(long offset, Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
writeAtAll(handle, offset, buf, off, count, type, stat);
writeAtAll(handle, offset, buf, db, off, count, type, stat);
return stat;
}
private native void writeAtAll(
long fh, long fileOffset, Object buf, int offset,
long fh, long fileOffset, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -396,20 +400,21 @@ public Status read(Object buf, int count, Datatype type) throws MPIException
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
read(handle, buf, off, count, type, stat);
read(handle, buf, db, off, count, type, stat);
return stat;
}
private native void read(
long fh, Object buf, int offset,
long fh, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -424,20 +429,21 @@ public Status readAll(Object buf, int count, Datatype type) throws MPIException
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
readAll(handle, buf, off, count, type, stat);
readAll(handle, buf, db, off, count, type, stat);
return stat;
}
private native void readAll(
long fh, Object buf, int offset,
long fh, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -452,20 +458,21 @@ public Status write(Object buf, int count, Datatype type) throws MPIException
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
write(handle, buf, off, count, type, stat);
write(handle, buf, db, off, count, type, stat);
return stat;
}
private native void write(
long fh, Object buf, int offset,
long fh, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -480,20 +487,21 @@ public Status writeAll(Object buf, int count, Datatype type) throws MPIException
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
writeAll(handle, buf, off, count, type, stat);
writeAll(handle, buf, db, off, count, type, stat);
return stat;
}
private native void writeAll(
long fh, Object buf, int offset,
long fh, Object buf, boolean db, int offset,
int count, Datatype type, Status stat) throws MPIException;
/**
@ -586,21 +594,22 @@ public Status readShared(Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
readShared(handle, buf, off, count, type, stat);
readShared(handle, buf, db, off, count, type, stat);
return stat;
}
private native void readShared(
long fh, Object buf, int offset, int count, Datatype type, Status stat)
throws MPIException;
long fh, Object buf, boolean db, int offset, int count,
Datatype type, Status stat) throws MPIException;
/**
* Java binding of {@code MPI_FILE_WRITE_SHARED}.
@ -615,21 +624,22 @@ public Status writeShared(Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
writeShared(handle, buf, off, count, type, stat);
writeShared(handle, buf, db, off, count, type, stat);
return stat;
}
private native void writeShared(
long fh, Object buf, int offset, int count, Datatype type, Status stat)
throws MPIException;
long fh, Object buf, boolean db, int offset, int count,
Datatype type, Status stat) throws MPIException;
/**
* Java binding of {@code MPI_FILE_IREAD_SHARED}.
@ -682,21 +692,22 @@ public Status readOrdered(Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
readOrdered(handle, buf, off, count, type, stat);
readOrdered(handle, buf, db, off, count, type, stat);
return stat;
}
private native void readOrdered(
long fh, Object buf, int offset, int count, Datatype type, Status stat)
throws MPIException;
long fh, Object buf, boolean db, int offset, int count,
Datatype type, Status stat) throws MPIException;
/**
* Java binding of {@code MPI_FILE_WRITE_ORDERED}.
@ -711,21 +722,22 @@ public Status writeOrdered(Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status stat = new Status();
writeOrdered(handle, buf, off, count, type, stat);
writeOrdered(handle, buf, db, off, count, type, stat);
return stat;
}
private native void writeOrdered(
long fh, Object buf, int offset, int count, Datatype type, Status stat)
throws MPIException;
long fh, Object buf, boolean db, int offset, int count,
Datatype type, Status stat) throws MPIException;
/**
* Java binding of {@code MPI_FILE_SEEK_SHARED}.
@ -783,7 +795,7 @@ public void readAtAllBegin(long offset, Object buf, int count, Datatype type)
}
Status stat = new Status();
readAtAll(handle, offset, buf, off, count, type, stat);
readAtAll(handle, offset, buf, false, off, count, type, stat);
beginStatus = stat;
}
}
@ -845,7 +857,7 @@ public void writeAtAllBegin(long offset, Object buf, int count, Datatype type)
}
Status stat = new Status();
writeAtAll(handle, offset, buf, off, count, type, stat);
writeAtAll(handle, offset, buf, false, off, count, type, stat);
beginStatus = stat;
}
}
@ -906,7 +918,7 @@ public void readAllBegin(Object buf, int count, Datatype type)
}
Status stat = new Status();
readAll(handle, buf, off, count, type, stat);
readAll(handle, buf, false, off, count, type, stat);
beginStatus = stat;
}
}
@ -966,7 +978,7 @@ public void writeAllBegin(Object buf, int count, Datatype type)
}
Status stat = new Status();
writeAll(handle, buf, off, count, type, stat);
writeAll(handle, buf, false, off, count, type, stat);
beginStatus = stat;
}
}
@ -1026,7 +1038,7 @@ public void readOrderedBegin(Object buf, int count, Datatype type)
}
Status stat = new Status();
readOrdered(handle, buf, off, count, type, stat);
readOrdered(handle, buf, false, off, count, type, stat);
beginStatus = stat;
}
}
@ -1087,7 +1099,7 @@ public void writeOrderedBegin(Object buf, int count, Datatype type)
}
Status stat = new Status();
writeOrdered(handle, buf, off, count, type, stat);
writeOrdered(handle, buf, false, off, count, type, stat);
beginStatus = stat;
}
}

Просмотреть файл

@ -24,7 +24,6 @@
package mpi;
import java.nio.*;
import static mpi.MPI.isHeapBuffer;
import static mpi.MPI.assertDirectBuffer;
/**
@ -285,13 +284,16 @@ public final void scan(Object sendbuf, Object recvbuf,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
@ -299,7 +301,7 @@ public final void scan(Object sendbuf, Object recvbuf,
op.setDatatype(type);
scan(handle, sendbuf, sendoff, recvbuf, recvoff,
scan(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op);
}
@ -318,8 +320,9 @@ public final void scan(Object recvbuf, int count, Datatype type, Op op)
{
MPI.check();
int recvoff = 0;
boolean rdb = false;
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
@ -327,12 +330,13 @@ public final void scan(Object recvbuf, int count, Datatype type, Op op)
op.setDatatype(type);
scan(handle, null, 0, recvbuf, recvoff,
scan(handle, null, false, 0, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op);
}
private native void scan(
long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff,
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff,
int count, long type, int baseType, Op op) throws MPIException;
/**
@ -403,13 +407,16 @@ public final void exScan(Object sendbuf, Object recvbuf,
int sendoff = 0,
recvoff = 0;
if(isHeapBuffer(sendbuf))
boolean sdb = false,
rdb = false;
if(sendbuf instanceof Buffer && !(sdb = ((Buffer)sendbuf).isDirect()))
{
sendoff = ((Buffer)sendbuf).arrayOffset();
sendbuf = ((Buffer)sendbuf).array();
}
if(isHeapBuffer(recvbuf))
if(recvbuf instanceof Buffer && !(rdb = ((Buffer)recvbuf).isDirect()))
{
recvoff = ((Buffer)recvbuf).arrayOffset();
recvbuf = ((Buffer)recvbuf).array();
@ -417,7 +424,7 @@ public final void exScan(Object sendbuf, Object recvbuf,
op.setDatatype(type);
exScan(handle, sendbuf, sendoff, recvbuf, recvoff,
exScan(handle, sendbuf, sdb, sendoff, recvbuf, rdb, recvoff,
count, type.handle, type.baseType, op);
}
@ -436,19 +443,23 @@ public final void exScan(Object buf, int count, Datatype type, Op op)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
op.setDatatype(type);
exScan(handle, null, 0, buf, off, count, type.handle, type.baseType, op);
exScan(handle, null, false, 0, buf, db, off,
count, type.handle, type.baseType, op);
}
private native void exScan(
long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff,
long comm, Object sendbuf, boolean sdb, int sendoff,
Object recvbuf, boolean rdb, int recvoff,
int count, long type, int baseType, Op op) throws MPIException;
/**

Просмотреть файл

@ -91,21 +91,22 @@ public Status mRecv(Object buf, int count, Datatype type)
{
MPI.check();
int off = 0;
boolean db = false;
if(isHeapBuffer(buf))
if(buf instanceof Buffer && !(db = ((Buffer)buf).isDirect()))
{
off = ((Buffer)buf).arrayOffset();
buf = ((Buffer)buf).array();
}
Status status = new Status();
mRecv(buf, off, count, type, status);
mRecv(buf, db, off, count, type, status);
return status;
}
private native void mRecv(
Object buf, int offset, int count, Datatype type, Status status)
throws MPIException;
Object buf, boolean db, int offset, int count,
Datatype type, Status status) throws MPIException;
/**
* Java binding of {@code MPI_IMRECV}.