1
1

Merge pull request #749 from nrgraham23/additional_comm_java_bindings

Additional java bindings for the Comm class
Этот коммит содержится в:
Howard Pritchard 2015-07-29 16:17:54 -06:00
родитель 477083bca3 59c43f4669
Коммит ea6f5b31fd
7 изменённых файлов: 103 добавлений и 2 удалений

Просмотреть файл

@ -214,6 +214,15 @@ JNIEXPORT jlongArray JNICALL Java_mpi_Comm_iDup(
return jcr; return jcr;
} }
JNIEXPORT jlong JNICALL Java_mpi_Comm_dupWithInfo(
JNIEnv *env, jobject jthis, jlong comm, jlong info)
{
MPI_Comm newcomm;
int rc = MPI_Comm_dup_with_info((MPI_Comm)comm, (MPI_Info)info, &newcomm);
ompi_java_exceptionCheck(env, rc);
return (jlong)newcomm;
}
JNIEXPORT jint JNICALL Java_mpi_Comm_getSize( JNIEXPORT jint JNICALL Java_mpi_Comm_getSize(
JNIEnv *env, jobject jthis, jlong comm) JNIEnv *env, jobject jthis, jlong comm)
{ {

Просмотреть файл

@ -86,6 +86,15 @@ JNIEXPORT jlong JNICALL Java_mpi_Intracomm_create(
return (jlong)newcomm; return (jlong)newcomm;
} }
JNIEXPORT jlong JNICALL Java_mpi_Intracomm_createGroup(
JNIEnv *env, jobject jthis, jlong comm, jlong group, int tag)
{
MPI_Comm newcomm;
int rc = MPI_Comm_create_group((MPI_Comm)comm, (MPI_Group)group, tag, &newcomm);
ompi_java_exceptionCheck(env, rc);
return (jlong)newcomm;
}
JNIEXPORT jlong JNICALL Java_mpi_Intracomm_createCart( JNIEXPORT jlong JNICALL Java_mpi_Intracomm_createCart(
JNIEnv *env, jobject jthis, jlong comm, JNIEnv *env, jobject jthis, jlong comm,
jintArray dims, jbooleanArray periods, jboolean reorder) jintArray dims, jbooleanArray periods, jboolean reorder)

Просмотреть файл

@ -114,6 +114,19 @@ public final class CartComm extends Intracomm
return new CartComm(iDup(handle)); return new CartComm(iDup(handle));
} }
/**
* Duplicates this communicator with the info object used in the call.
* <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
* @param info info object to associate with the new communicator
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public CartComm dupWithInfo(Info info) throws MPIException
{
MPI.check();
return new CartComm(dupWithInfo(handle, info.handle));
}
/** /**
* Returns cartesian topology information. * Returns cartesian topology information.
* <p>Java binding of the MPI operations {@code MPI_CARTDIM_GET} and * <p>Java binding of the MPI operations {@code MPI_CARTDIM_GET} and

Просмотреть файл

@ -153,6 +153,21 @@ public class Comm implements Freeable
protected final native long[] iDup(long comm) throws MPIException; protected final native long[] iDup(long comm) throws MPIException;
/**
* Duplicates this communicator with the info object used in the call.
* <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
* @param info info object to associate with the new communicator
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public Comm dupWithInfo(Info info) throws MPIException
{
MPI.check();
return new Comm(dupWithInfo(handle, info.handle));
}
protected final native long dupWithInfo(long comm, long info) throws MPIException;
/** /**
* Returns the associated request to this communicator if it was * Returns the associated request to this communicator if it was
* created using {@link #iDup}. * created using {@link #iDup}.

Просмотреть файл

@ -114,6 +114,19 @@ public final class GraphComm extends Intracomm
return new GraphComm(iDup(handle)); return new GraphComm(iDup(handle));
} }
/**
* Duplicates this communicator with the info object used in the call.
* <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
* @param info info object to associate with the new communicator
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public GraphComm dupWithInfo(Info info) throws MPIException
{
MPI.check();
return new GraphComm(dupWithInfo(handle, info.handle));
}
/** /**
* Returns graph topology information. * Returns graph topology information.
* <p>Java binding of the MPI operations {@code MPI_GRAPHDIMS_GET} * <p>Java binding of the MPI operations {@code MPI_GRAPHDIMS_GET}

Просмотреть файл

@ -107,6 +107,19 @@ public final class Intercomm extends Comm
return new Intercomm(iDup(handle)); return new Intercomm(iDup(handle));
} }
/**
* Duplicates this communicator with the info object used in the call.
* <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
* @param info info object to associate with the new communicator
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intercomm dupWithInfo(Info info) throws MPIException
{
MPI.check();
return new Intercomm(dupWithInfo(handle, info.handle));
}
// Inter-Communication // Inter-Communication
/** /**

Просмотреть файл

@ -124,6 +124,19 @@ public class Intracomm extends Comm
return new Intracomm(iDup(handle)); return new Intracomm(iDup(handle));
} }
/**
* Duplicates this communicator with the info object used in the call.
* <p>Java binding of {@code MPI_COMM_DUP_WITH_INFO}.
* @param info info object to associate with the new communicator
* @return copy of this communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
@Override public Intracomm dupWithInfo(Info info) throws MPIException
{
MPI.check();
return new Intracomm(dupWithInfo(handle, info.handle));
}
/** /**
* Partition the group associated with this communicator and create * Partition the group associated with this communicator and create
* a new communicator within each subgroup. * a new communicator within each subgroup.
@ -174,6 +187,22 @@ public class Intracomm extends Comm
private native long create(long comm, long group); private native long create(long comm, long group);
/**
* Create a new intracommunicator for the given group.
* <p>Java binding of the MPI operation {@code MPI_COMM_CREATE_GROUP}.
* @param group group which is a subset of the group of this communicator
* @param tag an integer tag
* @return new communicator
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Intracomm createGroup(Group group, int tag) throws MPIException
{
MPI.check();
return new Intracomm(createGroup(handle, group.handle, tag));
}
private native long createGroup(long comm, long group, int tag);
// Topology Constructors // Topology Constructors
/** /**