void mpi_open_port_f(MPI_Fint *info, char *port_name, MPI_Fint *ierr, int port_name_len)
{
    MPI_Info c_info;
    char c_port_name[MPI_MAX_PORT_NAME];

    c_info = MPI_Info_f2c(*info);

    *ierr = OMPI_INT_2_FINT(MPI_Open_port(c_info, c_port_name));

    if ( MPI_SUCCESS == OMPI_FINT_2_INT (*ierr )) {
	ompi_fortran_string_c2f(c_port_name, port_name, port_name_len );
    }
}
void mpi_type_get_name_f(MPI_Fint *type, char *type_name, MPI_Fint *resultlen, MPI_Fint *ierr, int name_len)
{
    int err, c_len;
    MPI_Datatype c_type = MPI_Type_f2c(*type);
    char c_name[MPI_MAX_OBJECT_NAME];

    err = MPI_Type_get_name(c_type, c_name, &c_len);
    if (MPI_SUCCESS == err) {
        ompi_fortran_string_c2f(c_name, type_name, name_len);
        *resultlen = OMPI_INT_2_FINT(c_len);
        *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
    } else {
        *ierr = OMPI_INT_2_FINT(err);
    }
}
void mpi_comm_get_name_f(MPI_Fint *comm, char *comm_name,
			 MPI_Fint *resultlen, MPI_Fint *ierr,
                         int name_len)
{
    int err, c_len;
    MPI_Comm c_comm = MPI_Comm_f2c(*comm);
    char c_name[MPI_MAX_OBJECT_NAME];

    err = MPI_Comm_get_name(c_comm, c_name, &c_len);
    if (MPI_SUCCESS == err) {
        ompi_fortran_string_c2f(c_name, comm_name, name_len);
        *resultlen = OMPI_INT_2_FINT(c_len);
        *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
    } else {
        *ierr = OMPI_INT_2_FINT(err);
    }
}
Beispiel #4
0
void ompi_info_get_nthkey_f(MPI_Fint *info, MPI_Fint *n, char *key,
			   MPI_Fint *ierr, int key_len)
{
    int c_ierr, ret;
    MPI_Info c_info;
    char c_key[MPI_MAX_INFO_KEY + 1];

    c_info = PMPI_Info_f2c(*info);

    c_ierr = PMPI_Info_get_nthkey(c_info,
                                 OMPI_FINT_2_INT(*n),
                                 c_key);
    if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);

    if (OMPI_SUCCESS != (ret = ompi_fortran_string_c2f(c_key, key, key_len))) {
        c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
        if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
        return;
    }
}
Beispiel #5
0
void ompi_file_get_view_f(MPI_Fint *fh, MPI_Offset *disp,
			 MPI_Fint *etype, MPI_Fint *filetype,
			 char *datarep, MPI_Fint *ierr, int datarep_len)
{
    int c_ierr;
    MPI_File c_fh = MPI_File_f2c(*fh);
    MPI_Datatype c_etype, c_filetype;
    MPI_Offset c_disp;
    char c_datarep[MPI_MAX_DATAREP_STRING];

    c_ierr = MPI_File_get_view(c_fh, &c_disp, &c_etype,
                               &c_filetype, c_datarep);
    if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);

    if (MPI_SUCCESS == c_ierr) {
        *disp = (MPI_Offset) c_disp;
        *etype = MPI_Type_c2f(c_etype);
        *filetype = MPI_Type_c2f(c_filetype);
        ompi_fortran_string_c2f(c_datarep, datarep, datarep_len);
    }
}
Beispiel #6
0
void mpi_info_get_f(MPI_Fint *info, char *key, MPI_Fint *valuelen,
                    char *value, ompi_fortran_logical_t *flag, MPI_Fint *ierr,
                    int key_len, int value_len)
{
    int c_err, ret;
    MPI_Info c_info;
    char *c_key = NULL, c_value[MPI_MAX_INFO_VAL + 1];
    OMPI_LOGICAL_NAME_DECL(flag);

    if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(key, key_len, &c_key))) {
        c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
        *ierr = OMPI_INT_2_FINT(c_err);
        return;
    }
    c_info = MPI_Info_f2c(*info);

    *ierr = OMPI_INT_2_FINT(MPI_Info_get(c_info, c_key,
                                         OMPI_FINT_2_INT(*valuelen),
                                         c_value,
                                         OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)));
    if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
        OMPI_SINGLE_INT_2_LOGICAL(flag);

        /* If we found the info key, copy the value back to the
           Fortran string (note: all Fortran compilers have FALSE ==
           0, so just check for any nonzero value, because not all
           Fortran compilers have TRUE == 1).  Note: use the full
           length of the Fortran string, not *valuelen.  See comment
           in ompi/mpi/fortran/base/strings.c. */
        if (*flag && OMPI_SUCCESS != 
            (ret = ompi_fortran_string_c2f(c_value, value, value_len))) {
            c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
            *ierr = OMPI_INT_2_FINT(c_err);
            free(c_key);
            return;
        }
    }

    free(c_key);
}
Beispiel #7
0
void mpi_info_get_f(MPI_Fint *info, char *key, MPI_Fint *valuelen,
                    char *value, ompi_fortran_logical_t *flag, MPI_Fint *ierr,
                    int key_len, int value_len)
{
    int c_err, ret;
    MPI_Info c_info;
    char *c_key = NULL, c_value[MPI_MAX_INFO_VAL + 1];
    OMPI_LOGICAL_NAME_DECL(flag);

    if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(key, key_len, &c_key))) {
        c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
        *ierr = OMPI_INT_2_FINT(c_err);
        return;
    }
    c_info = MPI_Info_f2c(*info);

    *ierr = OMPI_INT_2_FINT(MPI_Info_get(c_info, c_key,
                                         OMPI_FINT_2_INT(*valuelen),
                                         c_value,
                                         OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag)));
    if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
        OMPI_SINGLE_INT_2_LOGICAL(flag);

        /* Use the full length of the Fortran string, not *valuelen.
           See comment in ompi/mpi/f77/strings.c. */
        if (OMPI_SUCCESS != (ret = ompi_fortran_string_c2f(c_value, value,
                                                           value_len))) {
            c_err = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, ret, FUNC_NAME);
            *ierr = OMPI_INT_2_FINT(c_err);
            free(c_key);
            return;
        }
    }

    free(c_key);
}