From 33c80ba72075b8fdf47eba3164e6a58bffcc7290 Mon Sep 17 00:00:00 2001 From: Pierre-Nicolas Clauss Date: Wed, 4 May 2011 15:44:12 +0200 Subject: [PATCH] Use a thread-specific cache variable (make sure to relink your app before using this). --- include/smpi/smpif.h.in | 2 +- src/smpi/smpi_bench.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; -- 2.20.1