Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 6 Nov 2015 19:57:08 +0000 (20:57 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 6 Nov 2015 19:57:08 +0000 (20:57 +0100)
22 files changed:
.gitignore
CMakeLists.txt
ChangeLog
doc/doxygen/options.doc
src/mc/Process.cpp
src/mc/Process.hpp
src/mc/mc_checkpoint.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_dwarf.hpp
src/mc/mc_global.cpp
src/mc/mc_object_info.h
src/mc/mc_private.h
src/simgrid/sg_config.c
src/smpi/smpi_base.c
src/smpi/smpi_bench.c
src/smpi/smpi_global.c
src/smpi/smpi_memory.cpp [new file with mode: 0644]
src/xbt/log.c
src/xbt/memory_map.cpp [moved from src/mc/memory_map.cpp with 91% similarity]
src/xbt/memory_map.hpp [moved from src/mc/mc_memory_map.h with 78% similarity]
teshsuite/smpi/mpich3-test/runtests
tools/cmake/DefinePackages.cmake

index 47d4275..4eb43f0 100644 (file)
@@ -723,6 +723,7 @@ teshsuite/smpi/mpich3-test/f77/rma/winaccf
 teshsuite/smpi/mpich3-test/f77/rma/winfencef
 teshsuite/smpi/mpich3-test/f77/rma/wingetf
 teshsuite/smpi/mpich3-test/f77/rma/winnamef
+teshsuite/smpi/mpich3-test/f77/rma/winscale1f
 teshsuite/smpi/mpich3-test/f77/topo/cartcrf
 teshsuite/smpi/mpich3-test/f90/coll/allredint8f90
 teshsuite/smpi/mpich3-test/f90/coll/allredopttf90
@@ -764,6 +765,7 @@ teshsuite/smpi/mpich3-test/f90/rma/winaccf90
 teshsuite/smpi/mpich3-test/f90/rma/winfencef90
 teshsuite/smpi/mpich3-test/f90/rma/wingetf90
 teshsuite/smpi/mpich3-test/f90/rma/winnamef90
+teshsuite/smpi/mpich3-test/f90/rma/winscale1f90
 teshsuite/smpi/mpich3-test/group/groupcreate
 teshsuite/smpi/mpich3-test/group/groupnullincl
 teshsuite/smpi/mpich3-test/group/grouptest
@@ -832,20 +834,27 @@ teshsuite/smpi/mpich3-test/pt2pt/waittestnull
 teshsuite/smpi/mpich3-test/rma/accfence1
 teshsuite/smpi/mpich3-test/rma/accfence2
 teshsuite/smpi/mpich3-test/rma/accfence2_am
+teshsuite/smpi/mpich3-test/rma/accpscw1
 teshsuite/smpi/mpich3-test/rma/allocmem
 teshsuite/smpi/mpich3-test/rma/epochtest
 teshsuite/smpi/mpich3-test/rma/getfence1
 teshsuite/smpi/mpich3-test/rma/getgroup
 teshsuite/smpi/mpich3-test/rma/manyrma3
+teshsuite/smpi/mpich3-test/rma/nullpscw
 teshsuite/smpi/mpich3-test/rma/putfence1
 teshsuite/smpi/mpich3-test/rma/putfidx
+teshsuite/smpi/mpich3-test/rma/putpscw1
 teshsuite/smpi/mpich3-test/rma/test1
 teshsuite/smpi/mpich3-test/rma/test1_am
 teshsuite/smpi/mpich3-test/rma/test1_dt
+teshsuite/smpi/mpich3-test/rma/test2
+teshsuite/smpi/mpich3-test/rma/test2_am
+teshsuite/smpi/mpich3-test/rma/test3
 teshsuite/smpi/mpich3-test/rma/test5
 teshsuite/smpi/mpich3-test/rma/test5_am
 teshsuite/smpi/mpich3-test/rma/transpose1
 teshsuite/smpi/mpich3-test/rma/transpose2
+teshsuite/smpi/mpich3-test/rma/transpose3
 teshsuite/smpi/mpich3-test/rma/transpose6
 teshsuite/smpi/mpich3-test/rma/transpose7
 teshsuite/smpi/mpich3-test/rma/window_creation
index 3904250..c5a2b3c 100644 (file)
@@ -423,14 +423,12 @@ endif()
 
 if(enable_smpi)
   include(FindGFortran)
-  #really checks for objdump for privatization
-  find_package(BinUtils QUIET)
-  mark_as_advanced(BinUtils_DIR)
   SET(HAVE_SMPI 1)
-
-  if( NOT "${CMAKE_OBJDUMP}" MATCHES "CMAKE_OBJDUMP-NOTFOUND" AND HAVE_MMAP)
+  if("${CMAKE_SYSTEM}" MATCHES "Linux")
+    SET(USE_LIBUTIL 0)
     SET(HAVE_PRIVATIZATION 1)
-  else()
+  elseif("${CMAKE_SYSTEM}" MATCHES "^FreeBSD")
+    SET(USE_LIBUTIL 0)
     SET(HAVE_PRIVATIZATION 0)
   endif()
 endif()
index e5d4efc..136a2c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 SimGrid (3.13) UNRELEASED; urgency=low
 
+ SMPI
+ * BC breaks:
+   - The option smpi/async_small_thres was renamed to smpi/async_small_thresh
+     as we attempt to unify our naming schemes -> smpi/send_is_detached_thresh
+     
+
  XBT
  * Kill the setset datacontainer: it's unused since a while.
 
index 9f675d7..3bc5f7b 100644 (file)
@@ -294,7 +294,7 @@ to wait 10 microseconds (1e-5 seconds) between emissions.
 It is possible to specify that messages below a certain size will be sent
 as soon as the call to MPI_Send is issued, without waiting for the
 correspondant receive. This threshold can be configured through the
-\b smpi/async_small_thres item. The default value is 0. This behavior can also be
+\b smpi/async_small_thresh item. The default value is 0. This behavior can also be
 manually set for MSG mailboxes, by setting the receiving mode of the mailbox
 with a call to \ref MSG_mailbox_set_async . For MSG, all messages sent to this
 mailbox will have this behavior, so consider using two mailboxes if needed.
@@ -1108,7 +1108,7 @@ silently overflow on other parts of the memory.
 - \c surf/precision: \ref options_model_precision
 
 - \c <b>For collective operations of SMPI, please refer to Section \ref options_index_smpi_coll</b>
-- \c smpi/async_small_thres: \ref options_model_network_asyncsend
+- \c smpi/async_small_thresh: \ref options_model_network_asyncsend
 - \c smpi/bw_factor: \ref options_model_smpi_bw_factor
 - \c smpi/coll_selector: \ref options_model_smpi_collectives
 - \c smpi/cpu_threshold: \ref options_smpi_bench
index ea58d75..b001926 100644 (file)
@@ -214,7 +214,7 @@ Process::Process(pid_t pid, int sockfd) : AddressSpace(this)
   process->pid_ = pid;
   process->running_ = true;
   process->status_ = 0;
-  process->memory_map_ = get_memory_map(pid);
+  process->memory_map_ = simgrid::xbt::get_memory_map(pid);
   process->cache_flags = MC_PROCESS_CACHE_FLAG_NONE;
   process->init_memory_map_info();
   process->clear_refs_fd_ = -1;
@@ -329,14 +329,14 @@ void Process::init_memory_map_info()
   if(regcomp(&res.so_re, SO_RE, 0) || regcomp(&res.version_re, VERSION_RE, 0))
     xbt_die(".so regexp did not compile");
 
-  std::vector<simgrid::mc::VmMap> const& maps = this->memory_map_;
+  std::vector<simgrid::xbt::VmMap> const& maps = this->memory_map_;
 
   const char* current_name = NULL;
 
   this->object_infos.resize(0);
 
   for (size_t i=0; i < maps.size(); i++) {
-    simgrid::mc::VmMap const& reg = maps[i];
+    simgrid::xbt::VmMap const& reg = maps[i];
     const char* pathname = maps[i].pathname.c_str();
 
     // Nothing to do
index 223711a..6cc3cfd 100644 (file)
 #include "src/simix/popping_private.h"
 #include "src/simix/smx_private.h"
 
+#include "../xbt/memory_map.hpp"
+
 #include "mc_forward.hpp"
 #include "mc_base.h"
 #include "mc_mmalloc.h" // std_heap
-#include "mc_memory_map.h"
 #include "AddressSpace.hpp"
 #include "mc_protocol.h"
 
@@ -163,7 +164,7 @@ private:
   int socket_;
   int status_;
   bool running_;
-  std::vector<VmMap> memory_map_;
+  std::vector<simgrid::xbt::VmMap> memory_map_;
   remote_ptr<void> maestro_stack_start_, maestro_stack_end_;
   int memory_file;
   std::vector<IgnoredRegion> ignored_regions_;
index 01c5183..f458f72 100644 (file)
@@ -11,7 +11,6 @@
 #include <dirent.h>
 
 #include "src/internal_config.h"
-#include "mc_memory_map.h"
 #include "mc_private.h"
 #include "xbt/module.h"
 #include <xbt/mmalloc.h>
@@ -197,13 +196,13 @@ static void MC_get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t s
  *  `dl_iterate_phdr` would be more robust but would not work in cross-process.
  * */
 void MC_find_object_address(
-  std::vector<simgrid::mc::VmMap> const& maps,
+  std::vector<simgrid::xbt::VmMap> const& maps,
   simgrid::mc::ObjectInformation* result)
 {
   char* file_name = xbt_strdup(result->file_name.c_str());
   const char *name = basename(file_name);
   for (size_t i = 0; i < maps.size(); ++i) {
-    simgrid::mc::VmMap const& reg = maps[i];
+    simgrid::xbt::VmMap const& reg = maps[i];
     if (maps[i].pathname.empty()
         || strcmp(basename(maps[i].pathname.c_str()), name)) {
       // Nothing to do
@@ -214,7 +213,7 @@ void MC_find_object_address(
       result->start_rw = (char*) reg.start_addr;
       result->end_rw = (char*) reg.end_addr;
       // .bss is usually after the .data:
-      simgrid::mc::VmMap const& next = maps[i + 1];
+      simgrid::xbt::VmMap const& next = maps[i + 1];
       if (next.pathname.empty() && (next.prot & PROT_WRITE)
           && next.start_addr == reg.end_addr) {
         result->end_rw = (char*) maps[i + 1].end_addr;
index efce4fd..c744d0a 100644 (file)
@@ -1149,7 +1149,7 @@ static void MC_post_process_types(simgrid::mc::ObjectInformation* info)
 
 /** \brief Finds informations about a given shared object/executable */
 std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
-  std::vector<simgrid::mc::VmMap> const& maps, const char *name)
+  std::vector<simgrid::xbt::VmMap> const& maps, const char *name)
 {
   std::shared_ptr<simgrid::mc::ObjectInformation> result =
     std::make_shared<simgrid::mc::ObjectInformation>();
index 4ddeaa7..85c7641 100644 (file)
@@ -17,7 +17,6 @@
 #include <dwarf.h>
 
 #include "src/mc/Variable.hpp"
-#include "src/mc/mc_memory_map.h"
 
 namespace simgrid {
 namespace dwarf {
index 7ead3c5..3fe3677 100644 (file)
@@ -36,7 +36,6 @@
 #include "mc_comm_pattern.h"
 #include "mc_request.h"
 #include "mc_safety.h"
-#include "mc_memory_map.h"
 #include "mc_snapshot.h"
 #include "mc_liveness.h"
 #include "mc_private.h"
index d8df6b2..840d3e1 100644 (file)
 #include <xbt/base.h>
 
 #include "mc_forward.hpp"
-#include "mc_memory_map.h"
+#include "../xbt/memory_map.hpp"
 
 XBT_PRIVATE std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
-  std::vector<simgrid::mc::VmMap> const& maps, const char* name);
+  std::vector<simgrid::xbt::VmMap> const& maps, const char* name);
 XBT_PRIVATE  void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info);
 
 #endif
index bbd2a64..b21b6a5 100644 (file)
 #include "xbt/fifo.h"
 #include "xbt/config.h"
 
+#ifdef __cplusplus
+#include "../xbt/memory_map.hpp"
+#endif
+
 #include "xbt/function_types.h"
 #include "xbt/mmalloc.h"
 #include "../simix/smx_private.h"
@@ -118,6 +122,13 @@ XBT_PRIVATE void MC_report_assertion_error(void);
 
 XBT_PRIVATE void MC_invalidate_cache(void);
 
+#ifdef __cplusplus
+
+XBT_PRIVATE void MC_find_object_address(
+  std::vector<simgrid::xbt::VmMap> const& maps, simgrid::mc::ObjectInformation* result);
+
+#endif
+
 SG_END_DECL()
 
 #endif
index 624b6d8..0182f32 100644 (file)
@@ -837,10 +837,10 @@ void sg_config_init(int *argc, char **argv)
                      xbt_cfgelm_double, 1, 1, NULL, NULL);
     xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/cpu_threshold", 1e-6);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/async_small_thres",
+    xbt_cfg_register(&_sg_cfg_set, "smpi/async_small_thresh",
                      "Maximal size of messages that are to be sent asynchronously, without waiting for the receiver",
                      xbt_cfgelm_int, 1, 1, NULL, NULL);
-    xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/async_small_thres", 0);
+    xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/async_small_thresh", 0);
 
     xbt_cfg_register(&_sg_cfg_set, "smpi/send_is_detached_thres",
                      "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend",
index baaee4b..bc93e0d 100644 (file)
@@ -342,16 +342,16 @@ void smpi_mpi_start(MPI_Request request)
   if (request->flags & RECV) {
     print_request("New recv", request);
 
-    int async_small_thres = sg_cfg_get_int("smpi/async_small_thres");
+    int async_small_thresh = sg_cfg_get_int("smpi/async_small_thresh");
 
     xbt_mutex_t mut = smpi_process_mailboxes_mutex();
-    if (async_small_thres != 0 ||request->flags & RMA)
+    if (async_small_thresh != 0 ||request->flags & RMA)
       xbt_mutex_acquire(mut);
 
-    if (async_small_thres == 0 && !(request->flags & RMA)) {
+    if (async_small_thresh == 0 && !(request->flags & RMA)) {
       mailbox = smpi_process_mailbox();
     }
-    else if (request->flags & RMA || request->size < async_small_thres){
+    else if (request->flags & RMA || request->size < async_small_thresh){
     //We have to check both mailboxes (because SSEND messages are sent to the large mbox). begin with the more appropriate one : the small one.
       mailbox = smpi_process_mailbox_small();
       XBT_DEBUG("Is there a corresponding send already posted in the small mailbox %p (in case of SSEND)?", mailbox);
@@ -399,7 +399,7 @@ void smpi_mpi_start(MPI_Request request)
                                          request, -1.0);
         XBT_DEBUG("recv simcall posted");
 
-    if (async_small_thres != 0 || request->flags & RMA)
+    if (async_small_thresh != 0 || request->flags & RMA)
       xbt_mutex_release(mut);
   } else {
 
@@ -424,17 +424,17 @@ void smpi_mpi_start(MPI_Request request)
         XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size));
     }
 
-    int async_small_thres = sg_cfg_get_int("smpi/async_small_thres");
+    int async_small_thresh = sg_cfg_get_int("smpi/async_small_thresh");
 
     xbt_mutex_t mut=smpi_process_remote_mailboxes_mutex(receiver);
 
-    if (async_small_thres != 0 || request->flags & RMA)
+    if (async_small_thresh != 0 || request->flags & RMA)
       xbt_mutex_acquire(mut);
 
-    if (!(async_small_thres != 0 || request->flags & RMA)) {
+    if (!(async_small_thresh != 0 || request->flags & RMA)) {
       mailbox = smpi_process_remote_mailbox(receiver);
     }
-    else if (request->flags & RMA || request->size < async_small_thres) { // eager mode
+    else if (request->flags & RMA || request->size < async_small_thresh) { // eager mode
       mailbox = smpi_process_remote_mailbox(receiver);
       XBT_DEBUG("Is there a corresponding recv already posted in the large mailbox %p?", mailbox);
       smx_synchro_t action = simcall_comm_iprobe(mailbox, 1,request->dst, request->tag, &match_send, (void*)request);
@@ -503,7 +503,7 @@ void smpi_mpi_start(MPI_Request request)
     if (request->action)
        simcall_set_category(request->action, TRACE_internal_smpi_get_category());
 
-    if (async_small_thres != 0 || request->flags & RMA)
+    if (async_small_thresh != 0 || request->flags & RMA)
       xbt_mutex_release(mut);
   }
 
@@ -881,7 +881,7 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
 
   print_request("New iprobe", request);
   // We have to test both mailboxes as we don't know if we will receive one one or another
-  if (sg_cfg_get_int("smpi/async_small_thres")>0){
+  if (sg_cfg_get_int("smpi/async_small_thresh")>0){
       mailbox = smpi_process_mailbox_small();
       XBT_DEBUG("trying to probe the perm recv mailbox");
       request->action = simcall_comm_iprobe(mailbox, 0, request->src, request->tag, &match_recv, (void*)request);
index 6dbbddb..76bc438 100644 (file)
@@ -644,82 +644,6 @@ int smpi_is_privatisation_file(char* file)
   return strncmp("/dev/shm/my-buffer-", file, 19) == 0;
 }
 
-void smpi_get_executable_global_size(){
-  int size_bss_binary=0;
-  int size_data_binary=0;
-  FILE *fp;
-  char *line = NULL;            /* Temporal storage for each line that is readed */
-  ssize_t read;                 /* Number of bytes readed */
-  size_t n = 0;                 /* Amount of bytes to read by xbt_getline */
-
-  char *lfields[7];
-  int i, found = 0;
-
-  char *command = bprintf("objdump --section-headers %s", xbt_binary_name);
-
-  fp = popen(command, "r");
-
-  if(fp == NULL){
-    perror("popen failed");
-    xbt_abort();
-  }
-
-  while ((read = xbt_getline(&line, &n, fp)) != -1 && found != 2) {
-
-    if(n == 0)
-      continue;
-
-    /* Wipeout the new line character */
-    line[read - 1] = '\0';
-
-    lfields[0] = strtok(line, " ");
-
-    if(lfields[0] == NULL)
-      continue;
-
-    if(strcmp(lfields[0], "Sections:") == 0
-        || strcmp(lfields[0], "Idx") == 0
-        || strncmp(lfields[0], xbt_binary_name, strlen(xbt_binary_name)) == 0)
-      continue;
-
-    for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
-      lfields[i] = strtok(NULL, " ");
-    }
-
-    /*
-     * we are looking for these fields
-    23 .data         02625a20  00000000006013e0  00000000006013e0  000013e0  2**5
-                     CONTENTS, ALLOC, LOAD, DATA
-    24 .bss          02625a40  0000000002c26e00  0000000002c26e00  02626e00  2**5
-                     ALLOC
-    */
-
-    if(i>=6){
-      if(strcmp(lfields[1], ".data") == 0){
-        size_data_binary = strtoul(lfields[2], NULL, 16);
-        smpi_start_data_exe = (char*) strtoul(lfields[4], NULL, 16);
-        found++;
-      }else if(strcmp(lfields[1], ".bss") == 0){
-        //the beginning of bss is not exactly the end of data if not aligned, grow bss reported size accordingly
-        //TODO : check if this is OK, as some segments may be inserted between them..
-        size_bss_binary = ((char*) strtoul(lfields[4], NULL, 16) - (smpi_start_data_exe + size_data_binary))
-                          + strtoul(lfields[2], NULL, 16);
-        found++;
-       }
-
-    }
-
-  }
-
-  smpi_size_data_exe = (unsigned long) smpi_start_data_exe
-    - (unsigned long) TOPAGE(smpi_start_data_exe)
-    + size_data_binary+size_bss_binary;
-  xbt_free(command);
-  xbt_free(line);
-  pclose(fp);
-
-}
-
 void smpi_initialize_global_memory_segments(){
 
 #ifndef HAVE_PRIVATIZATION
index 1aa59ee..7047bcc 100644 (file)
@@ -396,7 +396,7 @@ void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm,
 static void smpi_check_options(){
   //check correctness of MPI parameters
 
-   xbt_assert(sg_cfg_get_int("smpi/async_small_thres") <=
+   xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <=
               sg_cfg_get_int("smpi/send_is_detached_thres"));
 
    if (sg_cfg_is_default_value("smpi/running_power")) {
diff --git a/src/smpi/smpi_memory.cpp b/src/smpi/smpi_memory.cpp
new file mode 100644 (file)
index 0000000..34e3d8f
--- /dev/null
@@ -0,0 +1,59 @@
+/* Copyright (c) 2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <iostream>
+
+#include <limits.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+#include "../xbt/memory_map.hpp"
+
+#include "private.h"
+
+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 )
+
+void smpi_get_executable_global_size(void)
+{
+  char buffer[PATH_MAX];
+  char* full_name = realpath(xbt_binary_name, buffer);
+  if (full_name == nullptr)
+    xbt_die("Could not resolve binary file name");
+
+  std::vector<simgrid::xbt::VmMap> map = simgrid::xbt::get_memory_map(getpid());
+  for (auto i = map.begin(); i != map.end() ; ++i) {
+    // TODO, In practice, this implementation would not detect a completely
+    // anonymous data segment. This does not happen in practice, however.
+
+    // File backed RW entry:
+    if (i->pathname == full_name
+        && (i->prot & PROT_RWX) == PROT_RW) {
+      smpi_start_data_exe = (char*) i->start_addr;
+      smpi_size_data_exe = i->end_addr - i->start_addr;
+      ++i;
+      /* Here we are making the assumption that a suitable empty region
+         following the rw- area is the end of the data segment. It would
+         be better to check with the size of the data segment. */
+      if (i != map.end()
+          && i->pathname.empty()
+          && (i->prot & PROT_RWX) == PROT_RW
+          && i->start_addr == (std::uint64_t) smpi_start_data_exe + smpi_size_data_exe) {
+        smpi_size_data_exe = i->end_addr - (std::uint64_t) smpi_start_data_exe;
+      }
+      return;
+    }
+  }
+  xbt_die("Did not find my data segment.");
+}
index 0ce0cd4..8cb2f84 100644 (file)
@@ -644,7 +644,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(mcer_ignore);
   XBT_LOG_CONNECT(mc_liveness);
   XBT_LOG_CONNECT(mc_memory);
-  XBT_LOG_CONNECT(mc_memory_map);
   XBT_LOG_CONNECT(mc_page_snapshot);
   XBT_LOG_CONNECT(mc_request);
   XBT_LOG_CONNECT(mc_safety);
similarity index 91%
rename from src/mc/memory_map.cpp
rename to src/xbt/memory_map.cpp
index f13f9af..0fc10cb 100644 (file)
@@ -9,24 +9,28 @@
 #include <cstring>
 
 #include <sys/types.h>
+#include <sys/mman.h>
 
+#include <xbt/sysdep.h>
 #include <xbt/base.h>
+#include <xbt/file.h>
+#include <xbt/log.h>
 
-#include "mc_memory_map.h"
-#include "mc_private.h"
+#include "memory_map.hpp"
 
 extern "C" {
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory_map, mc,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_memory_map, xbt,
                                 "Logging specific to algorithms for memory_map");
 
 }
 
 namespace simgrid {
-namespace mc {
+namespace xbt {
 
 XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
 {
+#ifdef __linux__
   /* Open the actual process's proc maps file and create the memory_map_t */
   /* to be returned. */
   char* path = bprintf("/proc/%i/maps", (int) pid);
@@ -162,6 +166,11 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
   std::free(line);
   std::fclose(fp);
   return std::move(ret);
+#else
+  /* On FreeBSD, kinfo_getvmmap() could be used but mmap() support is disabled
+     anyway. */
+  xbt_die("Could not get memory map from process %lli", (long long int) pid);
+#endif
 }
 
 }
similarity index 78%
rename from src/mc/mc_memory_map.h
rename to src/xbt/memory_map.hpp
index 7860854..e4e138d 100644 (file)
@@ -4,23 +4,18 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef SIMGRID_MC_MEMORY_MAP_H
-#define SIMGRID_MC_MEMORY_MAP_H
+#ifndef SIMGRID_XBT_MEMORY_MAP_HPP
+#define SIMGRID_XBT_MEMORY_MAP_HPP
 
 #include <cstdint>
-
 #include <string>
 #include <vector>
 
-#include <sys/types.h>
-
 #include <xbt/base.h>
-
-#include <simgrid_config.h>
-#include "mc_forward.hpp"
+#include <sys/types.h>
 
 namespace simgrid {
-namespace mc {
+namespace xbt {
 
 /** An virtual memory map entry from /proc/$pid/maps */
 struct VmMap {
@@ -39,11 +34,4 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid);
 }
 }
 
-extern "C" {
-
-XBT_PRIVATE void MC_find_object_address(
-  std::vector<simgrid::mc::VmMap> const& maps, simgrid::mc::ObjectInformation* result);
-
-}
-
 #endif
index b356be9..721da48 100755 (executable)
@@ -154,7 +154,7 @@ foreach $_ (@ARGV) {
     elsif (/--?maxnp=(.*)/) { $np_max = $1; }
     elsif (/--?tests=(.*)/) { $listfiles = $1; }
     elsif (/--?srcdir=(.*)/) { $srcdir = $1;
-       $mpiexec="$mpiexec  -platform ${srcdir}/../../../../examples/platforms/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile_coll --log=root.thr:critical --cfg=smpi/running_power:1e9  --cfg=smpi/async_small_thres:65536"; }
+       $mpiexec="$mpiexec  -platform ${srcdir}/../../../../examples/platforms/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile_coll --log=root.thr:critical --cfg=smpi/running_power:1e9  --cfg=smpi/async_small_thresh:65536"; }
     elsif (/--?verbose/) { $verbose = 1; }
     elsif (/--?showprogress/) { $showProgress = 1; }
     elsif (/--?debug/) { $debug = 1; }
index 360eb6c..6f50c77 100644 (file)
@@ -105,6 +105,7 @@ set(EXTRA_DIST
   src/xbt/heap_private.h
   src/xbt/log_private.h
   src/xbt/mallocator_private.h
+
   src/xbt/mmalloc/mfree.c
   src/xbt/mmalloc/mm.c
   src/xbt/mmalloc/mm_legacy.c
@@ -229,6 +230,7 @@ set(SMPI_SRC
   src/smpi/instr_smpi.c
   src/smpi/smpi_base.c
   src/smpi/smpi_bench.c
+  src/smpi/smpi_memory.cpp
   src/smpi/smpi_c99.c
   src/smpi/smpi_coll.c
   src/smpi/smpi_comm.c
@@ -264,6 +266,8 @@ set(XBT_SRC
   src/xbt/lib.c
   src/xbt/log.c
   src/xbt/mallocator.c
+  src/xbt/memory_map.cpp
+  src/xbt/memory_map.hpp
   src/xbt/parmap.cpp
   src/xbt/set.c
   src/xbt/snprintf.c
@@ -284,6 +288,7 @@ set(XBT_SRC
   src/xbt/xbt_strbuff.c
   src/xbt/xbt_virtu.c
   src/xbt_modinter.h
+
   )
 
 if(HAVE_MMALLOC)
@@ -673,8 +678,6 @@ set(MC_SRC
   src/mc/mc_state.h
   src/mc/mc_state.cpp
   src/mc/mc_visited.cpp
-  src/mc/mc_memory_map.h
-  src/mc/memory_map.cpp
   src/mc/mc_client.cpp
   src/mc/mc_client_api.cpp
   src/mc/mc_client.h