2004-04-16 06:33:49 +04:00
|
|
|
/*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
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 "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-22 18:49:52 +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-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;
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
ompi_attribute_fortran_ptr_t 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
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
the size of Fortran INTEGERS; the C function 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/SET_ATTR when you need
|
|
|
|
lossless conversion. */
|
2004-09-21 23:52:19 +04:00
|
|
|
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
c_err = MPI_Attr_get(c_comm, OMPI_FINT_2_INT(*keyval),
|
|
|
|
&value.c_ptr, &c_flag);
|
2004-09-21 23:52:19 +04:00
|
|
|
*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
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
"convert it to an integer". This compliments ATTR_PUT, who,
|
|
|
|
since we need to save Fortran attributes by value, saves only
|
|
|
|
the MPI_Fint (regardless of the size of the back-end attribute
|
|
|
|
storeage). So here we simply extract that MPI_Fint and get the
|
|
|
|
value back. */
|
2004-09-21 23:52:19 +04:00
|
|
|
|
|
|
|
if (MPI_SUCCESS == c_err && 1 == c_flag) {
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
*attribute_val = value.f_integer;
|
2004-09-21 23:52:19 +04:00
|
|
|
}
|
2004-04-16 06:33:49 +04:00
|
|
|
}
|