Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ompi/mpi/java/c/mpi_Win.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

62 changes: 62 additions & 0 deletions ompi/mpi/java/java/Win.java
Original file line number Diff line number Diff line change
Expand Up @@ -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