Esempio n. 1
0
void ompi_graph_map_f(MPI_Fint *comm, MPI_Fint *nnodes, MPI_Fint *indx,
		     MPI_Fint *edges, MPI_Fint *nrank, MPI_Fint *ierr)
{
    int c_ierr;
    MPI_Comm c_comm;
    OMPI_ARRAY_NAME_DECL(indx);
    OMPI_ARRAY_NAME_DECL(edges);
    OMPI_SINGLE_NAME_DECL(nrank);

    c_comm = MPI_Comm_f2c(*comm);

    /* Number of edges is equal to the last entry in the index array */
    OMPI_ARRAY_FINT_2_INT(edges, indx[*nnodes - 1]);
    OMPI_ARRAY_FINT_2_INT(indx, *nnodes);

    c_ierr = MPI_Graph_map(c_comm, OMPI_FINT_2_INT(*nnodes),
                           OMPI_ARRAY_NAME_CONVERT(indx),
                           OMPI_ARRAY_NAME_CONVERT(edges),
                           OMPI_SINGLE_NAME_CONVERT(nrank));
    if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);

    if (MPI_SUCCESS == c_ierr) {
        OMPI_SINGLE_INT_2_FINT(nrank);
    }
    OMPI_ARRAY_FINT_2_INT_CLEANUP(edges);
    OMPI_ARRAY_FINT_2_INT_CLEANUP(indx);
}
JNIEXPORT jint JNICALL Java_mpi_GraphComm_map(
        JNIEnv *env, jobject jthis, jlong comm,
        jintArray index, jintArray edges)
{
    int nNodes = (*env)->GetArrayLength(env, index);
    jint *jIndex, *jEdges;
    int  *cIndex, *cEdges;
    ompi_java_getIntArray(env, index, &jIndex, &cIndex);
    ompi_java_getIntArray(env, edges, &jEdges, &cEdges);

    int newrank;
    int rc = MPI_Graph_map((MPI_Comm)comm, nNodes, cIndex, cEdges, &newrank);
    ompi_java_exceptionCheck(env, rc);

    ompi_java_releaseIntArray(env, index, jIndex, cIndex);
    ompi_java_releaseIntArray(env, edges, jEdges, cEdges);
    return newrank;
}
Esempio n. 3
0
FORT_DLL_SPEC void FORT_CALL mpi_graph_map_ ( MPI_Fint *v1, MPI_Fint *v2, MPI_Fint v3[], MPI_Fint v4[], MPI_Fint *v5, MPI_Fint *ierr ){
    *ierr = MPI_Graph_map( (MPI_Comm)(*v1), (int)*v2, v3, v4, v5 );
}