mpi.Message: java object members as parameters
This commit was SVN r30755.
Этот коммит содержится в:
родитель
a80a24029d
Коммит
98530055d1
@ -15,77 +15,65 @@ JNIEXPORT void JNICALL Java_mpi_Message_init(JNIEnv *e, jclass c)
|
|||||||
ompi_java.MessageHandle = (*e)->GetFieldID(e, c, "handle", "J");
|
ompi_java.MessageHandle = (*e)->GetFieldID(e, c, "handle", "J");
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL Java_mpi_Message_mProbe(
|
JNIEXPORT jlong JNICALL Java_mpi_Message_mProbe(
|
||||||
JNIEnv *env, jobject jthis, jint source, jint tag, jlong comm)
|
JNIEnv *env, jobject jthis,
|
||||||
|
jint source, jint tag, jlong jComm, jobject jStatus)
|
||||||
{
|
{
|
||||||
MPI_Message message = (MPI_Message)((*env)->GetLongField(
|
MPI_Comm comm = (MPI_Comm)jComm;
|
||||||
env, jthis, ompi_java.MessageHandle));
|
MPI_Message message;
|
||||||
int rc;
|
MPI_Status status;
|
||||||
MPI_Status status;
|
int rc = MPI_Mprobe(source, tag, comm, &message, &status);
|
||||||
rc = MPI_Mprobe(source, tag, (MPI_Comm)comm, &message, &status);
|
ompi_java_exceptionCheck(env, rc);
|
||||||
|
ompi_java_status_set(&status, env, jStatus);
|
||||||
if(ompi_java_exceptionCheck(env, rc))
|
return (jlong)message;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
(*env)->SetLongField(env, jthis, ompi_java.MessageHandle, (jlong)message);
|
|
||||||
jobject stat = ompi_java_status_new(&status, env);
|
|
||||||
return stat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL Java_mpi_Message_imProbe(
|
JNIEXPORT jobject JNICALL Java_mpi_Message_imProbe(
|
||||||
JNIEnv *env, jobject jthis, jint source, jint tag, jlong comm)
|
JNIEnv *env, jobject jthis, jint source, jint tag, jlong jComm)
|
||||||
{
|
{
|
||||||
MPI_Message message = (MPI_Message)((*env)->GetLongField(
|
MPI_Comm comm = (MPI_Comm)jComm;
|
||||||
env, jthis, ompi_java.MessageHandle));
|
MPI_Message message;
|
||||||
|
MPI_Status status;
|
||||||
int rc, flag;
|
int rc, flag;
|
||||||
MPI_Status status;
|
rc = MPI_Improbe(source, tag, comm, &flag, &message, &status);
|
||||||
rc = MPI_Improbe(source, tag, (MPI_Comm)comm, &flag, &message, &status);
|
|
||||||
|
|
||||||
if(ompi_java_exceptionCheck(env, rc) || !flag)
|
if(ompi_java_exceptionCheck(env, rc) || !flag)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
(*env)->SetLongField(env, jthis, ompi_java.MessageHandle, (jlong)message);
|
(*env)->SetLongField(env, jthis, ompi_java.MessageHandle, (jlong)message);
|
||||||
jobject stat = ompi_java_status_new(&status, env);
|
return ompi_java_status_new(&status, env);
|
||||||
return stat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_mpi_Message_mRecv(
|
JNIEXPORT jlong JNICALL Java_mpi_Message_mRecv(
|
||||||
JNIEnv *env, jobject jthis, jobject buf, jboolean db,
|
JNIEnv *env, jobject jthis, jlong jMessage, jobject buf, jboolean db,
|
||||||
jint offset, jint count, jobject jType, jobject stat)
|
jint offset, jint count, jlong jType, jint bType, jobject stat)
|
||||||
{
|
{
|
||||||
MPI_Message msg = (MPI_Message)((*env)->GetLongField(
|
MPI_Message message = (MPI_Message)jMessage;
|
||||||
env, jthis, ompi_java.MessageHandle));
|
MPI_Datatype type = (MPI_Datatype)jType;
|
||||||
|
|
||||||
MPI_Datatype type = (MPI_Datatype)((*env)->GetLongField(
|
|
||||||
env, jType, ompi_java.DatatypeHandle));
|
|
||||||
|
|
||||||
int bType = (*env)->GetIntField(env, jType, ompi_java.DatatypeBaseType);
|
|
||||||
void *bufPtr, *bufBase;
|
void *bufPtr, *bufBase;
|
||||||
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, bType, offset);
|
bufPtr = ompi_java_getBufPtr(&bufBase, env, buf, db, bType, offset);
|
||||||
|
|
||||||
MPI_Status status;
|
MPI_Status status;
|
||||||
int rc = MPI_Mrecv(bufPtr, count, type, &msg, &status);
|
int rc = MPI_Mrecv(bufPtr, count, type, &message, &status);
|
||||||
|
ompi_java_exceptionCheck(env, rc);
|
||||||
if(!ompi_java_exceptionCheck(env, rc))
|
|
||||||
{
|
|
||||||
(*env)->SetLongField(env, jthis, ompi_java.MessageHandle, (jlong)msg);
|
|
||||||
ompi_java_status_set(&status, env, stat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ompi_java_status_set(&status, env, stat);
|
||||||
ompi_java_releaseBufPtr(env, buf, db, bufBase, bType);
|
ompi_java_releaseBufPtr(env, buf, db, bufBase, bType);
|
||||||
|
return (jlong)message;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_mpi_Message_imRecv(
|
JNIEXPORT jlong JNICALL Java_mpi_Message_imRecv(
|
||||||
JNIEnv *env, jobject jthis, jobject buf, jint count, jlong type)
|
JNIEnv *env, jobject jthis, jlong jMessage,
|
||||||
|
jobject buf, jint count, jlong jType)
|
||||||
{
|
{
|
||||||
MPI_Message msg = (MPI_Message)((*env)->GetLongField(
|
MPI_Message message = (MPI_Message)jMessage;
|
||||||
env, jthis, ompi_java.MessageHandle));
|
MPI_Datatype type = (MPI_Datatype)jType;
|
||||||
|
|
||||||
void *ptr = ompi_java_getDirectBufferAddress(env, buf);
|
void *ptr = ompi_java_getDirectBufferAddress(env, buf);
|
||||||
MPI_Request request;
|
|
||||||
|
|
||||||
int rc = MPI_Imrecv(ptr, count, (MPI_Datatype)type, &msg, &request);
|
MPI_Request request;
|
||||||
|
int rc = MPI_Imrecv(ptr, count, type, &message, &request);
|
||||||
ompi_java_exceptionCheck(env, rc);
|
ompi_java_exceptionCheck(env, rc);
|
||||||
(*env)->SetLongField(env, jthis, ompi_java.MessageHandle, (jlong)msg);
|
(*env)->SetLongField(env, jthis, ompi_java.MessageHandle, (jlong)message);
|
||||||
return (jlong)request;
|
return (jlong)request;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package mpi;
|
package mpi;
|
||||||
|
|
||||||
import java.nio.*;
|
import java.nio.*;
|
||||||
import static mpi.MPI.isHeapBuffer;
|
|
||||||
import static mpi.MPI.assertDirectBuffer;
|
import static mpi.MPI.assertDirectBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,10 +55,12 @@ public boolean isNoProc()
|
|||||||
public Status mProbe(int source, int tag, Comm comm) throws MPIException
|
public Status mProbe(int source, int tag, Comm comm) throws MPIException
|
||||||
{
|
{
|
||||||
MPI.check();
|
MPI.check();
|
||||||
return mProbe(source, tag, comm.handle);
|
Status status = new Status();
|
||||||
|
handle = mProbe(source, tag, comm.handle, status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Status mProbe(int source, int tag, long comm)
|
private native long mProbe(int source, int tag, long comm, Status status)
|
||||||
throws MPIException;
|
throws MPIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,13 +101,14 @@ public Status mRecv(Object buf, int count, Datatype type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status status = new Status();
|
Status status = new Status();
|
||||||
mRecv(buf, db, off, count, type, status);
|
handle = mRecv(handle, buf, db, off, count,
|
||||||
|
type.handle, type.baseType, status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void mRecv(
|
private native long mRecv(
|
||||||
Object buf, boolean db, int offset, int count,
|
long message, Object buf, boolean db, int offset, int count,
|
||||||
Datatype type, Status status) throws MPIException;
|
long type, int baseType, Status status) throws MPIException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java binding of {@code MPI_IMRECV}.
|
* Java binding of {@code MPI_IMRECV}.
|
||||||
@ -121,10 +123,10 @@ public Request imRecv(Buffer buf, int count, Datatype type)
|
|||||||
{
|
{
|
||||||
MPI.check();
|
MPI.check();
|
||||||
assertDirectBuffer(buf);
|
assertDirectBuffer(buf);
|
||||||
return new Request(imRecv(buf, count, type.handle));
|
return new Request(imRecv(handle, buf, count, type.handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native long imRecv(Object buf, int count, long type)
|
private native long imRecv(long message, Object buf, int count, long type)
|
||||||
throws MPIException;
|
throws MPIException;
|
||||||
|
|
||||||
} // Message
|
} // Message
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user