1
1
openmpi/ompi/mpi/java/c/mpi_Prequest.c
Jeff Squyres e4e3e411fc Next generation of MPI Java bindings.
Includes all MPI functions supported by Open MPI, including MPI-3
functions (as of about 2 weeks ago).  Many changes compared to the
prior generation of Java bindings; not much is left from the prior
generation, actually.  The changes include (but are not limited to):

 * Add support for more than just a subset of MPI-1 functions
 * Use typical Java case for symbol names
 * Support Java Direct buffers (giving darn-near "native C"
   performance)
 * Support "type struct" better than the prior generation
 * Make more of an effort for the Java bindings to be a thin layer
   over the back-end C bindings
 * ...and more

A proper README with more information about what is supported, how to
use these bindings, etc. will be committed shortly.

This commit was SVN r29263.
2013-09-26 21:44:39 +00:00

60 строки
1.6 KiB
C

#include "ompi_config.h"
#include <stdlib.h>
#include <assert.h>
#ifdef HAVE_TARGETCONDITIONALS_H
#include <TargetConditionals.h>
#endif
#include "mpi.h"
#include "mpi_Prequest.h"
#include "mpiJava.h"
/*
* Class: mpi_Prequest
* Method: start_jni
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_mpi_Prequest_start_1jni(JNIEnv *env, jobject jthis)
{
MPI_Request request = (MPI_Request)(*env)->GetLongField(
env, jthis, ompi_java.ReqHandle);
int rc = MPI_Start(&request);
ompi_java_exceptionCheck(env, rc);
(*env)->SetLongField(env, jthis, ompi_java.ReqHandle, (jlong)request);
}
/*
* Class: mpi_Prequest
* Method: startAll_jni
* Signature: ([Lmpi/Prequest;)V
*/
JNIEXPORT void JNICALL Java_mpi_Prequest_startAll_1jni(
JNIEnv *env, jclass clazz, jobjectArray prequests)
{
int i, count = (*env)->GetArrayLength(env, prequests);
MPI_Request *requests = calloc(count, sizeof(MPI_Request));
for(i = 0; i < count; i++)
{
jobject r = (*env)->GetObjectArrayElement(env, prequests, i);
requests[i] = (MPI_Request)(*env)->GetLongField(
env, r, ompi_java.ReqHandle);
(*env)->DeleteLocalRef(env, r);
}
int rc = MPI_Startall(count, requests);
ompi_java_exceptionCheck(env, rc);
for(i = 0; i < count; i++)
{
jobject r = (*env)->GetObjectArrayElement(env, prequests, i);
(*env)->SetLongField(env, r, ompi_java.ReqHandle, (long)requests[i]);
(*env)->DeleteLocalRef(env, r);
}
free(requests);
}