summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2002-04-23 23:52:42 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2002-04-23 23:52:42 (GMT)
commitda58f157dd9aea4de12b4f448fa5cafbef2d32d0 (patch)
tree75f80818f6cc421a13725a596d2e055ef70b063c /fortran
parent09f85560986cb82e6b8c5d062f97f8bb0ed8e19f (diff)
downloadhdf5-da58f157dd9aea4de12b4f448fa5cafbef2d32d0.zip
hdf5-da58f157dd9aea4de12b4f448fa5cafbef2d32d0.tar.gz
hdf5-da58f157dd9aea4de12b4f448fa5cafbef2d32d0.tar.bz2
[svn-r5243]
Purpose: Bug fix Description: Different MPI implementations use different ways to pass MPI objects between C and Fortran layers. MPI-2 defines a standard set of MPI_*_c2f(f2c) functions for this purpose. Unfortunately it is not implemented everywhere and makes code non-portable between different parallel platforms. Solution: Always use MPI_*c2f(f2c) functions in our code. Configure finds out if those functions are available. If not, then we define macros to immulate those functions. Platforms tested: IRIX64-6.5 (modi4) and SP3 (seaborg.nersc.gov). On those platforms functions do not exist and we use macros. Bill will test on HPUX System V (SDSC machine) to check if this works when functions are defined. Preliminary testing showed that it worked.
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5FDmpiof.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/fortran/src/H5FDmpiof.c b/fortran/src/H5FDmpiof.c
index 9122fb4..369b800 100644
--- a/fortran/src/H5FDmpiof.c
+++ b/fortran/src/H5FDmpiof.c
@@ -1,5 +1,17 @@
#include "H5f90.h"
#include <mpi.h>
+#include "H5config_fortran.h"
+
+
+/* Support for C to Fortran translation in MPI */
+#ifndef HAVE_MPI_MULTI_LANG_Comm
+#define MPI_Comm_c2f(comm) (int_f)(comm)
+#define MPI_Comm_f2c(comm) (MPI_Comm)(comm)
+#endif /*MPI Comm*/
+#ifndef HAVE_MPI_MULTI_LANG_Info
+#define MPI_Info_c2f(info) (int_f)(info)
+#define MPI_Info_f2c(info) (MPI_Info)(info)
+#endif /*MPI Info*/
/*----------------------------------------------------------------------------
* Name: h5pset_fapl_mpio_c
@@ -21,8 +33,8 @@ nh5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
herr_t ret;
MPI_Comm c_comm;
MPI_Info c_info;
- c_comm = (MPI_Comm) *comm;
- c_info = (MPI_Info) *info;
+ c_comm = MPI_Comm_f2c(*comm);
+ c_info = MPI_Info_f2c(*info);
/*
* Call H5Pset_mpi function.
@@ -60,8 +72,8 @@ nh5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info)
c_prp_id = *prp_id;
ret = H5Pget_fapl_mpio(c_prp_id, &c_comm, &c_info);
if (ret < 0) return ret_value;
- *comm = (int_f) c_comm;
- *info = (int_f) c_info;
+ *comm = (int_f) MPI_Comm_c2f(c_comm);
+ *info = (int_f) MPI_Info_c2f(c_info);
ret_value = 0;
return ret_value;
}