Skip to content

Commit 4225507

Browse files
committed
IMB-MPI4: add mpi4 benchmark; bcast,reduce persistent benchmarks
1 parent ea76d2b commit 4225507

16 files changed

+1807
-9
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ IMB-NBC:
4040
make -C src_cpp -f Makefile TARGET=NBC
4141
@cp src_cpp/IMB-NBC .
4242

43+
IMB-MPI4:
44+
make -C src_cpp -f Makefile TARGET=MPI4
45+
@cp src_cpp/IMB-MPI4 .
46+
4347
IMB-EXT:
4448
make -C src_cpp -f Makefile TARGET=EXT
4549
@cp src_cpp/IMB-EXT .

src_c/IMB_alltoall.c

Lines changed: 192 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,5 +349,196 @@ Output variables:
349349
time[0] = t_pure;
350350
}
351351

352-
#endif // NBC // MPI1
352+
#elif defined MPI4 // NBC
353+
354+
/*************************************************************************/
355+
356+
void IMB_alltoall_persist(struct comm_info* c_info,
357+
int size,
358+
struct iter_schedule* ITERATIONS,
359+
MODES RUN_MODE,
360+
double* time) {
361+
/*
362+
363+
364+
MPI-MPI4 benchmark kernel
365+
Benchmarks MPI_Alltoall_init
366+
367+
368+
369+
Input variables:
370+
371+
-c_info (type struct comm_info*)
372+
Collection of all base data for MPI;
373+
see [1] for more information
374+
375+
376+
-size (type int)
377+
Basic message size in bytes
378+
379+
-ITERATIONS (type struct iter_schedule *)
380+
Repetition scheduling
381+
382+
-RUN_MODE (type MODES)
383+
384+
385+
Output variables:
386+
387+
-time (type double*)
388+
Timing result per sample
389+
390+
391+
*/
392+
int i = 0;
393+
Type_Size s_size,
394+
r_size;
395+
int s_num = 0,
396+
r_num = 0;
397+
MPI_Request request;
398+
MPI_Status status;
399+
double t_pure = 0.,
400+
t_comp = 0.,
401+
t_ovrlp = 0.;
402+
403+
/* GET SIZE OF DATA TYPE */
404+
MPI_Type_size(c_info->s_data_type, &s_size);
405+
MPI_Type_size(c_info->r_data_type, &r_size);
406+
407+
if ((s_size != 0) && (r_size != 0))
408+
{
409+
s_num = size / s_size;
410+
r_num = size / r_size;
411+
}
412+
413+
if (c_info->rank != -1) {
414+
IMB_alltoall_pure_persist(c_info, size, ITERATIONS, RUN_MODE, &t_pure);
415+
416+
/* INITIALIZATION CALL */
417+
IMB_cpu_exploit(t_pure, 1);
418+
419+
IMB_do_n_barriers (c_info->communicator, N_BARR);
420+
421+
// Create a persistent collective operation
422+
MPI_ERRHAND(MPI_Alltoall_init((char*)c_info->s_buffer + i % ITERATIONS->s_cache_iter * ITERATIONS->s_offs,
423+
s_num,
424+
c_info->s_data_type,
425+
(char*)c_info->r_buffer + i % ITERATIONS->r_cache_iter * ITERATIONS->r_offs,
426+
r_num,
427+
c_info->r_data_type,
428+
c_info->communicator,
429+
c_info->info,
430+
&request));
431+
for(i = 0; i < ITERATIONS->n_sample; i++)
432+
{
433+
t_ovrlp -= MPI_Wtime();
434+
// Start the persistent request
435+
MPI_ERRHAND(MPI_Start(&request));
436+
t_comp -= MPI_Wtime();
437+
IMB_cpu_exploit(t_pure, 0);
438+
t_comp += MPI_Wtime();
439+
440+
MPI_Wait(&request, &status);
441+
t_ovrlp += MPI_Wtime();
442+
443+
IMB_do_n_barriers(c_info->communicator, c_info->sync);
444+
}
445+
// Clean up
446+
MPI_Request_free(&request);
447+
448+
t_ovrlp /= ITERATIONS->n_sample;
449+
t_comp /= ITERATIONS->n_sample;
450+
}
451+
452+
time[0] = t_pure;
453+
time[1] = t_ovrlp;
454+
time[2] = t_comp;
455+
}
456+
457+
/*************************************************************************/
458+
459+
void IMB_alltoall_pure_persist(struct comm_info* c_info,
460+
int size,
461+
struct iter_schedule* ITERATIONS,
462+
MODES RUN_MODE,
463+
double* time) {
464+
/*
465+
466+
467+
MPI-MPI4 benchmark kernel
468+
Benchmarks MPI_Alltoall_init
469+
470+
Input variables:
471+
472+
-c_info (type struct comm_info*)
473+
Collection of all base data for MPI;
474+
see [1] for more information
475+
476+
477+
-size (type int)
478+
Basic message size in bytes
479+
480+
-ITERATIONS (type struct iter_schedule *)
481+
Repetition scheduling
482+
483+
-RUN_MODE (type MODES)
484+
(only MPI-2 case: see [1])
485+
486+
487+
Output variables:
488+
489+
-time (type double*)
490+
Timing result per sample
491+
492+
493+
*/
494+
int i = 0;
495+
Type_Size s_size,
496+
r_size;
497+
int s_num = 0,
498+
r_num = 0;
499+
MPI_Request request;
500+
MPI_Status status;
501+
double t_pure = 0.;
502+
503+
/* GET SIZE OF DATA TYPE */
504+
MPI_Type_size(c_info->s_data_type, &s_size);
505+
MPI_Type_size(c_info->s_data_type, &r_size);
506+
507+
if ((s_size != 0) && (r_size != 0)) {
508+
s_num = size / s_size;
509+
r_num = size / r_size;
510+
}
511+
512+
if(c_info->rank != -1) {
513+
IMB_do_n_barriers(c_info->communicator, N_BARR);
514+
515+
// Create a persistent collective operation
516+
MPI_ERRHAND(MPI_Alltoall_init((char*)c_info->s_buffer + i % ITERATIONS->s_cache_iter * ITERATIONS->s_offs,
517+
s_num,
518+
c_info->s_data_type,
519+
(char*)c_info->r_buffer + i % ITERATIONS->r_cache_iter * ITERATIONS->r_offs,
520+
r_num,
521+
c_info->r_data_type,
522+
c_info->communicator,
523+
c_info->info,
524+
&request));
525+
for(i = 0; i < ITERATIONS->n_sample; i++) {
526+
t_pure -= MPI_Wtime();
527+
// Start the persistent request
528+
MPI_ERRHAND(MPI_Start(&request));
529+
MPI_Wait(&request, &status);
530+
t_pure += MPI_Wtime();
531+
532+
IMB_do_n_barriers(c_info->communicator, c_info->sync);
533+
}
534+
// Clean up
535+
MPI_Request_free(&request);
536+
537+
t_pure /= ITERATIONS->n_sample;
538+
}
539+
540+
time[0] = t_pure;
541+
}
542+
543+
#endif // NBC // MPI1 // MPI4
353544

0 commit comments

Comments
 (0)