Skip to content

Commit 7e0581c

Browse files
committed
MPI_Win_{get,set}_info : add Java bindings
1 parent 0836344 commit 7e0581c

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

ompi/mpi/java/c/mpi_Win.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,23 @@ JNIEXPORT jlong JNICALL Java_mpi_Win_free(
279279
ompi_java_exceptionCheck(env, rc);
280280
return (jlong)win;
281281
}
282+
283+
JNIEXPORT jlong JNICALL Java_mpi_Win_getInfo(
284+
JNIEnv *env, jobject jthis, jlong handle)
285+
{
286+
MPI_Win win = (MPI_Win)handle;
287+
MPI_Info info;
288+
int rc = MPI_Win_get_info((MPI_Win)win, &info);
289+
ompi_java_exceptionCheck(env, rc);
290+
return (jlong)info;
291+
}
292+
293+
JNIEXPORT void JNICALL Java_mpi_Win_setInfo(
294+
JNIEnv *env, jobject jthis, jlong handle, jlong i)
295+
{
296+
MPI_Win win = (MPI_Win)handle;
297+
MPI_Info info = (MPI_Info)i;
298+
int rc = MPI_Win_set_info(win, info);
299+
ompi_java_exceptionCheck(env, rc);
300+
}
301+

ompi/mpi/java/java/Comm.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12+
* Copyright (c) 2015 Research Organization for Information Science
13+
* and Technology (RIST). All rights reserved.
1214
* $COPYRIGHT$
1315
*
1416
* Additional copyrights may follow
@@ -231,6 +233,18 @@ public final boolean isNull()
231233
return handle == nullHandle;
232234
}
233235

236+
/**
237+
* Java binding of {@code MPI_COMM_GET_INFO}.
238+
* @throws MPIException
239+
*/
240+
public final Info getInfo() throws MPIException
241+
{
242+
MPI.check();
243+
return getInfo(handle);
244+
}
245+
246+
private native void getInfo(long handle, long info) throws MPIException;
247+
234248
/**
235249
* Java binding of {@code MPI_COMM_SET_INFO}.
236250
* @param info info object
@@ -242,7 +256,7 @@ public final void setInfo(Info info) throws MPIException
242256
setInfo(handle, info.handle);
243257
}
244258

245-
private native void setInfo(long fh, long info) throws MPIException;
259+
private native void setInfo(long comm, long info) throws MPIException;
246260

247261
/**
248262
* Java binding of {@code MPI_COMM_GET_INFO}.
@@ -255,7 +269,7 @@ public final Info getInfo() throws MPIException
255269
return new Info(getInfo(handle));
256270
}
257271

258-
private native long getInfo(long fh) throws MPIException;
272+
private native long getInfo(long comm) throws MPIException;
259273

260274
/**
261275
* Java binding of the MPI operation {@code MPI_COMM_DISCONNECT}.

ompi/mpi/java/java/Win.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,4 +468,31 @@ public void deleteAttr(int keyval) throws MPIException
468468

469469
private native long free(long win) throws MPIException;
470470

471+
/**
472+
* Java binding of the MPI operation {@code MPI_WIN_GET_INFO}.
473+
* @throws MPIException
474+
*/
475+
public Info getInfo() throws MPIException
476+
{
477+
MPI.check();
478+
return getInfo(handle);
479+
}
480+
481+
private native Info getInfo(long win)
482+
throws MPIException;
483+
484+
/**
485+
* Java binding of the MPI operation {@code MPI_WIN_SET_INFO}.
486+
* @param info the new info
487+
* @throws MPIException
488+
*/
489+
public void setInfo(Info info) throws MPIException
490+
{
491+
MPI.check();
492+
setInfo(handle, info);
493+
}
494+
495+
private native void setInfo(long win, Info info)
496+
throws MPIException;
497+
471498
} // Win

0 commit comments

Comments
 (0)