1
1

ompi/java: add MPI_Rget and MPI_Rput java bindings

Wrote tests for ompi tests, but will commit later.

Signed-off-by: Nathaniel Graham <ngraham@lanl.gov>
Этот коммит содержится в:
Nathaniel Graham 2015-06-30 12:05:59 -06:00
родитель f6882a85bb
Коммит bb5699e912
2 изменённых файлов: 93 добавлений и 0 удалений

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

@ -298,3 +298,34 @@ JNIEXPORT void JNICALL Java_mpi_Win_setInfo(
ompi_java_exceptionCheck(env, rc);
}
JNIEXPORT jlong JNICALL Java_mpi_Win_rPut(JNIEnv *env, jobject jthis,
jlong win, jobject origin_addr, jint origin_count, jlong origin_type,
jint target_rank, jint target_disp, jint target_count, jlong target_datatype,
jint basetype)
{
void *origPtr = ompi_java_getDirectBufferAddress(env, origin_addr);
MPI_Request request;
int rc = MPI_Rput(origPtr, origin_count, (MPI_Datatype)origin_type,
target_rank, (MPI_Aint)target_disp, target_count, (MPI_Datatype)target_datatype,
(MPI_Win)win, &request);
ompi_java_exceptionCheck(env, rc);
return (jlong)request;
}
JNIEXPORT jlong JNICALL Java_mpi_Win_rGet(JNIEnv *env, jobject jthis, jlong win,
jobject origin, jint orgCount, jlong orgType, jint targetRank, jint targetDisp,
jint targetCount, jlong targetType, jint base)
{
void *orgPtr = (*env)->GetDirectBufferAddress(env, origin);
MPI_Request request;
int rc = MPI_Rget(orgPtr, orgCount, (MPI_Datatype)orgType,
targetRank, (MPI_Aint)targetDisp, targetCount,
(MPI_Datatype)targetType, (MPI_Win)win, &request);
ompi_java_exceptionCheck(env, rc);
return (jlong)request;
}

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

@ -496,4 +496,66 @@ public void setInfo(Info info) throws MPIException
private native void setInfo(long win, long info)
throws MPIException;
/**
* <p>Java binding of the MPI operation {@code MPI_RPUT}.
* @param origin_addr initial address of origin buffer
* @param origin_count number of entries in origin buffer
* @param origin_datatype datatype of each entry in origin buffer
* @param target_rank rank of target
* @param target_disp displacement from start of window to target buffer
* @param target_count number of entries in target buffer
* @param target_datatype datatype of each entry in target buffer
* @return RMA request
* @throws MPIException
*/
public final Request rPut(Buffer origin_addr, int origin_count,
Datatype origin_datatype, int target_rank, int target_disp,
int target_count, Datatype target_datatype)
throws MPIException
{
if(!origin_addr.isDirect())
throw new IllegalArgumentException("The origin must be direct buffer.");
return new Request(rPut(handle, origin_addr, origin_count,
origin_datatype.handle, target_rank, target_disp,
target_count, target_datatype.handle, getBaseType(origin_datatype, target_datatype)));
}
private native long rPut(long win, Buffer origin_addr, int origin_count,
long origin_datatype, int target_rank, int target_disp,
int target_count, long target_datatype, int baseType)
throws MPIException;
/**
* Java binding of {@code MPI_RGET}.
* @param origin origin buffer
* @param orgCount number of entries in origin buffer
* @param orgType datatype of each entry in origin buffer
* @param targetRank rank of target
* @param targetDisp displacement from start of window to target buffer
* @param targetCount number of entries in target buffer
* @param targetType datatype of each entry in target buffer
* @return RMA request
* @throws MPIException
*/
public final Request rGet(Buffer origin, int orgCount, Datatype orgType,
int targetRank, int targetDisp, int targetCount,
Datatype targetType)
throws MPIException
{
MPI.check();
if(!origin.isDirect())
throw new IllegalArgumentException("The origin must be direct buffer.");
return new Request(rGet(handle, origin, orgCount, orgType.handle,
targetRank, targetDisp, targetCount, targetType.handle,
getBaseType(orgType, targetType)));
}
private native long rGet(
long win, Buffer origin, int orgCount, long orgType,
int targetRank, int targetDisp, int targetCount, long targetType,
int baseType) throws MPIException;
} // Win