SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
sion_fortran_omp.c
Go to the documentation of this file.
1 /****************************************************************************
2 ** SIONLIB http://www.fz-juelich.de/jsc/sionlib **
3 *****************************************************************************
4 ** Copyright (c) 2008-2019 **
5 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
6 ** **
7 ** See the file COPYRIGHT in the package base directory for details **
8 ****************************************************************************/
18 #define _XOPEN_SOURCE 700
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 
24 #include "sion.h"
25 #include "sion_debug.h"
26 #include "sion_fd.h"
27 #include "sion_filedesc.h"
28 #include "sion_omp.h"
29 #include "sion_fortran_omp.h"
30 
49 void fsion_paropen_omp_c(char *fname,
50  char *file_mode,
51  sion_int64 *chunksize,
52  sion_int32 *fsblksize,
53  int *globalrank,
54  char *newfname,
55  int *sid,
56  int fname_len,
57  int file_mode_len,
58  int newfname_len)
59 {
60  char *fname_tmp,*fmode_tmp;
61 
62  fname_tmp = (char *) malloc((size_t) ((fname_len + 1) * sizeof(char)));
63  fmode_tmp = (char *) malloc((size_t) ((file_mode_len + 1) * sizeof(char)));
64 
65  /* Copy the strings to the new buffers and pad with nulls */
66  strncpy(fname_tmp, fname, fname_len);
67  strncpy(fmode_tmp, file_mode, file_mode_len);
68 
69  fname_tmp[fname_len] = '\0';
70  fmode_tmp[file_mode_len] = '\0';
71 
72 #ifdef SION_DEBUG_UNUSED
73  if (*globalrank == 0){
74  fprintf(stderr,"fsion_paropen_omp: filename_len: %d\n", (int) fname_len);
75  fprintf(stderr,"fsion_paropen_omp: filename: %s\n",fname_tmp);
76 
77  fprintf(stderr,"fsion_paropen_omp: filemode_len: %d\n", (int) file_mode_len);
78  fprintf(stderr,"fsion_paropen_omp: filemode: %s\n",fmode_tmp);
79 
80  fprintf(stderr,"fsion_paropen_omp: chunksize: %lld\n",*chunksize);
81  fprintf(stderr,"fsion_paropen_omp: fsblksize: %d\n",*fsblksize);
82  }
83 #endif
84 
85  (*sid) = sion_paropen_omp(fname_tmp, fmode_tmp, chunksize, fsblksize, globalrank, NULL, NULL);
86 
87 
88  /* Free the used memory */
89  free(fname_tmp);
90  free(fmode_tmp);
91 
92 }
93 
104 void fsion_parclose_omp_c(int *sid,
105  int *ierr)
106 {
107  (*ierr) = sion_parclose_omp(*sid);
108 }
109 
void fsion_paropen_omp_c(char *fname, char *file_mode, 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_omp.
void fsion_parclose_omp_c(int *sid, int *ierr)
Fortran procedure to close a sion file opened with OpenMP in parallel.