2004-04-16 06:33:49 +04:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-04-16 06:33:49 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "mpi.h"
|
|
|
|
#include "mpi/f77/bindings.h"
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
|
2004-04-16 06:33:49 +04:00
|
|
|
#pragma weak PMPI_ATTR_GET = mpi_attr_get_f
|
|
|
|
#pragma weak pmpi_attr_get = mpi_attr_get_f
|
|
|
|
#pragma weak pmpi_attr_get_ = mpi_attr_get_f
|
|
|
|
#pragma weak pmpi_attr_get__ = mpi_attr_get_f
|
2004-06-07 19:33:53 +04:00
|
|
|
#elif OMPI_PROFILE_LAYER
|
|
|
|
OMPI_GENERATE_F77_BINDINGS (PMPI_ATTR_GET,
|
2004-04-16 06:33:49 +04:00
|
|
|
pmpi_attr_get,
|
|
|
|
pmpi_attr_get_,
|
|
|
|
pmpi_attr_get__,
|
|
|
|
pmpi_attr_get_f,
|
2004-09-21 23:52:19 +04:00
|
|
|
(MPI_Fint *comm, MPI_Fint *keyval, MPI_Fnt *attribute_val, MPI_Fint *flag, MPI_Fint *ierr),
|
2004-04-16 06:33:49 +04:00
|
|
|
(comm, keyval, attribute_val, flag, ierr) )
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS
|
2004-04-16 06:33:49 +04:00
|
|
|
#pragma weak MPI_ATTR_GET = mpi_attr_get_f
|
|
|
|
#pragma weak mpi_attr_get = mpi_attr_get_f
|
|
|
|
#pragma weak mpi_attr_get_ = mpi_attr_get_f
|
|
|
|
#pragma weak mpi_attr_get__ = mpi_attr_get_f
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if ! OMPI_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
|
|
|
|
OMPI_GENERATE_F77_BINDINGS (MPI_ATTR_GET,
|
2004-04-16 06:33:49 +04:00
|
|
|
mpi_attr_get,
|
|
|
|
mpi_attr_get_,
|
|
|
|
mpi_attr_get__,
|
|
|
|
mpi_attr_get_f,
|
2004-09-21 23:52:19 +04:00
|
|
|
(MPI_Fint *comm, MPI_Fint *keyval, MPI_Fint *attribute_val, MPI_Fint *flag, MPI_Fint *ierr),
|
2004-04-16 06:33:49 +04:00
|
|
|
(comm, keyval, attribute_val, flag, ierr) )
|
|
|
|
#endif
|
|
|
|
|
2004-04-20 22:50:43 +04:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_PROFILE_LAYER && ! OMPI_HAVE_WEAK_SYMBOLS
|
2004-07-18 00:10:03 +04:00
|
|
|
#include "mpi/f77/profile/defines.h"
|
2004-04-20 22:50:43 +04:00
|
|
|
#endif
|
|
|
|
|
2004-08-26 23:23:18 +04:00
|
|
|
void mpi_attr_get_f(MPI_Fint *comm, MPI_Fint *keyval,
|
2004-09-21 23:52:19 +04:00
|
|
|
MPI_Fint *attribute_val, MPI_Fint *flag, MPI_Fint *ierr)
|
2004-04-16 06:33:49 +04:00
|
|
|
{
|
2004-09-21 23:52:19 +04:00
|
|
|
int c_err, c_flag;
|
2004-08-26 23:23:18 +04:00
|
|
|
MPI_Comm c_comm;
|
2004-09-21 23:52:19 +04:00
|
|
|
int *c_value;
|
2004-08-26 23:23:18 +04:00
|
|
|
|
|
|
|
c_comm = MPI_Comm_f2c(*comm);
|
2004-08-28 01:53:11 +04:00
|
|
|
|
2004-09-21 23:52:19 +04:00
|
|
|
/* This stuff is very confusing. Be sure to see MPI-2 4.12.7. */
|
|
|
|
|
|
|
|
/* Didn't use all the FINT macros that could have prevented a few
|
|
|
|
extra variables in this function, but I figured that the
|
|
|
|
clarity of code, and the fact that this is not expected to be a
|
|
|
|
high-performance function, was worth it */
|
|
|
|
|
|
|
|
/* Note that this function deals with attribute values that are
|
|
|
|
the size of Fortran INTEGERS; MPI_ATTR_GET deals with attribute
|
|
|
|
values that are the size of address integers. Hence, it is
|
|
|
|
possible that you'll lose some precision upon the cast. Per
|
|
|
|
MPI-2 4.12.7, use MPI_xxx_get/put_attr when you need lossless
|
|
|
|
conversion. */
|
|
|
|
|
|
|
|
c_err = MPI_Attr_get(c_comm, OMPI_FINT_2_INT(*keyval), &c_value, &c_flag);
|
|
|
|
*ierr = OMPI_INT_2_FINT(c_err);
|
|
|
|
*flag = OMPI_INT_2_FINT(c_flag);
|
|
|
|
|
|
|
|
/* Note that MPI-2 4.12.7 specifically says that Fortran's
|
|
|
|
ATTR_GET function will take the address returned from C and
|
|
|
|
"convert it to an integer" (which assumedly means
|
|
|
|
dereference) */
|
|
|
|
|
|
|
|
if (MPI_SUCCESS == c_err && 1 == c_flag) {
|
|
|
|
*attribute_val = OMPI_INT_2_FINT(*c_value);
|
|
|
|
}
|
2004-04-16 06:33:49 +04:00
|
|
|
}
|