Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix SimGridMC when SMPI is disabled
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 14 Sep 2015 10:09:31 +0000 (12:09 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 14 Sep 2015 10:09:31 +0000 (12:09 +0200)
Disable parts of the code which use SMPI symbols and are useless if we
don't have SMPI.

src/mc/ObjectInformation.hpp
src/mc/mc_checkpoint.cpp
src/mc/mc_process.cpp
src/mc/mc_smx.cpp

index 8ada283..21c3a04 100644 (file)
@@ -88,7 +88,11 @@ public:
 
   bool privatized() const
   {
+#ifdef HAVE_SMPI
     return this->executable() && smpi_privatize_global_variables;
+#else
+    return false;
+#endif
   }
 
   void* base_address() const;
index 7f4a821..8821fbb 100644 (file)
@@ -83,6 +83,7 @@ static void MC_region_restore(mc_mem_region_t region)
 namespace simgrid {
 namespace mc {
 
+#ifdef HAVE_SMPI
 simgrid::mc::RegionSnapshot privatized_region(
     RegionType region_type, void *start_addr, void* permanent_addr, size_t size
     )
@@ -112,6 +113,7 @@ simgrid::mc::RegionSnapshot privatized_region(
   region.privatized_data(std::move(data));
   return std::move(region);
 }
+#endif
 
 }
 }
@@ -128,12 +130,14 @@ static void MC_snapshot_add_region(int index, mc_snapshot_t snapshot,
   else if (type == simgrid::mc::RegionType::Heap)
     xbt_assert(!object_info, "Unexpected object info for heap region.");
 
-  const bool privatization_aware = object_info && object_info->privatized();
-
   simgrid::mc::RegionSnapshot region;
+
+#ifdef HAVE_SMPI
+  const bool privatization_aware = object_info && object_info->privatized();
   if (privatization_aware && MC_smpi_process_count())
     region = simgrid::mc::privatized_region(type, start_addr, permanent_addr, size);
   else
+#endif
     region = simgrid::mc::region(type, start_addr, permanent_addr, size);
 
   region.object_info(object_info);
@@ -535,8 +539,10 @@ static std::vector<s_fd_infos_t> MC_get_current_fds(pid_t pid)
     }
     link[res] = '\0';
 
+#ifdef HAVE_SMPI
     if(smpi_is_privatisation_file(link))
       continue;
+#endif
 
     // This is (probably) the DIR* we are reading:
     // TODO, read all the file entries at once and close the DIR.*
index f66e9d1..a39caa5 100644 (file)
@@ -525,6 +525,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
     std::shared_ptr<simgrid::mc::ObjectInformation> const& info =
       this->find_object_info_rw((void*)address.address());
     // Segment overlap is not handled.
+#ifdef HAVE_SMPI
     if (info.get() && info.get()->privatized()) {
       if (process_index < 0)
         xbt_die("Missing process index");
@@ -544,6 +545,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
       size_t offset = address.address() - (std::uint64_t)info->start_rw;
       address = remote((char*)privatisation_region.address + offset);
     }
+#endif
   }
 
   if (this->is_self()) {
index 643726e..7b76077 100644 (file)
@@ -212,6 +212,7 @@ const char* MC_smx_process_get_name(smx_process_t p)
   return info->name;
 }
 
+#ifdef HAVE_SMPI
 int MC_smpi_process_count(void)
 {
   if (mc_mode == MC_MODE_CLIENT)
@@ -223,6 +224,7 @@ int MC_smpi_process_count(void)
     return res;
   }
 }
+#endif
 
 unsigned long MC_smx_get_maxpid(void)
 {