18 #define _XOPEN_SOURCE 700
31 #include "sion_fortran_ompi.h"
60 sion_int64 *chunksize,
61 sion_int32 *fsblksize,
69 char *fname_tmp,*fmode_tmp;
70 MPI_Comm cgComm,clComm;
72 fname_tmp = (
char *) malloc((
size_t) ((fname_len + 1) *
sizeof(
char)));
73 fmode_tmp = (
char *) malloc((
size_t) ((file_mode_len + 1) *
sizeof(
char)));
76 strncpy(fname_tmp, fname, fname_len);
77 strncpy(fmode_tmp, file_mode, file_mode_len);
79 fname_tmp[fname_len] =
'\0';
80 fmode_tmp[file_mode_len] =
'\0';
82 cgComm = MPI_Comm_f2c(*fgComm);
83 clComm = MPI_Comm_f2c(*flComm);
85 #ifdef SION_DEBUG_UNUSED
88 if (*globalrank == 0){
89 if (cgComm == MPI_COMM_WORLD) fprintf(stderr,
"COMM_WORLD selected\n");
90 fprintf(stderr,
"fsion_paropen_ompi_c: filename_len: %d\n", (
int) fname_len);
91 fprintf(stderr,
"fsion_paropen_ompi_c: filename: %s\n",fname_tmp);
93 fprintf(stderr,
"fsion_paropen_ompi_c: filemode_len: %d\n", (
int) file_mode_len);
94 fprintf(stderr,
"fsion_paropen_ompi_c: filemode: %s\n",fmode_tmp);
96 fprintf(stderr,
"fsion_paropen_ompi_c: chunksize: %lld\n",*chunksize);
97 fprintf(stderr,
"fsion_paropen_ompi_c: fsblksize: %d\n",*fsblksize);
98 fprintf(stderr,
"fsion_paropen_ompi_c: numFiles: %d\n",*numFiles);
104 (*sid) = sion_paropen_ompi(fname_tmp, fmode_tmp, numFiles, cgComm, &clComm, chunksize, fsblksize, globalrank, NULL, NULL);
106 *flComm = MPI_Comm_c2f(clComm);
144 sion_int64 *chunksize,
145 sion_int32 *fsblksize,
153 MPI_Comm cgComm, clComm;
156 char *fname_tmp, *fmode_tmp, *newfname_tmp;
159 fname_tmp = (
char *) malloc((
size_t) ((fname_len + 1) *
sizeof(
char)));
160 fmode_tmp = (
char *) malloc((
size_t) ((file_mode_len + 1) *
sizeof(
char)));
161 newfname_tmp = (
char *) malloc((
size_t) ((newfname_len + 1) *
sizeof(
char)));
164 strncpy(fname_tmp, fname, fname_len);
165 strncpy(fmode_tmp, file_mode, file_mode_len);
167 fname_tmp[fname_len] =
'\0';
168 fmode_tmp[file_mode_len] =
'\0';
169 newfname_tmp[newfname_len] =
'\0';
170 strncpy(newfname_tmp, newfname, newfname_len);
172 cgComm = MPI_Comm_f2c(*fgComm);
174 (*sid) = sion_paropen_ompi(fname_tmp, fmode_tmp, numFiles, cgComm, &clComm, chunksize, fsblksize, globalrank, NULL, &newfname_tmp);
176 *flComm = MPI_Comm_c2f(clComm);
177 strncpy(newfname, newfname_tmp, newfname_len);
198 (*ierr) = sion_parclose_ompi(*sid);
void fsion_paropen_multi_ompi_c(char *fname, char *file_mode, int *numFiles, MPI_Fint *fgComm, MPI_Fint *flComm, sion_int64 *chunksize, sion_int32 *fsblksize, int *globalrank, int *sid, char *newfname, int fname_len, int file_mode_len, int newfname_len)
Fortran procedure to open multiple sion files in parallel.
void fsion_paropen_ompi_c(char *fname, char *file_mode, int *numFiles, MPI_Fint *fgComm, MPI_Fint *flComm, sion_int64 *chunksize, sion_int32 *fsblksize, int *globalrank, char *newfname, int *sid, int fname_len, int file_mode_len, int newfname_len)
Fortran wrapper function that calls sion_paropen_mpi for 1 file.
void fsion_parclose_ompi_c(int *sid, int *ierr)
Fortran procedure to close a sion file opened in OpenMP/MPI in parallel.