SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
sion_generic_apidesc.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 ****************************************************************************/
9 
14 #define _XOPEN_SOURCE 700
15 
16 #include <stdlib.h>
17 #include <stdio.h>
18 #include <stdarg.h>
19 #include <string.h>
20 
21 #include "sion.h"
22 #include "sion_internal.h"
23 #include "sion_debug.h"
24 #include "sion_error_handler.h"
25 #include "sion_generic_apidesc.h"
26 
32  _sion_generic_apidesc *sion_apidesc;
33 
34  sion_apidesc = (_sion_generic_apidesc *) malloc(sizeof(_sion_generic_apidesc));
35  if (sion_apidesc == NULL) {
36  _sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"cannot allocate apidescriptor structure of size %lu (sion_apidesc), aborting ...\n", (unsigned long) sizeof(_sion_generic_apidesc));
37  return(NULL);
38  }
39 
40  return(sion_apidesc);
41 }
42 
50 {
51 
52  int rc = SION_SUCCESS;
53 
54  if (sion_apidesc == NULL) {
55  return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"_sion_generic_init_apidesc: cannot initalized, data structure is not allocated, aborting ...\n"));
56  }
57  sion_apidesc->aid = -1;
58  sion_apidesc->name = NULL;
59  sion_apidesc->level=SION_GENERIC_API_LEVEL_NONE;
60  sion_apidesc->create_lcg_cb = NULL;
61  sion_apidesc->free_lcg_cb = NULL;
62  sion_apidesc->barrier_cb = NULL;
63  sion_apidesc->bcastr_cb = NULL;
64  sion_apidesc->gatherr_cb = NULL;
65  sion_apidesc->gathervr_cb = NULL;
66  sion_apidesc->scatterr_cb = NULL;
67  sion_apidesc->scattervr_cb = NULL;
68  sion_apidesc->gather_execute_cb = NULL;
69  sion_apidesc->execute_scatter_cb = NULL;
70  sion_apidesc->get_multi_filename_cb = NULL;
71  sion_apidesc->get_capability_cb = NULL;
72  return(rc);
73 
74 }
75 
83 {
84 
85  int rc = SION_SUCCESS;
86 
87  if (sion_apidesc == NULL) {
88  return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"_sion_generic_free_apidesc: cannot free, data structure is not allocated, aborting ...\n"));
89  }
90 
91  if (sion_apidesc->name) free(sion_apidesc->name);
92 
93  free(sion_apidesc);
94 
95  return(rc);
96 
97 }
98 
99 
105  _sion_generic_gendata *sion_gendata;
106 
107  sion_gendata = (_sion_generic_gendata *) malloc(sizeof(_sion_generic_gendata));
108  if (sion_gendata == NULL) {
109  _sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"cannot allocate gendata structure of size %lu (sion_gendata), aborting ...\n", (unsigned long) sizeof(_sion_generic_gendata));
110  return(NULL);
111  }
112 
113  return(sion_gendata);
114 }
115 
123 {
124 
125  int rc = SION_SUCCESS;
126 
127  if (sion_gendata == NULL) {
128  return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"_sion_generic_init_gendata: cannot initalized, data structure is not allocated, aborting ...\n"));
129  }
130  sion_gendata->apidesc = NULL;
131  sion_gendata->aid = -1;
132  sion_gendata->comm_data_global = NULL;
133  sion_gendata->comm_data_local = NULL;
134 
135  return(rc);
136 
137 }
138 
146 {
147 
148  int rc = SION_SUCCESS;
149 
150  if (sion_gendata == NULL) {
151  return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"_sion_generic_free_gendata: cannot free, data structure is not allocated, aborting ...\n"));
152  }
153  free(sion_gendata);
154 
155  return(rc);
156 
157 }
158 
159 
167 {
168 
169  int rc = SION_SUCCESS;
170 
171  if (sion_apidesc == NULL) {
172  return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,"_sion_generic_update_api_level: cannot update data structure, it is not allocated, aborting ...\n"));
173  }
174 
175  if (
176  (sion_apidesc->create_lcg_cb) &&
177  (sion_apidesc->free_lcg_cb) &&
178  (sion_apidesc->barrier_cb) &&
179  (sion_apidesc->bcastr_cb) &&
180  (sion_apidesc->gatherr_cb) &&
181  (sion_apidesc->gathervr_cb) &&
182  (sion_apidesc->scatterr_cb) &&
183  (sion_apidesc->scattervr_cb)
184  ) {
185  sion_apidesc->level=SION_GENERIC_API_LEVEL_STD;
186 
187  if (
188  (sion_apidesc->gather_execute_cb) &&
189  (sion_apidesc->execute_scatter_cb) &&
190  (sion_apidesc->get_capability_cb)
191  ) {
192  sion_apidesc->level=SION_GENERIC_API_LEVEL_FULL;
193  }
194  }
195 
196  return(rc);
197 
198 }
int _sion_generic_free_apidesc(_sion_generic_apidesc *sion_apidesc)
free apidesc structure
int _sion_generic_free_gendata(_sion_generic_gendata *sion_gendata)
Free sion gendata description.
int _sion_generic_init_apidesc(_sion_generic_apidesc *sion_apidesc)
Initialize the sion api description.
int _sion_generic_update_api_level(_sion_generic_apidesc *sion_apidesc)
Update API level.
_sion_generic_gendata * _sion_generic_alloc_gendata(void)
Allocates memory for internal sion api data structure needed for each SION file.
int _sion_generic_init_gendata(_sion_generic_gendata *sion_gendata)
Initialize the sion file description.
_sion_generic_apidesc * _sion_generic_alloc_apidesc(void)
Allocates memory for internal sion api desc structure.