intel / mpi-benchmarks

146 stars 63 forks source link

dodgy memsets #32

Closed loveshack closed 4 months ago

loveshack commented 3 years ago

GCC issues these warnings with the 2019.6 release which look valid:

helpers/helper_IMB_functions.h:594:40: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
             memset(time, 0, MAX_TIME_ID);
                                        ^
../src_c/IMB_mem_manager.c:707:9: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
         memset(time, 0, MAX_TIME_ID);
         ^~~~~~
VinnitskiV commented 3 years ago

@loveshack Thank you for your contribution! This issue will be fixed in one of next releases.

a-v-medvedev commented 2 years ago

ok it's December 2021, the issue is still there...

jeffhammond commented 1 year ago

It's 2023 and still there. Here's the fix.

diff --git a/src_cpp/helpers/helper_IMB_functions.h b/src_cpp/helpers/helper_IMB_functions.h
index d462b48..8c0672b 100644
--- a/src_cpp/helpers/helper_IMB_functions.h
+++ b/src_cpp/helpers/helper_IMB_functions.h
@@ -591,7 +591,7 @@ struct Bmark_descr {
             int acc_rep_test, t_sample;
             int selected_n_sample = ITERATIONS->n_sample;

-            memset(time, 0, MAX_TIME_ID);
+            memset(time, 0, MAX_TIME_ID*sizeof(double));
             if (iter == 0 || BMODE->type == Sync) {
                 ITERATIONS->n_sample_prev = ITERATIONS->msgspersample;
                 if (c_info->n_lens > 0) {
JuliaRS commented 8 months ago

@jeffhammond, @loveshack thank you for your contribution, I am going to add it to next release of IMB.

JuliaRS commented 4 months ago

For src_cpp/helpers/helper_IMB_functions.h it was fixed: https://github.com/intel/mpi-benchmarks/blob/master/src_cpp/helpers/helper_IMB_functions.h#L592

For src_c/IMB_mem_manager.c it will be fix in IMB 2021.8 version. I am going to close this issues