Skip to content

Commit f673333

Browse files
committed
IMB-MPI4: alltoall/v persistent benchmarks
1 parent 717a2b7 commit f673333

16 files changed

+403
-258
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,4 @@ clean:
8080
make -C src_cpp -f Makefile TARGET=MPI1 clean GPU_ENABLE=1
8181
rm -f IMB-MPI1 IMB-NBC IMB-RMA IMB-EXT IMB-IO IMB-MT IMB-P2P
8282
if [ -e IMB-MPI1-GPU ]; then rm -f IMB-MPI1-GPU; fi
83+
if [ -e IMB-MPI4 ]; then make -C src_cpp -f Makefile TARGET=MPI4 clean; rm -f IMB-MPI4; fi

src_c/IMB_alltoall.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,9 @@ void IMB_alltoall_persist(struct comm_info* c_info,
360360
double* time) {
361361
/*
362362
363-
364-
MPI-MPI4 benchmark kernel
363+
MPI4 benchmark kernel
365364
Benchmarks MPI_Alltoall_init
366365
367-
368-
369366
Input variables:
370367
371368
-c_info (type struct comm_info*)
@@ -381,13 +378,11 @@ Input variables:
381378
382379
-RUN_MODE (type MODES)
383380
384-
385381
Output variables:
386382
387383
-time (type double*)
388384
Timing result per sample
389385
390-
391386
*/
392387
int i = 0;
393388
Type_Size s_size,
@@ -433,6 +428,7 @@ Output variables:
433428
t_ovrlp -= MPI_Wtime();
434429
// Start the persistent request
435430
MPI_ERRHAND(MPI_Start(&request));
431+
436432
t_comp -= MPI_Wtime();
437433
IMB_cpu_exploit(t_pure, 0);
438434
t_comp += MPI_Wtime();
@@ -464,7 +460,7 @@ void IMB_alltoall_pure_persist(struct comm_info* c_info,
464460
/*
465461
466462
467-
MPI-MPI4 benchmark kernel
463+
MPI4 benchmark kernel
468464
Benchmarks MPI_Alltoall_init
469465
470466
Input variables:

src_c/IMB_alltoallv.c

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,4 +357,190 @@ Output variables:
357357
time[0] = t_pure;
358358
}
359359

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

src_c/IMB_barrier.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void IMB_barrier_persist(struct comm_info* c_info,
243243
t_ovrlp = (MPI_Wtime() - t_ovrlp) / ITERATIONS->n_sample;
244244
t_comp /= ITERATIONS->n_sample;
245245
}
246-
246+
247247
time[0] = t_pure;
248248
time[1] = t_ovrlp;
249249
time[2] = t_comp;

src_c/IMB_bcast.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ Output variables:
525525
c_info->info,
526526
&request));
527527
for(i = 0; i < ITERATIONS->n_sample; i++) {
528-
529528
t_pure -= MPI_Wtime();
530529
// Start the persistent request
531530
MPI_ERRHAND(MPI_Start(&request));

src_c/IMB_bnames_mpi4.h

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/****************************************************************************
2+
* *
3+
* CopyrGht (C) 2024 Intel Corporation *
4+
* *
5+
*****************************************************************************
6+
7+
RedistrBution and use in source and binary forms, with or without modification,
8+
are permitted provided that the following conditions are met:
9+
10+
1. RedistrButions of source code must retain the above copyrGht notice,
11+
this list of conditions and the following disclaimer.
12+
2. RedistrButions in binary form must reproduce the above copyrGht notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materAls provided with the distrBution.
15+
3. Neither the name of the copyrGht holder nor the names of its contrButors
16+
may be used to endorse or promote products derived from this software
17+
without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRGHT HOLDERS AND CONTRBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRGHT HOLDER OR CONTRBUTORS
23+
BE LABLE FOR ANY DRECT, INDRECT, INCIDENTAL, SPECAL, EXEMPLARY,
24+
OR CONSEQUENTAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
25+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LABILITY,
27+
WHETHER IN CONTRACT, STRICT LABILITY, OR TORT (INCLUDING NEGLGENCE
28+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29+
EVEN IF ADVISED OF THE POSSBILITY OF SUCH DAMAGE.
30+
31+
***************************************************************************
32+
33+
For more documentation than found here, see
34+
35+
[1] doc/ReadMe_IMB.txt
36+
37+
[2] Intel(R) MPI Benchmarks
38+
Users Guide and Methodology Description
39+
In
40+
doc/IMB_Users_Guide.pdf
41+
42+
***************************************************************************/
43+
44+
45+
46+
47+
#include "IMB_benchmark.h"
48+
49+
/* NAMES OF BENCHMARKS (DEFAULT CASE)*/
50+
char *DEFC[] = {
51+
"Bcast_persist",
52+
"Allgather_persist",
53+
"Allgatherv_persist",
54+
"Gather_persist",
55+
"Gatherv_persist",
56+
"Scatter_persist",
57+
"Scatterv_persist",
58+
"Alltoall_persist",
59+
"Alltoallv_persist",
60+
"Reduce_persist",
61+
"Reduce_scatter_persist",
62+
"Allreduce_persist",
63+
"Barrier_persist"
64+
};
65+
66+
/* NAMES OF BENCHMARKS (ALL CASE)*/
67+
char *ALLC[] = {
68+
"Bcast_persist",
69+
"Bcast_pure_persist",
70+
"Allgather_persist",
71+
"Allgather_pure_persist",
72+
"Allgatherv_persist",
73+
"Allgatherv_pure_persist",
74+
"Gather_persist",
75+
"Gather_pure_persist",
76+
"Gatherv_persist",
77+
"Gatherv_pure_persist",
78+
"Scatter_persist",
79+
"Scatter_pure_persist",
80+
"Scatterv_persist",
81+
"Scatterv_pure_persist",
82+
"Alltoall_persist",
83+
"Alltoall_pure_persist",
84+
"Alltoallv_persist",
85+
"Alltoallv_pure_persist",
86+
"Reduce_persist",
87+
"Reduce_pure_persist",
88+
"Reduce_scatter_persist",
89+
"Reduce_scatter_pure_persist",
90+
"Allreduce_persist",
91+
"Allreduce_pure_persist",
92+
"Barrier_persist",
93+
"Barrier_pure_persist"
94+
};
95+

src_c/IMB_g_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void IMB_general_info() {
100100
#elif defined RMA
101101
fprintf(unit, "# Intel(R) MPI Benchmarks %s, MPI-RMA part\n", VERSION);
102102
#elif defined MPI4
103-
fprintf(unit, "# Intel(R) MPI Benchmarks %s, MPI-MPI4 part\n", VERSION);
103+
fprintf(unit, "# Intel(R) MPI Benchmarks %s, MPI-4 part\n", VERSION);
104104
#endif
105105

106106

src_c/IMB_init_transfer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ In/out variables:
211211
MPI_ERRHAND(MPI_Win_fence(0, c_info->WIN));
212212
}
213213
}
214-
#elif defined RMA || defined MPI4
214+
#elif defined RMA
215215
int s_size, r_size;
216216

217217
if (Bmark->reduction) {

0 commit comments

Comments
 (0)