Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a thread-specific cache variable (make sure to relink your app before using this).
authorPierre-Nicolas Clauss <pini@tuxfamily.org>
Wed, 4 May 2011 13:44:12 +0000 (15:44 +0200)
committerPierre-Nicolas Clauss <pini@tuxfamily.org>
Wed, 4 May 2011 13:44:15 +0000 (15:44 +0200)
include/smpi/smpif.h.in
src/smpi/smpi_bench.c

index 915d13e..bbcb661 100644 (file)
@@ -17,7 +17,7 @@
 #include <smpi/smpi.h>
 #include <f2c.h>
 
 #include <smpi/smpi.h>
 #include <f2c.h>
 
-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);
 
 XBT_PUBLIC(int) smpi_process_argc(void);
 XBT_PUBLIC(int) smpi_process_getarg(integer* index, char* dst, ftnlen len);
index 6dcff87..2a38ef7 100644 (file)
@@ -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 */
 
 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;
 
 typedef struct {
   int count;