@@ -134,7 +134,9 @@ int mca_common_ompio_file_write (ompio_file_t *fh,
134
134
& i ,
135
135
& j ,
136
136
& total_bytes_written ,
137
- & spc );
137
+ & spc ,
138
+ & fh -> f_io_array ,
139
+ & fh -> f_num_of_io_entries );
138
140
139
141
if (fh -> f_num_of_io_entries ) {
140
142
ret_code = fh -> f_fbtl -> fbtl_pwritev (fh );
@@ -283,7 +285,9 @@ int mca_common_ompio_file_iwrite (ompio_file_t *fh,
283
285
& i ,
284
286
& j ,
285
287
& total_bytes_written ,
286
- & spc );
288
+ & spc ,
289
+ & fh -> f_io_array ,
290
+ & fh -> f_num_of_io_entries );
287
291
288
292
if (fh -> f_num_of_io_entries ) {
289
293
fh -> f_fbtl -> fbtl_ipwritev (fh , (ompi_request_t * ) ompio_req );
@@ -411,7 +415,8 @@ int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp,
411
415
int mca_common_ompio_build_io_array ( ompio_file_t * fh , int index , int cycles ,
412
416
size_t bytes_per_cycle , int max_data , uint32_t iov_count ,
413
417
struct iovec * decoded_iov , int * ii , int * jj , size_t * tbw ,
414
- size_t * spc )
418
+ size_t * spc , mca_common_ompio_io_array_t * * io_array ,
419
+ int * num_io_entries )
415
420
{
416
421
ptrdiff_t disp ;
417
422
int block = 1 ;
@@ -424,7 +429,9 @@ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
424
429
int k = 0 ; /* index into the io_array */
425
430
int i = * ii ;
426
431
int j = * jj ;
427
-
432
+ mca_common_ompio_io_array_t * f_io_array = NULL ;
433
+ int f_num_io_entries = 0 ;
434
+
428
435
sum_previous_length = fh -> f_position_in_file_view ;
429
436
430
437
if ((index == cycles - 1 ) && (max_data % bytes_per_cycle )) {
@@ -434,9 +441,9 @@ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
434
441
bytes_to_write_in_cycle = bytes_per_cycle ;
435
442
}
436
443
437
- fh -> f_io_array = (mca_common_ompio_io_array_t * )malloc
444
+ f_io_array = (mca_common_ompio_io_array_t * )malloc
438
445
(OMPIO_IOVEC_INITIAL_SIZE * sizeof (mca_common_ompio_io_array_t ));
439
- if (NULL == fh -> f_io_array ) {
446
+ if (NULL == f_io_array ) {
440
447
opal_output (1 , "OUT OF MEMORY\n" );
441
448
return OMPI_ERR_OUT_OF_RESOURCE ;
442
449
}
@@ -445,10 +452,10 @@ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
445
452
/* reallocate if needed */
446
453
if (OMPIO_IOVEC_INITIAL_SIZE * block <= k ) {
447
454
block ++ ;
448
- fh -> f_io_array = (mca_common_ompio_io_array_t * )realloc
449
- (fh -> f_io_array , OMPIO_IOVEC_INITIAL_SIZE *
455
+ f_io_array = (mca_common_ompio_io_array_t * )realloc
456
+ (f_io_array , OMPIO_IOVEC_INITIAL_SIZE *
450
457
block * sizeof (mca_common_ompio_io_array_t ));
451
- if (NULL == fh -> f_io_array ) {
458
+ if (NULL == f_io_array ) {
452
459
opal_output (1 , "OUT OF MEMORY\n" );
453
460
return OMPI_ERR_OUT_OF_RESOURCE ;
454
461
}
@@ -462,15 +469,15 @@ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
462
469
463
470
disp = (ptrdiff_t )decoded_iov [i ].iov_base +
464
471
(total_bytes_written - sum_previous_counts );
465
- fh -> f_io_array [k ].memory_address = (IOVBASE_TYPE * )disp ;
472
+ f_io_array [k ].memory_address = (IOVBASE_TYPE * )disp ;
466
473
467
474
if (decoded_iov [i ].iov_len -
468
475
(total_bytes_written - sum_previous_counts ) >=
469
476
bytes_to_write_in_cycle ) {
470
- fh -> f_io_array [k ].length = bytes_to_write_in_cycle ;
477
+ f_io_array [k ].length = bytes_to_write_in_cycle ;
471
478
}
472
479
else {
473
- fh -> f_io_array [k ].length = decoded_iov [i ].iov_len -
480
+ f_io_array [k ].length = decoded_iov [i ].iov_len -
474
481
(total_bytes_written - sum_previous_counts );
475
482
}
476
483
@@ -492,36 +499,36 @@ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
492
499
493
500
disp = (ptrdiff_t )fh -> f_decoded_iov [j ].iov_base +
494
501
(fh -> f_total_bytes - sum_previous_length );
495
- fh -> f_io_array [k ].offset = (IOVBASE_TYPE * )(intptr_t )(disp + fh -> f_offset );
502
+ f_io_array [k ].offset = (IOVBASE_TYPE * )(intptr_t )(disp + fh -> f_offset );
496
503
497
504
if (! (fh -> f_flags & OMPIO_CONTIGUOUS_FVIEW )) {
498
505
if (fh -> f_decoded_iov [j ].iov_len -
499
506
(fh -> f_total_bytes - sum_previous_length )
500
- < fh -> f_io_array [k ].length ) {
501
- fh -> f_io_array [k ].length = fh -> f_decoded_iov [j ].iov_len -
507
+ < f_io_array [k ].length ) {
508
+ f_io_array [k ].length = fh -> f_decoded_iov [j ].iov_len -
502
509
(fh -> f_total_bytes - sum_previous_length );
503
510
}
504
511
}
505
512
506
- total_bytes_written += fh -> f_io_array [k ].length ;
507
- fh -> f_total_bytes += fh -> f_io_array [k ].length ;
508
- bytes_to_write_in_cycle -= fh -> f_io_array [k ].length ;
513
+ total_bytes_written += f_io_array [k ].length ;
514
+ fh -> f_total_bytes += f_io_array [k ].length ;
515
+ bytes_to_write_in_cycle -= f_io_array [k ].length ;
509
516
k = k + 1 ;
510
517
}
511
518
fh -> f_position_in_file_view = sum_previous_length ;
512
519
fh -> f_index_in_file_view = j ;
513
- fh -> f_num_of_io_entries = k ;
520
+ f_num_io_entries = k ;
514
521
515
522
#if 0
516
523
if (fh -> f_rank == 0 ) {
517
524
int d ;
518
- printf ("*************************** %d\n" , fh -> f_num_of_io_entries );
525
+ printf ("*************************** %d\n" , f_num_io_entries );
519
526
520
- for (d = 0 ; d < fh -> f_num_of_io_entries ; d ++ ) {
527
+ for (d = 0 ; d < f_num_of_entries ; d ++ ) {
521
528
printf (" ADDRESS: %p OFFSET: %p LENGTH: %d prev_count=%ld prev_length=%ld\n" ,
522
- fh -> f_io_array [d ].memory_address ,
523
- fh -> f_io_array [d ].offset ,
524
- fh -> f_io_array [d ].length ,
529
+ f_io_array [d ].memory_address ,
530
+ f_io_array [d ].offset ,
531
+ f_io_array [d ].length ,
525
532
sum_previous_counts , sum_previous_length );
526
533
}
527
534
}
@@ -530,7 +537,9 @@ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles,
530
537
* jj = j ;
531
538
* tbw = total_bytes_written ;
532
539
* spc = sum_previous_counts ;
533
-
540
+ * io_array = f_io_array ;
541
+ * num_io_entries = f_num_io_entries ;
542
+
534
543
return OMPI_SUCCESS ;
535
544
}
536
545
0 commit comments