New Java method in Comm: iDup
This commit was SVN r31299.
Этот коммит содержится в:
родитель
c9e6f09af1
Коммит
aa3e2f7afd
@ -292,15 +292,30 @@ JNIEXPORT void JNICALL Java_mpi_Comm_getComm(JNIEnv *env, jobject jthis,
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_mpi_Comm_dup(JNIEnv *env, jobject jthis)
|
||||
JNIEXPORT jlong JNICALL Java_mpi_Comm_dup(
|
||||
JNIEnv *env, jobject jthis, jlong comm)
|
||||
{
|
||||
MPI_Comm comm, newcomm;
|
||||
comm = (MPI_Comm)(*env)->GetLongField(env, jthis, ompi_java.CommHandle);
|
||||
int rc = MPI_Comm_dup(comm, &newcomm);
|
||||
MPI_Comm newcomm;
|
||||
int rc = MPI_Comm_dup((MPI_Comm)comm, &newcomm);
|
||||
ompi_java_exceptionCheck(env, rc);
|
||||
return (jlong)newcomm;
|
||||
}
|
||||
|
||||
JNIEXPORT jlongArray JNICALL Java_mpi_Comm_iDup(
|
||||
JNIEnv *env, jobject jthis, jlong comm)
|
||||
{
|
||||
MPI_Comm newcomm;
|
||||
MPI_Request request;
|
||||
int rc = MPI_Comm_idup((MPI_Comm)comm, &newcomm, &request);
|
||||
ompi_java_exceptionCheck(env, rc);
|
||||
jlongArray jcr = (*env)->NewLongArray(env, 2);
|
||||
jlong *cr = (jlong*)(*env)->GetPrimitiveArrayCritical(env, jcr, NULL);
|
||||
cr[0] = (jlong)newcomm;
|
||||
cr[1] = (jlong)request;
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jcr, cr, 0);
|
||||
return jcr;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_mpi_Comm_getSize(
|
||||
JNIEnv *env, jobject jthis, jlong comm)
|
||||
{
|
||||
|
@ -62,19 +62,23 @@ protected CartComm(long handle) throws MPIException
|
||||
super(handle);
|
||||
}
|
||||
|
||||
protected CartComm(long[] commRequest)
|
||||
{
|
||||
super(commRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate this communicator.
|
||||
* <p>Java binding of the MPI operation {@code MPI_COMM_DUP}.
|
||||
* <p>The new communicator is "congruent" to the old one,
|
||||
* but has a different context.
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
|
||||
* because the last can't throw an {@link mpi.MPIException}.
|
||||
* @return copy of this communicator
|
||||
*/
|
||||
@Override public CartComm clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
MPI.check();
|
||||
return new CartComm(dup());
|
||||
return dup();
|
||||
}
|
||||
catch(MPIException e)
|
||||
{
|
||||
@ -82,6 +86,32 @@ protected CartComm(long handle) throws MPIException
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public CartComm dup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new CartComm(dup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_IDUP}.
|
||||
* <p>The new communicator can't be used before the operation completes.
|
||||
* The request object must be obtained calling {@link #getRequest}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public CartComm iDup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new CartComm(iDup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns cartesian topology information.
|
||||
* <p>Java binding of the MPI operations {@code MPI_CARTDIM_GET} and
|
||||
|
@ -66,6 +66,7 @@ public class Comm implements Freeable
|
||||
protected final static int SELF = 1;
|
||||
protected final static int WORLD = 2;
|
||||
protected long handle;
|
||||
private Request request;
|
||||
|
||||
private static long nullHandle;
|
||||
|
||||
@ -85,6 +86,12 @@ protected Comm(long handle)
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
protected Comm(long[] commRequest)
|
||||
{
|
||||
handle = commRequest[0];
|
||||
request = new Request(commRequest[1]);
|
||||
}
|
||||
|
||||
protected final void setType(int type)
|
||||
{
|
||||
getComm(type);
|
||||
@ -93,18 +100,17 @@ protected final void setType(int type)
|
||||
private native void getComm(int type);
|
||||
|
||||
/**
|
||||
* Duplicate this communicator.
|
||||
* <p>Java binding of the MPI operation {@code MPI_COMM_DUP}.
|
||||
* <p>The new communicator is "congruent" to the old one,
|
||||
* but has a different context.
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
|
||||
* because the last can't throw an {@link mpi.MPIException}.
|
||||
* @return copy of this communicator
|
||||
*/
|
||||
@Override public Comm clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
MPI.check();
|
||||
return new Comm(dup());
|
||||
return dup();
|
||||
}
|
||||
catch(MPIException e)
|
||||
{
|
||||
@ -112,7 +118,46 @@ private native void getComm(int type);
|
||||
}
|
||||
}
|
||||
|
||||
protected final native long dup() throws MPIException;
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
public Comm dup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new Comm(dup(handle));
|
||||
}
|
||||
|
||||
protected final native long dup(long comm) throws MPIException;
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_IDUP}.
|
||||
* <p>The new communicator can't be used before the operation completes.
|
||||
* The request object must be obtained calling {@link #getRequest}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
public Comm iDup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new Comm(iDup(handle));
|
||||
}
|
||||
|
||||
protected final native long[] iDup(long comm) throws MPIException;
|
||||
|
||||
/**
|
||||
* Returns the associated request to this communicator if it was
|
||||
* created using {@link #iDup}.
|
||||
* @return associated request if this communicator was created
|
||||
* using {@link #iDup}, or null otherwise.
|
||||
*/
|
||||
public final Request getRequest()
|
||||
{
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Size of group of this communicator.
|
||||
|
@ -62,19 +62,23 @@ protected GraphComm(long handle) throws MPIException
|
||||
super(handle);
|
||||
}
|
||||
|
||||
protected GraphComm(long[] commRequest)
|
||||
{
|
||||
super(commRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate this communicator.
|
||||
* <p>Java binding of the MPI operation {@code MPI_COMM_DUP}.
|
||||
* <p>The new communicator is "congruent" to the old one,
|
||||
* but has a different context.
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
|
||||
* because the last can't throw an {@link mpi.MPIException}.
|
||||
* @return copy of this communicator
|
||||
*/
|
||||
@Override public GraphComm clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
MPI.check();
|
||||
return new GraphComm(dup());
|
||||
return dup();
|
||||
}
|
||||
catch(MPIException e)
|
||||
{
|
||||
@ -82,6 +86,32 @@ protected GraphComm(long handle) throws MPIException
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public GraphComm dup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new GraphComm(dup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>The new communicator can't be used before the operation completes.
|
||||
* The request object must be obtained calling {@link #getRequest}.
|
||||
* <p>Java binding of {@code MPI_COMM_IDUP}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public GraphComm iDup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new GraphComm(iDup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns graph topology information.
|
||||
* <p>Java binding of the MPI operations {@code MPI_GRAPHDIMS_GET}
|
||||
|
@ -55,19 +55,23 @@ protected Intercomm(long handle)
|
||||
super(handle);
|
||||
}
|
||||
|
||||
protected Intercomm(long[] commRequest)
|
||||
{
|
||||
super(commRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate this communicator.
|
||||
* <p>Java binding of the MPI operation {@code MPI_COMM_DUP}.
|
||||
* <p>The new communicator is "congruent" to the old one,
|
||||
* but has a different context.
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
|
||||
* because the last can't throw an {@link mpi.MPIException}.
|
||||
* @return copy of this communicator
|
||||
*/
|
||||
@Override public Intercomm clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
MPI.check();
|
||||
return new Intercomm(dup());
|
||||
return dup();
|
||||
}
|
||||
catch(MPIException e)
|
||||
{
|
||||
@ -75,6 +79,32 @@ protected Intercomm(long handle)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public Intercomm dup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new Intercomm(dup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_IDUP}.
|
||||
* <p>The new communicator can't be used before the operation completes.
|
||||
* The request object must be obtained calling {@link #getRequest}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public Intercomm iDup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new Intercomm(iDup(handle));
|
||||
}
|
||||
|
||||
// Inter-Communication
|
||||
|
||||
/**
|
||||
|
@ -72,19 +72,23 @@ protected Intracomm(long handle)
|
||||
super(handle);
|
||||
}
|
||||
|
||||
protected Intracomm(long[] commRequest)
|
||||
{
|
||||
super(commRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate this communicator.
|
||||
* <p>Java binding of the MPI operation {@code MPI_COMM_DUP}.
|
||||
* <p>The new communicator is "congruent" to the old one,
|
||||
* but has a different context.
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* <p>It is recommended to use {@link #dup} instead of {@link #clone}
|
||||
* because the last can't throw an {@link mpi.MPIException}.
|
||||
* @return copy of this communicator
|
||||
*/
|
||||
@Override public Intracomm clone()
|
||||
{
|
||||
try
|
||||
{
|
||||
MPI.check();
|
||||
return new Intracomm(dup());
|
||||
return dup();
|
||||
}
|
||||
catch(MPIException e)
|
||||
{
|
||||
@ -92,6 +96,32 @@ protected Intracomm(long handle)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_DUP}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public Intracomm dup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new Intracomm(dup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicates this communicator.
|
||||
* <p>Java binding of {@code MPI_COMM_IDUP}.
|
||||
* <p>The new communicator can't be used before the operation completes.
|
||||
* The request object must be obtained calling {@link #getRequest}.
|
||||
* @return copy of this communicator
|
||||
* @throws MPIException
|
||||
*/
|
||||
@Override public Intracomm iDup() throws MPIException
|
||||
{
|
||||
MPI.check();
|
||||
return new Intracomm(iDup(handle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Partition the group associated with this communicator and create
|
||||
* a new communicator within each subgroup.
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user