File tree Expand file tree Collapse file tree 2 files changed +25
-20
lines changed Expand file tree Collapse file tree 2 files changed +25
-20
lines changed Original file line number Diff line number Diff line change @@ -645,25 +645,10 @@ In/out variables:
645645 /* the displ is declared as int by MPI1 standard
646646 If c_info->num_procs*init_size exceed INT_MAX value there is no way to run this sample
647647 */
648- if (
649- #ifdef MPI1
650- !strcmp (Bmark -> name , "Alltoallv" ) ||
651- !strcmp (Bmark -> name , "Allgatherv" ) ||
652- !strcmp (Bmark -> name , "Scatterv" ) ||
653- !strcmp (Bmark -> name , "Gatherv" )
654- #elif defined NBC // MPI1
655- !strcmp (Bmark -> name , "Ialltoallv" ) || !strcmp (Bmark -> name , "Ialltoallv_pure" ) ||
656- !strcmp (Bmark -> name , "Iallgatherv" ) || !strcmp (Bmark -> name , "Iallgatherv_pure" ) ||
657- !strcmp (Bmark -> name , "Iscatterv" ) || !strcmp (Bmark -> name , "Iscatterv_pure" ) ||
658- !strcmp (Bmark -> name , "Igatherv" ) || !strcmp (Bmark -> name , "Igatherv_pure" )
659- #else // NBC // MPI1
660- 0
661- #endif // NBC // MPI1
662- ) {
663- if (s_len > INT_MAX || r_len > INT_MAX ) {
664- Bmark -> sample_failure = SAMPLE_FAILED_INT_OVERFLOW ;
665- return ;
666- }
648+
649+ if (s_len > INT_MAX || r_len > INT_MAX ) {
650+ Bmark -> sample_failure = SAMPLE_FAILED_INT_OVERFLOW ;
651+ return ;
667652 }
668653 /*===============================================*/
669654
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ goods and services.
5151#pragma once
5252
5353#include < algorithm>
54+ #include < climits>
5455
5556#ifdef MPIIO
5657static int do_nonblocking_;
@@ -484,7 +485,26 @@ struct Bmark_descr {
484485 if (!result) {
485486 throw std::logic_error (" wrong recv or send buffer requirement description on a benchmark" );
486487 }
487- // printf(">> s_len=%ld, r_len=%ld\n", s_len, r_len);
488+ if (flags.count (REDUCTION)) {
489+ int red_size_dt;
490+ MPI_Type_size (c_info->red_data_type , &red_size_dt);
491+
492+ if (s_len / red_size_dt > INT_MAX || r_len / red_size_dt > INT_MAX) {
493+ Bmark->sample_failure = SAMPLE_FAILED_INT_OVERFLOW;
494+ return ;
495+ }
496+ }
497+ else {
498+ int s_size_dt,
499+ r_size_dt;
500+ MPI_Type_size (c_info->s_data_type , &s_size_dt);
501+ MPI_Type_size (c_info->r_data_type , &r_size_dt);
502+
503+ if (s_len / s_size_dt > INT_MAX || r_len / r_size_dt > INT_MAX) {
504+ Bmark->sample_failure = SAMPLE_FAILED_INT_OVERFLOW;
505+ return ;
506+ }
507+ }
488508// ---------------------------------------------------------------------------------------------------
489509// --- STEP 3: set s_alloc and r_alloc AND all these ITERATIONS->s_offs,r_offs,...
490510// ---------------------------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments