From: Pierre-Nicolas Clauss Date: Wed, 4 May 2011 13:44:12 +0000 (+0200) Subject: Use a thread-specific cache variable (make sure to relink your app before using this). X-Git-Tag: exp_20120216~195^2~51 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/33c80ba72075b8fdf47eba3164e6a58bffcc7290?ds=sidebyside Use a thread-specific cache variable (make sure to relink your app before using this). --- diff --git a/include/smpi/smpif.h.in b/include/smpi/smpif.h.in index 915d13e80e..bbcb661ac1 100644 --- a/include/smpi/smpif.h.in +++ b/include/smpi/smpif.h.in @@ -17,7 +17,7 @@ #include #include -XBT_PUBLIC(int) smpi_current_rank; +XBT_PUBLIC_DATA(__thread int) smpi_current_rank; XBT_PUBLIC(int) smpi_process_argc(void); XBT_PUBLIC(int) smpi_process_getarg(integer* index, char* dst, ftnlen len); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index 6dcff87004..2a38ef792e 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -14,7 +14,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi, xbt_dict_t allocs = NULL; /* Allocated on first use */ xbt_dict_t samples = NULL; /* Allocated on first use */ -int smpi_current_rank = 0; /* Updated after each MPI call */ +__thread int smpi_current_rank = 0; /* Updated after each MPI call */ typedef struct { int count;