Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Move definition of macro TOPAGE to private.hpp
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 16 Jun 2016 13:24:30 +0000 (15:24 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 17 Jun 2016 09:27:40 +0000 (11:27 +0200)
This was used in 2 files and should hence just go there.

src/smpi/private.hpp
src/smpi/smpi_bench.cpp
src/smpi/smpi_memory.cpp

index a384ac7..b05de0c 100644 (file)
@@ -9,6 +9,14 @@
 #include <unordered_map>
 #include "src/instr/instr_smpi.h"
 
+/**
+ * Get the address of the beginning of the memory page where addr is located.
+ * Note that we use an integer division here, so (a/b)*b is not a, unless a%b == 0
+ *
+ * This is used when privatizing.
+ */
+#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
+
 #ifdef HAVE_PAPI
 typedef 
     std::vector<std::pair</* counter name */std::string, /* counter value */long long>> papi_counter_t;
@@ -24,3 +32,4 @@ XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location(void);
 XBT_PUBLIC(smpi_trace_call_location_t*) smpi_trace_get_call_location();
 }
 #endif
+
index 2aa1b81..c69d32c 100644 (file)
@@ -606,7 +606,6 @@ void* smpi_shared_set_call(const char* func, const char* input, void* data) {
    return data;
 }
 
-#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
 
 /** Map a given SMPI privatization segment (make a SMPI process active) */
 void smpi_switch_data_segment(int dest){
index 0c29b39..a080aac 100644 (file)
 #include "../xbt/memory_map.hpp"
 
 #include "private.h"
+#include "private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI");
 
-#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
-
 #define PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC)
 #define PROT_RW (PROT_READ | PROT_WRITE )
 #define PROT_RX (PROT_READ | PROT_EXEC )