1111//@HEADER
1212*/
1313
14+ /*
15+ Similar to bench1 but delays n-1 tasks by an equal ammount of time
16+ */
17+
1418#include " mpi.h"
1519#include < cstdio>
1620#include < partix.h>
1721#include < stdlib.h>
1822#include < unistd.h>
1923
20- #define DEFAULT_ITERS 5
24+ #define DEFAULT_ITERS 10
2125#define DATA_TYPE MPI_DOUBLE
2226#define USE_PARRIVED
2327
24- #define ALL_TASKS_SLEEP
28+ // #define ALL_TASKS_SLEEP_SAME_AMMOUNT
2529#define DEFAULT_RECV_SEND_PARTITION_RATIO 1
2630
2731double timer[3 ] = {0.0 , 0.0 , 0.0 };
@@ -64,15 +68,15 @@ void send_task(partix_task_args_t *args) {
6468 send_task_args_t *task_args = (send_task_args_t *)args->user_task_args ;
6569
6670// First partition completion is delayed by sleep_time_ms
67- # ifdef ALL_TASKS_SLEEP
68- size_t sleep_time_ms = global_conf-> overlap_duration ;
69- usleep ( sleep_time_ms * 1000 ) ;
71+ size_t sleep_time_ms = 0 ;
72+ # ifdef ALL_TASKS_SLEEP_SAME_AMMOUNT
73+ sleep_time_ms = global_conf-> overlap_duration ;
7074#else
7175 if (task_args->partition_id == 0 ) {
72- size_t sleep_time_ms = global_conf->overlap_duration ;
73- usleep (sleep_time_ms * 1000 );
76+ sleep_time_ms = global_conf->overlap_duration ;
7477 }
7578#endif
79+ usleep (sleep_time_ms * 1000 );
7680 MPI_Pready (task_args->partition_id , *task_args->request );
7781}
7882
@@ -202,6 +206,11 @@ int main(int argc, char *argv[]) {
202206 }
203207 }
204208
209+ // Measure perceived BW, that is communication as it were in the critical
210+ // path, by subtracting overlap
211+ timer[0 ] -= iterations * (float )global_conf->overlap_duration / 1000 ;
212+ timer[1 ] -= iterations * (float )global_conf->overlap_duration / 1000 ;
213+
205214 timer[0 ] /= iterations;
206215 timer[1 ] /= iterations;
207216
@@ -211,22 +220,22 @@ int main(int argc, char *argv[]) {
211220 if (myrank == 0 ) {
212221 double send_BW = total_size_bytes / timer[0 ] / 1024 / 1024 ;
213222#if true
214- printf (" %i, %i, %i, %.1f , %.2f, %.2f, %.2f, %.2f\n " ,
223+ printf (" %i, %i, %i, %.3f , %.2f, %.2f, %.2f, %.2f\n " ,
215224 conf.num_tasks ,
216225 conf.num_threads ,
217226 conf.num_partitions ,
218- (float )global_conf->overlap_duration ,
227+ (float )global_conf->overlap_duration / 1000.0 ,
219228 ((double )patition_size_bytes) / 1024 ,
220229 ((double )total_size_bytes) / 1024 , timer[0 ] /* rank0*/ , send_BW);
221230#endif
222231 } else {
223232#if false
224233 double recv_BW = total_size_bytes / timer[1 ] / 1024 / 1024 ;
225- printf (" %i, %i, %i, %.1f , %.2f, %.2f, %.2f, %.2f\n " ,
234+ printf (" %i, %i, %i, %.3f , %.2f, %.2f, %.2f, %.2f\n " ,
226235 conf.num_tasks ,
227236 conf.num_threads ,
228237 conf.num_partitions ,
229- (float )global_conf->overlap_duration ,
238+ (float )global_conf->overlap_duration / 1000.0 ,
230239 ((double )patition_size_bytes) / 1024 ,
231240 ((double )total_size_bytes) / 1024 ,
232241 timer[1 ] /* rank1*/ ,
0 commit comments