This source file includes following definitions.
- ompi_file_open_f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23
24 #include "ompi/mpi/fortran/mpif-h/bindings.h"
25 #include "ompi/mpi/fortran/base/fortran_base_strings.h"
26 #include "ompi/file/file.h"
27
28 #if OMPI_BUILD_MPI_PROFILING
29 #if OPAL_HAVE_WEAK_SYMBOLS
30 #pragma weak PMPI_FILE_OPEN = ompi_file_open_f
31 #pragma weak pmpi_file_open = ompi_file_open_f
32 #pragma weak pmpi_file_open_ = ompi_file_open_f
33 #pragma weak pmpi_file_open__ = ompi_file_open_f
34
35 #pragma weak PMPI_File_open_f = ompi_file_open_f
36 #pragma weak PMPI_File_open_f08 = ompi_file_open_f
37 #else
38 OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_OPEN,
39 pmpi_file_open,
40 pmpi_file_open_,
41 pmpi_file_open__,
42 pompi_file_open_f,
43 (MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len),
44 (comm, filename, amode, info, fh, ierr, name_len) )
45 #endif
46 #endif
47
48 #if OPAL_HAVE_WEAK_SYMBOLS
49 #pragma weak MPI_FILE_OPEN = ompi_file_open_f
50 #pragma weak mpi_file_open = ompi_file_open_f
51 #pragma weak mpi_file_open_ = ompi_file_open_f
52 #pragma weak mpi_file_open__ = ompi_file_open_f
53
54 #pragma weak MPI_File_open_f = ompi_file_open_f
55 #pragma weak MPI_File_open_f08 = ompi_file_open_f
56 #else
57 #if ! OMPI_BUILD_MPI_PROFILING
58 OMPI_GENERATE_F77_BINDINGS (MPI_FILE_OPEN,
59 mpi_file_open,
60 mpi_file_open_,
61 mpi_file_open__,
62 ompi_file_open_f,
63 (MPI_Fint *comm, char *filename, MPI_Fint *amode, MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len),
64 (comm, filename, amode, info, fh, ierr, name_len) )
65 #else
66 #define ompi_file_open_f pompi_file_open_f
67 #endif
68 #endif
69
70
71 void ompi_file_open_f(MPI_Fint *comm, char *filename, MPI_Fint *amode,
72 MPI_Fint *info, MPI_Fint *fh, MPI_Fint *ierr, int name_len)
73 {
74 MPI_Comm c_comm = PMPI_Comm_f2c(*comm);
75 MPI_Info c_info = PMPI_Info_f2c(*info);
76 MPI_File c_fh;
77 char *c_filename;
78 int c_ierr, ret;
79
80
81 if (OMPI_SUCCESS != (ret = ompi_fortran_string_f2c(filename, name_len,
82 &c_filename))) {
83 c_ierr = OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, ret, "MPI_FILE_OPEN");
84 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
85 return;
86 }
87
88 c_ierr = PMPI_File_open(c_comm, c_filename,
89 OMPI_FINT_2_INT(*amode),
90 c_info, &c_fh);
91 if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
92
93 if (MPI_SUCCESS == c_ierr) {
94 *fh = PMPI_File_c2f(c_fh);
95 }
96
97 free(c_filename);
98 }