37 #include "sion_hints.h" 69 sion_int64 *chunksize,
70 sion_int32 *fsblksize,
86 sion_int64 lchunksize, lstartpointer, lglobalrank, new_fsblocksize, helpint64, apiflag;
87 sion_int64 *sion_tmpintfield = NULL;
95 DPRINTFP((2,
"_sion_paropen_generic_one_file", rank,
"enter parallel open of file %s in mode %d #tasks=%d\n", fname, (
int) flags_store->mask, ntasks));
96 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
"sizeof: int=%d long=%d longlong=%d sion_int32=%d sion_int64=%d\n",
sizeof(
int),
sizeof(
long),
97 sizeof(
long long),
sizeof(sion_int32),
sizeof(sion_int64)));
101 filenum = *filenumber;
104 if (sion_filedesc == NULL) {
105 _sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_ABORT,
"_sion_paropen_omp: cannot allocate filedescriptor structure of size %lu (sion_filedesc), aborting ...\n",
106 (
unsigned long)
sizeof(sion_filedesc));
109 sion_filedesc->
fname = strdup(fname);
112 sion_filedesc->
sid=sid;
121 if (flags_store->mask&_SION_FMODE_WRITE) {
124 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
" starting open for write #tasks=%d\n", ntasks));
128 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"sion_paropen: wrong number of tasks specific: ntasks=%d (<0), returning ...\n", (
int) ntasks));
133 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"sion_paropen: chunksize=%d < 0, returning ...\n", (
int) *chunksize));
138 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"sion_paropen: globalrank < 0, returning ...\n", (
int) *globalrank));
146 sion_filedesc->
rank = rank;
148 sion_filedesc->
ntasks = ntasks;
149 sion_filedesc->
nfiles = nfiles;
151 sion_filedesc->
prefix = strdup(prefix);
152 sion_filedesc->
compress = flags_store->mask&_SION_FMODE_COMPRESS;
153 sion_filedesc->
usecoll = (flags_store->mask&_SION_FMODE_COLLECTIVE)>0;
154 sion_filedesc->
collmergemode = (flags_store->mask&_SION_FMODE_COLLECTIVE_MERGE)>0;
161 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"sion_paropen_generic: cannot open %s for writing, aborting ...\n", fname));
166 if((new_fsblocksize<0) || (new_fsblocksize>SION_MAX_FSBLOCKSIZE)) new_fsblocksize=SION_DEFAULT_FSBLOCKSIZE;
170 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
175 sion_gendata->apidesc->bcastr_cb(&new_fsblocksize, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
176 *fsblksize=new_fsblocksize;
179 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
"setting fsblksize to %lld\n", new_fsblocksize));
188 _sion_keyval_check_env(sion_filedesc, flags_store->mask);
190 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
keyvalmode, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
194 if ((flags_entry = _sion_flags_get(flags_store,
"collsize"))) {
195 sion_filedesc->
collsize = atoi(flags_entry->val);
197 _sion_coll_check_env(sion_filedesc);
199 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
usecoll, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
200 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
collsize, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
201 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
collmergemode, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
205 if(sion_gendata->apidesc->level!=SION_GENERIC_API_LEVEL_FULL) {
206 _sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_WARN,
"sion_paropen_generic: requested coalescing I/O but API does not support this mode, falling back to individual mode ...\n");
213 _sion_hints_check_env(sion_filedesc);
215 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
usehints, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
216 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
hinttype, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
218 DPRINTFTS(rank,
"before alloc");
224 DPRINTFTS(rank,
"after alloc");
227 lchunksize = (sion_int64) *chunksize;
228 lglobalrank = (sion_int64) *globalrank;
230 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
"lchunksize=%lld lglobalrank=%lld\n", lchunksize,lglobalrank));
232 DPRINTFTS2(rank,
"before gather");
233 sion_gendata->apidesc->gatherr_cb(&lchunksize, sion_filedesc->
all_chunksizes, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
234 sion_gendata->apidesc->gatherr_cb(&lglobalrank, sion_filedesc->
all_globalranks, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
238 sion_filedesc->
coll_capability=sion_gendata->apidesc->get_capability_cb(sion_gendata->comm_data_global);
242 DPRINTFTS2(rank,
"after gather");
244 DPRINTFTS(rank,
"before calculate");
245 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
"chunksizes[%d - 1]=%ld\n", ntasks,(
long) sion_filedesc->
all_chunksizes[ntasks - 1]));
246 if (!sion_filedesc->
usecoll) _sion_calculate_startpointers(sion_filedesc);
248 if (!sion_filedesc->
collmergemode) _sion_calculate_startpointers_collective(sion_filedesc);
249 else _sion_calculate_startpointers_collective_merge(sion_filedesc);
251 DPRINTFTS(rank,
"after calculate");
255 DPRINTFTS(rank,
"before open");
258 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"sion_paropen_generic: cannot open %s for reading, aborting ...\n", fname));
260 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
261 DPRINTFTS(rank,
"after open");
264 sion_filedesc->
fileptr = sion_fileptr;
271 _sion_apply_hints(sion_filedesc,SION_HINTS_ACCESS_TYPE_METADATABLOCK1);
273 DPRINTFTS(rank,
"before writeh");
275 DPRINTFTS(rank,
"after writeh");
283 DPRINTFTS(rank,
"before setp(0)");
286 DPRINTFTS(rank,
"after setp(0)");
291 DPRINTFTS(rank,
"before scatter");
292 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_startpointers, &sion_filedesc->
startpos, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
293 DPRINTFTS(rank,
"after scatter");
296 DPRINTFTS(rank,
"before scatter");
297 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_chunksizes, &sion_filedesc->
chunksize, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
298 DPRINTFTS(rank,
"after scatter");
302 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_coll_collsize, &sion_filedesc->
collsize, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
303 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_coll_collector, &sion_filedesc->
collector, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
309 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
globalskip, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
311 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
" start position is %10lld %10.4f MB chunksize=%10lld %10.4f MB\n",
317 DPRINTFTS(rank,
"before setp");
318 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
325 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
328 _sion_apply_hints(sion_filedesc,SION_HINTS_ACCESS_TYPE_CHUNK);
330 DPRINTFTS(rank,
"after setp");
331 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
" ending open for write #tasks=%d filepos=%lld\n", ntasks,
_sion_file_get_position(sion_filedesc->
fileptr)));
334 else if (flags_store->mask&_SION_FMODE_READ) {
337 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
" starting open for read #tasks=%d\n", ntasks));
339 DPRINTFTS(rank,
"before openR");
341 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
342 DPRINTFTS(rank,
"after openR");
344 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"_sion_paropen_generic_one_file: cannot open %s for reading, aborting ...\n", fname));
348 sion_filedesc->
fileptr = sion_fileptr;
349 sion_filedesc->
rank = rank;
350 sion_filedesc->
ntasks = ntasks;
353 sion_filedesc->
nfiles = nfiles;
358 if (rc!=SION_SUCCESS) {
359 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"_sion_paropen_generic_one_file: cannot read header from file %s, aborting ...\n", fname));
361 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
362 " read, after read of fix header part endianness=0x%x blksize=%d ntasks=%d\n", sion_filedesc->
endianness, sion_filedesc->
fsblksize, sion_filedesc->
ntasks));
364 DPRINTFTS(rank,
"before alloc");
367 DPRINTFTS(rank,
"after alloc");
370 if (rc!=SION_SUCCESS) {
371 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"_sion_paropen_generic_one_file: cannot read header from file %s, aborting ...\n", fname));
374 if ((flags_entry = _sion_flags_get(flags_store,
"collsize"))) {
375 sion_filedesc->
collsize = atoi(flags_entry->val);
377 _sion_coll_check_env(sion_filedesc);
381 if (!sion_filedesc->
usecoll) _sion_calculate_startpointers(sion_filedesc);
383 if (!sion_filedesc->
collmergemode) _sion_calculate_startpointers_collective(sion_filedesc);
384 else _sion_calculate_startpointers_collective_merge(sion_filedesc);
386 DPRINTFTS(rank,
"after calculate");
389 _sion_keyval_check_env(sion_filedesc, flags_store->mask);
393 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
keyvalmode, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
396 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
usecoll, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
397 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
collsize, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
400 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_coll_collsize, &sion_filedesc->
collsize, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
401 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_coll_collector, &sion_filedesc->
collector, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
407 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
globalskip, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
410 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
endianness, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
411 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
swapbytes, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
412 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
fsblksize, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
413 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
ntasks, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
414 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
fileversion, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
415 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
nfiles, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
416 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
filenumber, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
417 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
flag1, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
418 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
flag2, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
419 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
maxusedchunks, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
421 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
424 DPRINTFTS(rank,
"after bcast");
427 DPRINTFTS(rank,
"before scatter");
428 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_chunksizes, &sion_filedesc->
chunksize, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
429 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_startpointers, &sion_filedesc->
startpos, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
430 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_globalranks, &helpint64, sion_gendata->comm_data_local, _SION_INT64, 1, 0);sion_filedesc->
globalrank=(sion_int32) helpint64;
431 DPRINTFTS(rank,
"after scatter");
435 sion_tmpintfield = (sion_int64 *) malloc(ntasks *
sizeof(sion_int64));
436 if (sion_tmpintfield == NULL) {
437 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"_sion_paropen_generic_one_file: cannot allocate temporary memory of size %lu (sion_tmpintfield), aborting ...\n",
438 (
unsigned long) ntasks *
sizeof(sion_int64)));
442 for (j = 0; j < ntasks; j++)
443 DPRINTFP((2048,
"_sion_paropen_generic_one_file", rank,
" read, blockcount on task %02d is %10ld\n", j, (
long) sion_tmpintfield[j]));
447 DPRINTFTS(rank,
"before scatter");
448 sion_gendata->apidesc->scatterr_cb(sion_tmpintfield, &helpint64, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
449 DPRINTFTS(rank,
"after scatter");
451 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
" lastchunknr on task %02d is %10ld\n", rank, (
long) sion_filedesc->
lastchunknr));
455 DPRINTFTS(rank,
"before scatter");
456 sion_gendata->apidesc->scatterr_cb(sion_tmpintfield, &helpint64, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
457 DPRINTFTS(rank,
"after scatter");
466 DPRINTFTS(rank,
"before setp");
467 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
479 if(sion_tmpintfield) free(sion_tmpintfield);
481 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
482 DPRINTFTS(rank,
"after setp");
485 return(
_sion_errorprint(SION_ID_NOT_VALID,_SION_ERROR_RETURN,
"sion_paropen_multi_mpi: unknown file mode"));
490 *fileptr=sion_filedesc->
fileptr->fileptr;
505 DPRINTFP((32,
"_sion_paropen_generic_one_file", rank,
" start position on task %02d is at end of sion_paropen_generic %10lld\n", rank,
508 DPRINTFP((2,
"_sion_paropen_generic_one_file", rank,
"leave parallel open of file %s in mode 0x%lx #tasks=%d\n", fname, (
long) flags_store->mask, ntasks));
536 int rc = SION_SUCCESS;
538 sion_int64 helpint64;
539 sion_int64 *sion_tmpintfield = NULL;
543 return(
_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"_sion_parclose_generic: invalid sion_filedesc, aborting %d ...\n", sid));
547 return(
_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"_sion_parclose_generic: sion file with sid=%d was not opened by a sion_paropen\n", sid));
550 DPRINTFP((2,
"_sion_parclose_generic", rank,
"enter parallel close sid=%d\n", sid));
557 DPRINTFP((32,
"_sion_parclose_generic", rank,
" parallel close (read mode) sid=%d, call fclose on file\n", sid));
579 DPRINTFP((32,
"_sion_parclose_generic", rank,
" parallel close (write mode) sid=%d, call fclose on file\n", sid));
586 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
588 DPRINTFP((32,
"_sion_parclose_generic", rank,
" parallel close sid=%d: lastchunknr=%d globalskip=%lld\n", sid, sion_filedesc->
lastchunknr,
590 for (blknum = 0; blknum <= sion_filedesc->
lastchunknr; blknum++) {
591 DPRINTFP((1024,
"_sion_parclose_generic", rank,
" parallel close sid=%d: local block %02d -> %10lld bytes\n", sid, blknum,
596 sion_tmpintfield = (sion_int64 *) malloc(sion_filedesc->
ntasks *
sizeof(sion_int64));
597 if (sion_tmpintfield == NULL) {
598 return(
_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"_sion_parclose_generic: cannot allocate temporary memory of size %lu (sion_tmpintfield), aborting ...\n",
599 (
unsigned long) sion_filedesc->
ntasks *
sizeof(sion_int64)));
604 DPRINTFTS2(rank,
"before gather");
606 sion_gendata->apidesc->gatherr_cb(&helpint64, sion_tmpintfield, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
610 for (blknum = 0; blknum < sion_filedesc->
ntasks; blknum++)
612 sion_filedesc->
maxusedchunks = (int) sion_tmpintfield[blknum];
614 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
maxusedchunks, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
615 DPRINTFTS2(rank,
"after gather");
629 for (blknum = 0; blknum < sion_filedesc->
maxusedchunks; blknum++) {
630 if (blknum <= sion_filedesc->lastchunknr) {
631 helpint64 = sion_filedesc->
blocksizes[blknum];
637 DPRINTFTS2(rank,
"before gather");
638 sion_gendata->apidesc->gatherr_cb(&helpint64, sion_tmpintfield, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
639 DPRINTFTS2(rank,
"after gather");
642 for (lrank = 0; lrank < ntasks; lrank++)
643 DPRINTFP((2048,
"_sion_parclose_generic", rank,
" parallel close sid=%d: write total chunksize for block %d: %2lld rank=%d\n", sid, blknum,
644 sion_tmpintfield[lrank], lrank));
658 DPRINTFP((32,
"_sion_parclose_generic", rank,
" parallel close (write mode) sid=%d, call fclose on file\n", sid));
664 if(sion_tmpintfield) free(sion_tmpintfield);
669 _sion_free_filedesc(sion_filedesc);
670 sion_filedesc = NULL;
673 DPRINTFP((2,
"_sion_parclose_generic", rank,
"leave parallel close sid=%d\n", sid));
684 sion_int64 chunksize,
690 int rc = SION_SUCCESS;
692 sion_int64 lchunksize, lstartpointer, lglobalrank;
695 return(
_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"_sion_parreinit_generic: invalid sion_filedesc, aborting %d ...\n", sid));
699 return(
_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"_sion_parreinit_generic: sion file with sid=%d was not opened by a sion_paropen\n", sid));
702 DPRINTFP((2,
"_sion_parreinit_generic", sion_filedesc->
rank,
"enter parallel reinit sid=%d\n", sid));
705 return(
_sion_errorprint(SION_NOT_SUCCESS,_SION_ERROR_RETURN,
"_sion_parreinit_generic: sion file with sid=%d only allowed for files openend for write\n", sid));
708 DPRINTFTS(sion_filedesc->
rank,
"before alloc");
709 if (sion_filedesc->
rank == 0) {
713 DPRINTFTS(sion_filedesc->
rank,
"after alloc");
716 lchunksize = (sion_int64) chunksize;
717 lglobalrank = (sion_int64) sion_filedesc->
globalrank;
719 DPRINTFTS2(sion_filedesc->
rank,
"before gather");
720 sion_gendata->apidesc->gatherr_cb(&lchunksize, sion_filedesc->
all_chunksizes, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
721 sion_gendata->apidesc->gatherr_cb(&lglobalrank, sion_filedesc->
all_globalranks, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
723 DPRINTFTS2(sion_filedesc->
rank,
"after gather");
727 if (sion_filedesc->
rank == 0) {
728 DPRINTFTS(sion_filedesc->
rank,
"before calculate");
729 if (!sion_filedesc->
usecoll) _sion_calculate_startpointers(sion_filedesc);
730 else _sion_calculate_startpointers_collective(sion_filedesc);
731 DPRINTFTS(sion_filedesc->
rank,
"after calculate");
735 if (sion_filedesc->
rank == 0) {
738 _sion_apply_hints(sion_filedesc,SION_HINTS_ACCESS_TYPE_METADATABLOCK1);
744 DPRINTFTS(sion_filedesc->
rank,
"before writeh");
746 DPRINTFTS(sion_filedesc->
rank,
"after writeh");
755 DPRINTFTS(sion_filedesc->
rank,
"before setp(0)");
758 DPRINTFTS(sion_filedesc->
rank,
"after setp(0)");
763 DPRINTFTS(sion_filedesc->
rank,
"before scatter");
764 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_startpointers, &sion_filedesc->
startpos, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
765 DPRINTFTS(sion_filedesc->
rank,
"after scatter");
769 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_coll_collsize, &sion_filedesc->
collsize, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
770 sion_gendata->apidesc->scatterr_cb(sion_filedesc->
all_coll_collector, &sion_filedesc->
collector, sion_gendata->comm_data_local, _SION_INT32, 1, 0);
776 sion_gendata->apidesc->bcastr_cb(&sion_filedesc->
globalskip, sion_gendata->comm_data_local, _SION_INT64, 1, 0);
778 DPRINTFP((32,
"_sion_parreinit_generic", sion_filedesc->
rank,
" start position is %10lld %10.4f MB\n",
782 DPRINTFTS(sion_filedesc->
rank,
"before setp");
783 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
787 sion_filedesc->
chunksize = (sion_int64) chunksize;
788 sion_gendata->apidesc->barrier_cb(sion_gendata->comm_data_local);
791 _sion_apply_hints(sion_filedesc,SION_HINTS_ACCESS_TYPE_CHUNK);
793 if (sion_filedesc->
rank == 0) {
798 DPRINTFTS(sion_filedesc->
rank,
"after setp");
799 DPRINTFP((32,
"_sion_parreinit_generic", sion_filedesc->
rank,
" ending open for write #tasks=%d filepos=%lld\n",
802 DPRINTFP((2,
"_sion_parreinit_generic", sion_filedesc->
rank,
"leave parallel reinit of file %s in #tasks=%d\n",
long _sion_file_get_opt_blksize(_sion_fileptr *sion_fileptr)
Get optional file system block size for a file.
sion_int64 _sion_file_get_position(_sion_fileptr *sion_fileptr)
Get new position in file.
int _sion_buffer_flush(_sion_filedesc *sion_filedesc)
Flush buffer.
int _sion_flush_block(_sion_filedesc *sion_filedesc)
Update the internal data structure.
sion_int64 _sion_file_set_position(_sion_fileptr *sion_fileptr, sion_int64 startpointer)
Set new position in file.
_sion_filedesc * _sion_alloc_filedesc()
Allocates memory for internal sion structure.
int _sion_reassignvcd(int sid, void *data, int type)
_sion_fileptr * _sion_file_open(const char *fname, unsigned int flags, unsigned int addflags)
Create and open a new file for writing.
Sion File Descriptor Structure.
#define SION_FILE_FLAG_WRITE
int _sion_file_purge(_sion_fileptr *sion_fileptr)
Purge data to file.
sion_int64 * all_globalranks
int _sion_alloc_filedesc_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion arrays.
int _sion_free_filedesc_arrays(_sion_filedesc *sion_filedesc)
free memory for the internal sion arrays
int _sion_parclose_generic(int sid, int rank, int ntasks, int mapping_size, sion_int32 *mapping, _sion_generic_gendata *sion_gendata)
Internal function to close parallel opened SION file.
#define SION_FILE_FLAG_READ
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_vcdtype(int sid)
sion_int32 * all_coll_collector
sion_int32 fileptr_exported
sion_int32 _sion_get_endianness_with_flags(sion_int64 flags)
Return endianness including possible choice via flags.
#define SION_FILE_FLAG_POSIX
int _sion_parreinit_generic(int sid, sion_int64 chunksize, int rank, int ntasks, _sion_generic_gendata *sion_gendata)
change chunksize for an already opened SION file (write)
sion_int32 * all_coll_capability
void * _sion_vcdtovcon(int sid)
#define SION_FILE_FLAG_ANSI
#define SION_FILE_FLAG_CREATE
#define SION_FILEMODE_READ
sion_int64 * all_startpointers
int _sion_file_close(_sion_fileptr *sion_fileptr)
Close file and destroys fileptr structure.
int _sion_errorprint(int rc, int level, const char *format,...)
Internal SION error.
#define SION_FILESTATE_PAROPEN
int _sion_free_filedesc_coll_arrays(_sion_filedesc *sion_filedesc)
free memory for the internal sion arrays
int _sion_buffer_check_env(_sion_filedesc *sion_filedesc)
Checks if environment variables are set to use buffer.
sion_int32 coll_capability
sion_int32 currentblocknr
int _sion_cache_check_env(_sion_filedesc *sion_filedesc)
Check if environment variables are set to use cache.
#define SION_FILEDESCRIPTOR
sion_int64 * all_chunksizes
int _sion_print_filedesc(_sion_filedesc *sion_filedesc, int level, char *desc, int flag)
Print the initialized sion file description.
#define SION_FILESTATE_CLOSE
int _sion_alloc_filedesc_coll_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion arrays.
int _sion_init_filedesc(_sion_filedesc *sion_filedesc)
Initialize the sion file description.
#define SION_FILEMODE_WRITE
sion_int32 * all_coll_collsize
sion_int64 start_of_varheader
int _sion_file_flush(_sion_fileptr *sion_fileptr)
Flush data to file.
int _sion_paropen_generic_one_file(int sid, char *fname, _sion_flags_store *flags_store, char *prefix, int *numFiles, int *filenumber, sion_int64 *chunksize, sion_int32 *fsblksize, int rank, int ntasks, int *globalrank, int flag, FILE **fileptr, _sion_generic_gendata *sion_gendata)
Generic parallel open of one direct access file.