Skip to content

Commit 717a2b7

Browse files
committed
IMB-MPI4: gather/v,allgather/v,barrier persist collective operations
1 parent 4225507 commit 717a2b7

File tree

15 files changed

+1026
-14
lines changed

15 files changed

+1026
-14
lines changed

src_c/IMB_allgather.c

Lines changed: 179 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,182 @@ Output variables:
338338
time[0] = t_pure;
339339
}
340340

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

src_c/IMB_allgatherv.c

Lines changed: 191 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,194 @@ Output variables:
361361
time[0] = t_pure;
362362
}
363363

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

0 commit comments

Comments
 (0)