diff --git a/ompi/mpi/java/c/mpi_Comm.c b/ompi/mpi/java/c/mpi_Comm.c index 68985fcefe..6b326eb625 100644 --- a/ompi/mpi/java/c/mpi_Comm.c +++ b/ompi/mpi/java/c/mpi_Comm.c @@ -1213,14 +1213,13 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iScatter( } JNIEXPORT void JNICALL Java_mpi_Comm_scatterv( - JNIEnv *env, jobject jthis, + JNIEnv *env, jobject jthis, jlong jComm, jobject sendBuf, jint sOffset, jintArray sCounts, - jintArray displs, jobject sJType, - jobject recvBuf, jint rOffset, jint rCount, jobject rJType, - jint root) + jintArray displs, 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); @@ -1230,40 +1229,31 @@ JNIEXPORT void JNICALL Java_mpi_Comm_scatterv( void *sPtr = NULL, *sBase, *rPtr, *rBase; MPI_Datatype rType; - int rBType; - if(rJType == NULL) + if(rjType == 0) { assert(recvBuf == NULL); - rType = MPI_DATATYPE_NULL; - rBType = 0; - rPtr = MPI_IN_PLACE; - rBase = NULL; + rType = MPI_DATATYPE_NULL; + rPtr = MPI_IN_PLACE; + rBase = NULL; } 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); } jint *jSCounts = NULL, *jDispls = NULL; int *cSCounts = NULL, *cDispls = NULL; MPI_Datatype sType = rType; - int sBType; if(rootOrInter) { ompi_java_getIntArray(env, sCounts, &jSCounts, &cSCounts); ompi_java_getIntArray(env, displs, &jDispls, &cDispls); - 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); } rc = MPI_Scatterv(sPtr, cSCounts, cDispls, sType, @@ -1340,41 +1330,28 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iScatterv( } JNIEXPORT void JNICALL Java_mpi_Comm_allGather( - JNIEnv *env, jobject jthis, - jobject sendBuf, jint sOffset, jint sCount, jobject sendtype, - jobject recvBuf, jint rOffset, jint rCount, jobject recvtype) + 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) { - MPI_Comm comm = (MPI_Comm)((*env)->GetLongField( - env, jthis, ompi_java.CommHandle)); - int sBType; + MPI_Comm comm = (MPI_Comm)jComm; MPI_Datatype sType; void *sPtr, *sBase, *rPtr, *rBase; - if(sendtype == 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, sendtype, ompi_java.DatatypeHandle)); - - sBType = (*env)->GetIntField(env, - sendtype, 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, recvtype, ompi_java.DatatypeHandle)); - - int rBType = (*env)->GetIntField(env, - recvtype, ompi_java.DatatypeBaseType); - + MPI_Datatype rType = (MPI_Datatype)rjType; rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset); int rc = MPI_Allgather(sPtr, sCount, sType, rPtr, rCount, rType, comm); ompi_java_exceptionCheck(env, rc); @@ -1415,40 +1392,29 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllGather( } JNIEXPORT void JNICALL Java_mpi_Comm_allGatherv( - JNIEnv *env, jobject jthis, - jobject sendBuf, jint sOffset, jint sCount, jobject sJType, - jobject recvBuf, jint rOffset, jintArray rCounts, - jintArray displs, jobject rJType) + 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) { - MPI_Comm comm = (MPI_Comm)((*env)->GetLongField( - env, jthis, ompi_java.CommHandle)); - + MPI_Comm comm = (MPI_Comm)jComm; void *sPtr, *sBase, *rPtr, *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); } - MPI_Datatype rType = (MPI_Datatype)((*env)->GetLongField( - env, rJType, ompi_java.DatatypeHandle)); - - int rBType = (*env)->GetIntField(env, rJType, ompi_java.DatatypeBaseType); - + MPI_Datatype rType = (MPI_Datatype)rjType; jint *jRCounts, *jDispls; int *cRCounts, *cDispls; ompi_java_getIntArray(env, rCounts, &jRCounts, &cRCounts); @@ -1506,20 +1472,13 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllGatherv( } JNIEXPORT void JNICALL Java_mpi_Comm_allToAll( - JNIEnv *env, jobject jthis, - jobject sendBuf, jint sOffset, jint sCount, jobject sJType, - jobject recvBuf, jint rOffset, jint rCount, jobject rJType) + 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) { - 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 sBType = (*env)->GetIntField(env, sJType, ompi_java.DatatypeBaseType); - int rBType = (*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 *sPtr, *sBase, *rPtr, *rBase; rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, rBType, rOffset); @@ -1551,22 +1510,15 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllToAll( } JNIEXPORT void JNICALL Java_mpi_Comm_allToAllv( - JNIEnv *env, jobject jthis, + JNIEnv *env, jobject jthis, jlong jComm, jobject sendBuf, jint sOffset, jintArray sCount, - jintArray sDispls, jobject sJType, + jintArray sDispls, jlong sjType, jint sBType, jobject recvBuf, jint rOffset, jintArray rCount, - jintArray rDispls, jobject rJType) + jintArray rDispls, jlong rjType, jint rBType) { - 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 sBType = (*env)->GetIntField(env, sJType, ompi_java.DatatypeBaseType), - rBType = (*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; jint *jSCount, *jRCount, *jSDispls, *jRDispls; int *cSCount, *cRCount, *cSDispls, *cRDispls; @@ -1622,12 +1574,11 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllToAllv( } JNIEXPORT void JNICALL Java_mpi_Comm_reduce( - JNIEnv *env, jobject jthis, jobject sendBuf, jint sOffset, - jobject recvBuf, jint rOffset, jint count, jobject type, - jobject op, jint root) + JNIEnv *env, jobject jthis, jlong jComm, + jobject sendBuf, jint sOffset, jobject recvBuf, jint rOffset, + jint count, jlong jType, jint baseType, jobject op, 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); @@ -1635,10 +1586,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduce( if(ompi_java_exceptionCheck(env, rc)) return; - MPI_Datatype mpiType = (MPI_Datatype)((*env)->GetLongField( - env, type, ompi_java.DatatypeHandle)); - - int baseType = (*env)->GetIntField(env, type, ompi_java.DatatypeBaseType); + MPI_Datatype type = (MPI_Datatype)jType; void *sPtr, *sBase, *rPtr = NULL, *rBase; if(sendBuf == NULL) @@ -1662,7 +1610,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_reduce( } MPI_Op mpiOp = ompi_java_op_getHandle(env, op, baseType); - rc = MPI_Reduce(sPtr, rPtr, count, mpiType, mpiOp, root, comm); + rc = MPI_Reduce(sPtr, rPtr, count, type, mpiOp, root, comm); ompi_java_exceptionCheck(env, rc); if(sendBuf != NULL) @@ -1717,18 +1665,12 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduce( } JNIEXPORT void JNICALL Java_mpi_Comm_allReduce( - JNIEnv *env, jobject jthis, - jobject sendBuf, jint sendOffset, - jobject recvBuf, jint recvOffset, - jint count, jobject type, jobject op) + JNIEnv *env, jobject jthis, jlong jComm, + jobject sendBuf, jint sendOffset, jobject recvBuf, jint recvOffset, + jint count, jlong jType, jint baseType, jobject op) { - MPI_Comm comm = (MPI_Comm)((*env)->GetLongField( - env, jthis, ompi_java.CommHandle)); - - MPI_Datatype mpiType = (MPI_Datatype)((*env)->GetLongField( - env, type, ompi_java.DatatypeHandle)); - - int baseType = (*env)->GetIntField(env, type, ompi_java.DatatypeBaseType); + MPI_Comm comm = (MPI_Comm)jComm; + MPI_Datatype type = (MPI_Datatype)jType; void *sPtr, *sBase, *rPtr, *rBase; if(sendBuf == NULL) @@ -1738,7 +1680,7 @@ JNIEXPORT void JNICALL Java_mpi_Comm_allReduce( rPtr = ompi_java_getBufPtr(&rBase, env, recvBuf, baseType, recvOffset); MPI_Op mpiOp = ompi_java_op_getHandle(env, op, baseType); - int rc = MPI_Allreduce(sPtr, rPtr, count, mpiType, mpiOp, comm); + int rc = MPI_Allreduce(sPtr, rPtr, count, type, mpiOp, comm); ompi_java_exceptionCheck(env, rc); ompi_java_releaseBufPtr(env, recvBuf, rBase, baseType); @@ -1771,17 +1713,12 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iAllReduce( } JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatter( - JNIEnv *env, jobject jthis, jobject sendBuf, jint sOffset, - jobject recvBuf, jint rOffset, jintArray rCounts, - jobject jType, jobject op) + JNIEnv *env, jobject jthis, jlong jComm, + jobject sendBuf, jint sOffset, jobject recvBuf, jint rOffset, + jintArray rCounts, jlong jType, jint bType, jobject op) { - 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); + MPI_Comm comm = (MPI_Comm)jComm; + MPI_Datatype type = (MPI_Datatype)jType; void *sPtr, *sBase, *rPtr, *rBase; if(sendBuf == NULL) @@ -1835,16 +1772,12 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduceScatter( } JNIEXPORT void JNICALL Java_mpi_Comm_reduceScatterBlock( - JNIEnv *env, jobject jthis, jobject sendBuf, jint sOffset, - jobject recvBuf, jint rOffset, jint count, jobject jType, jobject op) + JNIEnv *env, jobject jthis, jlong jComm, + jobject sendBuf, jint sOffset, jobject recvBuf, jint rOffset, + jint count, jlong jType, jint bType, jobject op) { - 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); + MPI_Comm comm = (MPI_Comm)jComm; + MPI_Datatype type = (MPI_Datatype)jType; void *sPtr, *sBase, *rPtr, *rBase; if(sendBuf == NULL) @@ -1887,23 +1820,21 @@ JNIEXPORT jlong JNICALL Java_mpi_Comm_iReduceScatterBlock( } JNIEXPORT void JNICALL Java_mpi_Comm_reduceLocal( - JNIEnv *env, jobject jthis, jobject inbuf, jint inoff, - jobject inoutbuf, jint inoutoff, jint count, jobject type, jobject op) + JNIEnv *env, jclass clazz, jobject inBuf, jint inOff, + jobject inOutBuf, jint inOutOff, jint count, + jlong jType, jint bType, jobject op) { - MPI_Datatype mpi_type = - (MPI_Datatype)((*env)->GetLongField(env,type,ompi_java.DatatypeHandle)); + 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); - int baseType = (*env)->GetIntField(env, type, ompi_java.DatatypeBaseType); - void *inptr, *inbase, *inoutptr, *inoutbase; - inptr = ompi_java_getBufPtr(&inbase, env, inbuf, baseType, inoff); - inoutptr = ompi_java_getBufPtr(&inoutbase, env, inoutbuf, baseType, inoutoff); - - int rc = MPI_Reduce_local(inptr, inoutptr, count, mpi_type, - ompi_java_op_getHandle(env, op, baseType)); + int rc = MPI_Reduce_local(inPtr, inOutPtr, count, type, + ompi_java_op_getHandle(env, op, bType)); ompi_java_exceptionCheck(env, rc); - ompi_java_releaseReadBufPtr(env, inbuf, inbase, baseType); - ompi_java_releaseBufPtr(env, inoutbuf, inoutbase, baseType); + releaseBufCritical(env, inBuf, inBase); + releaseBufCritical(env, inOutBuf, inOutBase); } JNIEXPORT void JNICALL Java_mpi_Comm_setName( diff --git a/ompi/mpi/java/java/Comm.java b/ompi/mpi/java/java/Comm.java index 7dca99eef3..039de68913 100644 --- a/ompi/mpi/java/java/Comm.java +++ b/ompi/mpi/java/java/Comm.java @@ -1613,8 +1613,10 @@ public final void scatterv( recvbuf = ((Buffer)recvbuf).array(); } - scatterv(sendbuf, sendoff, sendcount, displs, sendtype, - recvbuf, recvoff, recvcount, recvtype, root); + scatterv(handle, sendbuf, sendoff, sendcount, displs, + sendtype.handle, sendtype.baseType, + recvbuf, recvoff, recvcount, + recvtype.handle, recvtype.baseType, root); } /** @@ -1642,8 +1644,9 @@ public final void scatterv(Object sendbuf, int[] sendcount, int[] displs, sendbuf = ((Buffer)sendbuf).array(); } - scatterv(sendbuf, sendoff, sendcount, displs, sendtype, - null, 0, 0, null, root); + scatterv(handle, sendbuf, sendoff, sendcount, displs, + sendtype.handle, sendtype.baseType, + null, 0, 0, 0, 0, root); } /** @@ -1670,15 +1673,16 @@ public final void scatterv(Object recvbuf, int recvcount, recvbuf = ((Buffer)recvbuf).array(); } - scatterv(null, 0, null, null, null, - recvbuf, recvoff, recvcount, recvtype, root); + scatterv(handle, null, 0, null, null, 0, 0, + recvbuf, recvoff, recvcount, + recvtype.handle, recvtype.baseType, root); } private native void scatterv( - Object sendbuf, int sendoffset, - int[] sendcount, int[] displs, Datatype sendtype, - Object recvbuf, int recvoffset, int recvcount, - Datatype recvtype, int root) + long comm, Object sendBuf, int sendOffset, + int[] sendCount, int[] displs, long sendType, int sendBaseType, + Object recvBuf, int recvOffset, int recvCount, + long recvType, int recvBaseType, int root) throws MPIException; /** @@ -1792,8 +1796,10 @@ public final void allGather(Object sendbuf, int sendcount, Datatype sendtype, recvbuf = ((Buffer)recvbuf).array(); } - allGather(sendbuf, sendoff, sendcount, sendtype, - recvbuf, recvoff, recvcount, recvtype); + allGather(handle, sendbuf, sendoff, sendcount, + sendtype.handle, sendtype.baseType, + recvbuf, recvoff, recvcount, + recvtype.handle, recvtype.baseType); } /** @@ -1817,13 +1823,15 @@ public final void allGather(Object buf, int count, Datatype type) buf = ((Buffer)buf).array(); } - allGather(null, 0, 0, null, buf, off, count, type); + allGather(handle, null, 0, 0, 0, 0, + buf, off, count, type.handle, type.baseType); } private native void allGather( - Object sendbuf, int sendoffset, int sendcount, Datatype sendtype, - Object recvbuf, int recvoffset, int recvcount, Datatype recvtype) - throws MPIException; + long comm, Object sendBuf, int sendOffset, int sendCount, + long sendType, int sendBaseType, + Object recvBuf, int recvOffset, int recvCount, + long recvType, int recvBaseType) throws MPIException; /** * Similar to {@code gather}, but all processes receive the result. @@ -1905,8 +1913,10 @@ public final void allGatherv( recvbuf = ((Buffer)recvbuf).array(); } - allGatherv(sendbuf, sendoff, sendcount, sendtype, - recvbuf, recvoff, recvcount, displs, recvtype); + allGatherv(handle, sendbuf, sendoff, sendcount, + sendtype.handle, sendtype.baseType, + recvbuf, recvoff, recvcount, displs, + recvtype.handle, recvtype.baseType); } /** @@ -1932,13 +1942,15 @@ public final void allGatherv(Object recvbuf, int[] recvcount, recvbuf = ((Buffer)recvbuf).array(); } - allGatherv(null, 0, 0, null, recvbuf, recvoff, recvcount, displs, recvtype); + allGatherv(handle, null, 0, 0, 0, 0, recvbuf, recvoff, recvcount, + displs, recvtype.handle, recvtype.baseType); } private native void allGatherv( - Object sendbuf, int sendoffset, int sendcount, Datatype sendtype, - Object recvbuf, int recvoffset, int[] recvcount, int[] displs, - Datatype recvtype) 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) throws MPIException; /** * Similar to {@code gatherv}, but all processes receive the result. @@ -2026,14 +2038,17 @@ public final void allToAll(Object sendbuf, int sendcount, Datatype sendtype, recvbuf = ((Buffer)recvbuf).array(); } - allToAll(sendbuf, sendoff, sendcount, sendtype, - recvbuf, recvoff, recvcount, recvtype); + allToAll(handle, sendbuf, sendoff, sendcount, + sendtype.handle, sendtype.baseType, + recvbuf, recvoff, recvcount, + recvtype.handle, recvtype.baseType); } private native void allToAll( - Object sendbuf, int sendoffset, int sendcount, Datatype sendtype, - Object recvbuf, int recvoffset, int recvcount, Datatype recvtype) - throws MPIException; + long comm, Object sendBuf, int sendOffset, int sendCount, + long sendType, int sendBaseType, + Object recvBuf, int recvOffset, int recvCount, + long recvType, int recvBaseType) throws MPIException; /** * Extension of {@code allGather} to the case where each process sends @@ -2100,15 +2115,17 @@ public final void allToAllv( recvbuf = ((Buffer)recvbuf).array(); } - allToAllv(sendbuf, sendoff, sendcount, sdispls, sendtype, - recvbuf, recvoff, recvcount, rdispls, recvtype); + allToAllv(handle, sendbuf, sendoff, sendcount, sdispls, + sendtype.handle, sendtype.baseType, + recvbuf, recvoff, recvcount, rdispls, + recvtype.handle, recvtype.baseType); } private native void allToAllv( - Object sendbuf, int sendoffset, - int[] sendcount, int[] sdispls, Datatype sendtype, - Object recvbuf, int recvoffset, - int[] recvcount, int[] rdispls, Datatype recvtype) + long comm, Object sendBuf, int sendOffset, + int[] sendCount, int[] sdispls, long sendType, int sendBaseType, + Object recvBuf, int recvOffset, + int[] recvCount, int[] rdispls, long recvType, int recvBaseType) throws MPIException; /** @@ -2186,7 +2203,8 @@ public final void reduce(Object sendbuf, Object recvbuf, int count, recvbuf = ((Buffer)recvbuf).array(); } - reduce(sendbuf, sendoff, recvbuf, recvoff, count, type, op, root); + reduce(handle, sendbuf, sendoff, recvbuf, recvoff, count, + type.handle, type.baseType, op, root); } /** @@ -2215,12 +2233,14 @@ public final void reduce(Object buf, int count, Datatype type, Op op, int root) buf = ((Buffer)buf).array(); } - reduce(null, 0, buf, off, count, type, op, root); + reduce(handle, null, 0, buf, off, count, + type.handle, type.baseType, op, root); } private native void reduce( - Object sendbuf, int sendoff, Object recvbuf, int recvoff, - int count, Datatype type, Op op, int root) throws MPIException; + long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff, + int count, long type, int baseType, Op op, int root) + throws MPIException; /** * Combine elements in input buffer of each process using the reduce @@ -2311,7 +2331,8 @@ public final void allReduce(Object sendbuf, Object recvbuf, recvbuf = ((Buffer)recvbuf).array(); } - allReduce(sendbuf, sendoff, recvbuf, recvoff, count, type, op); + allReduce(handle, sendbuf, sendoff, recvbuf, recvoff, count, + type.handle, type.baseType, op); } /** @@ -2338,12 +2359,12 @@ public final void allReduce(Object buf, int count, Datatype type, Op op) buf = ((Buffer)buf).array(); } - allReduce(null, 0, buf, off, count, type, op); + allReduce(handle, null, 0, buf, off, count, type.handle, type.baseType, op); } private native void allReduce( - Object sendbuf, int sendoff, Object recvbuf, int recvoff, - int count, Datatype type, Op op) throws MPIException; + long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff, + int count, long type, int baseType, Op op) throws MPIException; /** * Same as {@code reduce} except that the result appears in receive @@ -2430,7 +2451,8 @@ public final void reduceScatter(Object sendbuf, Object recvbuf, recvbuf = ((Buffer)recvbuf).array(); } - reduceScatter(sendbuf, sendoff, recvbuf, recvoff, recvcounts, type, op); + reduceScatter(handle, sendbuf, sendoff, recvbuf, recvoff, recvcounts, + type.handle, type.baseType, op); } /** @@ -2458,12 +2480,13 @@ public final void reduceScatter(Object buf, int[] counts, Datatype type, Op op) buf = ((Buffer)buf).array(); } - reduceScatter(null, 0, buf, off, counts, type, op); + reduceScatter(handle, null, 0, buf, off, counts, + type.handle, type.baseType, op); } private native void reduceScatter( - Object sendbuf, int sendoff, Object recvbuf, int recvoff, - int[] recvcounts, Datatype type, Op op) throws MPIException; + long comm, Object sendbuf, int sendoff, Object recvbuf, int recvoff, + int[] recvcounts, long type, int baseType, Op op) throws MPIException; /** * Combine elements in input buffer of each process using the reduce @@ -2551,7 +2574,8 @@ public final void reduceScatterBlock(Object sendbuf, Object recvbuf, recvbuf = ((Buffer)recvbuf).array(); } - reduceScatterBlock(sendbuf, sendoff, recvbuf, recvoff, recvcount, type, op); + reduceScatterBlock(handle, sendbuf, sendoff, recvbuf, recvoff, recvcount, + type.handle, type.baseType, op); } /** @@ -2578,12 +2602,13 @@ public final void reduceScatterBlock( buf = ((Buffer)buf).array(); } - reduceScatterBlock(null, 0, buf, off, count, type, op); + reduceScatterBlock(handle, null, 0, buf, off, count, + type.handle, type.baseType, op); } private native void reduceScatterBlock( - Object sendbuf, int sendoffset, Object recvbuf, int recvoffset, - int recvcount, Datatype type, Op op) throws MPIException; + long comm, Object sendBuf, int sOffset, Object recvBuf, int rOffset, + int rCount, long type, int baseType, Op op) throws MPIException; /** * Combine values and scatter the results. @@ -2637,44 +2662,45 @@ private native long iReduceScatterBlock( /** * Apply the operation given by {@code op} element-wise to the - * elements of {@code inbuf} and {@code inoutbuf} with the result - * stored element-wise in {@code inoutbuf}. + * elements of {@code inBuf} and {@code inOutBuf} with the result + * stored element-wise in {@code inOutBuf}. *

Java binding of the MPI operation {@code MPI_REDUCE_LOCAL}. - * @param inbuf input buffer array - * @param inoutbuf input buffer array, will contain combined output + * @param inBuf input buffer array + * @param inOutBuf input buffer array, will contain combined output * @param count number of elements * @param type data type of each item * @param op reduce operation * @throws MPIException */ -public final void reduceLocal(Object inbuf, Object inoutbuf, int count, - Datatype type, Op op) +public static void reduceLocal( + Object inBuf, Object inOutBuf, int count, Datatype type, Op op) throws MPIException { MPI.check(); op.setDatatype(type); - int inoff = 0, - inoutoff = 0; + int inOff = 0, + inOutOff = 0; - if(isHeapBuffer(inbuf)) + if(isHeapBuffer(inBuf)) { - inoff = ((Buffer)inbuf).arrayOffset(); - inbuf = ((Buffer)inbuf).array(); + inOff = ((Buffer)inBuf).arrayOffset(); + inBuf = ((Buffer)inBuf).array(); } - if(isHeapBuffer(inoutbuf)) + if(isHeapBuffer(inOutBuf)) { - inoutoff = ((Buffer)inoutbuf).arrayOffset(); - inoutbuf = ((Buffer)inoutbuf).array(); + inOutOff = ((Buffer)inOutBuf).arrayOffset(); + inOutBuf = ((Buffer)inOutBuf).array(); } - reduceLocal(inbuf, inoff, inoutbuf, inoutoff, count, type, op); + reduceLocal(inBuf, inOff, inOutBuf, inOutOff, count, + type.handle, type.baseType, op); } -private native void reduceLocal( - Object inbuf, int inoff, Object inoutbuf, int inoutoff, - int count, Datatype datatype, Op op) throws MPIException; +private static native void reduceLocal( + Object inBuf, int inOff, Object inOutBuf, int inOutOff, + int count, long type, int baseType, Op op) throws MPIException; /** * Sets the print name for the communicator.