14 #define _XOPEN_SOURCE 700
24 #include "sion_error_handler.h"
30 #define DFUNCTION "_sion_init_filedesc"
40 int rc = SION_SUCCESS;
42 if (sion_filedesc == NULL) {
43 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot initalized, data structure is not allocated, aborting ...\n"));
46 sion_filedesc->
fname = NULL;
47 sion_filedesc->
sid = -1;
48 sion_filedesc->
rank = -1;
49 sion_filedesc->
lrank = -1;
51 sion_filedesc->
ntasks = -1;
59 sion_filedesc->
fileversion = SION_FILEFORMAT_VERSION;
60 sion_filedesc->
filesionversion = 1000 * SION_MAIN_VERSION + SION_SUB_VERSION;
94 sion_filedesc->
debug = -1;
96 sion_filedesc->
nfiles = -1;
105 sion_filedesc->
ntasks = -1;
111 sion_filedesc->
prefix = NULL;
127 sion_filedesc->
cachefn[0]=
'\0';
133 sion_filedesc->
buffer = NULL;
163 #define DFUNCTION "_sion_alloc_filedesc"
173 if (sion_filedesc == NULL) {
174 _sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"cannot allocate filedescriptor structure of size %lu (sion_filedesc), aborting ...\n", (
unsigned long)
sizeof(sion_filedesc));
178 return(sion_filedesc);
183 #define DFUNCTION "_sion_realloc_filedesc_blocklist"
193 int rc = SION_SUCCESS;
196 sion_filedesc->
blocksizes = (sion_int64 *) malloc(maxchunks *
sizeof(sion_int64));
198 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_blocksizes), aborting ...\n",
199 (
unsigned long) maxchunks *
sizeof(sion_int64)));
201 for (i = 0; i < maxchunks; i++)
204 DPRINTFP((2, DFUNCTION, -1,
" alloc for %d chunks\n", maxchunks ));
207 if (sion_filedesc->
maxchunks <= maxchunks) {
208 sion_filedesc->
blocksizes = (sion_int64 *) realloc(sion_filedesc->
blocksizes, maxchunks *
sizeof(sion_int64));
209 for (i = sion_filedesc->
maxchunks; i < maxchunks; i++)
211 DPRINTFP((2, DFUNCTION, -1,
" realloc from %d to %d chunks\n", sion_filedesc->
maxchunks, maxchunks ));
215 fprintf(stderr,
"allocate temporary memory of size %zu (sion_blocksizes) not necessary (allocated size %zu) ...\n",
216 (
size_t) maxchunks *
sizeof(sion_int64), (
size_t) sion_filedesc->
maxchunks *
sizeof(sion_int64));
217 DPRINTFP((2, DFUNCTION, -1,
"allocate temporary memory of size %zu (sion_blocksizes) not necessary (allocated size %zu) ...\n",
218 (
size_t) maxchunks *
sizeof(sion_int64), (
size_t) sion_filedesc->
maxchunks *
sizeof(sion_int64) ));
226 #define DFUNCTION "_sion_alloc_filedesc_all_chunksizes"
227 int _sion_alloc_filedesc_all_chunksizes(
_sion_filedesc *sion_filedesc)
229 int i, rc = SION_SUCCESS;
232 if (sion_filedesc->
ntasks<0) {
233 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate internal arrays ntasks<0, aborting ...\n"));
236 DPRINTFP((2, DFUNCTION, -1,
"enter alloc arrays size=%d (%lu bytes)\n", sion_filedesc->
ntasks, (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
237 sion_filedesc->
all_chunksizes = p = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
239 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_chunksizes), aborting ...\n",
240 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
242 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
247 #define DFUNCTION "_sion_alloc_filedesc_all_startpointers"
248 int _sion_alloc_filedesc_all_startpointers(
_sion_filedesc *sion_filedesc)
250 int i, rc = SION_SUCCESS;
253 if (sion_filedesc->
ntasks<0) {
254 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate internal arrays ntasks<0, aborting ...\n"));
258 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_startpointers), aborting ...\n",
259 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
261 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
267 #define DFUNCTION "_sion_alloc_filedesc_all_globalranks"
268 int _sion_alloc_filedesc_all_globalranks(
_sion_filedesc *sion_filedesc)
270 int i, rc = SION_SUCCESS;
273 if (sion_filedesc->
ntasks<0) {
274 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate internal arrays ntasks<0, aborting ...\n"));
276 sion_filedesc->
all_globalranks = p = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
278 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_globalranks), aborting ...\n",
279 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
281 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
287 #define DFUNCTION "_sion_alloc_filedesc_all_localranks"
288 int _sion_alloc_filedesc_all_localranks(
_sion_filedesc *sion_filedesc)
290 int i, rc = SION_SUCCESS;
293 if (sion_filedesc->
ntasks<0) {
294 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate internal arrays ntasks<0, aborting ...\n"));
296 sion_filedesc->
all_localranks = p = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
298 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_localranks), aborting ...\n",
299 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
301 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
307 #define DFUNCTION "_sion_alloc_filedesc_all_keyvalptr"
308 int _sion_alloc_filedesc_all_keyvalptr(
_sion_filedesc *sion_filedesc)
310 int i, rc = SION_SUCCESS;
313 if (sion_filedesc->
ntasks<0) {
314 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate internal arrays ntasks<0, aborting ...\n"));
317 DPRINTFP((2, DFUNCTION, -1,
"enter alloc arrays size=%d (%lu bytes)\n", sion_filedesc->
ntasks, (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
318 sion_filedesc->
all_keyvalptr = p = (
void *) malloc(sion_filedesc->
ntasks *
sizeof(
void *));
320 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_keyvalptr), aborting ...\n",
321 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
323 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = NULL;
329 #define DFUNCTION "_sion_alloc_filedesc_arrays"
338 DPRINTFP((2, DFUNCTION, -1,
"enter alloc arrays size=%d (%lu bytes)\n", sion_filedesc->
ntasks, (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
340 _sion_alloc_filedesc_all_chunksizes(sion_filedesc);
341 _sion_alloc_filedesc_all_startpointers(sion_filedesc);
342 _sion_alloc_filedesc_all_globalranks(sion_filedesc);
344 DPRINTFP((2, DFUNCTION, -1,
"leave alloc arrays size=%d\n", sion_filedesc->
ntasks));
350 #define DFUNCTION "_sion_free_filedesc_all_chunksizes"
351 int _sion_free_filedesc_all_chunksizes(
_sion_filedesc *sion_filedesc)
353 DPRINTFP((2, DFUNCTION, -1,
"enter free arrays\n"));
358 DPRINTFP((2, DFUNCTION, -1,
"leave free arrays\n"));
363 #define DFUNCTION "_sion_free_filedesc_all_globalranks"
364 int _sion_free_filedesc_all_globalranks(
_sion_filedesc *sion_filedesc)
366 DPRINTFP((2, DFUNCTION, -1,
"enter free arrays\n"));
371 DPRINTFP((2, DFUNCTION, -1,
"leave free arrays\n"));
376 #define DFUNCTION "_sion_free_filedesc_all_startpointers"
377 int _sion_free_filedesc_all_startpointers(
_sion_filedesc *sion_filedesc)
379 DPRINTFP((2, DFUNCTION, -1,
"enter free arrays\n"));
384 DPRINTFP((2, DFUNCTION, -1,
"leave free arrays\n"));
389 #define DFUNCTION "_sion_free_filedesc_all_localranks"
390 int _sion_free_filedesc_all_localranks(
_sion_filedesc *sion_filedesc)
392 DPRINTFP((2, DFUNCTION, -1,
"enter free arrays\n"));
397 DPRINTFP((2, DFUNCTION, -1,
"leave free arrays\n"));
402 #define DFUNCTION "_sion_free_filedesc_all_keyvalptr"
403 int _sion_free_filedesc_all_keyvalptr(
_sion_filedesc *sion_filedesc)
406 DPRINTFP((2, DFUNCTION, -1,
"enter free arrays\n"));
408 for(tasknr=0;tasknr<sion_filedesc->
ntasks;tasknr++) {
410 DPRINTFP((2, DFUNCTION, -1,
"free now KEYVALPTR all_keyvalptr[%d] = %x\n",tasknr,sion_filedesc->
all_keyvalptr[tasknr]));
417 DPRINTFP((2, DFUNCTION, -1,
"leave free arrays\n"));
422 #define DFUNCTION "_sion_free_filedesc_arrays"
432 _sion_free_filedesc_all_chunksizes(sion_filedesc);
433 _sion_free_filedesc_all_globalranks(sion_filedesc);
434 _sion_free_filedesc_all_startpointers(sion_filedesc);
440 #define DFUNCTION "_sion_alloc_filedesc_coll_arrays"
452 if (sion_filedesc->
ntasks<0) {
453 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate internal arrays ntasks<0, aborting ...\n"));
456 DPRINTFP((2, DFUNCTION, -1,
"enter alloc arrays size=%d (%lu bytes)\n", sion_filedesc->
ntasks, (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int32)));
459 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_collsize), aborting ...\n",
460 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int32)));
462 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
464 DPRINTFP((2, DFUNCTION, -1,
"enter alloc arrays size=%d (%lu bytes)\n", sion_filedesc->
ntasks, (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int32)));
467 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_collector), aborting ...\n",
468 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int32)));
470 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
472 DPRINTFP((2, DFUNCTION, -1,
"enter alloc arrays size=%d (%lu bytes)\n", sion_filedesc->
ntasks, (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int32)));
475 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_all_capability), aborting ...\n",
476 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int32)));
478 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
481 DPRINTFP((2, DFUNCTION, -1,
"leave alloc arrays size=%d\n", sion_filedesc->
ntasks));
487 #define DFUNCTION "_sion_free_filedesc_coll_arrays"
497 DPRINTFP((2, DFUNCTION, -1,
"enter free arrays\n"));
510 DPRINTFP((2, DFUNCTION, -1,
"leave free arrays\n"));
515 #define DFUNCTION "_sion_alloc_filedesc_block_arrays"
527 DPRINTFP((2, DFUNCTION, -1,
"enter alloc locations size=%d, maxblocks=%d\n", sion_filedesc->
ntasks, sion_filedesc->
maxchunks));
528 sion_filedesc->
all_blockcount = p = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
530 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_blockcount), aborting ...\n",
531 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
533 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
535 sion_filedesc->
all_currentpos = p = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
537 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_currentpos), aborting ...\n",
538 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
540 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
544 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_currentblocknr), aborting ...\n",
545 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
547 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
551 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_blocksizes), aborting ...\n",
552 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
554 for (i = 0; i < sion_filedesc->
maxchunks * sion_filedesc->
ntasks; i++) p[i] = -1;
557 DPRINTFP((2, DFUNCTION, -1,
"leave alloc locations size=%d, maxblocks=%d\n", sion_filedesc->
ntasks, sion_filedesc->
maxchunks));
563 #define DFUNCTION "_sion_alloc_filedesc_block_arrays_only"
575 DPRINTFP((2, DFUNCTION, -1,
"enter alloc locations size=%d, maxblocks=%d\n", sion_filedesc->
ntasks, sion_filedesc->
maxchunks));
576 sion_filedesc->
all_blockcount = p = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
578 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_blockcount), aborting ...\n",
579 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
581 for (i = 0; i < sion_filedesc->
ntasks; i++) p[i] = -1;
585 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot allocate temporary memory of size %lu (sion_blocksizes), aborting ...\n",
586 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
588 for (i = 0; i < sion_filedesc->
maxchunks * sion_filedesc->
ntasks; i++) p[i] = -1;
590 DPRINTFP((2, DFUNCTION, -1,
"leave alloc locations size=%d, maxblocks=%d\n", sion_filedesc->
ntasks, sion_filedesc->
maxchunks));
595 #define DFUNCTION "_sion_free_filedesc"
599 int rc = SION_SUCCESS;
601 if (sion_filedesc == NULL) {
605 if (sion_filedesc->
fname)
606 free(sion_filedesc->
fname);
630 _sion_free_filedesc_all_keyvalptr(sion_filedesc);
633 if (sion_filedesc->
prefix)
634 free(sion_filedesc->
prefix);
642 if (sion_filedesc->
buffer)
643 free(sion_filedesc->
buffer);
651 #define DFUNCTION "_sion_print_filedesc"
659 int rc = SION_SUCCESS;
662 if (sion_filedesc == NULL) {
663 return(_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN, DFUNCTION
": cannot print, data structure is not allocated, aborting ...\n"));
666 DPRINTFP((level, desc, sion_filedesc->
rank,
"DUMP: sion_filedesc\n"));
667 DPRINTFP((level, desc, sion_filedesc->
rank,
"-------------------\n"));
669 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"fileptr", sion_filedesc->
fileptr));
673 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%s\n",
"fname", sion_filedesc->
fname));
674 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"sid", sion_filedesc->
sid));
675 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"rank", sion_filedesc->
rank));
676 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"globalrank", sion_filedesc->
globalrank));
677 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"ntasks", sion_filedesc->
ntasks));
682 else if(sion_filedesc->
state==
SION_FILESTATE_CLOSE) DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d (SION_FILESTATE_CLOSE)\n",
"state", sion_filedesc->
state));
686 else DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d (unknown)\n",
"state", sion_filedesc->
state));
687 if(sion_filedesc->
mode==
SION_FILEMODE_WRITE) DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d (SION_FILEMODE_WRITE)\n",
"mode", sion_filedesc->
mode));
688 else if(sion_filedesc->
mode==
SION_FILEMODE_READ) DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d (SION_FILEMODE_READ)\n",
"mode", sion_filedesc->
mode));
689 else DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d (unknown)\n",
"mode", sion_filedesc->
mode));
694 else DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d (unknown)\n",
"dup", sion_filedesc->
dup_mode));
695 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"endianness", sion_filedesc->
endianness));
696 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"swapbytes", sion_filedesc->
swapbytes));
697 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"fileversion", sion_filedesc->
fileversion));
698 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"filesionversion", sion_filedesc->
filesionversion));
699 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"filesionpatchlevel", sion_filedesc->
filesionpatchlevel));
700 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"fsblksize", sion_filedesc->
fsblksize));
701 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"lastchunknr", sion_filedesc->
lastchunknr));
702 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"maxchunks", sion_filedesc->
maxchunks));
703 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"maxusedchunks", sion_filedesc->
maxusedchunks));
705 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"currentpos", sion_filedesc->
currentpos));
706 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"currentblocknr", sion_filedesc->
currentblocknr));
708 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"startpos", sion_filedesc->
startpos));
709 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"chunksize", sion_filedesc->
chunksize));
710 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"chunksize_req", sion_filedesc->
chunksize_req));
711 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"globalskip", sion_filedesc->
globalskip));
712 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"end_of_header", sion_filedesc->
end_of_header));
713 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"start_of_varheader", sion_filedesc->
start_of_varheader));
714 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%lld\n",
"start_of_data", sion_filedesc->
start_of_data));
716 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"nfiles", sion_filedesc->
nfiles));
717 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"filenumber", sion_filedesc->
filenumber));
718 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=\"%s\"\n",
"prefix", sion_filedesc->
prefix));
719 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"fpbuffer", sion_filedesc->
fpbuffer));
720 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"fpbuffer_size", sion_filedesc->
fpbuffer_size));
721 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"buffer", sion_filedesc->
buffer));
722 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"buffer_size", sion_filedesc->
buffer_size));
723 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"buffer_ptr", sion_filedesc->
buffer_ptr));
725 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"compress", sion_filedesc->
compress));
727 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"usecache", sion_filedesc->
usecache));
728 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"cachesize", sion_filedesc->
cachesize));
730 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"usecoll", sion_filedesc->
usecoll));
731 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"collsize", sion_filedesc->
collsize));
732 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"collector", sion_filedesc->
collector));
733 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"colldebug", sion_filedesc->
colldebug));
734 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"collcmdused", sion_filedesc->
collcmdused));
735 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"collmergemode", sion_filedesc->
collmergemode));
736 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"collmsa", sion_filedesc->
collmsa));
741 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"fileptr_exported", sion_filedesc->
fileptr_exported));
743 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"usebuddy", sion_filedesc->
usebuddy));
744 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"buddylevel", sion_filedesc->
buddylevel));
745 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"buddynr", sion_filedesc->
buddynr));
746 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"buddies", sion_filedesc->
buddies));
748 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"usehints", sion_filedesc->
usehints));
749 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"hinttype", sion_filedesc->
hinttype));
752 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"lrank", sion_filedesc->
lrank));
753 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"nlocaltasksinfile", sion_filedesc->
nlocaltasksinfile));
754 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"ntotaltasksinfile", sion_filedesc->
ntotaltasksinfile));
755 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%d\n",
"filemanagedbytask", sion_filedesc->
filemanagedbytask));
758 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"dataptr", sion_filedesc->
dataptr));
763 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"keyvalptr", sion_filedesc->
keyvalptr));
764 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s=%x\n",
"all_keyvalptr", sion_filedesc->
all_keyvalptr));
773 if (maxprintblocks>20) maxprintblocks=20;
774 for (i = 0; i <= maxprintblocks; i++) {
775 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"blocksizes", i, sion_filedesc->
blocksizes[i]));
777 if(maxprintblocks<sion_filedesc->lastchunknr) {
778 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s[....]=...\n",
"blocksizes"));
784 for (i = 0; i < sion_filedesc->
nfiles; i++) {
785 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%s\n",
"file:", i, sion_filedesc->
multifiles[i]->
fname));
789 if (flag&_SION_DEBUG_PRINT_ALL) {
792 for (i = 0; i < sion_filedesc->
ntasks; i++) {
793 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_chunksizes", i, sion_filedesc->
all_chunksizes[i]));
798 for (i = 0; i < sion_filedesc->
ntasks; i++) {
799 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_globalranks", i, sion_filedesc->
all_globalranks[i]));
804 for (i = 0; i < sion_filedesc->
ntasks; i++) {
805 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_localranks", i, sion_filedesc->
all_localranks[i]));
810 for (i = 0; i < sion_filedesc->
ntasks; i++) {
811 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_startpointers", i, sion_filedesc->
all_startpointers[i]));
816 for (i = 0; i < sion_filedesc->
ntasks; i++) {
817 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_currentpos", i, sion_filedesc->
all_currentpos[i]));
822 for (i = 0; i < sion_filedesc->
ntasks; i++) {
823 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_currentblocknr", i, sion_filedesc->
all_currentblocknr[i]));
828 for (i = 0; i < sion_filedesc->
ntasks; i++) {
829 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d]=%lld\n",
"all_blockcount", i, sion_filedesc->
all_blockcount[i]));
834 for (i = 0; i < sion_filedesc->
ntasks; i++) {
837 if (maxprintblocks>20) maxprintblocks=20;
838 for (b = 0; b < maxprintblocks ; b++) {
839 DPRINTFP((2048, desc, sion_filedesc->
rank,
"D: %-20s[%4d][%d]=%lld\n",
"all_blocksizes", i, b,
842 if(maxprintblocks<sion_filedesc->all_blockcount[i]) {
843 DPRINTFP((level, desc, sion_filedesc->
rank,
"D: %-20s[%4d][..]=...\n",
"all_blocksizes", i));
850 if (flag&_SION_DEBUG_PRINT_RECURSIVE) {
851 for (i = 0; i < sion_filedesc->
nfiles; i++) {
852 DPRINTFP((level, desc, sion_filedesc->
rank,
"\n"));
853 DPRINTFP((level, desc, sion_filedesc->
rank,
"*** DUMP of multifile[%d] ***\n",i));
863 #define DFUNCTION "_sion_get_size_of_filedesc"
873 int bytes=0, fds=0, help_bytes, help_fds, i;
875 if(sion_filedesc==NULL)
return(bytes);
877 DPRINTFP((2, DFUNCTION, -1,
"start sid=%d nfiles=%d ntasks=%d maxchunks=%d mapping_size=%d\n", sion_filedesc->
sid,
881 DPRINTFP((512, DFUNCTION, -1,
" sizeof(sion_filedesc)= %5d\n", help_bytes));
886 DPRINTFP((512, DFUNCTION, -1,
" sizeof blocksizes= %5d\n", help_bytes));
892 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_chunksizes= %5d\n", help_bytes));
898 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_globalranks= %5d\n", help_bytes));
903 if(sion_filedesc->
fileptr!=NULL) {
910 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_localranks= %5d\n", help_bytes));
916 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_startpointers= %5d\n", help_bytes));
922 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_currentpos= %5d\n", help_bytes));
928 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_currentblocknr= %5d\n", help_bytes));
934 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_coll_collector= %5d\n", help_bytes));
940 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_coll_collsize= %5d\n", help_bytes));
946 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_blockcount= %5d\n", help_bytes));
952 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_blocksizes= %5d\n", help_bytes));
956 if( (sion_filedesc->
mapping!=NULL) ) {
958 DPRINTFP((512, DFUNCTION, -1,
" sizeof mapping= %5d\n", help_bytes));
962 if( (sion_filedesc->
prefix!=NULL) ) {
963 help_bytes=strlen(sion_filedesc->
prefix);
964 DPRINTFP((512, DFUNCTION, -1,
" sizeof prefix= %5d\n", help_bytes));
968 if( (sion_filedesc->
fpbuffer!=NULL) ) {
970 DPRINTFP((512, DFUNCTION, -1,
" sizeof fpbuffer= %5d\n", help_bytes));
974 if( (sion_filedesc->
buffer!=NULL) ) {
976 DPRINTFP((512, DFUNCTION, -1,
" sizeof buffer= %5d\n", help_bytes));
983 help_bytes=_sion_keyvalue_keymngr_key_get_sizeof(sion_filedesc->
keyvalptr);
984 DPRINTFP((512, DFUNCTION, -1,
" sizeof keyvalptr= %5d\n", help_bytes));
994 for (i = 0; i < sion_filedesc->
ntasks; i++) {
996 help_bytes=_sion_keyvalue_keymngr_key_get_sizeof(sion_filedesc->
all_keyvalptr[i]);
997 DPRINTFP((512, DFUNCTION, -1,
" sizeof all_keyvalptr[%d]= %5d\n", i, help_bytes));
1007 DPRINTFP((512, DFUNCTION, -1,
" sizeof multifiles= %5d\n", help_bytes));
1010 for (i = 0; i < sion_filedesc->
nfiles; i++) {
1013 DPRINTFP((512, DFUNCTION, -1,
" sizeof multifile[%d]= %5d + %1d\n", i, help_bytes, help_fds));
1019 *numbytes=bytes;*numfds=fds;
1020 DPRINTFP((2, DFUNCTION, -1,
"leave total_size =%5d + %d fds\n", bytes, fds));
1026 #define DFUNCTION "_sion_dup_filedesc"
1036 if (sion_filedesc == NULL) {
1037 _sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"cannot allocate filedescriptor structure (sion_filedesc), aborting ...\n");
1053 new_fd->
fname = strdup(sion_filedesc->
fname);
1054 new_fd->
rank = sion_filedesc->
rank;
1060 new_fd->
mode = sion_filedesc->
mode;
#define SION_KEYVAL_INLINE
#define SION_KEYVAL_UNKNOWN
char * _sion_get_fileptr_desc(_sion_fileptr *sion_fileptr)
int _sion_alloc_filedesc_block_arrays_only(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion structure, fields for all chunksizes of all tasks.
int _sion_init_filedesc(_sion_filedesc *sion_filedesc)
Initialize the sion file description.
int _sion_realloc_filedesc_blocklist(_sion_filedesc *sion_filedesc, sion_int32 maxchunks)
Increase the memory used by the internal sion structure for the blocklist.
int _sion_alloc_filedesc_coll_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion arrays.
int _sion_get_size_of_filedesc(_sion_filedesc *sion_filedesc, int *numbytes, int *numfds)
get size of internal data structure sion_filedesc
int _sion_alloc_filedesc_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion arrays.
int _sion_print_filedesc(_sion_filedesc *sion_filedesc, int level, char *desc, int flag)
Print the initialized sion file description.
_sion_filedesc * _sion_dup_filedesc(_sion_filedesc *sion_filedesc)
duplicates a filedesc data structure, not copying/reopen active file pointers
int _sion_free_filedesc_arrays(_sion_filedesc *sion_filedesc)
free memory for the internal sion arrays
_sion_filedesc * _sion_alloc_filedesc(void)
Allocates memory for internal sion structure.
int _sion_free_filedesc_coll_arrays(_sion_filedesc *sion_filedesc)
free memory for the internal sion arrays
int _sion_alloc_filedesc_block_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion structure, fields for all chunksizes of all tasks.
#define SION_DESCSTATE_ORIG
#define SION_FILESTATE_PAROPENMAPPED
#define SION_FILEMODE_WRITE
struct _sion_filedesc_struct _sion_filedesc
SION File Descriptor Alias.
#define SION_FILESTATE_PAROPENMAPPEDMANAGED
#define SION_DESCSTATE_DUP_SEL_RANK
#define SION_FILEMODE_READ
#define SION_CACHE_UNKNOWN
#define SION_FILESTATE_UNKNOWN
#define SION_DESCSTATE_DUP
#define SION_FILESTATE_SEROPENRANK
#define SION_CAPABILITY_NONE
#define SION_FILESTATE_PAROPEN
#define SION_CAPABILITY_ONLY_SENDER
#define SION_FILESTATE_SEROPENMASTER
#define SION_FILESTATE_CLOSE
#define SION_DESCSTATE_DUP_SEL_RANK_KEY
#define SION_FILESTATE_SEROPEN
#define SION_FILEMODE_UNKNOWN
#define SION_HINTS_TYPE_UNKNOWN
#define SION_CAPABILITY_FULL
#define SION_FILESTATE_PAROPENMAPPEDMASTER
Sion File Descriptor Structure.
sion_int64 * all_localranks
sion_int64 * all_blocksizes
char cachefn[SION_CACHE_FNLEN]
sion_int32 * all_coll_collsize
sion_int32 * all_coll_collector
sion_int32 filesionversion
sion_int32 nlocaltasksinfile
sion_int64 start_of_varheader
sion_int32 filesionpatchlevel
sion_int64 * all_chunksizes
sion_int64 * all_currentpos
sion_int32 filemanagedbytask
sion_int64 * all_currentblocknr
sion_int32 fileptr_exported
_sion_filedesc ** multifiles
sion_int64 * all_globalranks
sion_int32 ntotaltasksinfile
sion_int32 currentblocknr
sion_int32 * all_coll_capability
sion_int32 coll_capability
sion_int64 * all_startpointers
sion_int64 * all_blockcount