Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 3 Apr 2021 07:05:37 +0000 (09:05 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 3 Apr 2021 07:05:37 +0000 (09:05 +0200)
130 files changed:
ChangeLog
doc/doxygen/uhood_switch.doc
docs/source/app_s4u.rst
examples/c/dht-pastry/dht-pastry.c
examples/cpp/dht-chord/s4u-dht-chord.cpp
examples/cpp/io-async/s4u-io-async.cpp
examples/cpp/io-disk-raw/s4u-io-disk-raw.cpp
examples/cpp/maestro-set/s4u-maestro-set.cpp
examples/cpp/replay-io/s4u-replay-io.cpp
examples/deprecated/simdag/ptg-dotload/sd_ptg-dotload.c
examples/platforms/wifi.xml
examples/platforms/wifi_energy.xml
examples/platforms/wifi_ns3.xml
include/simgrid/disk.h
include/simgrid/kernel/future.hpp
include/simgrid/kernel/routing/DijkstraZone.hpp
include/simgrid/kernel/routing/FloydZone.hpp
include/simgrid/kernel/routing/FullZone.hpp
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/kernel/routing/WifiZone.hpp
include/simgrid/plugins/file_system.h
include/simgrid/s4u/Disk.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Host.hpp
include/simgrid/s4u/Link.hpp
include/simgrid/s4u/NetZone.hpp
include/smpi/mpif.h.in
include/xbt/asserts.h
include/xbt/string.hpp
include/xbt/sysdep.h
src/bindings/java/JavaContext.cpp
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_task.cpp
src/instr/instr_interface.cpp
src/instr/instr_platform.cpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/context/ContextSwapped.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/resource/profile/Profile.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/VivaldiZone.cpp
src/kernel/routing/WifiZone.cpp
src/mc/ModelChecker.cpp
src/mc/Session.cpp
src/mc/api.cpp
src/mc/api.hpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/checker/simgrid_mc.cpp
src/mc/inspect/LocationList.cpp
src/mc/inspect/mc_dwarf.cpp
src/mc/mc_config.cpp
src/mc/mc_record.cpp
src/mc/remote/AppSide.cpp
src/mc/remote/RemoteProcess.cpp
src/mc/remote/RemoteProcess.hpp
src/mc/sosp/PageStore.cpp
src/mc/sosp/Snapshot.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/s4u/s4u_Disk.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Link.cpp
src/s4u/s4u_Netzone.cpp
src/simdag/sd_daxloader.cpp
src/smpi/bindings/smpi_mpi.cpp
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/bindings/smpi_pmpi_comm.cpp
src/smpi/bindings/smpi_pmpi_op.cpp
src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/bindings/smpi_pmpi_type.cpp
src/smpi/bindings/smpi_pmpi_win.cpp
src/smpi/colls/bcast/bcast-scatter-rdb-allgather.cpp
src/smpi/colls/smpi_coll.cpp
src/smpi/include/private.hpp
src/smpi/include/smpi_actor.hpp
src/smpi/include/smpi_datatype.hpp
src/smpi/include/smpi_f2c.hpp
src/smpi/include/smpi_op.hpp
src/smpi/include/smpi_request.hpp
src/smpi/internals/smpi_actor.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_memory.cpp
src/smpi/internals/smpi_shared.cpp
src/smpi/internals/smpi_utils.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_file.cpp
src/smpi/mpi/smpi_op.cpp
src/smpi/mpi/smpi_request.cpp
src/smpi/mpi/smpi_win.cpp
src/surf/HostImpl.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_ib.cpp
src/surf/network_ib.hpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/network_smpi.cpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/surf_interface.cpp
src/surf/xml/surfxml_parseplatf.cpp
src/xbt/automaton/automatonparse_promela.c
src/xbt/config.cpp
src/xbt/string.cpp
src/xbt/xbt_log_appender_file.cpp
teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c
teshsuite/s4u/concurrent_rw/concurrent_rw.cpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/smpi/coll-allreduce-with-leaks/coll-allreduce-with-leaks.tesh
teshsuite/smpi/coll-allreduce-with-leaks/mc-coll-allreduce-with-leaks.tesh
teshsuite/smpi/mpich3-test/attr/attrdeleteget.c
teshsuite/smpi/mpich3-test/rma/rma-contig.c
teshsuite/xbt/mmalloc/mmalloc_test.cpp
tools/docker/Dockerfile.tuto-s4u
tools/docker/Dockerfile.tuto-smpi

index 62e8630..2e8cd4f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 
 SimGrid (3.27.1) NOT RELEASED YET (v3.28 expected June 21. 2021, 03:32 UTC)
 
+XBT:
+ - xbt_assert is not disabled anymore, even when built with enable_debug=off.
+
 ----------------------------------------------------------------------------
 
 SimGrid (3.27) March 29. 2021
index ae65213..4521722 100644 (file)
@@ -260,8 +260,7 @@ T simgrid::kernel::Future::get()
 template<class T>
 T simgrid::kernel::FutureState<T>::get()
 {
-  if (status_ != FutureStatus::ready)
-    xbt_die("Deadlock: this future is not ready");
+  xbt_assert(status_ == FutureStatus::ready, "Deadlock: this future is not ready");
   status_ = FutureStatus::done;
   if (exception_) {
     std::exception_ptr exception = std::move(exception_);
@@ -478,8 +477,7 @@ template<class F>
 auto kernel_sync(F code) -> decltype(code().get())
 {
   typedef decltype(code().get()) T;
-  if (SIMIX_is_maestro())
-    xbt_die("Can't execute blocking call in kernel mode");
+  xbt_assert(not SIMIX_is_maestro(), "Can't execute blocking call in kernel mode");
 
   smx_actor_t self = SIMIX_process_self();
   simgrid::xbt::Result<T> result;
index 8b50a25..42bc82c 100644 (file)
@@ -1109,11 +1109,11 @@ I/O operations
 
    .. group-tab:: C++
 
-      .. doxygenfunction:: simgrid::s4u::Disk::io_init(sg_size_t size, s4u::Io::OpType type)
-      .. doxygenfunction:: simgrid::s4u::Disk::read(sg_size_t size)
-      .. doxygenfunction:: simgrid::s4u::Disk::read_async(sg_size_t size)
-      .. doxygenfunction:: simgrid::s4u::Disk::write(sg_size_t size)
-      .. doxygenfunction:: simgrid::s4u::Disk::write_async(sg_size_t size)
+      .. doxygenfunction:: simgrid::s4u::Disk::io_init(sg_size_t size, s4u::Io::OpType type) const
+      .. doxygenfunction:: simgrid::s4u::Disk::read(sg_size_t size) const
+      .. doxygenfunction:: simgrid::s4u::Disk::read_async(sg_size_t size) const
+      .. doxygenfunction:: simgrid::s4u::Disk::write(sg_size_t size) const
+      .. doxygenfunction:: simgrid::s4u::Disk::write_async(sg_size_t size) const
 
 Signals
 -------
index 10f21ac..0c1f981 100644 (file)
@@ -526,12 +526,10 @@ int main(int argc, char* argv[])
       XBT_DEBUG("Set nb_bits to %d", nb_bits);
     } else {
       length = strlen("-timeout=");
-      if (!strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
-        timeout = (int)xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s");
-        XBT_DEBUG("Set timeout to %d", timeout);
-      } else {
-        xbt_die("Invalid pastry option '%s'", options[0]);
-      }
+      xbt_assert(strncmp(options[0], "-timeout=", length) == 0 && strlen(options[0]) > length,
+                 "Invalid pastry option '%s'", options[0]);
+      timeout = (int)xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s");
+      XBT_DEBUG("Set timeout to %d", timeout);
     }
     options++;
   }
index 6651af6..bc2fb64 100644 (file)
@@ -26,12 +26,10 @@ int main(int argc, char* argv[])
       XBT_DEBUG("Set nb_bits to %d", nb_bits);
     } else {
       length = strlen("-timeout=");
-      if (not strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
-        timeout = static_cast<int>(xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s"));
-        XBT_DEBUG("Set timeout to %d", timeout);
-      } else {
-        xbt_die("Invalid chord option '%s'", options[0]);
-      }
+      xbt_assert(strncmp(options[0], "-timeout=", length) == 0 && strlen(options[0]) > length,
+                 "Invalid chord option '%s'", options[0]);
+      timeout = static_cast<int>(xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s"));
+      XBT_DEBUG("Set timeout to %d", timeout);
     }
     options++;
   }
index ac72b84..67ee0b9 100644 (file)
@@ -9,7 +9,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example")
 
 static void test(sg_size_t size)
 {
-  simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
+  const simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
   XBT_INFO("Hello! read %llu bytes from %s", size, disk->get_cname());
 
   simgrid::s4u::IoPtr activity = disk->io_init(size, simgrid::s4u::Io::OpType::READ);
@@ -21,7 +21,7 @@ static void test(sg_size_t size)
 
 static void test_waitfor(sg_size_t size)
 {
-  simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
+  const simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
   XBT_INFO("Hello! write %llu bytes from %s", size, disk->get_cname());
 
   simgrid::s4u::IoPtr activity = disk->write_async(size);
@@ -36,7 +36,7 @@ static void test_waitfor(sg_size_t size)
 
 static void test_cancel(sg_size_t size)
 {
-  simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
+  const simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
   simgrid::s4u::this_actor::sleep_for(0.5);
   XBT_INFO("Hello! write %llu bytes from %s", size, disk->get_cname());
 
@@ -50,7 +50,7 @@ static void test_cancel(sg_size_t size)
 
 static void test_monitor(sg_size_t size)
 {
-  simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
+  const simgrid::s4u::Disk* disk = simgrid::s4u::Host::current()->get_disks().front();
   simgrid::s4u::this_actor::sleep_for(1);
   simgrid::s4u::IoPtr activity = disk->write_async(size);
 
index 8d05ad6..8bd9564 100644 (file)
@@ -35,8 +35,8 @@ static void host()
   XBT_INFO("Read %llu bytes on '%s'", read, disk->get_cname());
 
   /* - Write 800,000 bytes on Disk3 */
-  simgrid::s4u::Disk* disk3 = disk_list.back();
-  sg_size_t write_on_disk3  = disk3->write(800000);
+  const simgrid::s4u::Disk* disk3 = disk_list.back();
+  sg_size_t write_on_disk3        = disk3->write(800000);
   XBT_INFO("Wrote %llu bytes on '%s'", write_on_disk3, disk3->get_cname());
 
   /* - Attach some user data to disk1 */
index 3f5e8d8..5ffa6e6 100644 (file)
@@ -68,10 +68,9 @@ int main(int argc, char* argv[])
 
   simgrid::s4u::Engine e(&argc, argv);
 
-  if (argc != 2) {
-    XBT_CRITICAL("Usage: %s platform_file\n", argv[0]);
-    xbt_die("example: %s ../platforms/small_platform.xml\n", argv[0]);
-  }
+  xbt_assert(argc == 2, "Usage: %s platform_file\n"
+                        "example: %s ../platforms/small_platform.xml\n",
+             argv[0], argv[0]);
 
   e.load_platform(argv[1]);
 
index 1211950..8755783 100644 (file)
@@ -88,8 +88,7 @@ public:
     double clock          = simgrid::s4u::Engine::get_clock();
 
     ACT_DEBUG("Entering Close: %s (filename: %s)", NAME.c_str(), file_name.c_str());
-    XBT_ATTRIB_UNUSED auto count = opened_files.erase(full_name);
-    xbt_assert(count == 1, "File not found in opened files: %s", full_name.c_str());
+    xbt_assert(opened_files.erase(full_name) == 1, "File not found in opened files: %s", full_name.c_str());
 
     log_action(action, simgrid::s4u::Engine::get_clock() - clock);
   }
index de67161..4f3bf64 100644 (file)
@@ -26,9 +26,7 @@ int main(int argc, char **argv){
 
   /* load the DOT file */
   dot = SD_PTG_dotload(argv[2]);
-  if(dot == NULL){
-    xbt_die("No dot load may be you have a cycle in your graph");
-  }
+  xbt_assert(dot != NULL, "No dot load may be you have a cycle in your graph");
 
   /* Display all the tasks */
   XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------");
index 9d054b2..008390c 100755 (executable)
@@ -17,7 +17,6 @@
         <router id="WIFI router"/>
     </zone>
 
-
     <!-- NODE1 AS -->
     <zone id="Wired zone" routing="Full">
       <host id="node1" speed="100.0Mf,50.0Mf,20.0Mf" />
index a62c875..8429adb 100644 (file)
@@ -1,19 +1,17 @@
-<?xml version='1.0'?>
+<?xml version = '1.0'?>
 <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-<platform version="4.1">
-  <zone id="world" routing="Full">
-    <zone id="WIFI zone" routing="Wifi">
-        <prop id="access_point" value="router" />
+<platform version = "4.1">
+  <zone id="WIFI zone" routing = "Wifi">
+    <prop id = "access_point" value = "router" />
     
-        <host id="Station 1" speed="100.0Mf,50.0Mf,20.0Mf" />
-       <host id="Station 2" speed="100.0Mf,50.0Mf,20.0Mf" />
+    <host id = "Station 1" speed = "100.0Mf,50.0Mf,20.0Mf" />
+    <host id = "Station 2" speed = "100.0Mf,50.0Mf,20.0Mf" />
 
-       <router id="router"/>
+    <router id = "router"/>
 
-        <link id="AP1" sharing_policy="WIFI" bandwidth="54Mbps" latency="0ms">
-          <prop id="wifi_watt_values" value="0:1:1:0"/>
-         <prop id="control_duration" value="0"/>
-        </link>
-    </zone>
+    <link id = "AP1" sharing_policy = "WIFI" bandwidth = "54Mbps" latency="0ms">
+      <prop id = "wifi_watt_values" value = "0:1:1:0"/>
+      <prop id = "control_duration" value = "0"/>
+    </link>
   </zone>
 </platform>    
index 4e633b6..fcda257 100644 (file)
@@ -1,38 +1,37 @@
 <?xml version='1.0'?><!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
 <platform version="4.1">
-       <config>
-               <prop id = "network/model" value = "ns-3" />
-       </config>
-       <zone id="world" routing="Floyd">
-
-               <zone id="SSID_1" routing="WIFI">
-                       <prop id="access_point" value="alice"/>
-                       <prop id="mcs" value="2"/> <!-- Optionnal: default = 3 -->
-                       <prop id="nss" value="1"/> <!-- Optionnal: default = 1 -->
-
-                       <host id="alice" speed="1Gf"/>
-
-                       <host id="STA0-0" speed="1Gf">
-                               <prop id="wifi_distance" value="37"/> <!-- Optionnal: default = 10 -->
-                       </host>
-                       <host id="STA0-1" speed="1Gf"/> 
-               </zone>
-
-               <zone id="SSID_2" routing="WIFI">
-                       <prop id="access_point" value="bob"/>
-
-                       <router id="bob"/>
-
-                       <host id="STA1-0" speed="1Gf"/>
-                       <host id="STA1-1" speed="1Gf"/>
-                       <host id="STA1-2" speed="1Gf"/>
-               </zone>
-
-               <link id="wireline" bandwidth="100Mbps" latency="2ms" sharing_policy="SHARED"/>
-
-               <zoneRoute src="SSID_1" dst="SSID_2" gw_src="alice" gw_dst="bob">
-                       <link_ctn id="wireline"/>
-               </zoneRoute>
-       </zone>
+  <config>
+    <prop id = "network/model" value = "ns-3" />
+  </config>
+  <zone id="world" routing="Floyd">
+
+    <zone id="SSID_1" routing="WIFI">
+      <prop id="access_point" value="alice"/>
+      <prop id="mcs" value="2"/> <!-- Optionnal: default = 3 -->
+      <prop id="nss" value="1"/> <!-- Optionnal: default = 1 -->
+
+      <host id="alice" speed="1Gf"/>
+      <host id="STA0-0" speed="1Gf">
+         <prop id="wifi_distance" value="37"/> <!-- Optionnal: default = 10 -->
+      </host>
+      <host id="STA0-1" speed="1Gf"/>
+    </zone>
+
+    <zone id="SSID_2" routing="WIFI">
+      <prop id="access_point" value="bob"/>
+
+      <router id="bob"/>
+
+      <host id="STA1-0" speed="1Gf"/>
+      <host id="STA1-1" speed="1Gf"/>
+      <host id="STA1-2" speed="1Gf"/>
+    </zone>
+
+    <link id="wireline" bandwidth="100Mbps" latency="2ms" sharing_policy="SHARED"/>
+
+    <zoneRoute src="SSID_1" dst="SSID_2" gw_src="alice" gw_dst="bob">
+      <link_ctn id="wireline"/>
+    </zoneRoute>
+  </zone>
 </platform>
 
index e115609..7418f18 100644 (file)
@@ -15,8 +15,8 @@ XBT_PUBLIC const char* sg_disk_get_name(const_sg_disk_t disk);
 XBT_PUBLIC sg_host_t sg_disk_get_host(const_sg_disk_t disk);
 XBT_PUBLIC double sg_disk_read_bandwidth(const_sg_disk_t disk);
 XBT_PUBLIC double sg_disk_write_bandwidth(const_sg_disk_t disk);
-XBT_PUBLIC sg_size_t sg_disk_write(sg_disk_t disk, sg_size_t size);
-XBT_PUBLIC sg_size_t sg_disk_read(sg_disk_t disk, sg_size_t size);
+XBT_PUBLIC sg_size_t sg_disk_write(const_sg_disk_t disk, sg_size_t size);
+XBT_PUBLIC sg_size_t sg_disk_read(const_sg_disk_t disk, sg_size_t size);
 XBT_PUBLIC void* sg_disk_get_data(const_sg_disk_t disk);
 XBT_PUBLIC void sg_disk_set_data(sg_disk_t disk, void* data);
 SG_END_DECL
index 897e4c2..e3a2468 100644 (file)
@@ -116,8 +116,7 @@ protected:
    **/
   void resolve()
   {
-    if (status_ != FutureStatus::ready)
-      xbt_die("Deadlock: this future is not ready");
+    xbt_assert(status_ == FutureStatus::ready, "Deadlock: this future is not ready");
     status_ = FutureStatus::done;
     if (exception_) {
       std::exception_ptr exception = std::move(exception_);
index 6ae3a92..16a435f 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <simgrid/kernel/routing/RoutedZone.hpp>
 
-
 namespace simgrid {
 namespace kernel {
 namespace routing {
@@ -52,7 +51,7 @@ public:
    */
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                 std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
+                 const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
 };
 } // namespace routing
 } // namespace kernel
index 19c7f20..17ade54 100644 (file)
@@ -38,7 +38,7 @@ public:
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                 std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
+                 const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
 };
 } // namespace routing
 } // namespace kernel
index b86d243..13565c4 100644 (file)
@@ -27,7 +27,7 @@ public:
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                 std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
+                 const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
 
 private:
   std::vector<RouteCreationArgs*> routing_table_;
index 6853d5c..c1bf111 100644 (file)
@@ -143,8 +143,8 @@ public:
   /** @brief Create a disk with the disk model from this NetZone */
   s4u::Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth);
   /** @brief Make a link within that NetZone */
-  virtual s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                 s4u::Link::SharingPolicy policy);
+  virtual s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths);
+  virtual s4u::Link* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths);
   /** @brief Creates a new route in this NetZone */
   virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                                 std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
@@ -154,7 +154,7 @@ public:
   virtual int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
   virtual void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                          kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                         std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical);
+                         const std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical);
   /** @brief Set parent of this Netzone */
   void set_parent(NetZoneImpl* parent);
   /** @brief Set network model for this Netzone */
index 381a7ba..1c45b4f 100644 (file)
@@ -30,8 +30,7 @@ public:
   WifiZone& operator=(const WifiZone) = delete;
 
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
-  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                         s4u::Link::SharingPolicy policy) override;
+  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
   NetPoint* get_access_point() const { return access_point_; }
 };
 } // namespace routing
index dbb6d54..d3bcd84 100644 (file)
@@ -96,10 +96,10 @@ class XBT_PUBLIC File : public xbt::Extendable<File> {
   std::string fullpath_;
   sg_size_t current_position_ = SEEK_SET;
   int desc_id                 = 0;
-  Disk* local_disk_           = nullptr;
+  const Disk* local_disk_     = nullptr;
   std::string mount_point_;
 
-  Disk* find_local_disk_on(const Host* host);
+  const Disk* find_local_disk_on(const Host* host);
 
 public:
   File(const std::string& fullpath, void* userdata);
index 9d332e4..0d051c8 100644 (file)
@@ -71,13 +71,13 @@ public:
   Disk* set_host(Host* host);
   Host* get_host() const;
 
-  IoPtr io_init(sg_size_t size, s4u::Io::OpType type);
+  IoPtr io_init(sg_size_t size, s4u::Io::OpType type) const;
 
-  IoPtr read_async(sg_size_t size);
-  sg_size_t read(sg_size_t size);
+  IoPtr read_async(sg_size_t size) const;
+  sg_size_t read(sg_size_t size) const;
 
-  IoPtr write_async(sg_size_t size);
-  sg_size_t write(sg_size_t size);
+  IoPtr write_async(sg_size_t size) const;
+  sg_size_t write(sg_size_t size) const;
   void seal();
 
 #ifndef DOXYGEN
index 9013733..a608f2e 100644 (file)
@@ -125,6 +125,13 @@ public:
 
   std::vector<kernel::routing::NetPoint*> get_all_netpoints() const;
   kernel::routing::NetPoint* netpoint_by_name_or_null(const std::string& name) const;
+  /**
+   * @brief Get netpoint by its name
+   *
+   * @param name Netpoint name
+   * @throw std::invalid_argument if netpoint doesn't exist
+   */
+  kernel::routing::NetPoint* netpoint_by_name(const std::string& name) const;
 
   NetZone* get_netzone_root() const;
   void set_netzone_root(const NetZone* netzone);
index 3fc3b0c..834944e 100644 (file)
@@ -119,7 +119,11 @@ public:
    * @param speed_per_state list of powers for this processor (default power is at index 0)
    */
   Host* set_pstate_speed(const std::vector<double>& speed_per_state);
-  /** @brief Set the CPU's speed (string version) */
+  /**
+   * @brief Set the CPU's speed (string version)
+   *
+   * @throw std::invalid_argument if speed format is incorrect.
+   */
   Host* set_pstate_speed(const std::vector<std::string>& speed_per_state);
 
   /** @brief Get the peak computing speed in flops/s at the current pstate, NOT taking the external load into account.
index 05808a1..284f82c 100644 (file)
@@ -64,10 +64,15 @@ public:
    * @param value New latency value (in s)
    */
   Link* set_latency(double value);
-  /** @brief Set latency (string version) */
+  /**
+   * @brief Set latency (string version)
+   *
+   * @throw std::invalid_argument if latency format is incorrect.
+   */
   Link* set_latency(const std::string& value);
 
   /** @brief Describes how the link is shared between flows */
+  Link* set_sharing_policy(SharingPolicy policy);
   SharingPolicy get_sharing_policy() const;
 
   /** Setup the profile with states events (ON or OFF). The profile must contain boolean values. */
index 4d00516..72922ec 100644 (file)
@@ -63,8 +63,38 @@ public:
 
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
   int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
+
+  /**
+   * @brief Add a route between 2 netpoints
+   *
+   * Create a regular route between 2 netpoints. A netpoint can be a host
+   * or a router.
+   *
+   * @param src Source netpoint
+   * @param dst Destination netpoint
+   * @param link_list List of links used in this communication
+   * @param symmetrical Bi-directional communication
+   */
+  void add_regular_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                         const std::vector<Link*>& link_list, bool symmetrical = true);
+  /**
+   * @brief Add a route between 2 netzones
+   *
+   * Create a route between 2 netzones, connecting 2 gateways.
+   *
+   * @param src Source netzone's netpoint
+   * @param dst Destination netzone' netpoint
+   * @param src_gw Netpoint of the gateway in the source netzone
+   * @param dst_gw Netpoint of the gateway in the destination netzone
+   * @param link_list List of links used in this communication
+   * @param symmetrical Bi-directional communication
+   */
+  void add_netzone_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                         kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                         const std::vector<Link*>& link_list, bool symmetrical = true);
+
   void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src,
-                 kernel::routing::NetPoint* gw_dst, std::vector<kernel::resource::LinkImpl*>& link_list,
+                 kernel::routing::NetPoint* gw_dst, const std::vector<kernel::resource::LinkImpl*>& link_list,
                  bool symmetrical);
   void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                         kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
@@ -85,7 +115,11 @@ public:
    * @param speed_per_state Vector of CPU's speeds
    */
   s4u::Host* create_host(const std::string& name, const std::vector<double>& speed_per_pstate);
-  /** @brief Create a Host (string version) */
+  /**
+   * @brief Create a Host (string version)
+   *
+   * @throw std::invalid_argument if speed format is incorrect.
+   */
   s4u::Host* create_host(const std::string& name, const std::vector<std::string>& speed_per_pstate);
 
   /**
@@ -94,13 +128,19 @@ public:
    * @param name Link name
    * @param bandwidths Link's speed (vector for wifi links)
    * @param policy Link sharing policy
+   * @throw std::invalid_argument if bandwidth format is incorrect.
    */
-  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                         Link::SharingPolicy policy = Link::SharingPolicy::SHARED);
+  s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths);
 
   /** @brief Create a link (string version) */
-  s4u::Link* create_link(const std::string& name, const std::vector<std::string>& bandwidths,
-                         Link::SharingPolicy policy = Link::SharingPolicy::SHARED);
+  s4u::Link* create_link(const std::string& name, const std::vector<std::string>& bandwidths);
+
+  /** @brief Seal this netzone configuration */
+  void seal();
+
+private:
+  /** @brief Auxiliary function to get list of LinkImpl */
+  static std::vector<kernel::resource::LinkImpl*> get_link_list_impl(const std::vector<Link*> link_list);
 };
 
 // External constructors so that the types (and the types of their content) remain hidden
index aa6ae7b..6b2a701 100644 (file)
 
       integer MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG, MPI_ERR_TYPE
       integer MPI_ERR_REQUEST, MPI_ERR_INTERN, MPI_ERR_COUNT
-      integer MPI_ERR_RANK, MPI_ERR_OTHER, MPI_ERR_UNKNOWN
-      integer MPI_ERR_TAG, MPI_ERR_TRUNCATE, MPI_ERR_GROUP, MPI_ERR_OP
+      integer MPI_ERR_RANK, MPI_ERR_TAG, MPI_ERR_TRUNCATE
+      integer MPI_ERR_GROUP, MPI_ERR_OP, MPI_ERR_OTHER
+      integer MPI_ERR_IN_STATUS, MPI_ERR_PENDING, MPI_ERR_BUFFER
+      integer MPI_ERR_NAME, MPI_ERR_DIMS, MPI_ERR_TOPOLOGY
+      integer MPI_ERR_NO_MEM, MPI_ERR_WIN, MPI_ERR_INFO_VALUE
+      integer MPI_ERR_INFO_KEY, MPI_ERR_INFO_NOKEY, MPI_ERR_ROOT
+      integer MPI_ERR_KEYVAL, MPI_ERR_BASE, MPI_ERR_SPAWN
+      integer MPI_ERR_UNKNOWN
+
       integer MPI_ERR_LASTCODE
       integer MPI_IDENT, MPI_SIMILAR, MPI_UNEQUAL, MPI_CONGRUENT
       parameter(MPI_SUCCESS=0)
       parameter(MPI_ERR_GROUP=10)
       parameter(MPI_ERR_OP=11)
       parameter(MPI_ERR_OTHER=12)
-      parameter(MPI_ERR_UNKNOWN=13)
+      parameter(MPI_ERR_IN_STATUS=13)
+      parameter(MPI_ERR_PENDING=14)
+      parameter(MPI_ERR_BUFFER=15)
+      parameter(MPI_ERR_NAME=16)
+      parameter(MPI_ERR_DIMS=17)
+      parameter(MPI_ERR_TOPOLOGY=18)
+      parameter(MPI_ERR_NO_MEM=19)
+      parameter(MPI_ERR_WIN=20)
+      parameter(MPI_ERR_INFO_VALUE=21)
+      parameter(MPI_ERR_INFO_KEY=22)
+      parameter(MPI_ERR_INFO_NOKEY=23)
+      parameter(MPI_ERR_ROOT=24)
+      parameter(MPI_ERR_KEYVAL=25)
+      parameter(MPI_ERR_BASE=26)
+      parameter(MPI_ERR_SPAWN=27)
+      parameter(MPI_ERR_UNKNOWN=28)
       parameter(MPI_ERR_LASTCODE=74)
       parameter(MPI_IDENT=0)
       parameter(MPI_SIMILAR=1)
 
 ! Attribute keys
       integer MPI_IO, MPI_HOST, MPI_WTIME_IS_GLOBAL, MPI_APPNUM
-      integer MPI_TAG_UB, MPI_TAG_LB
+      integer MPI_TAG_UB, MPI_TAG_LB, MPI_BSEND_OVERHEAD
       integer MPI_UNIVERSE_SIZE, MPI_LASTUSEDCODE
       parameter(MPI_IO=-1)
       parameter(MPI_HOST=-2)
       parameter(MPI_UNIVERSE_SIZE=-7)
       parameter(MPI_LASTUSEDCODE=-8)
 
+      parameter(MPI_BSEND_OVERHEAD=0)
 ! This should be equal to the number of int fields in MPI_Status
       integer MPI_STATUS_SIZE
       parameter(MPI_STATUS_SIZE=5)
       parameter(MPI_WIN_SIZE=-2)
       parameter(MPI_WIN_DISP_UNIT=-3)
 
+      integer MPI_GRAPH, MPI_CART
+      integer MPI_DIST_GRAPH, MPI_INVALID_TOPO
+      parameter(MPI_GRAPH=0)
+      parameter(MPI_CART=1)
+      parameter(MPI_DIST_GRAPH=2)
+      parameter(MPI_INVALID_TOPO=3)
+
 ! These IDs have to be unique, consecutive
 ! and ordered as in smpi_f77.cpp.
       parameter(MPI_COMM_WORLD=0)
index 53660d3..2799724 100644 (file)
@@ -44,12 +44,11 @@ XBT_ATTRIB_NORETURN XBT_PUBLIC void xbt_abort(void);
  *
  * You can pass them a format message and arguments, just as if it where a printf.
  * It is converted to a XBT_CRITICAL logging request.
- * Be careful: the boolean expression that you want to test should not have side effects, because assertions are
- * disabled at compile time if NDEBUG is set.
+ * An execution backtrace is also displayed, unless the option --log=no_loc is given at run-time.
+ *
+ * Unlike the standard assert, xbt_assert is never disabled, even if the macro NDEBUG is defined at compile time.  So
+ * it's safe to have a condition with side effects.
  */
-#ifdef NDEBUG
-#define xbt_assert(...) ((void)0)
-#else
 /** @brief The condition which failed will be displayed.
     @hideinitializer  */
 #define xbt_assert(...) \
@@ -64,7 +63,6 @@ XBT_ATTRIB_NORETURN XBT_PUBLIC void xbt_abort(void);
       abort();                                                                                                         \
     }                                                                                                                  \
   } while (0)
-#endif
 
 /** @} */
 SG_END_DECL
index 87ea383..a8bd317 100644 (file)
@@ -145,7 +145,7 @@ public:
   // Capacity
   size_t size() const { return str.len; }
   size_t length() const { return str.len; }
-  bool empty() const { return str.len != 0; }
+  bool empty() const { return str.len == 0; }
   void shrink_to_fit() { /* Being there, but doing nothing */}
 
   // Element access
index 9640735..6a132f7 100644 (file)
@@ -40,8 +40,7 @@ static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) {
   char *res = NULL;
   if (s) {
     res = strdup(s);
-    if (!res)
-      xbt_die("memory allocation error (strdup returned NULL)");
+    xbt_assert(res, "memory allocation error (strdup returned NULL)");
   }
   return res;
 }
@@ -50,8 +49,7 @@ static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) {
     @hideinitializer */
 static XBT_ALWAYS_INLINE void *xbt_malloc(size_t n) {
   void* res = malloc(n);
-  if (!res)
-    xbt_die("Memory allocation of %lu bytes failed", (unsigned long)n);
+  xbt_assert(res, "Memory allocation of %lu bytes failed", (unsigned long)n);
   return res;
 }
 
@@ -59,8 +57,7 @@ static XBT_ALWAYS_INLINE void *xbt_malloc(size_t n) {
     @hideinitializer */
 static XBT_ALWAYS_INLINE void *xbt_malloc0(size_t n) {
   void* res = calloc(n, 1);
-  if (!res)
-    xbt_die("Memory callocation of %lu bytes failed", (unsigned long)n);
+  xbt_assert(res, "Memory callocation of %lu bytes failed", (unsigned long)n);
   return res;
 }
 
@@ -71,8 +68,7 @@ static XBT_ALWAYS_INLINE void *xbt_realloc(void *p, size_t s) {
   if (s) {
     if (p) {
       res = realloc(p, s);
-      if (!res)
-        xbt_die("memory (re)allocation of %lu bytes failed", (unsigned long)s);
+      xbt_assert(res, "memory (re)allocation of %lu bytes failed", (unsigned long)s);
     } else {
       res = xbt_malloc(s);
     }
index 39a3070..e1a1e4e 100644 (file)
@@ -56,8 +56,8 @@ void JavaContext::start_hook()
 
   //Attach the thread to the JVM
   JNIEnv *env;
-  XBT_ATTRIB_UNUSED jint error = __java_vm->AttachCurrentThread((void**)&env, nullptr);
-  xbt_assert((error == JNI_OK), "The thread could not be attached to the JVM");
+  xbt_assert(__java_vm->AttachCurrentThread((void**)&env, nullptr) == JNI_OK,
+             "The thread could not be attached to the JVM");
   this->jenv_ = env;
 }
 
index 4b41e9e..cb08bb5 100644 (file)
@@ -257,8 +257,7 @@ static void run_jprocess(JNIEnv *env, jobject jprocess)
   if (env->ExceptionOccurred()) {
     XBT_DEBUG("Something went wrong in this Java actor, forget about it.");
     env->ExceptionClear();
-    XBT_ATTRIB_UNUSED jint error = __java_vm->DetachCurrentThread();
-    xbt_assert(error == JNI_OK, "Cannot detach failing thread");
+    xbt_assert(__java_vm->DetachCurrentThread() == JNI_OK, "Cannot detach failing thread");
     simgrid::ForcefulKillException::do_throw();
   }
 }
index 798d8f2..fc8c867 100644 (file)
@@ -115,8 +115,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jt
   }
 
   msg_error_t rv = MSG_task_cancel(ptask);
-  if (rv != MSG_OK)
-    xbt_die("MSG_task_cancel() unexpectedly failed with error code %d. Please report this bug", rv);
+  xbt_assert(rv == MSG_OK, "MSG_task_cancel() unexpectedly failed with error code %d. Please report this bug", rv);
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
index d6c2d30..245e609 100644 (file)
@@ -297,12 +297,10 @@ static void instr_user_srcdst_variable(double time, const char *src, const char
                               const char *father_type, double value, InstrUserVariable what)
 {
   simgrid::kernel::routing::NetPoint* src_elm = sg_netpoint_by_name_or_null(src);
-  if (not src_elm)
-    xbt_die("Element '%s' not found!",src);
+  xbt_assert(src_elm, "Element '%s' not found!", src);
 
   simgrid::kernel::routing::NetPoint* dst_elm = sg_netpoint_by_name_or_null(dst);
-  if (not dst_elm)
-    xbt_die("Element '%s' not found!",dst);
+  xbt_assert(dst_elm, "Element '%s' not found!", dst);
 
   std::vector<simgrid::kernel::resource::LinkImpl*> route;
   simgrid::kernel::routing::NetZoneImpl::get_global_route(src_elm, dst_elm, route, nullptr);
index 9e4594c..0ae2219 100644 (file)
@@ -75,9 +75,7 @@ static void linkContainers(simgrid::instr::Container* src, simgrid::instr::Conta
 
   // find common father
   simgrid::instr::Container* father = lowestCommonAncestor(src, dst);
-  if (not father) {
-    xbt_die("common father unknown, this is a tracing problem");
-  }
+  xbt_assert(father, "common father unknown, this is a tracing problem");
 
   // check if we already register this pair (we only need one direction)
   std::string aux1 = src->get_name() + dst->get_name();
index f51af06..44dcf48 100644 (file)
@@ -290,8 +290,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activi
                                   double timeout)
 {
   if (MC_is_active() || MC_record_replay_is_active()) {
-    if (timeout > 0.0)
-      xbt_die("Timeout not implemented for waitany in the model-checker");
+    xbt_assert(timeout <= 0.0, "Timeout not implemented for waitany in the model-checker");
     int idx                 = simcall->mc_value_;
     auto* comm              = comms[idx];
     comm->simcalls_.push_back(simcall);
index a549337..5b8950c 100644 (file)
@@ -76,8 +76,9 @@ void RawImpl::finish()
     XBT_DEBUG("RawImpl::finish(): host '%s' failed", simcall->issuer_->get_host()->get_cname());
     simcall->issuer_->context_->set_wannadie();
     simcall->issuer_->exception_ = std::make_exception_ptr(HostFailureException(XBT_THROW_POINT, "Host failed"));
-  } else if (state_ != State::SRC_TIMEOUT) {
-    xbt_die("Internal error in RawImpl::finish() unexpected synchro state %d", static_cast<int>(state_));
+  } else {
+    xbt_assert(state_ == State::SRC_TIMEOUT, "Internal error in RawImpl::finish() unexpected synchro state %d",
+               static_cast<int>(state_));
   }
 
   finish_callback_();
index bd913fb..d93d602 100644 (file)
@@ -97,25 +97,22 @@ SwappedContext::SwappedContext(std::function<void()>&& code, smx_actor_t actor,
       reinterpret_cast<unsigned char**>(stack_)[-1] = alloc;
 #elif !defined(_WIN32)
       void* alloc;
-      if (posix_memalign(&alloc, xbt_pagesize, size) != 0)
-        xbt_die("Failed to allocate stack.");
+      xbt_assert(posix_memalign(&alloc, xbt_pagesize, size) == 0, "Failed to allocate stack.");
       this->stack_ = static_cast<unsigned char*>(alloc);
 #else
       this->stack_ = static_cast<unsigned char*>(_aligned_malloc(size, xbt_pagesize));
 #endif
 
 #ifndef _WIN32
-      if (mprotect(this->stack_, smx_context_guard_size, PROT_NONE) == -1) {
-        xbt_die(
-            "Failed to protect stack: %s.\n"
-            "If you are running a lot of actors, you may be exceeding the amount of mappings allowed per process.\n"
-            "On Linux systems, change this value with sudo sysctl -w vm.max_map_count=newvalue (default value: 65536)\n"
-            "Please see "
-            "https://simgrid.org/doc/latest/Configuring_SimGrid.html#configuring-the-user-code-virtualization for more "
-            "information.",
-            strerror(errno));
-        /* This is fatal. We are going to fail at some point when we try reusing this. */
-      }
+      /* This is fatal. We are going to fail at some point when we try reusing this. */
+      xbt_assert(
+          mprotect(this->stack_, smx_context_guard_size, PROT_NONE) != -1,
+          "Failed to protect stack: %s.\n"
+          "If you are running a lot of actors, you may be exceeding the amount of mappings allowed per process.\n"
+          "On Linux systems, change this value with sudo sysctl -w vm.max_map_count=newvalue (default value: 65536)\n"
+          "Please see https://simgrid.org/doc/latest/Configuring_SimGrid.html#configuring-the-user-code-virtualization "
+          "for more information.",
+          strerror(errno));
 #endif
       this->stack_ = this->stack_ + smx_context_guard_size;
     } else {
index b820202..d2dae46 100644 (file)
@@ -187,6 +187,8 @@ public:
   /** @brief Unshare a constraint. */
   void unshare() { sharing_policy_ = s4u::Link::SharingPolicy::FATPIPE; }
 
+  /** @brief Set how a constraint is shared  */
+  void set_sharing_policy(s4u::Link::SharingPolicy policy) { sharing_policy_ = policy; }
   /** @brief Check how a constraint is shared  */
   s4u::Link::SharingPolicy get_sharing_policy() const { return sharing_policy_; }
 
index 234e2eb..7174d92 100644 (file)
@@ -181,8 +181,8 @@ Profile* Profile::from_string(const std::string& name, const std::string& input,
 
       profile->stochastic_event_list.emplace_back(stochevent);
     } else {
-      XBT_ATTRIB_UNUSED int res = sscanf(val.c_str(), "%lg  %lg\n", &event.date_, &event.value_);
-      xbt_assert(res == 2, "%s:%d: Syntax error in trace\n%s", name.c_str(), linecount, input.c_str());
+      xbt_assert(sscanf(val.c_str(), "%lg  %lg\n", &event.date_, &event.value_) == 2,
+                 "%s:%d: Syntax error in trace\n%s", name.c_str(), linecount, input.c_str());
 
       xbt_assert(last_event->date_ <= event.date_,
                  "%s:%d: Invalid trace: Events must be sorted, but time %g > time %g.\n%s", name.c_str(), linecount,
index 4a6a2ad..3b6a036 100644 (file)
@@ -219,7 +219,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr
 }
 
 void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                             std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
+                             const std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
 {
   add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
index 1b4bc8f..98903cb 100644 (file)
@@ -82,7 +82,7 @@ void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
 }
 
 void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                          std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
+                          const std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
 {
   /* set the size of table routing */
   unsigned int table_size = get_table_size();
index e3abf98..9f0c860 100644 (file)
@@ -64,7 +64,7 @@ void FullZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
 }
 
 void FullZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
-                         std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
+                         const std::vector<resource::LinkImpl*>& link_list, bool symmetrical)
 {
   add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
index a5996aa..6caa246 100644 (file)
@@ -145,12 +145,14 @@ s4u::Disk* NetZoneImpl::create_disk(const std::string& name, double read_bandwid
   return l->get_iface();
 }
 
-s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                    s4u::Link::SharingPolicy policy)
+s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  auto* l = network_model_->create_link(name, bandwidths, policy);
+  return network_model_->create_link(name, bandwidths)->get_iface();
+}
 
-  return l->get_iface();
+s4u::Link* NetZoneImpl::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return network_model_->create_wifi_link(name, bandwidths)->get_iface();
 }
 
 s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
@@ -173,7 +175,7 @@ int NetZoneImpl::add_component(NetPoint* elm)
 }
 
 void NetZoneImpl::add_route(NetPoint* /*src*/, NetPoint* /*dst*/, NetPoint* /*gw_src*/, NetPoint* /*gw_dst*/,
-                            std::vector<resource::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
+                            const std::vector<resource::LinkImpl*>& /*link_list*/, bool /*symmetrical*/)
 {
   xbt_die("NetZone '%s' does not accept new routes (wrong class).", get_cname());
 }
@@ -465,44 +467,55 @@ void NetZoneImpl::get_global_route(NetPoint* src, NetPoint* dst,
 
 void NetZoneImpl::seal()
 {
+  /* already sealed netzone */
+  if (sealed_)
+    return;
   do_seal(); // derived class' specific sealing procedure
+
+  /* seals sub-netzones and hosts */
+  for (auto* host : get_all_hosts()) {
+    host->seal();
+  }
+  for (auto* sub_net : *get_children()) {
+    sub_net->seal();
+  }
   sealed_ = true;
 }
 
 void NetZoneImpl::set_parent(NetZoneImpl* parent)
 {
-  xbt_assert(sealed_ == false, "Impossible to set parent to an already sealed NetZone(%s)", this->get_cname());
+  xbt_assert(not sealed_, "Impossible to set parent to an already sealed NetZone(%s)", this->get_cname());
   parent_ = parent;
   netpoint_->set_englobing_zone(parent_);
 }
 
 void NetZoneImpl::set_network_model(std::shared_ptr<resource::NetworkModel> netmodel)
 {
-  xbt_assert(sealed_ == false, "Impossible to set network model to an already sealed NetZone(%s)", this->get_cname());
+  xbt_assert(not sealed_, "Impossible to set network model to an already sealed NetZone(%s)", this->get_cname());
   network_model_ = std::move(netmodel);
 }
 
 void NetZoneImpl::set_cpu_vm_model(std::shared_ptr<resource::CpuModel> cpu_model)
 {
-  xbt_assert(sealed_ == false, "Impossible to set CPU model to an already sealed NetZone(%s)", this->get_cname());
+  xbt_assert(not sealed_, "Impossible to set CPU model to an already sealed NetZone(%s)", this->get_cname());
   cpu_model_vm_ = std::move(cpu_model);
 }
 
 void NetZoneImpl::set_cpu_pm_model(std::shared_ptr<resource::CpuModel> cpu_model)
 {
-  xbt_assert(sealed_ == false, "Impossible to set CPU model to an already sealed NetZone(%s)", this->get_cname());
+  xbt_assert(not sealed_, "Impossible to set CPU model to an already sealed NetZone(%s)", this->get_cname());
   cpu_model_pm_ = std::move(cpu_model);
 }
 
 void NetZoneImpl::set_disk_model(std::shared_ptr<resource::DiskModel> disk_model)
 {
-  xbt_assert(sealed_ == false, "Impossible to set disk model to an already sealed NetZone(%s)", this->get_cname());
+  xbt_assert(not sealed_, "Impossible to set disk model to an already sealed NetZone(%s)", this->get_cname());
   disk_model_ = std::move(disk_model);
 }
 
 void NetZoneImpl::set_host_model(std::shared_ptr<surf::HostModel> host_model)
 {
-  xbt_assert(sealed_ == false, "Impossible to set host model to an already sealed NetZone(%s)", this->get_cname());
+  xbt_assert(not sealed_, "Impossible to set host model to an already sealed NetZone(%s)", this->get_cname());
   host_model_ = std::move(host_model);
 }
 
index bc963e1..f073f37 100644 (file)
@@ -70,11 +70,9 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out,
 
   std::string link_up   = "link_" + netpoint->get_name() + "_UP";
   std::string link_down = "link_" + netpoint->get_name() + "_DOWN";
-  resource::LinkImpl* linkUp =
-      get_network_model()->create_link(link_up, std::vector<double>(1, bw_out), s4u::Link::SharingPolicy::SHARED);
+  resource::LinkImpl* linkUp = get_network_model()->create_link(link_up, std::vector<double>(1, bw_out));
   linkUp->seal();
-  resource::LinkImpl* linkDown =
-      get_network_model()->create_link(link_down, std::vector<double>(1, bw_in), s4u::Link::SharingPolicy::SHARED);
+  resource::LinkImpl* linkDown = get_network_model()->create_link(link_down, std::vector<double>(1, bw_in));
   linkDown->seal();
   add_private_link_at(netpoint->id(), {linkUp, linkDown});
 }
index 720b748..91ea761 100644 (file)
@@ -52,15 +52,12 @@ void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   }
 }
 
-s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                 s4u::Link::SharingPolicy policy)
+s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(wifi_link_ == nullptr,
              "WIFI netzone %s contains more than one link. Please only declare one, the wifi link.", get_cname());
-  xbt_assert(policy == s4u::Link::SharingPolicy::WIFI, "Link %s in WIFI zone %s must follow the WIFI sharing policy.",
-             name.c_str(), get_cname());
 
-  auto s4u_link = NetZoneImpl::create_link(name, bandwidths, policy);
+  auto s4u_link = NetZoneImpl::create_wifi_link(name, bandwidths)->set_sharing_policy(s4u::Link::SharingPolicy::WIFI);
   wifi_link_    = s4u_link->get_impl();
   return s4u_link;
 }
index a4feac6..f83ee8d 100644 (file)
@@ -64,9 +64,8 @@ void ModelChecker::start()
   // The model-checked process SIGSTOP itself to signal it's ready:
   const pid_t pid = remote_process_->pid();
 
-  pid_t res = waitpid(pid, &status, WAITPID_CHECKED_FLAGS);
-  if (res < 0 || not WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP)
-    xbt_die("Could not wait model-checked process");
+  xbt_assert(waitpid(pid, &status, WAITPID_CHECKED_FLAGS) == pid && WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP,
+             "Could not wait model-checked process");
 
   if (not _sg_mc_dot_output_file.get().empty())
     MC_init_dot_output();
@@ -266,8 +265,7 @@ void ModelChecker::handle_waitpid()
       // From PTRACE_O_TRACEEXIT:
 #ifdef __linux__
       if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) {
-        long ptrace_res = ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status);
-        xbt_assert(ptrace_res != -1, "Could not get exit status");
+        xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status) != -1, "Could not get exit status");
         if (WIFSIGNALED(status)) {
           MC_report_crash(status);
           this->get_remote_process().terminate();
@@ -383,19 +381,19 @@ std::string ModelChecker::simcall_dot_label(int aid, int times_considered)
 
 void ModelChecker::finalize_app(bool terminate_asap)
 {
-  s_mc_message_int_t m{MessageType::FINALIZE, terminate_asap};
-  int res = checker_side_.get_channel().send(m);
-  xbt_assert(res == 0, "Could not ask the app to finalize on need");
+  s_mc_message_int_t m;
+  memset(&m, 0, sizeof m);
+  m.type  = MessageType::FINALIZE;
+  m.value = terminate_asap;
+  xbt_assert(checker_side_.get_channel().send(m) == 0, "Could not ask the app to finalize on need");
 
   s_mc_message_t answer;
-  ssize_t s = checker_side_.get_channel().receive(answer);
-  xbt_assert(s != -1, "Could not receive answer to FINALIZE");
+  xbt_assert(checker_side_.get_channel().receive(answer) != -1, "Could not receive answer to FINALIZE");
 }
 
 bool ModelChecker::checkDeadlock()
 {
-  int res = checker_side_.get_channel().send(MessageType::DEADLOCK_CHECK);
-  xbt_assert(res == 0, "Could not check deadlock state");
+  xbt_assert(checker_side_.get_channel().send(MessageType::DEADLOCK_CHECK) == 0, "Could not check deadlock state");
   s_mc_message_int_t message;
   ssize_t s = checker_side_.get_channel().receive(message);
   xbt_assert(s != -1, "Could not receive message");
index 1eaae21..6b2943b 100644 (file)
@@ -39,16 +39,14 @@ template <class Code> void run_child_process(int socket, Code code)
   // Make sure we do not outlive our parent
   sigset_t mask;
   sigemptyset (&mask);
-  int sigprocmask_res = sigprocmask(SIG_SETMASK, &mask, nullptr);
-  xbt_assert(sigprocmask_res >= 0, "Could not unblock signals");
-  int prctl_res = prctl(PR_SET_PDEATHSIG, SIGHUP);
-  xbt_assert(prctl_res == 0, "Could not PR_SET_PDEATHSIG");
+  xbt_assert(sigprocmask(SIG_SETMASK, &mask, nullptr) >= 0, "Could not unblock signals");
+  xbt_assert(prctl(PR_SET_PDEATHSIG, SIGHUP) == 0, "Could not PR_SET_PDEATHSIG");
 #endif
 
   // Remove CLOEXEC to pass the socket to the application
-  int fdflags   = fcntl(socket, F_GETFD, 0);
-  int fcntl_res = fdflags != -1 ? fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) : -1;
-  xbt_assert(fcntl_res != -1, "Could not remove CLOEXEC for socket");
+  int fdflags = fcntl(socket, F_GETFD, 0);
+  xbt_assert(fdflags != -1 && fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) != -1,
+             "Could not remove CLOEXEC for socket");
 
   // Disable lazy relocation in the model-checked process to prevent the application from
   // modifying its .got.plt during snapshot.
@@ -71,8 +69,7 @@ Session::Session(const std::function<void()>& code)
   // between the model-checker process (ourselves) and the model-checked
   // process:
   int sockets[2];
-  int res = socketpair(AF_LOCAL, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sockets);
-  xbt_assert(res != -1, "Could not create socketpair");
+  xbt_assert(socketpair(AF_LOCAL, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sockets) != -1, "Could not create socketpair");
 
   pid_t pid = fork();
   xbt_assert(pid >= 0, "Could not fork model-checked process");
@@ -146,7 +143,8 @@ void Session::close()
 
 bool Session::actor_is_enabled(aid_t pid) const
 {
-  s_mc_message_actor_enabled_t msg{};
+  s_mc_message_actor_enabled_t msg;
+  memset(&msg, 0, sizeof msg);
   msg.type = simgrid::mc::MessageType::ACTOR_ENABLED;
   msg.aid  = pid;
   model_checker_->channel().send(msg);
index be0b7ed..aae3945 100644 (file)
@@ -379,10 +379,10 @@ xbt::string const& Api::get_actor_host_name(smx_actor_t actor) const
   return *info->hostname;
 }
 
-std::string Api::get_actor_name(smx_actor_t actor) const
+xbt::string const& Api::get_actor_name(smx_actor_t actor) const
 {
   if (mc_model_checker == nullptr)
-    return actor->get_cname();
+    return actor->get_name();
 
   simgrid::mc::ActorInformation* info = actor_info_cast(actor);
   if (info->name.empty()) {
@@ -400,7 +400,7 @@ std::string Api::get_actor_string(smx_actor_t actor) const
   if (actor) {
     res = "(" + std::to_string(actor->get_pid()) + ")";
     if (actor->get_host())
-      res += std::string(get_actor_host_name(actor)) + " (" + get_actor_name(actor) + ")";
+      res += std::string(get_actor_host_name(actor)) + " (" + std::string(get_actor_name(actor)) + ")";
     else
       res += get_actor_name(actor);
   } else
@@ -450,6 +450,7 @@ simgrid::mc::Checker* Api::initialize(char** argv, simgrid::mc::CheckerAlgorithm
       THROW_IMPOSSIBLE;
   }
 
+  // FIXME: session and checker are never deleted
   simgrid::mc::session_singleton = session;
   mc_model_checker->setChecker(checker);
   return checker;
index 36730ee..548bbe8 100644 (file)
@@ -50,7 +50,6 @@ private:
   simgrid::kernel::activity::CommImpl* get_comm_or_nullptr(smx_simcall_t const r) const;
   bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2) const;
   simgrid::mc::ActorInformation* actor_info_cast(smx_actor_t actor) const;
-  std::string get_actor_name(smx_actor_t actor) const;
   std::string get_actor_string(smx_actor_t actor) const;
   std::string get_actor_dot_label(smx_actor_t actor) const;
 
@@ -79,6 +78,7 @@ public:
   unsigned long get_pattern_comm_src_proc(RemotePtr<kernel::activity::CommImpl> const& addr) const;
   unsigned long get_pattern_comm_dst_proc(RemotePtr<kernel::activity::CommImpl> const& addr) const;
   std::vector<char> get_pattern_comm_data(RemotePtr<kernel::activity::CommImpl> const& addr) const;
+  xbt::string const& get_actor_name(smx_actor_t actor) const;
   xbt::string const& get_actor_host_name(smx_actor_t actor) const;
 #if HAVE_SMPI
   bool check_send_request_detached(smx_simcall_t const& simcall) const;
index 1f3bb27..9175947 100644 (file)
@@ -236,8 +236,7 @@ void CommunicationDeterminismChecker::complete_comm_pattern(RemotePtr<kernel::ac
   auto current_comm_pattern =
       std::find_if(begin(incomplete_pattern), end(incomplete_pattern),
                    [&comm_addr](const PatternCommunication* comm) { return (comm->comm_addr == comm_addr); });
-  if (current_comm_pattern == std::end(incomplete_pattern))
-    xbt_die("Corresponding communication not found!");
+  xbt_assert(current_comm_pattern != std::end(incomplete_pattern), "Corresponding communication not found!");
 
   update_comm_pattern(*current_comm_pattern, comm_addr);
   std::unique_ptr<PatternCommunication> comm_pattern(*current_comm_pattern);
index 09efb3c..4943ad2 100644 (file)
@@ -110,9 +110,11 @@ void SafetyChecker::run()
     // req is now the transition of the process that was selected to be executed
 
     if (req == nullptr) {
-      XBT_DEBUG("There are no more processes to interleave. (depth %zu)", stack_.size() + 1);
+      XBT_DEBUG("There remains %zu actors, but no more processes to interleave. (depth %zu)",
+                mc_model_checker->get_remote_process().actors().size(), stack_.size() + 1);
 
-//      mc_model_checker->finalize_app();
+      if (mc_model_checker->get_remote_process().actors().empty())
+        mc_model_checker->finalize_app();
       this->backtrack();
       continue;
     }
@@ -185,7 +187,7 @@ void SafetyChecker::backtrack()
     stack_.pop_back();
     if (reductionMode_ == ReductionMode::dpor) {
       auto call = state->executed_req_.call_;
-      const kernel::actor::ActorImpl* issuer = api::get().simcall_get_issuer(&state->executed_req_);
+      kernel::actor::ActorImpl* issuer = api::get().simcall_get_issuer(&state->executed_req_);
       for (auto i = stack_.rbegin(); i != stack_.rend(); ++i) {
         State* prev_state = i->get();
         if (state->executed_req_.issuer_ == prev_state->executed_req_.issuer_) {
@@ -206,7 +208,7 @@ void SafetyChecker::backtrack()
           if (not prev_state->actor_states_[issuer->get_pid()].is_done())
             prev_state->mark_todo(issuer);
           else
-            XBT_DEBUG("Actor %s %ld is in done set", issuer->get_cname(), issuer->get_pid());
+            XBT_DEBUG("Actor %s %ld is in done set", api::get().get_actor_name(issuer).c_str(), issuer->get_pid());
           break;
         } else {
           const kernel::actor::ActorImpl* previous_issuer = api::get().simcall_get_issuer(&prev_state->executed_req_);
index 767c0bf..649562e 100644 (file)
@@ -31,8 +31,7 @@ char** argvdup(int argc, char** argv)
 
 int main(int argc, char** argv)
 {
-  if (argc < 2)
-    xbt_die("Missing arguments.\n");
+  xbt_assert(argc >= 2, "Missing arguments");
 
   // Currently, we need this before sg_config_init:
   _sg_do_model_check = 1;
index 426b97b..7bfb61f 100644 (file)
@@ -53,11 +53,10 @@ Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::Obj
                  unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space)
 {
   unw_word_t ip = 0;
-  if (c && unw_get_reg(c, UNW_REG_IP, &ip))
-    xbt_die("Could not resolve IP");
+  if (c)
+    xbt_assert(unw_get_reg(c, UNW_REG_IP, &ip) == 0, "Could not resolve IP");
   simgrid::dwarf::DwarfExpression const* expression = find_expression(locations, ip);
-  if (not expression)
-    xbt_die("Could not resolve location");
+  xbt_assert(expression != nullptr, "Could not resolve location");
   return simgrid::dwarf::resolve(*expression, object_info, c, frame_pointer_address, address_space);
 }
 
@@ -76,8 +75,7 @@ LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Att
 
     if (offset == 0)
       break;
-    else if (offset == -1)
-      xbt_die("Error while loading location list");
+    xbt_assert(offset != -1, "Error while loading location list");
 
     auto base_address = reinterpret_cast<std::uint64_t>(info.base_address());
 
index d7b1868..90277e1 100644 (file)
@@ -399,10 +399,10 @@ static void MC_dwarf_fill_member_location(const simgrid::mc::Type* type, simgrid
   xbt_assert(not dwarf_hasattr(child, DW_AT_data_bit_offset), "Can't groke DW_AT_data_bit_offset.");
 
   if (not dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
-    if (type->type == DW_TAG_union_type)
-      return;
-    xbt_die("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%" PRIx64 ">%s",
-            member->name.c_str(), (uint64_t)type->id, type->name.c_str());
+    xbt_assert(type->type == DW_TAG_union_type,
+               "Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%" PRIx64 ">%s",
+               member->name.c_str(), (uint64_t)type->id, type->name.c_str());
+    return;
   }
 
   Dwarf_Attribute attr;
index 39c3491..78c86b6 100644 (file)
@@ -25,10 +25,10 @@ simgrid::mc::ReductionMode reduction_mode = simgrid::mc::ReductionMode::unset;
 
 static void _mc_cfg_cb_check(const char* spec, bool more_check = true)
 {
-  if (_sg_cfg_init_status && not _sg_do_model_check && more_check)
-    xbt_die("You are specifying a %s after the initialization (through MSG_config?), but the program was not run under "
-            "the model-checker (with simgrid-mc)). This won't work, sorry.",
-            spec);
+  xbt_assert(_sg_cfg_init_status == 0 || _sg_do_model_check || not more_check,
+             "You are specifying a %s after the initialization (through MSG_config?), but the program was not run "
+             "under the model-checker (with simgrid-mc)). This won't work, sorry.",
+             spec);
 }
 
 /* Replay (this part is enabled even if MC it disabled) */
index d8be674..bc2b30c 100644 (file)
@@ -30,13 +30,10 @@ void replay(RecordTrace const& trace)
 
     // Choose a request:
     kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_pid(transition.aid_);
-    if (actor == nullptr)
-      xbt_die("Unexpected actor (id:%ld).", transition.aid_);
+    xbt_assert(actor != nullptr, "Unexpected actor (id:%ld).", transition.aid_);
     const s_smx_simcall* simcall = &(actor->simcall_);
-    if (simcall->call_ == simix::Simcall::NONE)
-      xbt_die("No simcall for process %ld.", transition.aid_);
-    if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::actor_is_enabled(actor))
-      xbt_die("Unexpected simcall.");
+    xbt_assert(simcall->call_ != simix::Simcall::NONE, "No simcall for process %ld.", transition.aid_);
+    xbt_assert(simgrid::mc::request_is_visible(simcall) && simgrid::mc::actor_is_enabled(actor), "Unexpected simcall.");
 
     // Execute the request:
     simcall->issuer_->simcall_handle(transition.times_considered_);
index f202218..376e8b6 100644 (file)
@@ -46,8 +46,7 @@ AppSide* AppSide::initialize()
   // Check the socket type/validity:
   int type;
   socklen_t socklen = sizeof(type);
-  if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) != 0)
-    xbt_die("Could not check socket type");
+  xbt_assert(getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) == 0, "Could not check socket type");
   xbt_assert(type == SOCK_SEQPACKET, "Unexpected socket type %i", type);
   XBT_DEBUG("Model-checked application found expected socket type");
 
@@ -62,14 +61,13 @@ AppSide* AppSide::initialize()
 #else
 #error "no ptrace equivalent coded for this platform"
 #endif
-  if (errno != 0 || raise(SIGSTOP) != 0)
-    xbt_die("Could not wait for the model-checker (errno = %d: %s)", errno, strerror(errno));
+  xbt_assert(errno == 0 && raise(SIGSTOP) == 0, "Could not wait for the model-checker (errno = %d: %s)", errno,
+             strerror(errno));
 
   s_mc_message_initial_addresses_t message{
       MessageType::INITIAL_ADDRESSES, mmalloc_preinit(), simgrid::kernel::actor::get_maxpid_addr(),
       simgrid::simix::simix_global_get_actors_addr(), simgrid::simix::simix_global_get_dead_actors_addr()};
-  int send_res = instance_->channel_.send(message);
-  xbt_assert(send_res == 0, "Could not send the initial message with addresses.");
+  xbt_assert(instance_->channel_.send(message) == 0, "Could not send the initial message with addresses.");
 
   instance_->handle_messages();
   return instance_.get();
@@ -89,16 +87,14 @@ void AppSide::handle_deadlock_check(const s_mc_message_t*) const
 
   // Send result:
   s_mc_message_int_t answer{MessageType::DEADLOCK_CHECK_REPLY, deadlock};
-  int send_res = channel_.send(answer);
-  xbt_assert(send_res == 0, "Could not send response");
+  xbt_assert(channel_.send(answer) == 0, "Could not send response");
 }
 void AppSide::handle_simcall_execute(const s_mc_message_simcall_handle_t* message) const
 {
   kernel::actor::ActorImpl* process = kernel::actor::ActorImpl::by_pid(message->aid_);
   xbt_assert(process != nullptr, "Invalid pid %lu", message->aid_);
   process->simcall_handle(message->times_considered_);
-  if (channel_.send(MessageType::WAITING))
-    xbt_die("Could not send MESSAGE_WAITING to model-checker");
+  xbt_assert(channel_.send(MessageType::WAITING) == 0, "Could not send MESSAGE_WAITING to model-checker");
 }
 
 void AppSide::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg) const
@@ -148,8 +144,7 @@ void AppSide::handle_messages() const
 
         // Send result:
         s_mc_message_simcall_is_visible_answer_t answer{MessageType::SIMCALL_IS_VISIBLE_ANSWER, value};
-        int send_res = channel_.send(answer);
-        xbt_assert(send_res == 0, "Could not send response");
+        xbt_assert(channel_.send(answer) == 0, "Could not send response");
         break;
       }
 
@@ -164,8 +159,7 @@ void AppSide::handle_messages() const
         // Send result:
         s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
         value.copy(answer.value, (sizeof answer.value) - 1); // last byte was set to '\0' by initialization above
-        int send_res = channel_.send(answer);
-        xbt_assert(send_res == 0, "Could not send response");
+        xbt_assert(channel_.send(answer) == 0, "Could not send response");
         break;
       }
 
@@ -180,8 +174,7 @@ void AppSide::handle_messages() const
         // Send result:
         s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
         value.copy(answer.value, (sizeof answer.value) - 1); // last byte was set to '\0' by initialization above
-        int send_res = channel_.send(answer);
-        xbt_assert(send_res == 0, "Could not send response");
+        xbt_assert(channel_.send(answer) == 0, "Could not send response");
         break;
       }
 
@@ -193,17 +186,19 @@ void AppSide::handle_messages() const
       case MessageType::FINALIZE: {
         assert_msg_size("FINALIZE", s_mc_message_int_t);
         bool terminate_asap = ((s_mc_message_int_t*)message_buffer.data())->value;
-#if HAVE_SMPI
+        XBT_DEBUG("Finalize (terminate = %d)", (int)terminate_asap);
         if (not terminate_asap) {
-          XBT_INFO("Finalize. Smpi_enabled: %d", (int)smpi_enabled());
-          simix_global->display_all_actor_status();
+          if (XBT_LOG_ISENABLED(mc_client, xbt_log_priority_debug))
+            simix_global->display_all_actor_status();
+#if HAVE_SMPI
+          XBT_DEBUG("Smpi_enabled: %d", (int)smpi_enabled());
           if (smpi_enabled())
             SMPI_finalize();
-        }
 #endif
+        }
         coverage_checkpoint();
-        int send_res = channel_.send(MessageType::DEADLOCK_CHECK_REPLY); // really?
-        xbt_assert(send_res == 0, "Could not answer to FINALIZE");
+        xbt_assert(channel_.send(MessageType::DEADLOCK_CHECK_REPLY) == 0, // DEADLOCK_CHECK_REPLY, really?
+                   "Could not answer to FINALIZE");
         if (terminate_asap)
           ::_Exit(0);
         break;
@@ -221,16 +216,14 @@ void AppSide::main_loop() const
   coverage_checkpoint();
   while (true) {
     simgrid::mc::execute_actors();
-    int send_res = channel_.send(MessageType::WAITING);
-    xbt_assert(send_res == 0, "Could not send WAITING message to model-checker");
+    xbt_assert(channel_.send(MessageType::WAITING) == 0, "Could not send WAITING message to model-checker");
     this->handle_messages();
   }
 }
 
 void AppSide::report_assertion_failure() const
 {
-  if (channel_.send(MessageType::ASSERTION_FAILED))
-    xbt_die("Could not send assertion to model-checker");
+  xbt_assert(channel_.send(MessageType::ASSERTION_FAILED) == 0, "Could not send assertion to model-checker");
   this->handle_messages();
 }
 
@@ -240,8 +233,7 @@ void AppSide::ignore_memory(void* addr, std::size_t size) const
   message.type = MessageType::IGNORE_MEMORY;
   message.addr = (std::uintptr_t)addr;
   message.size = size;
-  if (channel_.send(message))
-    xbt_die("Could not send IGNORE_MEMORY message to model-checker");
+  xbt_assert(channel_.send(message) == 0, "Could not send IGNORE_MEMORY message to model-checker");
 }
 
 void AppSide::ignore_heap(void* address, std::size_t size) const
@@ -261,8 +253,7 @@ void AppSide::ignore_heap(void* address, std::size_t size) const
     heap->heapinfo[message.block].busy_frag.ignore[message.fragment]++;
   }
 
-  if (channel_.send(message))
-    xbt_die("Could not send ignored region to MCer");
+  xbt_assert(channel_.send(message) == 0, "Could not send ignored region to MCer");
 }
 
 void AppSide::unignore_heap(void* address, std::size_t size) const
@@ -271,21 +262,18 @@ void AppSide::unignore_heap(void* address, std::size_t size) const
   message.type = MessageType::UNIGNORE_HEAP;
   message.addr = (std::uintptr_t)address;
   message.size = size;
-  if (channel_.send(message))
-    xbt_die("Could not send IGNORE_HEAP message to model-checker");
+  xbt_assert(channel_.send(message) == 0, "Could not send IGNORE_HEAP message to model-checker");
 }
 
 void AppSide::declare_symbol(const char* name, int* value) const
 {
   s_mc_message_register_symbol_t message;
   message.type = MessageType::REGISTER_SYMBOL;
-  if (strlen(name) + 1 > message.name.size())
-    xbt_die("Symbol is too long");
+  xbt_assert(strlen(name) + 1 <= message.name.size(), "Symbol is too long");
   strncpy(message.name.data(), name, message.name.size());
   message.callback = nullptr;
   message.data     = value;
-  if (channel_.send(message))
-    xbt_die("Could send REGISTER_SYMBOL message to model-checker");
+  xbt_assert(channel_.send(message) == 0, "Could send REGISTER_SYMBOL message to model-checker");
 }
 
 void AppSide::declare_stack(void* stack, size_t size, ucontext_t* context) const
@@ -302,8 +290,7 @@ void AppSide::declare_stack(void* stack, size_t size, ucontext_t* context) const
   s_mc_message_stack_region_t message;
   message.type         = MessageType::STACK_REGION;
   message.stack_region = region;
-  if (channel_.send(message))
-    xbt_die("Could not send STACK_REGION to model-checker");
+  xbt_assert(channel_.send(message) == 0, "Could not send STACK_REGION to model-checker");
 }
 } // namespace mc
 } // namespace simgrid
index 64b83b5..eef3b18 100644 (file)
@@ -444,8 +444,8 @@ std::string RemoteProcess::read_string(RemotePtr<char> address) const
 
 void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, ReadOptions /*options*/) const
 {
-  if (pread_whole(this->memory_file, buffer, size, (size_t)address.address()) < 0)
-    xbt_die("Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_);
+  xbt_assert(pread_whole(this->memory_file, buffer, size, (size_t)address.address()) != -1,
+             "Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_);
   return buffer;
 }
 
@@ -457,8 +457,8 @@ void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr<void>
  */
 void RemoteProcess::write_bytes(const void* buffer, size_t len, RemotePtr<void> address) const
 {
-  if (pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) < 0)
-    xbt_die("Write to process %lli failed", (long long)this->pid_);
+  xbt_assert(pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) != -1,
+             "Write to process %lli failed", (long long)this->pid_);
 }
 
 static void zero_buffer_init(const void** zero_buffer, size_t zero_buffer_size)
index 2530d13..19df383 100644 (file)
@@ -27,7 +27,7 @@ public:
 
   /** Hostname (owned by `mc_model_checker->hostnames_`) */
   const xbt::string* hostname = nullptr;
-  std::string name;
+  xbt::string name;
 
   void clear()
   {
index 58fe243..07ff287 100644 (file)
@@ -42,8 +42,7 @@ PageStore::PageStore(std::size_t size) : capacity_(size)
   // Using mmap in order to be able to expand the region by relocating it somewhere else in the virtual memory space:
   void* memory =
       ::mmap(nullptr, size << xbt_pagebits, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
-  if (memory == MAP_FAILED)
-    xbt_die("Could not mmap initial snapshot pages.");
+  xbt_assert(memory != MAP_FAILED, "Could not mmap initial snapshot pages.");
 
   this->top_index_ = 0;
   this->memory_    = memory;
@@ -65,15 +64,13 @@ void PageStore::resize(std::size_t size)
   // virtual memory address if necessary:
 #if HAVE_MREMAP
   new_memory = mremap(this->memory_, old_bytesize, new_bytesize, MREMAP_MAYMOVE);
-  if (new_memory == MAP_FAILED)
-    xbt_die("Could not mremap snapshot pages.");
+  xbt_assert(new_memory != MAP_FAILED, "Could not mremap snapshot pages.");
 #else
   if (new_bytesize > old_bytesize) {
     // Grow: first try to add new space after current map
     new_memory = mmap((char*)this->memory_ + old_bytesize, new_bytesize - old_bytesize, PROT_READ | PROT_WRITE,
                       MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
-    if (new_memory == MAP_FAILED)
-      xbt_die("Could not mremap snapshot pages.");
+    xbt_assert(new_memory != MAP_FAILED, "Could not mremap snapshot pages.");
     // Check if expanding worked
     if (new_memory != (char*)this->memory_ + old_bytesize) {
       // New memory segment could not be put at the end of this->memory_,
@@ -81,8 +78,7 @@ void PageStore::resize(std::size_t size)
       munmap(new_memory, new_bytesize - old_bytesize);
       new_memory =
           mmap(nullptr, new_bytesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
-      if (new_memory == MAP_FAILED)
-        xbt_die("Could not mremap snapshot pages.");
+      xbt_assert(new_memory != MAP_FAILED, "Could not mremap snapshot pages.");
       memcpy(new_memory, this->memory_, old_bytesize);
       munmap(this->memory_, old_bytesize);
     }
index 82702f9..b195356 100644 (file)
@@ -72,8 +72,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame, Frame* sco
                                                          &(stack_frame->unw_cursor), (void*)stack_frame->frame_base,
                                                          &mc_model_checker->get_remote_process());
 
-      if (not location.in_memory())
-        xbt_die("Cannot handle non-address variable");
+      xbt_assert(location.in_memory(), "Cannot handle non-address variable");
       new_var.address = location.address();
     } else
       xbt_die("No address");
@@ -137,10 +136,8 @@ static std::vector<s_mc_stack_frame_t> unwind_stack_frames(UnwindContext* stack_
       break;
 
     int ret = unw_step(&c);
-    if (ret == 0)
-      xbt_die("Unexpected end of stack.");
-    else if (ret < 0)
-      xbt_die("Error while unwinding stack");
+    xbt_assert(ret >= 0, "Error while unwinding stack");
+    xbt_assert(ret != 0, "Unexpected end of stack.");
   }
 
   xbt_assert(not result.empty(), "unw_init_local failed");
index 46dcac8..bfa07cc 100644 (file)
@@ -37,9 +37,9 @@ namespace s4u {
 simgrid::xbt::Extension<Disk, FileSystemDiskExt> FileSystemDiskExt::EXTENSION_ID;
 simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
 
-Disk* File::find_local_disk_on(const Host* host)
+const Disk* File::find_local_disk_on(const Host* host)
 {
-  Disk* d                      = nullptr;
+  const Disk* d                = nullptr;
   size_t longest_prefix_length = 0;
   for (auto const& disk : host->get_disks()) {
     std::string current_mount;
@@ -53,15 +53,15 @@ Disk* File::find_local_disk_on(const Host* host)
       longest_prefix_length = current_mount.length();
       d                     = disk;
     }
-    if (longest_prefix_length > 0) { /* Mount point found, split fullpath_ into mount_name and path+filename*/
-      mount_point_ = fullpath_.substr(0, longest_prefix_length);
-      if (mount_point_ == std::string("/"))
-        path_ = fullpath_;
-      else
-        path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
-      XBT_DEBUG("%s + %s", mount_point_.c_str(), path_.c_str());
-    } else
-      xbt_die("Can't find mount point for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
+    xbt_assert(longest_prefix_length > 0, "Can't find mount point for '%s' on '%s'", fullpath_.c_str(),
+               host->get_cname());
+    /* Mount point found, split fullpath_ into mount_name and path+filename*/
+    mount_point_ = fullpath_.substr(0, longest_prefix_length);
+    if (mount_point_ == std::string("/"))
+      path_ = fullpath_;
+    else
+      path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
+    XBT_DEBUG("%s + %s", mount_point_.c_str(), path_.c_str());
   }
   return d;
 }
index 3c7334d..07c2012 100644 (file)
@@ -74,27 +74,27 @@ void Disk::set_property(const std::string& key, const std::string& value)
   kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
 }
 
-IoPtr Disk::io_init(sg_size_t size, Io::OpType type)
+IoPtr Disk::io_init(sg_size_t size, Io::OpType type) const
 {
   return Io::init()->set_disk(this)->set_size(size)->set_op_type(type);
 }
 
-IoPtr Disk::read_async(sg_size_t size)
+IoPtr Disk::read_async(sg_size_t size) const
 {
   return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start();
 }
 
-sg_size_t Disk::read(sg_size_t size)
+sg_size_t Disk::read(sg_size_t size) const
 {
   return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start()->wait()->get_performed_ioops();
 }
 
-IoPtr Disk::write_async(sg_size_t size)
+IoPtr Disk::write_async(sg_size_t size) const
 {
   return IoPtr(io_init(size, Io::OpType::WRITE)->vetoable_start());
 }
 
-sg_size_t Disk::write(sg_size_t size)
+sg_size_t Disk::write(sg_size_t size) const
 {
   return IoPtr(io_init(size, Io::OpType::WRITE))->vetoable_start()->wait()->get_performed_ioops();
 }
@@ -130,11 +130,11 @@ double sg_disk_write_bandwidth(const_sg_disk_t disk)
   return disk->get_write_bandwidth();
 }
 
-sg_size_t sg_disk_read(sg_disk_t disk, sg_size_t size)
+sg_size_t sg_disk_read(const_sg_disk_t disk, sg_size_t size)
 {
   return disk->read(size);
 }
-sg_size_t sg_disk_write(sg_disk_t disk, sg_size_t size)
+sg_size_t sg_disk_write(const_sg_disk_t disk, sg_size_t size)
 {
   return disk->write(size);
 }
index e904859..2d94c66 100644 (file)
@@ -346,6 +346,15 @@ kernel::routing::NetPoint* Engine::netpoint_by_name_or_null(const std::string& n
   return netp == pimpl->netpoints_.end() ? nullptr : netp->second;
 }
 
+kernel::routing::NetPoint* Engine::netpoint_by_name(const std::string& name) const
+{
+  auto netp = netpoint_by_name_or_null(name);
+  if (netp == nullptr) {
+    throw std::invalid_argument(std::string("Netpoint not found: %s") + name);
+  }
+  return netp;
+}
+
 std::vector<kernel::routing::NetPoint*> Engine::get_all_netpoints() const
 {
   std::vector<kernel::routing::NetPoint*> res;
index 81aa555..948353f 100644 (file)
@@ -69,8 +69,7 @@ Host* Host::by_name_or_null(const std::string& name)
 Host* Host::current()
 {
   kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
-  if (self == nullptr)
-    xbt_die("Cannot call Host::current() from the maestro context");
+  xbt_assert(self != nullptr, "Cannot call Host::current() from the maestro context");
   return self->get_host();
 }
 
@@ -281,7 +280,7 @@ std::vector<double> Host::convert_pstate_speed_vector(const std::vector<std::str
       double speed = xbt_parse_get_speed("", 0, speed_str.c_str(), nullptr, "");
       speed_list.push_back(speed);
     } catch (const simgrid::ParseError&) {
-      xbt_die("Host: Impossible to set_pstate_speed, invalid speed %s", speed_str.c_str());
+      throw std::invalid_argument(std::string("Invalid speed value: ") + speed_str);
     }
   }
   return speed_list;
@@ -350,7 +349,6 @@ void Host::execute(double flops, double priority) const
 
 void Host::seal()
 {
-  kernel::actor::simcall([this]() { this->pimpl_cpu->seal(); });
   kernel::actor::simcall([this]() { this->pimpl_->seal(); });
 }
 
index 7b195fb..231b05d 100644 (file)
@@ -75,7 +75,8 @@ Link* Link::set_latency(const std::string& value)
   try {
     d_value = xbt_parse_get_time("", 0, value.c_str(), nullptr, "");
   } catch (const simgrid::ParseError&) {
-    xbt_die("Link: Impossible to latency, invalid value %s", value.c_str());
+    throw std::invalid_argument(std::string("Impossible to set latency for link: ") + get_name() +
+                                std::string(". Invalid value: ") + value);
   }
   return set_latency(d_value);
 }
@@ -91,6 +92,11 @@ Link* Link::set_bandwidth(double value)
   return this;
 }
 
+Link* Link::set_sharing_policy(Link::SharingPolicy policy)
+{
+  kernel::actor::simcall([this, policy] { pimpl_->set_sharing_policy(policy); });
+  return this;
+}
 Link::SharingPolicy Link::get_sharing_policy() const
 {
   return this->pimpl_->get_sharing_policy();
index 57c83f3..4111435 100644 (file)
@@ -99,9 +99,31 @@ int NetZone::add_component(kernel::routing::NetPoint* elm)
   return pimpl_->add_component(elm);
 }
 
+std::vector<kernel::resource::LinkImpl*> NetZone::get_link_list_impl(const std::vector<Link*> link_list)
+{
+  std::vector<kernel::resource::LinkImpl*> links;
+  for (const auto& link : link_list) {
+    links.push_back(link->get_impl());
+  }
+  return links;
+}
+
+void NetZone::add_regular_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                                const std::vector<Link*>& link_list, bool symmetrical)
+{
+  add_route(src, dst, nullptr, nullptr, NetZone::get_link_list_impl(link_list), symmetrical);
+}
+
+void NetZone::add_netzone_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
+                                kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
+                                const std::vector<Link*>& link_list, bool symmetrical)
+{
+  add_route(src, dst, gw_src, gw_dst, NetZone::get_link_list_impl(link_list), symmetrical);
+}
+
 void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst,
                         kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
-                        std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical)
+                        const std::vector<kernel::resource::LinkImpl*>& link_list, bool symmetrical)
 {
   pimpl_->add_route(src, dst, gw_src, gw_dst, link_list, symmetrical);
 }
@@ -121,6 +143,11 @@ void NetZone::extract_xbt_graph(const s_xbt_graph_t* graph, std::map<std::string
   pimpl_->get_graph(graph, nodes, edges);
 }
 
+void NetZone::seal()
+{
+  kernel::actor::simcall([this] { pimpl_->seal(); });
+}
+
 s4u::Host* NetZone::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
 {
   return kernel::actor::simcall(
@@ -131,15 +158,12 @@ s4u::Host* NetZone::create_host(const std::string& name, const std::vector<std::
   return create_host(name, Host::convert_pstate_speed_vector(speed_per_pstate));
 }
 
-s4u::Link* NetZone::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                s4u::Link::SharingPolicy policy)
+s4u::Link* NetZone::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  return kernel::actor::simcall(
-      [this, &name, &bandwidths, &policy] { return pimpl_->create_link(name, bandwidths, policy); });
+  return kernel::actor::simcall([this, &name, &bandwidths] { return pimpl_->create_link(name, bandwidths); });
 }
 
-s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::string>& bandwidths,
-                                s4u::Link::SharingPolicy policy)
+s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::string>& bandwidths)
 {
   std::vector<double> bw;
   bw.reserve(bandwidths.size());
@@ -148,10 +172,11 @@ s4u::Link* NetZone::create_link(const std::string& name, const std::vector<std::
       double speed = xbt_parse_get_bandwidth("", 0, speed_str.c_str(), nullptr, "");
       bw.push_back(speed);
     } catch (const simgrid::ParseError&) {
-      xbt_die("Link: Impossible to create_link, invalid bandwidth %s", speed_str.c_str());
+      throw std::invalid_argument(std::string("Impossible to create link: ") + name +
+                                  std::string(". Invalid bandwidth: ") + speed_str);
     }
   }
-  return create_link(name, bw, policy);
+  return create_link(name, bw);
 }
 
 } // namespace s4u
index 61383ba..af8a699 100644 (file)
@@ -154,9 +154,7 @@ xbt_dynar_t SD_daxload(const char *filename)
   xbt_dynar_push(result, &root_task);
   SD_task_t end_task = SD_task_create_comp_seq("end", nullptr, 0);
 
-  int res = dax_lex();
-  if (res != 0)
-    xbt_die("Parse error in %s: %s", filename, dax__parse_err_msg());
+  xbt_assert(dax_lex() == 0, "Parse error in %s: %s", filename, dax__parse_err_msg());
   dax__delete_buffer(input_buffer);
   fclose(in_file);
   dax_lex_destroy();
index 62bfcaf..2777e0d 100644 (file)
@@ -137,6 +137,7 @@ WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_size,(MPI_Comm comm, int *size),(
 WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_split,(MPI_Comm comm, int color, int key, MPI_Comm* comm_out),(comm, color, key, comm_out))
 WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_split_type,(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm),(comm, split_type, key, info, newcomm))
 WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_create_group,(MPI_Comm comm, MPI_Group group, int tag, MPI_Comm* comm_out),(comm, group, tag, comm_out))
+WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_test_inter,(MPI_Comm comm, int* flag) ,(comm, flag))
 WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_call_errhandler,(MPI_Comm comm,int errorcode),(comm, errorcode))
 WRAPPED_PMPI_CALL(int,MPI_Comm_create_errhandler,( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler),( function, errhandler))
 WRAPPED_PMPI_CALL_ERRHANDLER_COMM(int,MPI_Comm_get_errhandler,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler))
@@ -407,7 +408,6 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_group,(MPI_Comm comm, MPI_Gr
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_size,(MPI_Comm comm, int* size) ,(comm, size))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn,(const char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes),( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn_multiple,(int count, char **array_of_commands, char*** array_of_argv, int* array_of_maxprocs, MPI_Info* array_of_info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes), (count, array_of_commands, array_of_argv, array_of_maxprocs, array_of_info, root, comm, intercomm, array_of_errcodes))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_test_inter,(MPI_Comm comm, int* flag) ,(comm, flag))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_Dist_graph_create, (MPI_Comm comm_old, int n, const int* sources, const int* degrees, const int* destinations, const int* weights, MPI_Info info, int reorder, MPI_Comm* comm_dist_graph), (comm_old, n, sources, degrees, destinations, weights, info, reorder, comm_dist_graph))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_Dist_graph_create_adjacent, (MPI_Comm comm_old, int indegree, const int* sources, const int* sourceweights, int outdegree, const int* destinations, const int* destweights, MPI_Info info, int reorder, MPI_Comm* comm_dist_graph), (comm_old, indegree, sources, sourceweights, outdegree, destinations, destweights, info, reorder, comm_dist_graph))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_Dist_graph_neighbors, (MPI_Comm comm, int maxindegree, int* sources, int* sourceweights, int maxoutdegree, int* destinations, int* destweights), (comm, maxindegree, sources, sourceweights, maxoutdegree, destinations, destweights))
index 39846ef..1e59cd8 100644 (file)
@@ -152,15 +152,13 @@ int PMPI_Get_address(const void *location, MPI_Aint * address)
 
 MPI_Aint PMPI_Aint_add(MPI_Aint address, MPI_Aint disp)
 {
-  if(address > PTRDIFF_MAX - disp)
-    xbt_die("overflow in MPI_Aint_add");
+  xbt_assert(address <= PTRDIFF_MAX - disp, "overflow in MPI_Aint_add");
   return address + disp;
 }
 
 MPI_Aint PMPI_Aint_diff(MPI_Aint address, MPI_Aint disp)
 {
-  if(address < PTRDIFF_MIN + disp)
-    xbt_die("underflow in MPI_Aint_diff");
+  xbt_assert(address >= PTRDIFF_MIN + disp, "underflow in MPI_Aint_diff");
   return address - disp;
 }
 
@@ -184,13 +182,12 @@ int PMPI_Get_count(const MPI_Status * status, MPI_Datatype datatype, int *count)
     size_t size = datatype->size();
     if (size == 0) {
       *count = 0;
-      return MPI_SUCCESS;
     } else if (status->count % size != 0) {
-      return MPI_UNDEFINED;
+      *count = MPI_UNDEFINED;
     } else {
       *count = simgrid::smpi::Status::get_count(status, datatype);
-      return MPI_SUCCESS;
     }
+    return MPI_SUCCESS;
   }
 }
 
@@ -255,12 +252,10 @@ int PMPI_Buffer_attach(void *buf, int size){
     return MPI_ERR_BUFFER;
   if(size<0)
     return MPI_ERR_ARG;
-  smpi_process()->set_bsend_buffer(buf, size);
-  return MPI_SUCCESS;
+  return smpi_process()->set_bsend_buffer(buf, size);
 }
 
 int PMPI_Buffer_detach(void* buffer, int* size){
   smpi_process()->bsend_buffer((void**)buffer, size);
-  smpi_process()->set_bsend_buffer(nullptr, 0);
-  return MPI_SUCCESS;
+  return smpi_process()->set_bsend_buffer(nullptr, 0);
 }
index 478be13..95d8c7c 100644 (file)
@@ -439,7 +439,7 @@ int PMPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
     CHECK_BUFFER(5, recvbuf, count)
   CHECK_TYPE(4, datatype)
   CHECK_COUNT(3, count)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
   CHECK_ROOT(7)
   CHECK_REQUEST(8)
 
@@ -466,7 +466,7 @@ int PMPI_Reduce_local(const void* inbuf, void* inoutbuf, int count, MPI_Datatype
   CHECK_BUFFER(2, inoutbuf, count)
   CHECK_TYPE(4, datatype)
   CHECK_COUNT(3, count)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
 
   smpi_bench_end();
   op->apply(inbuf, inoutbuf, &count, datatype);
@@ -487,7 +487,7 @@ int PMPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype
   CHECK_TYPE(4, datatype)
   CHECK_COUNT(3, count)
   CHECK_REQUEST(7)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
 
   smpi_bench_end();
   std::vector<unsigned char> tmp_sendbuf;
@@ -523,7 +523,7 @@ int PMPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
   CHECK_TYPE(4, datatype)
   CHECK_COUNT(3, count)
   CHECK_REQUEST(7)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
 
   smpi_bench_end();
   int rank         = simgrid::s4u::this_actor::get_pid();
@@ -558,7 +558,7 @@ int PMPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
   CHECK_TYPE(4, datatype)
   CHECK_COUNT(3, count)
   CHECK_REQUEST(7)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
 
   smpi_bench_end();
   int rank         = simgrid::s4u::this_actor::get_pid();
@@ -592,7 +592,7 @@ int PMPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int *recvcoun
   CHECK_TYPE(4, datatype)
   CHECK_NULL(3, MPI_ERR_COUNT, recvcounts)
   CHECK_REQUEST(7)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
   for (int i = 0; i < comm->size(); i++) {
     CHECK_COUNT(3, recvcounts[i])
     CHECK_BUFFER(1, sendbuf, recvcounts[i])
@@ -642,7 +642,7 @@ int PMPI_Ireduce_scatter_block(const void* sendbuf, void* recvbuf, int recvcount
   CHECK_TYPE(4, datatype)
   CHECK_COUNT(3, recvcount)
   CHECK_REQUEST(7)
-  CHECK_OP(5)
+  CHECK_OP(5, op, datatype)
 
   smpi_bench_end();
   int count = comm->size();
index 0057999..4b17184 100644 (file)
@@ -208,6 +208,13 @@ int PMPI_Comm_free_keyval(int* keyval) {
   return PMPI_Keyval_free(keyval);
 }
 
+int PMPI_Comm_test_inter(MPI_Comm comm, int* flag){
+  if(flag == nullptr)
+    return MPI_ERR_ARG;
+  *flag=false;
+  return MPI_SUCCESS;
+}
+
 int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
   CHECK_COMM(1)
   if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
index e90a6ba..a6200c1 100644 (file)
@@ -30,7 +30,7 @@ int PMPI_Op_free(MPI_Op * op)
 }
 
 int PMPI_Op_commutative(MPI_Op op, int* commute){
-  CHECK_OP(1)
+  CHECK_MPI_NULL(1, MPI_OP_NULL, MPI_ERR_OP, op)
   CHECK_NULL(1, MPI_ERR_ARG, commute)
   *commute = op->is_commutative();
   return MPI_SUCCESS;
index 9ef11e6..91984f9 100644 (file)
@@ -22,10 +22,10 @@ static int getPid(MPI_Comm comm, int id)
   CHECK_BUFFER(1, buf, count)\
   CHECK_COUNT(2, count)\
   CHECK_TYPE(3, datatype)\
+  CHECK_COMM(6)\
   if(dst!= MPI_PROC_NULL)\
     CHECK_RANK(4, dst, comm)\
-  CHECK_TAG(5, tag)\
-  CHECK_COMM(6)\
+  CHECK_TAG(5, tag)
 
 #define CHECK_ISEND_INPUTS\
   CHECK_REQUEST(7)\
@@ -38,10 +38,10 @@ static int getPid(MPI_Comm comm, int id)
   CHECK_BUFFER(1, buf, count)\
   CHECK_COUNT(2, count)\
   CHECK_TYPE(3, datatype)\
+  CHECK_COMM(6)\
   if(src!=MPI_ANY_SOURCE && src!=MPI_PROC_NULL)\
     CHECK_RANK(4, src, comm)\
-  CHECK_TAG(5, tag)\
-  CHECK_COMM(6)
+  CHECK_TAG(5, tag)
 /* PMPI User level calls */
 
 int PMPI_Send_init(const void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
@@ -259,8 +259,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
                                                        datatype->is_replayable() ? count : count * datatype->size(),
                                                        tag, simgrid::smpi::Datatype::encode(datatype)));
 
-    simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status);
-    retval = MPI_SUCCESS;
+    retval = simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status);
 
     // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
     int src_traced=0;
@@ -415,8 +414,7 @@ int PMPI_Sendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, int
       simgrid::smpi::Request::send(sendbuf, sendcount, sendtype, dst, sendtag, comm);
     retval = MPI_SUCCESS;
   } else if (dst == MPI_PROC_NULL){
-    simgrid::smpi::Request::recv(recvbuf, recvcount, recvtype, src, recvtag, comm, status);
-    retval = MPI_SUCCESS;
+    retval = simgrid::smpi::Request::recv(recvbuf, recvcount, recvtype, src, recvtag, comm, status);
   } else if (dst >= comm->group()->size() || dst <0 ||
       (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0))){
     retval = MPI_ERR_RANK;
index 5aa26ad..7155047 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "private.hpp"
 #include "smpi_datatype_derived.hpp"
+#include "smpi_comm.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
@@ -337,6 +338,6 @@ int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size)
   CHECK_NEGATIVE(1, MPI_ERR_COUNT, incount)
   CHECK_TYPE(2, datatype)
   CHECK_COMM(3)
-  *size=incount*datatype->size();
+  *size = incount * std::max<long>(datatype->size(), datatype->get_extent());
   return MPI_SUCCESS;
 }
index 97af682..e886154 100644 (file)
@@ -279,7 +279,7 @@ int PMPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_dat
 int PMPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
               MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
   CHECK_RMA
-  CHECK_OP(8)
+  CHECK_MPI_NULL(8, MPI_OP_NULL, MPI_ERR_OP, op)
   CHECK_WIN(9, win)
   CHECK_TARGET_DISP(5)
 
@@ -308,7 +308,7 @@ int PMPI_Raccumulate(const void *origin_addr, int origin_count, MPI_Datatype ori
   if(target_rank==MPI_PROC_NULL)
     *request = MPI_REQUEST_NULL;
   CHECK_RMA
-  CHECK_OP(8)
+  CHECK_MPI_NULL(8, MPI_OP_NULL, MPI_ERR_OP, op)
   CHECK_WIN(9, win)
   CHECK_TARGET_DISP(5)
   CHECK_NULL(10, MPI_ERR_ARG, request)
@@ -350,7 +350,7 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
   CHECK_NEGATIVE(7, MPI_ERR_RANK, target_rank)
   CHECK_COUNT(9, target_count)
   CHECK_TYPE(10, target_datatype)
-  CHECK_OP(11)
+  CHECK_MPI_NULL(11, MPI_OP_NULL, MPI_ERR_OP, op)
   CHECK_WIN(12, win)
   CHECK_TARGET_DISP(8)
 
@@ -392,7 +392,7 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
   CHECK_NEGATIVE(7, MPI_ERR_RANK, target_rank)
   CHECK_COUNT(9, target_count)
   CHECK_TYPE(10, target_datatype)
-  CHECK_OP(11)
+  CHECK_MPI_NULL(11, MPI_OP_NULL, MPI_ERR_OP, op)
   CHECK_WIN(12, win)
   CHECK_TARGET_DISP(8)
   CHECK_NULL(10, MPI_ERR_ARG, request)
index 8f2d24d..70c043a 100644 (file)
@@ -164,8 +164,7 @@ int bcast__scatter_rdb_allgather(
       position = 0;
       if (rank == root) {
         mpi_errno = datatype->pack(buffer, count, tmp_buf, nbytes, &position, comm);
-        if (mpi_errno)
-          xbt_die("crash while packing %d", mpi_errno);
+        xbt_assert(mpi_errno == 0, "crash while packing %d", mpi_errno);
       }
     }
 
@@ -174,9 +173,7 @@ int bcast__scatter_rdb_allgather(
 
     mpi_errno = scatter_for_bcast(root, comm,
                                   nbytes, tmp_buf);
-    if (mpi_errno) {
-      xbt_die("crash while scattering %d", mpi_errno);
-    }
+    xbt_assert(mpi_errno == 0, "crash while scattering %d", mpi_errno);
 
     /* curr_size is the amount of data that this process now has stored in
      * buffer at byte offset (relative_rank*scatter_size) */
@@ -316,16 +313,13 @@ int bcast__scatter_rdb_allgather(
 
     /* check that we received as much as we expected */
     /* recvd_size may not be accurate for packed heterogeneous data */
-    if (is_homogeneous && curr_size != nbytes) {
-      xbt_die("we didn't receive enough !");
-    }
+    xbt_assert(not is_homogeneous || curr_size == nbytes, "we didn't receive enough !");
 
     if (not is_contig || not is_homogeneous) {
       if (rank != root) {
         position  = 0;
         mpi_errno = MPI_Unpack(tmp_buf, nbytes, &position, buffer, count, datatype, comm);
-        if (mpi_errno)
-          xbt_die("error when unpacking %d", mpi_errno);
+        xbt_assert(mpi_errno == 0, "error when unpacking %d", mpi_errno);
       }
     }
 
index 5d75930..6e78241 100644 (file)
@@ -237,16 +237,14 @@ std::map<std::string, std::vector<s_mpi_coll_description_t>, std::less<>> smpi_c
 std::vector<s_mpi_coll_description_t>* colls::get_smpi_coll_descriptions(const std::string& name)
 {
   auto iter = smpi_coll_descriptions.find(name);
-  if (iter == smpi_coll_descriptions.end())
-    xbt_die("No collective named %s. This is a bug.", name.c_str());
+  xbt_assert(iter != smpi_coll_descriptions.end(), "No collective named %s. This is a bug.", name.c_str());
   return &iter->second;
 }
 
 static s_mpi_coll_description_t* find_coll_description(const std::string& collective, const std::string& algo)
 {
   std::vector<s_mpi_coll_description_t>* table = colls::get_smpi_coll_descriptions(collective);
-  if (table->empty())
-    xbt_die("No registered algorithm for collective '%s'! This is a bug.", collective.c_str());
+  xbt_assert(not table->empty(), "No registered algorithm for collective '%s'! This is a bug.", collective.c_str());
 
   for (auto& desc : *table) {
     if (algo == desc.name) {
@@ -289,8 +287,7 @@ void (*colls::smpi_coll_cleanup_callback)();
   {                                                                                                                    \
     auto desc = find_coll_description(_XBT_STRINGIFY(cat), name);                                                      \
     cat       = reinterpret_cast<ret(*) args>(desc->coll);                                                             \
-    if (cat == nullptr)                                                                                                \
-      xbt_die("Collective " _XBT_STRINGIFY(cat) " set to nullptr!");                                                   \
+    xbt_assert(cat != nullptr, "Collective " _XBT_STRINGIFY(cat) " set to nullptr!");                                  \
   }
 COLL_APPLY(COLL_SETTER, COLL_GATHER_SIG, "")
 COLL_APPLY(COLL_SETTER,COLL_ALLGATHER_SIG,"")
index fd6c957..afd523a 100644 (file)
@@ -536,8 +536,11 @@ XBT_PRIVATE void private_execute_flops(double flops);
              "%s: param %d %s cannot be negative", __func__, (num), _XBT_STRINGIFY(val));
 #define CHECK_COMM2(num, comm)                                                                                         \
   CHECK_MPI_NULL((num), MPI_COMM_NULL, MPI_ERR_COMM, (comm))
+#define CHECK_DELETED(num, err, obj)                                                                                  \
+  CHECK_ARGS((obj)->deleted(), (err), "%s: param %d %s has already been freed", __func__, (num), _XBT_STRINGIFY(obj));
 #define CHECK_COMM(num)                                                                                                \
-  CHECK_COMM2((num), comm)
+  CHECK_COMM2((num), comm)                                                                                             \
+  CHECK_DELETED((num), MPI_ERR_COMM, comm)
 #define CHECK_REQUEST(num)                                                                                             \
   CHECK_ARGS(request == nullptr, MPI_ERR_REQUEST,                                                                      \
              "%s: param %d request cannot be NULL",__func__, (num));
@@ -549,29 +552,32 @@ XBT_PRIVATE void private_execute_flops(double flops);
 #define CHECK_TYPE(num, datatype)                                                                                      \
   CHECK_ARGS(((datatype) == MPI_DATATYPE_NULL|| not (datatype)->is_valid()), MPI_ERR_TYPE,                             \
              "%s: param %d %s cannot be MPI_DATATYPE_NULL or invalid", __func__, (num), _XBT_STRINGIFY(datatype));
-#define CHECK_OP(num)                                                                                                  \
-    CHECK_MPI_NULL((num), MPI_OP_NULL, MPI_ERR_OP, op)
+#define CHECK_OP(num, op, type)                                                                                        \
+  CHECK_MPI_NULL((num), MPI_OP_NULL, MPI_ERR_OP, (op))                                                                 \
+  CHECK_ARGS(((op)->allowed_types() && (((op)->allowed_types() & (type)->flags()) == 0)), MPI_ERR_OP,                \
+             "%s: param %d op %s can't be applied to type %s", __func__, (num), _XBT_STRINGIFY(op), type->name());
+
 #define CHECK_ROOT(num)\
   CHECK_ARGS((root < 0 || root >= comm->size()), MPI_ERR_ROOT,                                                         \
              "%s: param %d root (=%d) cannot be negative or larger than communicator size (=%d)", __func__, (num),     \
              root, comm->size());
 #define CHECK_PROC(num,proc)                                                                                           \
-    CHECK_MPI_NULL((num), MPI_PROC_NULL, MPI_SUCCESS, (proc))
+  CHECK_MPI_NULL((num), MPI_PROC_NULL, MPI_SUCCESS, (proc))
 #define CHECK_INFO(num,info)                                                                                           \
-    CHECK_MPI_NULL((num), MPI_INFO_NULL, MPI_ERR_INFO, (info))
+  CHECK_MPI_NULL((num), MPI_INFO_NULL, MPI_ERR_INFO, (info))
 #define CHECK_TAG(num,tag)                                                                                             \
   CHECK_ARGS(((tag) < 0 && (tag) !=  MPI_ANY_TAG), MPI_ERR_TAG,                                                        \
              "%s: param %d %s (=%d) cannot be negative", __func__, (num), _XBT_STRINGIFY(tag), (tag));
 #define CHECK_FILE(num, fh)                                                                                            \
-    CHECK_MPI_NULL((num), MPI_FILE_NULL, MPI_ERR_FILE, (fh))
+  CHECK_MPI_NULL((num), MPI_FILE_NULL, MPI_ERR_FILE, (fh))
 #define CHECK_OFFSET(num, offset)                                                                                      \
   CHECK_NEGATIVE((num), MPI_ERR_DISP, (offset))
 #define CHECK_GROUP(num, group)                                                                                        \
-      CHECK_MPI_NULL((num), MPI_GROUP_NULL, MPI_ERR_GROUP, (group))
+  CHECK_MPI_NULL((num), MPI_GROUP_NULL, MPI_ERR_GROUP, (group))
 #define CHECK_WIN(num, win)                                                                                            \
-      CHECK_MPI_NULL((num), MPI_WIN_NULL, MPI_ERR_WIN, (win))
+  CHECK_MPI_NULL((num), MPI_WIN_NULL, MPI_ERR_WIN, (win))
 #define CHECK_RANK(num, rank, comm)                                                                                    \
-        CHECK_ARGS(((rank) >= (comm)->group()->size() || (rank) <0), MPI_ERR_RANK,                                     \
+  CHECK_ARGS(((rank) >= (comm)->group()->size() || (rank) <0), MPI_ERR_RANK,                                           \
              "%s: param %d %s (=%d) cannot be < 0 or > %d", __func__, (num), _XBT_STRINGIFY(rank),                     \
              (rank), (comm)->group()->size() );
 #endif
index 73092b6..3da3086 100644 (file)
@@ -86,7 +86,7 @@ public:
   void set_optind(int optind);
   MPI_Info info_env();
   void bsend_buffer(void** buf, int* size);
-  void set_bsend_buffer(void* buf, int size);
+  int set_bsend_buffer(void* buf, int size);
 };
 
 } // namespace smpi
index 3874680..294e617 100644 (file)
 #include <string>
 #include <vector>
 
-constexpr unsigned DT_FLAG_DESTROYED   = 0x0001; /**< user destroyed but some other layers still have a reference */
-constexpr unsigned DT_FLAG_COMMITED    = 0x0002; /**< ready to be used for a send/recv operation */
-constexpr unsigned DT_FLAG_CONTIGUOUS  = 0x0004; /**< contiguous datatype */
-constexpr unsigned DT_FLAG_OVERLAP     = 0x0008; /**< datatype is unproper for a recv operation */
-constexpr unsigned DT_FLAG_USER_LB     = 0x0010; /**< has a user defined LB */
-constexpr unsigned DT_FLAG_USER_UB     = 0x0020; /**< has a user defined UB */
-constexpr unsigned DT_FLAG_PREDEFINED  = 0x0040; /**< cannot be removed: initial and predefined datatypes */
-constexpr unsigned DT_FLAG_NO_GAPS     = 0x0080; /**< no gaps around the datatype */
-constexpr unsigned DT_FLAG_DATA        = 0x0100; /**< data or control structure */
-constexpr unsigned DT_FLAG_ONE_SIDED   = 0x0200; /**< datatype can be used for one sided operations */
-constexpr unsigned DT_FLAG_UNAVAILABLE = 0x0400; /**< datatypes unavailable on the build (OS or compiler dependent) */
-constexpr unsigned DT_FLAG_DERIVED     = 0x0800; /**< is the datatype derived ? */
+constexpr unsigned DT_FLAG_DESTROYED   = 0x00001; /**< user destroyed but some other layers still have a reference */
+constexpr unsigned DT_FLAG_COMMITED    = 0x00002; /**< ready to be used for a send/recv operation */
+constexpr unsigned DT_FLAG_CONTIGUOUS  = 0x00004; /**< contiguous datatype */
+constexpr unsigned DT_FLAG_OVERLAP     = 0x00008; /**< datatype is unproper for a recv operation */
+constexpr unsigned DT_FLAG_USER_LB     = 0x00010; /**< has a user defined LB */
+constexpr unsigned DT_FLAG_USER_UB     = 0x00020; /**< has a user defined UB */
+constexpr unsigned DT_FLAG_PREDEFINED  = 0x00040; /**< cannot be removed: initial and predefined datatypes */
+constexpr unsigned DT_FLAG_NO_GAPS     = 0x00080; /**< no gaps around the datatype */
+constexpr unsigned DT_FLAG_DATA        = 0x00100; /**< data or control structure */
+constexpr unsigned DT_FLAG_ONE_SIDED   = 0x00200; /**< datatype can be used for one sided operations */
+constexpr unsigned DT_FLAG_UNAVAILABLE = 0x00400; /**< datatypes unavailable on the build (OS or compiler dependent) */
+constexpr unsigned DT_FLAG_DERIVED     = 0x00800; /**< is the datatype derived ? */
+constexpr unsigned DT_FLAG_C_INTEGER   = 0x01000; /**< Family: C ints */
+constexpr unsigned DT_FLAG_F_INTEGER   = 0x02000; /**< Family: F ints */
+constexpr unsigned DT_FLAG_FP          = 0x04000; /**< Family: Floating point */
+constexpr unsigned DT_FLAG_LOGICAL     = 0x08000; /**< Family: Logical */
+constexpr unsigned DT_FLAG_COMPLEX     = 0x10000; /**< Family: Complex */
+constexpr unsigned DT_FLAG_BYTE        = 0x20000; /**< Family: Poor lonesome byte */
+constexpr unsigned DT_FLAG_MULTILANG   = 0x40000; /**< Family: Multi-language */
+constexpr unsigned DT_FLAG_REDUCTION   = 0x80000; /**< Family: Dual types for maxloc/minloc */
 /*
  * We should make the difference here between the predefined contiguous and non contiguous
  * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
index c839d1c..ee02512 100644 (file)
@@ -25,6 +25,7 @@ private:
   static int f2c_id_;
   static f2c_lookup_type::size_type num_default_handles_;
   int my_f2c_id_ = -1;
+  bool deleted_ = false;
 
 protected:
   static void allocate_lookup()
@@ -34,8 +35,10 @@ protected:
   }
   static int f2c_id() { return f2c_id_; }
   static void f2c_id_increment() { f2c_id_++; }
+  void mark_as_deleted() { deleted_ = true; };
 
 public:
+  bool deleted() const { return deleted_; }
   static f2c_lookup_type* lookup() { return f2c_lookup_.get(); }
   F2C();
   virtual ~F2C() = default;
@@ -43,7 +46,7 @@ public:
   int add_f();
   static void free_f(int id) { f2c_lookup_->erase(id); }
   int c2f();
-  static void print_f2c_lookup();
+
   // This method should be overridden in all subclasses to avoid casting the result when calling it.
   // For the default one, the MPI_*_NULL returned is assumed to be NULL.
   static F2C* f2c(int id);
index edf2042..bfb1e7d 100644 (file)
@@ -18,12 +18,14 @@ class Op : public F2C{
   bool is_fortran_op_ = false;
   int refcount_ = 1;
   bool is_predefined_;
+  int types_; //bitmask of the allowed datatypes flags
 
 public:
-  Op(MPI_User_function* function, bool commutative, bool predefined=false) : func_(function), is_commutative_(commutative), is_predefined_(predefined) {if(not predefined) this->add_f();}
+  Op(MPI_User_function* function, bool commutative, bool predefined=false, int types=0) : func_(function), is_commutative_(commutative), is_predefined_(predefined), types_(types) {if(not predefined) this->add_f();}
   bool is_commutative() const { return is_commutative_; }
   bool is_predefined() const { return is_predefined_; }
   bool is_fortran_op() const { return is_fortran_op_; }
+  int allowed_types() const { return types_; }
   // tell that we were created from fortran, so we need to translate the type to fortran when called
   void set_fortran_op() { is_fortran_op_ = true; }
   void apply(const void* invec, void* inoutvec, const int* len, MPI_Datatype datatype) const;
index 16b8998..226094d 100644 (file)
@@ -91,7 +91,7 @@ public:
   static MPI_Request issend(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
   static MPI_Request irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
 
-  static void recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
+  static int recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
   static void bsend(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
   static void send(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
   static void ssend(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
index d97e4e1..10f3f99 100644 (file)
@@ -257,10 +257,13 @@ void ActorExt::bsend_buffer(void** buf, int* size)
   *size = bsend_buffer_size_;
 }
 
-void ActorExt::set_bsend_buffer(void* buf, int size)
+int ActorExt::set_bsend_buffer(void* buf, int size)
 {
+  if(buf!=nullptr && bsend_buffer_!=nullptr)
+    return MPI_ERR_BUFFER;
   bsend_buffer_     = buf;
   bsend_buffer_size_= size;
+  return MPI_SUCCESS;
 }
 
 } // namespace smpi
index 0e4e852..b3cf6c8 100644 (file)
@@ -90,9 +90,9 @@ void smpi_bench_begin()
   if (not smpi_cfg_papi_events_file().empty()) {
     int event_set = smpi_process()->papi_event_set();
     // PAPI_start sets everything to 0! See man(3) PAPI_start
-    if (PAPI_LOW_LEVEL_INITED == PAPI_is_initialized() && event_set && PAPI_start(event_set) != PAPI_OK) {
-      xbt_die("Could not start PAPI counters (TODO: this needs some proper handling).");
-    }
+    if (PAPI_LOW_LEVEL_INITED == PAPI_is_initialized() && event_set)
+      xbt_assert(PAPI_start(event_set) == PAPI_OK,
+                 "Could not start PAPI counters (TODO: this needs some proper handling).");
   }
 #endif
   xbt_os_threadtimer_start(smpi_process()->timer());
@@ -129,8 +129,8 @@ void smpi_bench_end()
     int event_set                       = smpi_process()->papi_event_set();
     std::vector<long long> event_values(counter_data.size());
 
-    if (event_set && PAPI_stop(event_set, &event_values[0]) != PAPI_OK) // Error
-      xbt_die("Could not stop PAPI counters.");
+    if (event_set)
+      xbt_assert(PAPI_stop(event_set, &event_values[0]) == PAPI_OK, "Could not stop PAPI counters.");
     for (unsigned int i = 0; i < counter_data.size(); i++)
       counter_data[i].second += event_values[i];
   }
@@ -364,8 +364,8 @@ int smpi_sample_2(int global, const char *file, int line, int iter_count)
 
   XBT_DEBUG("sample2 %s %d", loc.c_str(), iter_count);
   auto sample = samples.find(loc);
-  if (sample == samples.end())
-    xbt_die("Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
+  xbt_assert(sample != samples.end(),
+             "Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
   const LocalData& data = sample->second;
 
   if (data.benching) {
@@ -400,8 +400,8 @@ void smpi_sample_3(int global, const char *file, int line)
 
   XBT_DEBUG("sample3 %s", loc.c_str());
   auto sample = samples.find(loc);
-  if (sample == samples.end())
-    xbt_die("Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
+  xbt_assert(sample != samples.end(),
+             "Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
   LocalData& data = sample->second;
 
   if (not data.benching)
@@ -432,9 +432,9 @@ int smpi_sample_exit(int global, const char *file, int line, int iter_count){
 
     XBT_DEBUG("sample exit %s", loc.c_str());
     auto sample = samples.find(loc);
-    if (sample == samples.end())
-      xbt_die("Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
-  
+    xbt_assert(sample != samples.end(),
+               "Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
+
     if (smpi_process()->sampling()){//end of loop, but still sampling needed
       const LocalData& data = sample->second;
       smpi_process()->set_sampling(0);
index 72c5425..f10b47c 100644 (file)
@@ -351,8 +351,8 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of
 {
   int fdin = open(src.c_str(), O_RDONLY);
   xbt_assert(fdin >= 0, "Cannot read from %s. Please make sure that the file exists and is executable.", src.c_str());
-  XBT_ATTRIB_UNUSED int unlink_status = unlink(target.c_str());
-  xbt_assert(unlink_status == 0 || errno == ENOENT, "Failed to unlink file %s: %s", target.c_str(), strerror(errno));
+  xbt_assert(unlink(target.c_str()) == 0 || errno == ENOENT, "Failed to unlink file %s: %s", target.c_str(),
+             strerror(errno));
   int fdout = open(target.c_str(), O_CREAT | O_RDWR | O_EXCL, S_IRWXU);
   xbt_assert(fdout >= 0, "Cannot write into %s: %s", target.c_str(), strerror(errno));
 
@@ -363,10 +363,10 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of
     close(fdin);
     close(fdout);
     return;
-  } else if (sent_size != -1 || errno != ENOSYS) {
-    xbt_die("Error while copying %s: only %zd bytes copied instead of %" PRIdMAX " (errno: %d -- %s)", target.c_str(),
-            sent_size, static_cast<intmax_t>(fdin_size), errno, strerror(errno));
   }
+  xbt_assert(sent_size == -1 && errno == ENOSYS,
+             "Error while copying %s: only %zd bytes copied instead of %" PRIdMAX " (errno: %d -- %s)", target.c_str(),
+             sent_size, static_cast<intmax_t>(fdin_size), errno, strerror(errno));
 #endif
   // If this point is reached, sendfile() actually is not available.  Copy file by hand.
   std::vector<unsigned char> buf(1024 * 1024 * 4);
@@ -419,14 +419,13 @@ static void smpi_init_privatization_dlopen(const std::string& executable)
     for (auto const& libname : privatize_libs) {
       // load the library once to add it to the local libs, to get the absolute path
       void* libhandle = dlopen(libname.c_str(), RTLD_LAZY);
-      xbt_assert(libhandle != nullptr, 
-                     "Cannot dlopen %s - check your settings in smpi/privatize-libs", libname.c_str());
+      xbt_assert(libhandle != nullptr, "Cannot dlopen %s - check your settings in smpi/privatize-libs",
+                 libname.c_str());
       // get library name from path
       std::string fullpath = libname;
 #if not defined(__APPLE__) && not defined(__HAIKU__)
-      XBT_ATTRIB_UNUSED int dl_iterate_res = dl_iterate_phdr(visit_libs, &fullpath);
-      xbt_assert(dl_iterate_res != 0, "Can't find a linked %s - check your settings in smpi/privatize-libs",
-                 fullpath.c_str());
+      xbt_assert(dl_iterate_phdr(visit_libs, &fullpath) != 0,
+                 "Can't find a linked %s - check your settings in smpi/privatize-libs", fullpath.c_str());
       XBT_DEBUG("Extra lib to privatize '%s' found", fullpath.c_str());
 #else
       xbt_die("smpi/privatize-libs is not (yet) compatible with OSX nor with Haiku");
index f425e22..c542a20 100644 (file)
@@ -159,20 +159,18 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt
 void* smpi_temp_shm_mmap(int fd, size_t size)
 {
   struct stat st;
-  if (fstat(fd, &st) != 0)
-    xbt_die("Could not stat fd %d: %s", fd, strerror(errno));
-  if (static_cast<off_t>(size) > st.st_size && ftruncate(fd, static_cast<off_t>(size)) != 0)
-    xbt_die("Could not truncate fd %d to %zu: %s", fd, size, strerror(errno));
+  xbt_assert(fstat(fd, &st) == 0, "Could not stat fd %d: %s", fd, strerror(errno));
+  xbt_assert(static_cast<off_t>(size) <= st.st_size || ftruncate(fd, static_cast<off_t>(size)) == 0,
+             "Could not truncate fd %d to %zu: %s", fd, size, strerror(errno));
   void* mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-  if (mem == MAP_FAILED) {
-    xbt_die("Failed to map fd %d with size %zu: %s\n"
-            "If you are running a lot of ranks, you may be exceeding the amount of mappings allowed per process.\n"
-            "On Linux systems, change this value with sudo sysctl -w vm.max_map_count=newvalue (default value: 65536)\n"
-            "Please see "
-            "https://simgrid.org/doc/latest/Configuring_SimGrid.html#configuring-the-user-code-virtualization for more "
-            "information.",
-            fd, size, strerror(errno));
-  }
+  xbt_assert(
+      mem != MAP_FAILED,
+      "Failed to map fd %d with size %zu: %s\n"
+      "If you are running a lot of ranks, you may be exceeding the amount of mappings allowed per process.\n"
+      "On Linux systems, change this value with sudo sysctl -w vm.max_map_count=newvalue (default value: 65536)\n"
+      "Please see https://simgrid.org/doc/latest/Configuring_SimGrid.html#configuring-the-user-code-virtualization for "
+      "more information.",
+      fd, size, strerror(errno));
   return mem;
 }
 
@@ -194,9 +192,9 @@ void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor)
   XBT_DEBUG("Switching data frame to the one of process %ld", actor->get_pid());
   const simgrid::smpi::ActorExt* process = smpi_process_remote(actor);
   int current                     = process->privatized_region()->file_descriptor;
-  const void* tmp = mmap(TOPAGE(smpi_data_exe_start), smpi_data_exe_size, PROT_RW, MAP_FIXED | MAP_SHARED, current, 0);
-  if (tmp != TOPAGE(smpi_data_exe_start))
-    xbt_die("Couldn't map the new region (errno %d): %s", errno, strerror(errno));
+  xbt_assert(mmap(TOPAGE(smpi_data_exe_start), smpi_data_exe_size, PROT_RW, MAP_FIXED | MAP_SHARED, current, 0) ==
+                 TOPAGE(smpi_data_exe_start),
+             "Couldn't map the new region (errno %d): %s", errno, strerror(errno));
   smpi_loaded_page = actor->get_pid();
 #endif
 }
index 34e70d2..b495246 100644 (file)
@@ -208,9 +208,8 @@ void* smpi_shared_malloc_partial(size_t size, const size_t* shared_block_offsets
     smpi_shared_malloc_bogusfile = mkstemp(name);
     XBT_DEBUG("bogusfile         : %s\n", name);
     unlink(name);
-    int err = ftruncate(smpi_shared_malloc_bogusfile, smpi_shared_malloc_blocksize);
-    if (err != 0)
-      xbt_die("Could not write bogus file for shared malloc");
+    xbt_assert(ftruncate(smpi_shared_malloc_bogusfile, smpi_shared_malloc_blocksize) == 0,
+               "Could not write bogus file for shared malloc");
   }
 
   int mmap_base_flag = MAP_FIXED | MAP_SHARED | MAP_POPULATE;
index a8cbb44..d280569 100644 (file)
@@ -16,6 +16,8 @@
 #include "smpi_f2c.hpp"
 #include "src/simix/smx_private.hpp"
 
+#include <algorithm>
+
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)");
 
 extern std::string surf_parsed_filename;
@@ -58,9 +60,8 @@ std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
     XBT_DEBUG("token : %s", token_iter->c_str());
     Tokenizer factor_values(*token_iter, factor_separator);
     s_smpi_factor_t fact;
-    if (factor_values.begin() == factor_values.end()) {
-      xbt_die("Malformed radical for smpi factor: '%s'", smpi_coef_string.c_str());
-    }
+    xbt_assert(factor_values.begin() != factor_values.end(), "Malformed radical for smpi factor: '%s'",
+               smpi_coef_string.c_str());
     unsigned int iteration = 0;
     for (Tokenizer::iterator factor_iter = factor_values.begin(); factor_iter != factor_values.end(); ++factor_iter) {
       iteration++;
@@ -130,13 +131,18 @@ void print_time_analysis(double global_time){
   }
 }
 
-void print_memory_analysis(){
-  if (simgrid::smpi::F2C::lookup() != nullptr &&
-      simgrid::smpi::F2C::lookup()->size() > simgrid::smpi::F2C::get_num_default_handles()) {
+void print_memory_analysis()
+{
+  size_t leak_count = 0;
+  if (simgrid::smpi::F2C::lookup() != nullptr)
+    leak_count =
+        std::count_if(simgrid::smpi::F2C::lookup()->cbegin(), simgrid::smpi::F2C::lookup()->cend(),
+                      [](auto const& entry) { return entry.first >= simgrid::smpi::F2C::get_num_default_handles(); });
+  if (leak_count > 0) {
     XBT_INFO("Probable memory leaks in your code: SMPI detected %zu unfreed MPI handles : "
              "display types and addresses (n max) with --cfg=smpi/list-leaks:n.\n"
              "Running smpirun with -wrapper \"valgrind --leak-check=full\" can provide more information",
-             simgrid::smpi::F2C::lookup()->size() - simgrid::smpi::F2C::get_num_default_handles());
+             leak_count);
     int n = simgrid::config::get_value<int>("smpi/list-leaks");
     for (auto const& p : *simgrid::smpi::F2C::lookup()) {
       static int printed = 0;
@@ -163,7 +169,6 @@ void print_memory_analysis(){
       XBT_INFO("%lu bytes were automatically shared between processes, in %u calls\n", total_shared_size, total_shared_calls);
   }
 }
-
 }
 }
 } // namespace simgrid
index 84751b0..a10451b 100644 (file)
@@ -65,6 +65,8 @@ void Comm::destroy(Comm* comm)
     Comm::destroy(smpi_process()->comm_world());
     return;
   }
+  if(comm != MPI_COMM_WORLD && comm != MPI_COMM_SELF)
+    comm->mark_as_deleted();
   Comm::unref(comm);
 }
 
@@ -111,7 +113,10 @@ int Comm::dup(MPI_Comm* newcomm){
   if(info_!=MPI_INFO_NULL)
     (*newcomm)->info_ = new simgrid::smpi::Info(info_);
   //duplicate errhandler
-  (*newcomm)->set_errhandler(errhandler_);
+  if (errhandlers_ != nullptr)//MPI_COMM_WORLD, only grab our own
+    (*newcomm)->set_errhandler(errhandlers_[this->rank()]);
+  else
+    (*newcomm)->set_errhandler(errhandler_);
   return ret;
 }
 
index 3f6b298..d504388 100644 (file)
@@ -21,11 +21,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_datatype, smpi, "Logging specific to SMPI (
 
 static std::unordered_map<std::string, simgrid::smpi::Datatype*> id2type_lookup;
 
-#define CREATE_MPI_DATATYPE(name, id, type)                                                                            \
+#define CREATE_MPI_DATATYPE(name, id, type, flag)                                                                            \
   simgrid::smpi::Datatype _XBT_CONCAT(smpi_MPI_, name)((char*)"MPI_"#name, (id), sizeof(type), /* size */   \
                                                          0,                                               /* lb */     \
                                                          sizeof(type), /* ub = lb + size */                            \
-                                                         DT_FLAG_BASIC /* flags */                                     \
+                                                         DT_FLAG_BASIC | flag /* flags */                                     \
                                                          );
 
 #define CREATE_MPI_DATATYPE_NULL(name, id)                                                                             \
@@ -37,71 +37,71 @@ static std::unordered_map<std::string, simgrid::smpi::Datatype*> id2type_lookup;
 
 // Predefined data types
 CREATE_MPI_DATATYPE_NULL(DATATYPE_NULL, -1)
-CREATE_MPI_DATATYPE(DOUBLE, 0, double)
-CREATE_MPI_DATATYPE(INT, 1, int)
-CREATE_MPI_DATATYPE(CHAR, 2, char)
-CREATE_MPI_DATATYPE(SHORT, 3, short)
-CREATE_MPI_DATATYPE(LONG, 4, long)
-CREATE_MPI_DATATYPE(FLOAT, 5, float)
-CREATE_MPI_DATATYPE(BYTE, 6, int8_t)
-CREATE_MPI_DATATYPE(LONG_LONG, 7, long long)
-CREATE_MPI_DATATYPE(SIGNED_CHAR, 8, signed char)
-CREATE_MPI_DATATYPE(UNSIGNED_CHAR, 9, unsigned char)
-CREATE_MPI_DATATYPE(UNSIGNED_SHORT, 10, unsigned short)
-CREATE_MPI_DATATYPE(UNSIGNED, 11, unsigned int)
-CREATE_MPI_DATATYPE(UNSIGNED_LONG, 12, unsigned long)
-CREATE_MPI_DATATYPE(UNSIGNED_LONG_LONG, 13, unsigned long long)
-CREATE_MPI_DATATYPE(LONG_DOUBLE, 14, long double)
-CREATE_MPI_DATATYPE(WCHAR, 15, wchar_t)
-CREATE_MPI_DATATYPE(C_BOOL, 16, bool)
-CREATE_MPI_DATATYPE(INT8_T, 17, int8_t)
-CREATE_MPI_DATATYPE(INT16_T, 18, int16_t)
-CREATE_MPI_DATATYPE(INT32_T, 19, int32_t)
-CREATE_MPI_DATATYPE(INT64_T, 20, int64_t)
-CREATE_MPI_DATATYPE(UINT8_T, 21, uint8_t)
-CREATE_MPI_DATATYPE(UINT16_T, 22, uint16_t)
-CREATE_MPI_DATATYPE(UINT32_T, 23, uint32_t)
-CREATE_MPI_DATATYPE(UINT64_T, 24, uint64_t)
-CREATE_MPI_DATATYPE(C_FLOAT_COMPLEX, 25, float _Complex)
-CREATE_MPI_DATATYPE(C_DOUBLE_COMPLEX, 26, double _Complex)
-CREATE_MPI_DATATYPE(C_LONG_DOUBLE_COMPLEX, 27, long double _Complex)
-CREATE_MPI_DATATYPE(AINT, 28, MPI_Aint)
-CREATE_MPI_DATATYPE(OFFSET, 29, MPI_Offset)
-
-CREATE_MPI_DATATYPE(FLOAT_INT, 30, float_int)
-CREATE_MPI_DATATYPE(LONG_INT, 31, long_int)
-CREATE_MPI_DATATYPE(DOUBLE_INT, 32, double_int)
-CREATE_MPI_DATATYPE(SHORT_INT, 33, short_int)
-CREATE_MPI_DATATYPE(2INT, 34, int_int)
-CREATE_MPI_DATATYPE(2FLOAT, 35, float_float)
-CREATE_MPI_DATATYPE(2DOUBLE, 36, double_double)
-CREATE_MPI_DATATYPE(2LONG, 37, long_long)
-
-CREATE_MPI_DATATYPE(REAL, 38, float)
-CREATE_MPI_DATATYPE(REAL4, 39, float)
-CREATE_MPI_DATATYPE(REAL8, 40, double)
-CREATE_MPI_DATATYPE(REAL16, 41, long double)
-CREATE_MPI_DATATYPE(COMPLEX8, 42, float_float)
-CREATE_MPI_DATATYPE(COMPLEX16, 43, double_double)
-CREATE_MPI_DATATYPE(COMPLEX32, 44, double_double)
-CREATE_MPI_DATATYPE(INTEGER1, 45, int)
-CREATE_MPI_DATATYPE(INTEGER2, 46, int16_t)
-CREATE_MPI_DATATYPE(INTEGER4, 47, int32_t)
-CREATE_MPI_DATATYPE(INTEGER8, 48, int64_t)
-CREATE_MPI_DATATYPE(INTEGER16, 49, integer128_t)
-
-CREATE_MPI_DATATYPE(LONG_DOUBLE_INT, 50, long_double_int)
-CREATE_MPI_DATATYPE(CXX_BOOL, 51, bool)
-CREATE_MPI_DATATYPE(CXX_FLOAT_COMPLEX, 52, std::complex<float>)
-CREATE_MPI_DATATYPE(CXX_DOUBLE_COMPLEX, 53, std::complex<double>)
-CREATE_MPI_DATATYPE(CXX_LONG_DOUBLE_COMPLEX, 54, std::complex<long double>)
+CREATE_MPI_DATATYPE(DOUBLE, 0, double, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(INT, 1, int, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(CHAR, 2, char, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(SHORT, 3, short, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(LONG, 4, long, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(FLOAT, 5, float, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(BYTE, 6, int8_t, DT_FLAG_BYTE)
+CREATE_MPI_DATATYPE(LONG_LONG, 7, long long, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(SIGNED_CHAR, 8, signed char, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UNSIGNED_CHAR, 9, unsigned char, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UNSIGNED_SHORT, 10, unsigned short, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UNSIGNED, 11, unsigned int, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UNSIGNED_LONG, 12, unsigned long, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UNSIGNED_LONG_LONG, 13, unsigned long long, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(LONG_DOUBLE, 14, long double, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(WCHAR, 15, wchar_t, DT_FLAG_BASIC)
+CREATE_MPI_DATATYPE(C_BOOL, 16, bool, DT_FLAG_LOGICAL)
+CREATE_MPI_DATATYPE(INT8_T, 17, int8_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(INT16_T, 18, int16_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(INT32_T, 19, int32_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(INT64_T, 20, int64_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UINT8_T, 21, uint8_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UINT16_T, 22, uint16_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UINT32_T, 23, uint32_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(UINT64_T, 24, uint64_t, DT_FLAG_C_INTEGER)
+CREATE_MPI_DATATYPE(C_FLOAT_COMPLEX, 25, float _Complex, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(C_DOUBLE_COMPLEX, 26, double _Complex, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(C_LONG_DOUBLE_COMPLEX, 27, long double _Complex, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(AINT, 28, MPI_Aint, DT_FLAG_MULTILANG)
+CREATE_MPI_DATATYPE(OFFSET, 29, MPI_Offset, DT_FLAG_MULTILANG)
+
+CREATE_MPI_DATATYPE(FLOAT_INT, 30, float_int, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(LONG_INT, 31, long_int, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(DOUBLE_INT, 32, double_int, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(SHORT_INT, 33, short_int, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(2INT, 34, int_int, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(2FLOAT, 35, float_float, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(2DOUBLE, 36, double_double, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(2LONG, 37, long_long, DT_FLAG_REDUCTION)
+
+CREATE_MPI_DATATYPE(REAL, 38, float, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(REAL4, 39, float, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(REAL8, 40, double, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(REAL16, 41, long double, DT_FLAG_FP)
+CREATE_MPI_DATATYPE(COMPLEX8, 42, float_float, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(COMPLEX16, 43, double_double, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(COMPLEX32, 44, double_double, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(INTEGER1, 45, int, DT_FLAG_F_INTEGER)
+CREATE_MPI_DATATYPE(INTEGER2, 46, int16_t, DT_FLAG_F_INTEGER)
+CREATE_MPI_DATATYPE(INTEGER4, 47, int32_t, DT_FLAG_F_INTEGER)
+CREATE_MPI_DATATYPE(INTEGER8, 48, int64_t, DT_FLAG_F_INTEGER)
+CREATE_MPI_DATATYPE(INTEGER16, 49, integer128_t, DT_FLAG_F_INTEGER)
+
+CREATE_MPI_DATATYPE(LONG_DOUBLE_INT, 50, long_double_int, DT_FLAG_REDUCTION)
+CREATE_MPI_DATATYPE(CXX_BOOL, 51, bool, DT_FLAG_LOGICAL)
+CREATE_MPI_DATATYPE(CXX_FLOAT_COMPLEX, 52, std::complex<float>, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(CXX_DOUBLE_COMPLEX, 53, std::complex<double>, DT_FLAG_COMPLEX)
+CREATE_MPI_DATATYPE(CXX_LONG_DOUBLE_COMPLEX, 54, std::complex<long double>, DT_FLAG_COMPLEX)
 
 CREATE_MPI_DATATYPE_NULL(UB, 55)
 CREATE_MPI_DATATYPE_NULL(LB, 56)
-CREATE_MPI_DATATYPE(PACKED, 57, char)
+CREATE_MPI_DATATYPE(PACKED, 57, char, DT_FLAG_PREDEFINED)
 // Internal use only
-CREATE_MPI_DATATYPE(PTR, 58, void*)
-CREATE_MPI_DATATYPE(COUNT, 59, long long)
+CREATE_MPI_DATATYPE(PTR, 58, void*, DT_FLAG_PREDEFINED)
+CREATE_MPI_DATATYPE(COUNT, 59, long long, DT_FLAG_MULTILANG)
 MPI_Datatype MPI_PTR = &smpi_MPI_PTR;
 
 
index 911ee58..48647a5 100644 (file)
@@ -30,8 +30,8 @@ namespace smpi{
     if (info_ != MPI_INFO_NULL)
       info_->ref();
     std::string fullname=filename;
-    if (simgrid::s4u::Host::current()->get_disks().empty())
-      xbt_die("SMPI/IO : Trying to open file on a diskless host ! Add one to your platform file");
+    xbt_assert(not simgrid::s4u::Host::current()->get_disks().empty(),
+               "SMPI/IO : Trying to open file on a diskless host ! Add one to your platform file");
 
     size_t found=fullname.find('/');
     //in case no fullpath is provided ... just pick the first mountpoint.
index cda3387..14b42bc 100644 (file)
@@ -63,7 +63,6 @@ APPLY_OP_LOOP(MPI_UNSIGNED, unsigned int,op)\
 APPLY_OP_LOOP(MPI_UNSIGNED_LONG, unsigned long,op)\
 APPLY_OP_LOOP(MPI_UNSIGNED_LONG_LONG, unsigned long long,op)\
 APPLY_OP_LOOP(MPI_WCHAR, wchar_t,op)\
-APPLY_OP_LOOP(MPI_BYTE, int8_t,op)\
 APPLY_OP_LOOP(MPI_INT8_T, int8_t,op)\
 APPLY_OP_LOOP(MPI_INT16_T, int16_t,op)\
 APPLY_OP_LOOP(MPI_INT32_T, int32_t,op)\
@@ -84,6 +83,9 @@ APPLY_OP_LOOP(MPI_COUNT, long long,op)
 #define APPLY_BOOL_OP_LOOP(op)\
 APPLY_OP_LOOP(MPI_C_BOOL, bool,op)
 
+#define APPLY_BYTE_OP_LOOP(op)\
+APPLY_OP_LOOP(MPI_BYTE, int8_t,op)
+
 #define APPLY_FLOAT_OP_LOOP(op)\
 APPLY_OP_LOOP(MPI_FLOAT, float,op)\
 APPLY_OP_LOOP(MPI_DOUBLE, double,op)\
@@ -177,6 +179,7 @@ static void band_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   APPLY_BASIC_OP_LOOP(BAND_OP)
   APPLY_BOOL_OP_LOOP(BAND_OP)
+  APPLY_BYTE_OP_LOOP(BAND_OP)
   APPLY_END_OP_LOOP(BAND_OP)
 }
 
@@ -184,6 +187,7 @@ static void bor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   APPLY_BASIC_OP_LOOP(BOR_OP)
   APPLY_BOOL_OP_LOOP(BOR_OP)
+  APPLY_BYTE_OP_LOOP(BOR_OP)
   APPLY_END_OP_LOOP(BOR_OP)
 }
 
@@ -191,6 +195,7 @@ static void bxor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
   APPLY_BASIC_OP_LOOP(BXOR_OP)
   APPLY_BOOL_OP_LOOP(BXOR_OP)
+  APPLY_BYTE_OP_LOOP(BXOR_OP)
   APPLY_END_OP_LOOP(BXOR_OP)
 }
 
@@ -216,23 +221,28 @@ static void no_func(void*, void*, int*, MPI_Datatype*)
   /* obviously a no-op */
 }
 
-#define CREATE_MPI_OP(name, func)                                                                                      \
-  SMPI_Op _XBT_CONCAT(smpi_MPI_, name)(&(func) /* func */, true, true);                                              \
-
-CREATE_MPI_OP(MAX, max_func)
-CREATE_MPI_OP(MIN, min_func)
-CREATE_MPI_OP(SUM, sum_func)
-CREATE_MPI_OP(PROD, prod_func)
-CREATE_MPI_OP(LAND, land_func)
-CREATE_MPI_OP(LOR, lor_func)
-CREATE_MPI_OP(LXOR, lxor_func)
-CREATE_MPI_OP(BAND, band_func)
-CREATE_MPI_OP(BOR, bor_func)
-CREATE_MPI_OP(BXOR, bxor_func)
-CREATE_MPI_OP(MAXLOC, maxloc_func)
-CREATE_MPI_OP(MINLOC, minloc_func)
-CREATE_MPI_OP(REPLACE, replace_func)
-CREATE_MPI_OP(NO_OP, no_func)
+
+#define CREATE_MPI_OP(name, func, types)                                                                                      \
+  SMPI_Op _XBT_CONCAT(smpi_MPI_, name)(&(func) /* func */, true, true, types);
+
+#define MAX_TYPES DT_FLAG_C_INTEGER|DT_FLAG_F_INTEGER|DT_FLAG_FP|DT_FLAG_MULTILANG
+#define LAND_TYPES DT_FLAG_C_INTEGER|DT_FLAG_FP|DT_FLAG_LOGICAL|DT_FLAG_MULTILANG
+#define BAND_TYPES DT_FLAG_C_INTEGER|DT_FLAG_FP|DT_FLAG_BYTE|DT_FLAG_MULTILANG
+
+CREATE_MPI_OP(MAX, max_func, MAX_TYPES)
+CREATE_MPI_OP(MIN, min_func, MAX_TYPES)
+CREATE_MPI_OP(SUM, sum_func, MAX_TYPES|DT_FLAG_COMPLEX)
+CREATE_MPI_OP(PROD, prod_func, MAX_TYPES|DT_FLAG_COMPLEX)
+CREATE_MPI_OP(LAND, land_func, LAND_TYPES)
+CREATE_MPI_OP(LOR, lor_func, LAND_TYPES)
+CREATE_MPI_OP(LXOR, lxor_func, LAND_TYPES)
+CREATE_MPI_OP(BAND, band_func, BAND_TYPES)
+CREATE_MPI_OP(BOR, bor_func, BAND_TYPES)
+CREATE_MPI_OP(BXOR, bxor_func, BAND_TYPES)
+CREATE_MPI_OP(MAXLOC, maxloc_func, DT_FLAG_REDUCTION)
+CREATE_MPI_OP(MINLOC, minloc_func, DT_FLAG_REDUCTION)
+CREATE_MPI_OP(REPLACE, replace_func, 0)
+CREATE_MPI_OP(NO_OP, no_func, 0)
 
 namespace simgrid{
 namespace smpi{
index 14bc5ce..72e5cfa 100644 (file)
@@ -73,31 +73,29 @@ void Request::ref(){
 
 void Request::unref(MPI_Request* request)
 {
-  if((*request) != MPI_REQUEST_NULL){
-    (*request)->refcount_--;
-    if((*request)->refcount_ < 0) {
-      (*request)->print_request("wrong refcount");
-      xbt_die("Whoops, wrong refcount");
-    }
-    if((*request)->refcount_==0){
-      if ((*request)->flags_ & MPI_REQ_GENERALIZED){
-        ((*request)->generalized_funcs)->free_fn(((*request)->generalized_funcs)->extra_state);
-      }else{
-        Comm::unref((*request)->comm_);
-        Datatype::unref((*request)->old_type_);
-      }
-      if ((*request)->op_!=MPI_REPLACE && (*request)->op_!=MPI_OP_NULL)
-        Op::unref(&(*request)->op_);
+  xbt_assert(*request != MPI_REQUEST_NULL, "freeing an already free request");
 
-      (*request)->print_request("Destroying");
-      F2C::free_f((*request)->c2f());
-      delete *request;
-      *request = MPI_REQUEST_NULL;
-    }else{
-      (*request)->print_request("Decrementing");
+  (*request)->refcount_--;
+  if ((*request)->refcount_ < 0) {
+    (*request)->print_request("wrong refcount");
+    xbt_die("Whoops, wrong refcount");
+  }
+  if ((*request)->refcount_ == 0) {
+    if ((*request)->flags_ & MPI_REQ_GENERALIZED) {
+      ((*request)->generalized_funcs)->free_fn(((*request)->generalized_funcs)->extra_state);
+    } else {
+      Comm::unref((*request)->comm_);
+      Datatype::unref((*request)->old_type_);
     }
-  }else{
-    xbt_die("freeing an already free request");
+    if ((*request)->op_ != MPI_REPLACE && (*request)->op_ != MPI_OP_NULL)
+      Op::unref(&(*request)->op_);
+
+    (*request)->print_request("Destroying");
+    F2C::free_f((*request)->c2f());
+    delete *request;
+    *request = MPI_REQUEST_NULL;
+  } else {
+    (*request)->print_request("Decrementing");
   }
 }
 
@@ -119,9 +117,13 @@ bool Request::match_common(MPI_Request req, MPI_Request sender, MPI_Request rece
       receiver->real_src_ = sender->src_;
     if (receiver->tag_ == MPI_ANY_TAG)
       receiver->real_tag_ = sender->tag_;
-    if (receiver->real_size_ < sender->real_size_ && ((receiver->flags_ & MPI_REQ_PROBE) == 0 )){
-      XBT_DEBUG("Truncating message - should not happen: receiver size : %zu < sender size : %zu", receiver->real_size_, sender->real_size_);
-      receiver->truncated_ = true;
+    if ((receiver->flags_ & MPI_REQ_PROBE) == 0 ){
+      if (receiver->real_size_ < sender->real_size_){
+        XBT_DEBUG("Truncating message - should not happen: receiver size : %zu < sender size : %zu", receiver->real_size_, sender->real_size_);
+        receiver->truncated_ = true;
+      } else if (receiver->real_size_ > sender->real_size_){
+        receiver->real_size_=sender->real_size_;
+      }
     }
     if (sender->detached_)
       receiver->detached_sender_ = sender; // tie the sender to the receiver, as it is detached and has to be freed in
@@ -315,12 +317,13 @@ MPI_Request Request::irecv(void *buf, int count, MPI_Datatype datatype, int src,
   return request;
 }
 
-void Request::recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
+int Request::recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
 {
   MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
   request = irecv(buf, count, datatype, src, tag, comm);
-  wait(&request,status);
+  int retval = wait(&request,status);
   request = nullptr;
+  return retval;
 }
 
 void Request::bsend(const void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
@@ -1025,6 +1028,9 @@ int Request::wait(MPI_Request * request, MPI_Status * status)
     ret = ((*request)->generalized_funcs)->query_fn(((*request)->generalized_funcs)->extra_state, mystatus);
   }
 
+  if ((*request)->truncated_)
+    ret = MPI_ERR_TRUNCATE;
+
   finish_wait(request, status); // may invalidate *request
   if (*request != MPI_REQUEST_NULL && (((*request)->flags_ & MPI_REQ_NON_PERSISTENT) != 0))
     *request = MPI_REQUEST_NULL;
index bc35012..b04f1b7 100644 (file)
@@ -520,8 +520,7 @@ int Win::post(MPI_Group group, int /*assert*/)
 }
 
 int Win::complete(){
-  if(opened_==0)
-    xbt_die("Complete called on already opened MPI_Win");
+  xbt_assert(opened_ != 0, "Complete called on already opened MPI_Win");
 
   XBT_DEBUG("Entering MPI_Win_Complete");
   int i             = 0;
index e5c6467..3e4d408 100644 (file)
@@ -153,6 +153,11 @@ void HostImpl::remove_disk(const std::string& disk_name)
 
 void HostImpl::seal()
 {
+  if (sealed_) {
+    return;
+  }
+  // seals host's CPU
+  get_iface()->pimpl_cpu->seal();
   sealed_ = true;
 }
 } // namespace surf
index e15a33c..dd0d66d 100644 (file)
@@ -129,6 +129,9 @@ Cpu* Cpu::set_speed_profile(kernel::profile::Profile* profile)
 
 void Cpu::seal()
 {
+  if (is_sealed()) {
+    return;
+  }
   lmm::System* lmm = get_model()->get_maxmin_system();
   if (dynamic_cast<CpuTiModel*>(get_model()) == nullptr)
     this->set_constraint(lmm->constraint_new(this, core_count_ * speed_per_pstate_.front()));
index bce17e5..b51fe9c 100644 (file)
@@ -56,11 +56,10 @@ CpuTiProfile::CpuTiProfile(const profile::Profile* profile)
  */
 double CpuTiTmgr::integrate(double a, double b) const
 {
-  if ((a < 0.0) || (a > b)) {
-    xbt_die("Error, invalid integration interval [%.2f,%.2f]. "
-            "You probably have a task executing with negative computation amount. Check your code.",
-            a, b);
-  }
+  xbt_assert(a >= 0.0 && a <= b,
+             "Error, invalid integration interval [%.2f,%.2f]. You probably have a task executing with negative "
+             "computation amount. Check your code.",
+             a, b);
   if (fabs(a - b) < EPSILON)
     return 0.0;
 
index 74414df..3ddb8ce 100644 (file)
@@ -76,39 +76,32 @@ namespace resource {
 
 NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
 {
-  if (config::get_value<std::string>("network/optim") == "Lazy")
-    set_update_algorithm(Model::UpdateAlgo::LAZY);
-
   std::string optim = config::get_value<std::string>("network/optim");
   bool select       = config::get_value<bool>("network/maxmin-selective-update");
 
   if (optim == "Lazy") {
+    set_update_algorithm(Model::UpdateAlgo::LAZY);
     xbt_assert(select || config::is_default("network/maxmin-selective-update"),
                "You cannot disable network selective update when using the lazy update mechanism");
     select = true;
   }
 
   set_maxmin_system(new lmm::System(select));
-  loopback_ = NetworkCm02Model::create_link("__loopback__",
-                                            std::vector<double>{config::get_value<double>("network/loopback-bw")},
-                                            s4u::Link::SharingPolicy::FATPIPE)
+  loopback_ = create_link("__loopback__", std::vector<double>{config::get_value<double>("network/loopback-bw")})
+                  ->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE)
                   ->set_latency(config::get_value<double>("network/loopback-lat"));
   loopback_->seal();
 }
 
-LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                        s4u::Link::SharingPolicy policy)
+LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
-  LinkImpl* link;
-  if (policy == s4u::Link::SharingPolicy::WIFI) {
-    link = new NetworkWifiLink(name, bandwidths, get_maxmin_system());
-  } else {
-    xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
-    link = new NetworkCm02Link(name, bandwidths[0], policy, get_maxmin_system());
-  }
+  xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
+  return (new NetworkCm02Link(name, bandwidths[0], get_maxmin_system()))->set_model(this);
+}
 
-  link->set_model(this);
-  return link;
+LinkImpl* NetworkCm02Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return (new NetworkWifiLink(name, bandwidths, get_maxmin_system()))->set_model(this);
 }
 
 void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
@@ -316,16 +309,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
 /************
  * Resource *
  ************/
-NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy,
-                                 kernel::lmm::System* system)
+NetworkCm02Link::NetworkCm02Link(const std::string& name, double bandwidth, kernel::lmm::System* system)
     : LinkImpl(name)
 {
   bandwidth_.scale = 1.0;
   bandwidth_.peak  = bandwidth;
   this->set_constraint(system->constraint_new(this, sg_bandwidth_factor * bandwidth));
-
-  if (policy == s4u::Link::SharingPolicy::FATPIPE)
-    get_constraint()->unshare();
 }
 
 void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
index 3cdf433..da0d5cd 100644 (file)
@@ -31,8 +31,8 @@ class XBT_PRIVATE NetworkSmpiModel;
 class NetworkCm02Model : public NetworkModel {
 public:
   explicit NetworkCm02Model(const std::string& name);
-  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                        s4u::Link::SharingPolicy policy) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
   void update_actions_state_lazy(double now, double delta) override;
   void update_actions_state_full(double now, double delta) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
@@ -44,7 +44,7 @@ public:
 
 class NetworkCm02Link : public LinkImpl {
 public:
-  NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, lmm::System* system);
+  NetworkCm02Link(const std::string& name, double bandwidth, lmm::System* system);
   void apply_event(kernel::profile::Event* event, double value) override;
   void set_bandwidth(double value) override;
   LinkImpl* set_latency(double value) override;
index 64a2492..e24ea76 100644 (file)
@@ -26,8 +26,7 @@ namespace simgrid {
 namespace kernel {
 namespace resource {
 
-LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/,
-                                            s4u::Link::SharingPolicy)
+LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::vector<double>& /*bandwidth*/)
 {
   xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
           "Please remove any link from your platform (and switch to routing='None')",
@@ -35,10 +34,15 @@ LinkImpl* NetworkConstantModel::create_link(const std::string& name, const std::
   return nullptr;
 }
 
+LinkImpl* NetworkConstantModel::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return create_link(name, bandwidths);
+}
+
 double NetworkConstantModel::next_occurring_event(double /*now*/)
 {
   double min = -1.0;
-  for (kernel::resource::Action const& action : *get_started_action_set()) {
+  for (Action const& action : *get_started_action_set()) {
     const auto& net_action = static_cast<const NetworkConstantAction&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
       min = net_action.latency_;
@@ -58,7 +62,7 @@ void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
         action.latency_ = 0.0;
       }
     }
-    action.update_remains(action.get_cost() * delta / action.initial_latency_);
+    action.update_remains(action.get_cost() * delta / sg_latency_factor);
     action.update_max_duration(delta);
 
     if ((action.get_remains_no_update() <= 0) ||
@@ -68,9 +72,9 @@ void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
   }
 }
 
-Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double size, double)
+Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double size, double /*rate*/)
 {
-  auto* action = new NetworkConstantAction(this, *src, *dst, size, sg_latency_factor);
+  auto* action = new NetworkConstantAction(this, *src, *dst, size);
 
   s4u::Link::on_communicate(*action);
   return action;
@@ -79,17 +83,14 @@ Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double
 /**********
  * Action *
  **********/
-NetworkConstantAction::NetworkConstantAction(NetworkConstantModel* model_, s4u::Host& src, s4u::Host& dst, double size,
-                                             double latency)
-    : NetworkAction(model_, src, dst, size, false), initial_latency_(latency)
+NetworkConstantAction::NetworkConstantAction(NetworkConstantModel* model_, s4u::Host& src, s4u::Host& dst, double size)
+    : NetworkAction(model_, src, dst, size, false)
 {
-  latency_ = latency;
+  latency_ = sg_latency_factor;
   if (latency_ <= 0.0)
     NetworkConstantAction::set_state(Action::State::FINISHED);
 }
 
-NetworkConstantAction::~NetworkConstantAction() = default;
-
 void NetworkConstantAction::update_remains_lazy(double /*now*/)
 {
   THROW_IMPOSSIBLE;
index d60f9b6..c570741 100644 (file)
@@ -6,8 +6,6 @@
 #ifndef NETWORK_CONSTANT_HPP_
 #define NETWORK_CONSTANT_HPP_
 
-#include <xbt/base.h>
-
 #include "network_interface.hpp"
 
 namespace simgrid {
@@ -21,15 +19,13 @@ public:
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
-  LinkImpl* create_link(const std::string& name, const std::vector<double>& bws,
-                        s4u::Link::SharingPolicy policy) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bws) override;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bws) override;
 };
 
 class NetworkConstantAction : public NetworkAction {
 public:
-  NetworkConstantAction(NetworkConstantModel* model_, s4u::Host& src, s4u::Host& dst, double size, double latency);
-  ~NetworkConstantAction() override;
-  double initial_latency_;
+  NetworkConstantAction(NetworkConstantModel* model_, s4u::Host& src, s4u::Host& dst, double size);
   void update_remains_lazy(double now) override;
 };
 
index b09cd48..bf7aa29 100644 (file)
@@ -38,7 +38,7 @@ static void IB_action_state_changed_callback(simgrid::kernel::resource::NetworkA
   std::pair<IBNode*, IBNode*> pair = ibModel->active_comms[&action];
   XBT_DEBUG("IB callback - action %p finished", &action);
 
-  ibModel->updateIBfactors(&action, pair.first, pair.second, 1);
+  ibModel->update_IB_factors(&action, pair.first, pair.second, 1);
 
   ibModel->active_comms.erase(&action);
 }
@@ -50,7 +50,7 @@ static void IB_action_init_callback(simgrid::kernel::resource::NetworkAction& ac
   auto* act_dst = &ibModel->active_nodes.at(action.get_dst().get_name());
 
   ibModel->active_comms[&action] = std::make_pair(act_src, act_dst);
-  ibModel->updateIBfactors(&action, act_src, act_dst, 0);
+  ibModel->update_IB_factors(&action, act_src, act_dst, 0);
 }
 
 /*********
@@ -93,49 +93,49 @@ NetworkIBModel::NetworkIBModel(const std::string& name) : NetworkSmpiModel(name)
                                                   "elements, semi-colon separated. Example: 0.965;0.925;1.35");
 
   try {
-    Be = std::stod(radical_elements.front());
+    Be_ = std::stod(radical_elements.front());
   } catch (const std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("First part of smpi/IB-penalty-factors is not numerical:") + ia.what());
   }
 
   try {
-    Bs = std::stod(radical_elements.at(1));
+    Bs_ = std::stod(radical_elements.at(1));
   } catch (const std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Second part of smpi/IB-penalty-factors is not numerical:") + ia.what());
   }
 
   try {
-    ys = std::stod(radical_elements.back());
+    ys_ = std::stod(radical_elements.back());
   } catch (const std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Third part of smpi/IB-penalty-factors is not numerical:") + ia.what());
   }
 }
 
-void NetworkIBModel::computeIBfactors(IBNode* root) const
+void NetworkIBModel::compute_IB_factors(IBNode* root) const
 {
-  double num_comm_out    = root->ActiveCommsUp.size();
+  double num_comm_out    = root->active_comms_up_.size();
   double max_penalty_out = 0.0;
   // first, compute all outbound penalties to get their max
-  for (ActiveComm const* comm : root->ActiveCommsUp) {
+  for (ActiveComm const* comm : root->active_comms_up_) {
     double my_penalty_out = 1.0;
 
     if (num_comm_out != 1) {
-      if (comm->destination->nbActiveCommsDown > 2) // number of comms sent to the receiving node
-        my_penalty_out = num_comm_out * Bs * ys;
+      if (comm->destination->nb_active_comms_down_ > 2) // number of comms sent to the receiving node
+        my_penalty_out = num_comm_out * Bs_ * ys_;
       else
-        my_penalty_out = num_comm_out * Bs;
+        my_penalty_out = num_comm_out * Bs_;
     }
 
     max_penalty_out = std::max(max_penalty_out, my_penalty_out);
   }
 
-  for (ActiveComm* comm : root->ActiveCommsUp) {
+  for (ActiveComm* comm : root->active_comms_up_) {
     // compute inbound penalty
     double my_penalty_in = 1.0;
-    int nb_comms         = comm->destination->nbActiveCommsDown; // total number of incoming comms
+    int nb_comms         = comm->destination->nb_active_comms_down_; // total number of incoming comms
     if (nb_comms != 1)
-      my_penalty_in = (comm->destination->ActiveCommsDown)[root]        // number of comm sent to dest by root node
-                      * Be * comm->destination->ActiveCommsDown.size(); // number of different nodes sending to dest
+      my_penalty_in = (comm->destination->active_comms_down_)[root]         // number of comm sent to dest by root node
+                      * Be_ * comm->destination->active_comms_down_.size(); // number of different nodes sending to dest
 
     double penalty = std::max(my_penalty_in, max_penalty_out);
 
@@ -147,51 +147,51 @@ void NetworkIBModel::computeIBfactors(IBNode* root) const
     double penalized_bw = num_comm_out ? comm->init_rate / penalty : comm->init_rate;
 
     if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
-      XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,
-                comm->destination->id, comm->action, penalized_bw, comm->action->get_bound(), comm->init_rate);
+      XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id_,
+                comm->destination->id_, comm->action, penalized_bw, comm->action->get_bound(), comm->init_rate);
       get_maxmin_system()->update_variable_bound(comm->action->get_variable(), penalized_bw);
     } else {
-      XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, comm->destination->id,
+      XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id_, comm->destination->id_,
                 comm->action, penalized_bw, comm->init_rate);
     }
   }
   XBT_DEBUG("Finished computing IB penalties");
 }
 
-void NetworkIBModel::updateIBfactors_rec(IBNode* root, std::vector<bool>& updatedlist) const
+void NetworkIBModel::update_IB_factors_rec(IBNode* root, std::vector<bool>& updatedlist) const
 {
-  if (not updatedlist[root->id]) {
-    XBT_DEBUG("IB - Updating rec %d", root->id);
-    computeIBfactors(root);
-    updatedlist[root->id] = true;
-    for (ActiveComm const* comm : root->ActiveCommsUp) {
-      if (not updatedlist[comm->destination->id])
-        updateIBfactors_rec(comm->destination, updatedlist);
+  if (not updatedlist[root->id_]) {
+    XBT_DEBUG("IB - Updating rec %d", root->id_);
+    compute_IB_factors(root);
+    updatedlist[root->id_] = true;
+    for (ActiveComm const* comm : root->active_comms_up_) {
+      if (not updatedlist[comm->destination->id_])
+        update_IB_factors_rec(comm->destination, updatedlist);
     }
-    for (std::map<IBNode*, int>::value_type const& comm : root->ActiveCommsDown) {
-      if (not updatedlist[comm.first->id])
-        updateIBfactors_rec(comm.first, updatedlist);
+    for (std::map<IBNode*, int>::value_type const& comm : root->active_comms_down_) {
+      if (not updatedlist[comm.first->id_])
+        update_IB_factors_rec(comm.first, updatedlist);
     }
   }
 }
 
-void NetworkIBModel::updateIBfactors(NetworkAction* action, IBNode* from, IBNode* to, int remove) const
+void NetworkIBModel::update_IB_factors(NetworkAction* action, IBNode* from, IBNode* to, int remove) const
 {
   if (from == to) // disregard local comms (should use loopback)
     return;
 
   if (remove) {
-    if (to->ActiveCommsDown[from] == 1)
-      to->ActiveCommsDown.erase(from);
+    if (to->active_comms_down_[from] == 1)
+      to->active_comms_down_.erase(from);
     else
-      to->ActiveCommsDown[from] -= 1;
+      to->active_comms_down_[from] -= 1;
 
-    to->nbActiveCommsDown--;
-    auto it = std::find_if(begin(from->ActiveCommsUp), end(from->ActiveCommsUp),
+    to->nb_active_comms_down_--;
+    auto it = std::find_if(begin(from->active_comms_up_), end(from->active_comms_up_),
                            [action](const ActiveComm* comm) { return comm->action == action; });
-    if (it != std::end(from->ActiveCommsUp)) {
+    if (it != std::end(from->active_comms_up_)) {
       delete *it;
-      from->ActiveCommsUp.erase(it);
+      from->active_comms_up_.erase(it);
     }
     action->unref();
   } else {
@@ -199,15 +199,15 @@ void NetworkIBModel::updateIBfactors(NetworkAction* action, IBNode* from, IBNode
     auto* comm        = new ActiveComm();
     comm->action      = action;
     comm->destination = to;
-    from->ActiveCommsUp.push_back(comm);
+    from->active_comms_up_.push_back(comm);
 
-    to->ActiveCommsDown[from] += 1;
-    to->nbActiveCommsDown++;
+    to->active_comms_down_[from] += 1;
+    to->nb_active_comms_down_++;
   }
-  XBT_DEBUG("IB - Updating %d", from->id);
+  XBT_DEBUG("IB - Updating %d", from->id_);
   std::vector<bool> updated(active_nodes.size(), false);
-  updateIBfactors_rec(from, updated);
-  XBT_DEBUG("IB - Finished updating %d", from->id);
+  update_IB_factors_rec(from, updated);
+  XBT_DEBUG("IB - Finished updating %d", from->id_);
 }
 } // namespace resource
 } // namespace kernel
index 8d8e2e4..ad0185d 100644 (file)
@@ -27,28 +27,28 @@ struct XBT_PRIVATE ActiveComm {
 
 class IBNode {
 public:
-  int id;
+  int id_;
   // store related links, to ease computation of the penalties
-  std::vector<ActiveComm*> ActiveCommsUp;
+  std::vector<ActiveComm*> active_comms_up_;
   // store the number of comms received from each node
-  std::map<IBNode*, int> ActiveCommsDown;
+  std::map<IBNode*, int> active_comms_down_;
   // number of comms the node is receiving
-  int nbActiveCommsDown = 0;
-  explicit IBNode(int id) : id(id){};
+  int nb_active_comms_down_ = 0;
+  explicit IBNode(int id) : id_(id){};
 };
 
 class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
-  double Bs;
-  double Be;
-  double ys;
-  void updateIBfactors_rec(IBNode* root, std::vector<bool>& updatedlist) const;
-  void computeIBfactors(IBNode* root) const;
+  double Bs_;
+  double Be_;
+  double ys_;
+  void update_IB_factors_rec(IBNode* root, std::vector<bool>& updatedlist) const;
+  void compute_IB_factors(IBNode* root) const;
 
 public:
   explicit NetworkIBModel(const std::string& name);
   NetworkIBModel(const NetworkIBModel&) = delete;
   NetworkIBModel& operator=(const NetworkIBModel&) = delete;
-  void updateIBfactors(NetworkAction* action, IBNode* from, IBNode* to, int remove) const;
+  void update_IB_factors(NetworkAction* action, IBNode* from, IBNode* to, int remove) const;
 
   std::unordered_map<std::string, IBNode> active_nodes;
   std::unordered_map<NetworkAction*, std::pair<IBNode*, IBNode*>> active_comms;
index c08c283..4ffd1df 100644 (file)
@@ -108,6 +108,11 @@ double LinkImpl::get_bandwidth() const
   return bandwidth_.peak * bandwidth_.scale;
 }
 
+LinkImpl* LinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy)
+{
+  get_constraint()->set_sharing_policy(policy);
+  return this;
+}
 s4u::Link::SharingPolicy LinkImpl::get_sharing_policy() const
 {
   return get_constraint()->get_sharing_policy();
index 5cbb9c4..e03a73d 100644 (file)
@@ -47,8 +47,9 @@ public:
    * @param bandwidth The initial bandwidth of the Link in bytes per second
    * @param policy The sharing policy of the Link
    */
-  virtual LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                s4u::Link::SharingPolicy policy) = 0;
+  virtual LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
+
+  virtual LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) = 0;
 
   /**
    * @brief Create a communication between two hosts.
@@ -137,6 +138,7 @@ public:
   virtual LinkImpl* set_latency(double value) = 0;
 
   /** @brief The sharing policy */
+  virtual LinkImpl* set_sharing_policy(s4u::Link::SharingPolicy policy);
   virtual s4u::Link::SharingPolicy get_sharing_policy() const;
 
   /** @brief Check if the Link is used */
index 0dbd1ef..6e4a467 100644 (file)
@@ -105,8 +105,8 @@ static void zoneCreation_cb(simgrid::s4u::NetZone const& zone)
   int mcs_value    = mcs ? atoi(mcs) : 3;
   int nss_value    = nss ? atoi(nss) : 1;
 #if NS3_MINOR_VERSION < 30
-  if (nss_value != 1 + (mcs_value / 8))
-    xbt_die("On NS3 < 3.30, NSS value has to satisfy NSS == 1+(MCS/8) constraint. Bailing out");
+  xbt_assert(nss_value == 1 + (mcs_value / 8),
+             "On NS3 < 3.30, NSS value has to satisfy NSS == 1+(MCS/8) constraint. Bailing out");
 #endif
   wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "ControlMode", ns3::StringValue("HtMcs0"), "DataMode",
                                ns3::StringValue("HtMcs" + std::to_string(mcs_value)));
@@ -327,13 +327,15 @@ NetworkNS3Model::NetworkNS3Model(const std::string& name) : NetworkModel(name)
   s4u::NetZone::on_seal.connect(&zoneCreation_cb);
 }
 
-LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                       s4u::Link::SharingPolicy policy)
+LinkImpl* NetworkNS3Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(bandwidths.size() == 1, "ns-3 links must use only 1 bandwidth.");
-  auto link = new LinkNS3(name, bandwidths[0], policy);
-  link->set_model(this);
-  return link;
+  return (new LinkNS3(name, bandwidths[0]))->set_model(this);
+}
+
+LinkImpl* NetworkNS3Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
+{
+  return create_link(name, bandwidths)->set_sharing_policy(s4u::Link::SharingPolicy::WIFI);
 }
 
 Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
@@ -434,8 +436,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta)
  * Resource *
  ************/
 
-LinkNS3::LinkNS3(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy)
-    : LinkImpl(name), sharing_policy_(policy)
+LinkNS3::LinkNS3(const std::string& name, double bandwidth) : LinkImpl(name)
 {
   bandwidth_.peak = bandwidth;
 }
@@ -464,6 +465,12 @@ LinkImpl* LinkNS3::set_latency(double latency)
   latency_.peak = latency;
   return this;
 }
+
+LinkImpl* LinkNS3::set_sharing_policy(s4u::Link::SharingPolicy policy)
+{
+  sharing_policy_ = policy;
+  return this;
+}
 /**********
  * Action *
  **********/
@@ -574,33 +581,32 @@ void ns3_add_direct_route(simgrid::kernel::routing::NetPoint* src, simgrid::kern
   xbt_assert(host_src != nullptr, "Network element %s does not seem to be ns-3-ready", src->get_cname());
   xbt_assert(host_dst != nullptr, "Network element %s does not seem to be ns-3-ready", dst->get_cname());
 
-  if (policy == simgrid::s4u::Link::SharingPolicy::WIFI) {
-    xbt_die("The wifi sharing policy is not supported for links. You want to use a wifi zone (see documentation).");
-  } else {
-    ns3::PointToPointHelper pointToPoint;
+  xbt_assert(policy != simgrid::s4u::Link::SharingPolicy::WIFI,
+             "The wifi sharing policy is not supported for links. You want to use a wifi zone (see documentation).");
 
-    XBT_DEBUG("\tAdd PTP from %s to %s bw:'%f Bps' lat:'%fs'", src->get_cname(), dst->get_cname(), bw, lat);
-    pointToPoint.SetDeviceAttribute("DataRate",
-                                    ns3::DataRateValue(ns3::DataRate(bw * 8))); // ns-3 takes bps, but we provide Bps
-    pointToPoint.SetChannelAttribute("Delay", ns3::TimeValue(ns3::Seconds(lat)));
+  ns3::PointToPointHelper pointToPoint;
 
-    netA.Add(pointToPoint.Install(host_src->ns3_node_, host_dst->ns3_node_));
+  XBT_DEBUG("\tAdd PTP from %s to %s bw:'%f Bps' lat:'%fs'", src->get_cname(), dst->get_cname(), bw, lat);
+  pointToPoint.SetDeviceAttribute("DataRate",
+                                  ns3::DataRateValue(ns3::DataRate(bw * 8))); // ns-3 takes bps, but we provide Bps
+  pointToPoint.SetChannelAttribute("Delay", ns3::TimeValue(ns3::Seconds(lat)));
 
-    std::string addr = simgrid::xbt::string_printf("%d.%d.0.0", number_of_networks, number_of_links);
-    address.SetBase(addr.c_str(), "255.255.0.0");
-    XBT_DEBUG("\tInterface stack '%s'", addr.c_str());
+  netA.Add(pointToPoint.Install(host_src->ns3_node_, host_dst->ns3_node_));
+
+  std::string addr = simgrid::xbt::string_printf("%d.%d.0.0", number_of_networks, number_of_links);
+  address.SetBase(addr.c_str(), "255.255.0.0");
+  XBT_DEBUG("\tInterface stack '%s'", addr.c_str());
 
-    auto addresses = address.Assign(netA);
+  auto addresses = address.Assign(netA);
 
-    host_src->ipv4_address_ = transformIpv4Address(addresses.GetAddress(0));
-    host_dst->ipv4_address_ = transformIpv4Address(addresses.GetAddress(1));
+  host_src->ipv4_address_ = transformIpv4Address(addresses.GetAddress(0));
+  host_dst->ipv4_address_ = transformIpv4Address(addresses.GetAddress(1));
 
-    if (number_of_links == 255) {
-      xbt_assert(number_of_networks < 255, "Number of links and networks exceed 255*255");
-      number_of_links = 1;
-      number_of_networks++;
-    } else {
-      number_of_links++;
-    }
+  if (number_of_links == 255) {
+    xbt_assert(number_of_networks < 255, "Number of links and networks exceed 255*255");
+    number_of_links = 1;
+    number_of_networks++;
+  } else {
+    number_of_links++;
   }
 }
index 1e4dbc5..7db4a38 100644 (file)
@@ -17,8 +17,8 @@ namespace resource {
 class NetworkNS3Model : public NetworkModel {
 public:
   explicit NetworkNS3Model(const std::string& name);
-  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth,
-                        s4u::Link::SharingPolicy policy) override;
+  LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth) override;
+  LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidth) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double next_occurring_event(double now) override;
   bool next_occurring_event_is_idempotent() override { return false; }
@@ -30,15 +30,16 @@ public:
  ************/
 class LinkNS3 : public LinkImpl {
 public:
-  explicit LinkNS3(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy);
+  explicit LinkNS3(const std::string& name, double bandwidth);
   ~LinkNS3() override;
-  s4u::Link::SharingPolicy sharing_policy_;
+  s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SHARED;
 
   void apply_event(profile::Event* event, double value) override;
   void set_bandwidth(double) override { THROW_UNIMPLEMENTED; }
   LinkImpl* set_latency(double) override;
   LinkImpl* set_bandwidth_profile(profile::Profile* profile) override;
   LinkImpl* set_latency_profile(profile::Profile* profile) override;
+  LinkImpl* set_sharing_policy(s4u::Link::SharingPolicy policy) override;
   s4u::Link::SharingPolicy get_sharing_policy() const override { return sharing_policy_; }
 };
 
index 0a2323d..54772d2 100644 (file)
@@ -47,7 +47,7 @@ double NetworkSmpiModel::get_bandwidth_factor(double size)
 {
   static std::vector<s_smpi_factor_t> smpi_bw_factor;
   if (smpi_bw_factor.empty())
-    smpi_bw_factor = simgrid::smpi::utils::parse_factor(config::get_value<std::string>("smpi/bw-factor"));
+    smpi_bw_factor = smpi::utils::parse_factor(config::get_value<std::string>("smpi/bw-factor"));
 
   double current = 1.0;
   for (auto const& fact : smpi_bw_factor) {
@@ -66,7 +66,7 @@ double NetworkSmpiModel::get_latency_factor(double size)
 {
   static std::vector<s_smpi_factor_t> smpi_lat_factor;
   if (smpi_lat_factor.empty())
-    smpi_lat_factor = simgrid::smpi::utils::parse_factor(config::get_value<std::string>("smpi/lat-factor"));
+    smpi_lat_factor = smpi::utils::parse_factor(config::get_value<std::string>("smpi/lat-factor"));
 
   double current = 1.0;
   for (auto const& fact : smpi_lat_factor) {
index 5e24970..58184ed 100644 (file)
@@ -61,10 +61,10 @@ NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel,
     : NetworkModel(name), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
-  loopback_ = NetworkL07Model::create_link(
-                  "__loopback__", std::vector<double>{simgrid::config::get_value<double>("network/loopback-bw")},
-                  s4u::Link::SharingPolicy::FATPIPE)
-                  ->set_latency(simgrid::config::get_value<double>("network/loopback-lat"));
+  loopback_ =
+      create_link("__loopback__", std::vector<double>{simgrid::config::get_value<double>("network/loopback-bw")})
+          ->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE)
+          ->set_latency(simgrid::config::get_value<double>("network/loopback-lat"));
   loopback_->seal();
 }
 
@@ -239,13 +239,16 @@ kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vecto
   return (new CpuL07(host, speed_per_pstate))->set_model(this);
 }
 
-kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                                         s4u::Link::SharingPolicy policy)
+kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
 {
   xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth.");
-  auto link = new LinkL07(name, bandwidths[0], policy, get_maxmin_system());
-  link->set_model(this);
-  return link;
+  return (new LinkL07(name, bandwidths[0], get_maxmin_system()))->set_model(this);
+}
+
+kernel::resource::LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name,
+                                                              const std::vector<double>& bandwidths)
+{
+  THROW_UNIMPLEMENTED;
 }
 
 /************
@@ -295,15 +298,10 @@ void CpuL07::on_speed_change()
   Cpu::on_speed_change();
 }
 
-LinkL07::LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy,
-                 kernel::lmm::System* system)
-    : LinkImpl(name)
+LinkL07::LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system) : LinkImpl(name)
 {
   this->set_constraint(system->constraint_new(this, bandwidth));
   bandwidth_.peak = bandwidth;
-
-  if (policy == s4u::Link::SharingPolicy::FATPIPE)
-    get_constraint()->unshare();
 }
 
 bool LinkL07::is_used() const
index cc4e370..6c7db7a 100644 (file)
@@ -67,8 +67,8 @@ public:
   NetworkL07Model(const NetworkL07Model&) = delete;
   NetworkL07Model& operator=(const NetworkL07Model&) = delete;
   ~NetworkL07Model() override;
-  kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
-                                          s4u::Link::SharingPolicy policy) override;
+  kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
+  kernel::resource::LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   void update_actions_state(double /*now*/, double /*delta*/) override{
@@ -106,7 +106,7 @@ protected:
 
 class LinkL07 : public kernel::resource::LinkImpl {
 public:
-  LinkL07(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, kernel::lmm::System* system);
+  LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system);
   LinkL07(const LinkL07&) = delete;
   LinkL07& operator=(const LinkL07&) = delete;
   ~LinkL07() override;
index 0d06ac2..154b2b8 100644 (file)
@@ -108,11 +108,12 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const std::string& name,
 
 static void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* args, const std::string& link_name)
 {
-  simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths, args->policy);
+  simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths);
   if (args->properties)
     link->set_properties(*args->properties);
 
   link->get_impl() // this call to get_impl saves some simcalls but can be removed
+      ->set_sharing_policy(args->policy)
       ->set_state_profile(args->state_trace)
       ->set_latency_profile(args->latency_trace)
       ->set_bandwidth_profile(args->bandwidth_trace)
index 4eec01a..3e020d7 100644 (file)
@@ -194,8 +194,7 @@ int find_model_description(const std::vector<surf_model_description_t>& table, c
   if (pos != table.end())
     return static_cast<int>(std::distance(table.begin(), pos));
 
-  if (table.empty())
-    xbt_die("No model is valid! This is a bug.");
+  xbt_assert(not table.empty(), "No model is valid! This is a bug.");
 
   std::string sep;
   std::string name_list;
index 59e24db..5201996 100644 (file)
@@ -78,10 +78,8 @@ void parse_platform_file(const std::string& file)
     luaL_loadfile(L, cfile); // This loads the file without executing it.
 
     /* Run the script */
-    if (lua_pcall(L, 0, 0, 0)) {
-      XBT_ERROR("FATAL ERROR:\n  %s: %s\n\n", "Lua call failed. Error message:", lua_tostring(L, -1));
-      xbt_die("Lua call failed. See Log");
-    }
+    xbt_assert(lua_pcall(L, 0, 0, 0) == 0, "FATAL ERROR:\n  %s: %s\n\n", "Lua call failed. Error message:",
+               lua_tostring(L, -1));
     lua_close(L);
     return;
 #else
index 7c7c90a..a257d01 100644 (file)
@@ -64,8 +64,7 @@ void xbt_automaton_load(xbt_automaton_t a, const char *file)
 {
   parsed_automaton = a;
   yyin = fopen(file, "r");
-  if (yyin == NULL)
-    xbt_die("Failed to open automaton file `%s': %s", file, strerror(errno));
+  xbt_assert(yyin != NULL, "Failed to open automaton file `%s': %s", file, strerror(errno));
   yyparse();
   fclose(yyin);
 }
index f213bb1..7cb1f63 100644 (file)
@@ -56,12 +56,10 @@ double parse_double(const char* value)
   double res = std::strtod(value, &end);
   if (errno == ERANGE)
     throw std::range_error("out of range");
-  else if (errno)
-    xbt_die("Unexpected errno");
+  xbt_assert(errno == 0, "Unexpected errno: %d", errno);
   if (end == value || *end != '\0')
     throw std::range_error("invalid double");
-  else
-    return res;
+  return res;
 }
 
 long int parse_long(const char* value)
@@ -69,17 +67,12 @@ long int parse_long(const char* value)
   char* end;
   errno = 0;
   long int res = std::strtol(value, &end, 0);
-  if (errno) {
-    if (res == LONG_MIN && errno == ERANGE)
-      throw std::range_error("underflow");
-    else if (res == LONG_MAX && errno == ERANGE)
-      throw std::range_error("overflow");
-    xbt_die("Unexpected errno");
-  }
+  if (errno == ERANGE)
+    throw std::range_error(res == LONG_MIN ? "underflow" : "overflow");
+  xbt_assert(errno == 0, "Unexpected errno: %d", errno);
   if (end == value || *end != '\0')
     throw std::range_error("invalid integer");
-  else
-    return res;
+  return res;
 }
 
 // ***** ConfigType *****
index 1b11219..7468c3b 100644 (file)
@@ -26,14 +26,13 @@ std::string string_vprintf(const char *fmt, va_list ap)
   va_copy(ap2, ap);
   int size = std::vsnprintf(nullptr, 0, fmt, ap2);
   va_end(ap2);
-  if (size < 0)
-    xbt_die("string_vprintf error");
+  xbt_assert(size >= 0, "string_vprintf error");
 
   // Allocate the string and format:
   std::string res;
   res.resize(size);
-  if (size != 0 && std::vsnprintf(&res[0], size + 1, fmt, ap) != size)
-    xbt_die("string_vprintf error");
+  if (size != 0)
+    xbt_assert(std::vsnprintf(&res[0], size + 1, fmt, ap) == size, "string_vprintf error");
   return res;
 }
 
index 928ef18..e014939 100644 (file)
@@ -41,8 +41,7 @@ xbt_log_appender_t xbt_log_appender_file_new(const char* arg)
   res->do_append         = &append_file;
   res->free_             = &free_;
   res->data              = static_cast<void*>(fopen(arg, "w"));
-  if (res->data == nullptr)
-    xbt_die("Cannot open file: %s: %s", arg, strerror(errno));
+  xbt_assert(res->data != nullptr, "Cannot open file: %s: %s", arg, strerror(errno));
   return res;
 }
 
@@ -62,8 +61,7 @@ static void open_append2_file(xbt_log_append2_file_t data){
     //Roll
     if (!data->file) {
       data->file= fopen(data->filename, "w");
-      if (data->file == nullptr)
-        xbt_die("Cannot open file: %s: %s", data->filename, strerror(errno));
+      xbt_assert(data->file != nullptr, "Cannot open file: %s: %s", data->filename, strerror(errno));
     } else {
       fputs(APPEND2_END_TOKEN_CLEAR,data->file);
       fseek(data->file,0,SEEK_SET);
@@ -81,8 +79,7 @@ static void open_append2_file(xbt_log_append2_file_t data){
     std::string newname = pre + std::to_string(data->count) + post;
     data->count++;
     data->file = fopen(newname.c_str(), "w");
-    if (data->file == nullptr)
-      xbt_die("Cannot open file: %s: %s", newname.c_str(), strerror(errno));
+    xbt_assert(data->file != nullptr, "Cannot open file: %s: %s", newname.c_str(), strerror(errno));
     xbt_free(pre);
   }
 }
index eebcf6d..2a10ed9 100644 (file)
@@ -66,8 +66,7 @@ static int worker(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
 {
   while (1) {
     msg_task_t task           = NULL;
-    XBT_ATTRIB_UNUSED int res = MSG_task_receive(&(task), "worker_mailbox");
-    xbt_assert(res == MSG_OK, "MSG_task_get failed");
+    xbt_assert(MSG_task_receive(&(task), "worker_mailbox") == MSG_OK, "MSG_task_receive failed");
     XBT_INFO("Handling task \"%s\"", MSG_task_get_name(task));
 
     if (!strcmp(MSG_task_get_name(task), "finalize")) {
index c5e1fec..ee7b828 100644 (file)
@@ -9,8 +9,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test");
 
 static void host()
 {
-  simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1
-  aid_t id                 = simgrid::s4u::this_actor::get_pid();
+  const simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1
+  aid_t id                       = simgrid::s4u::this_actor::get_pid();
   XBT_INFO("process %ld is writing!", id);
   disk->write(4000000);
   XBT_INFO("process %ld goes to sleep for %ld seconds", id, id);
index 46668da..44583a1 100644 (file)
@@ -202,8 +202,8 @@ int main(int argc, char** argv)
 
   sg4::Engine e(&argc, argv);
 
-  if (not parse_cmdline(&timings, &platformFile, argc, argv) || not platformFile)
-    xbt_die("Invalid command line arguments: expected [--timings] platformFile");
+  xbt_assert(parse_cmdline(&timings, &platformFile, argc, argv) && platformFile,
+             "Invalid command line arguments: expected [--timings] platformFile");
 
   XBT_DEBUG("%d,%s", timings, platformFile);
 
index db31cd0..dc83fbc 100644 (file)
@@ -20,10 +20,10 @@ $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/../../../smpi_script/bin/smpirun -map -ho
 > [rank 14] -> Ginette
 > [rank 15] -> Ginette
 > If this is too much, consider sharing allocations for computation buffers.
-> Largest allocation at once from a single process was 64 bytes, at sysdep.h:61. It was called 32 times during the whole simulation.
+> Largest allocation at once from a single process was 64 bytes, at sysdep.h:59. It was called 32 times during the whole simulation.
 > Running smpirun with -wrapper "valgrind --leak-check=full" can provide more information
 > This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
-> [0.023768] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 31 unfreed MPI handles : display types and addresses (n max) with --cfg=smpi/list-leaks:n.
+> [0.023768] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 32 unfreed MPI handles : display types and addresses (n max) with --cfg=smpi/list-leaks:n.
 > [0.023768] [smpi_utils/INFO] Memory Usage: Simulated application allocated 2048 bytes during its lifetime through malloc/calloc calls.
 
 
index 5890b63..6cf42f3 100644 (file)
@@ -7,6 +7,20 @@ $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/../../../smpi_script/bin/smpirun -wrapper
 > [rank 1] -> Tremblay
 > [rank 2] -> Tremblay
 > [rank 3] -> Tremblay
+> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles : display types and addresses (n max) with --cfg=smpi/list-leaks:n.
+> Running smpirun with -wrapper "valgrind --leak-check=full" can provide more information
+> [0.000000] [smpi_utils/INFO] Memory Usage: Simulated application allocated 128 bytes during its lifetime through malloc/calloc calls.
+> Largest allocation at once from a single process was 16 bytes, at sysdep.h:59. It was called 8 times during the whole simulation.
+> If this is too much, consider sharing allocations for computation buffers.
+> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
+>
+> [0.000000] [smpi_utils/INFO] Probable memory leaks in your code: SMPI detected 8 unfreed MPI handles : display types and addresses (n max) with --cfg=smpi/list-leaks:n.
+> Running smpirun with -wrapper "valgrind --leak-check=full" can provide more information
+> [0.000000] [smpi_utils/INFO] Memory Usage: Simulated application allocated 128 bytes during its lifetime through malloc/calloc calls.
+> Largest allocation at once from a single process was 16 bytes, at sysdep.h:59. It was called 8 times during the whole simulation.
+> If this is too much, consider sharing allocations for computation buffers.
+> This can be done automatically by setting --cfg=smpi/auto-shared-malloc-thresh to the minimum size wanted size (this can alter execution if data content is necessary)
+>
 > [0.000000] [mc_safety/INFO] Check a safety property. Reduction is: dpor.
 > [0.000000] [mc_safety/INFO] Executed transitions = 484
 > [0.000000] [mc_safety/INFO] Expanded states = 63
index fdfea46..a6459fc 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include "mpi.h"
 #include "mpitest.h"
-
+#define USE_STRICT_MPI
 int key = MPI_KEYVAL_INVALID;
 char a[100];
 
index 7cc14de..45fe54a 100644 (file)
@@ -1,13 +1,14 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
 /*
- *  (C) 2013 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
+ * Copyright (C) by Argonne National Laboratory
+ *     See COPYRIGHT in top-level directory
  */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <string.h>
 #include <mpi.h>
+#include "mpitest.h"
 
 #define MAX_DATA_SIZE   (1024)
 #define MAX_NUM_ITERATIONS (1024)
@@ -20,7 +21,7 @@ static int rank;
 static void run_test(int lock_mode, int lock_assert)
 {
     int nproc, test_iter, target_rank, data_size;
-    char *buf, *win_buf;
+    int *buf, *win_buf;
     MPI_Win win;
 
     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -32,15 +33,15 @@ static void run_test(int lock_mode, int lock_assert)
         printf("Synchronization mode: ");
 
         switch (lock_mode) {
-        case MPI_LOCK_EXCLUSIVE:
-            printf("Exclusive lock");
-            break;
-        case MPI_LOCK_SHARED:
-            printf("Shared lock");
-            break;
-        default:
-            printf("Unknown lock");
-            break;
+            case MPI_LOCK_EXCLUSIVE:
+                printf("Exclusive lock");
+                break;
+            case MPI_LOCK_SHARED:
+                printf("Shared lock");
+                break;
+            default:
+                printf("Unknown lock");
+                break;
         }
 
         if (lock_assert & MPI_MODE_NOCHECK)
@@ -101,8 +102,8 @@ static void run_test(int lock_mode, int lock_assert)
                     t_acc = MPI_Wtime();
 
                 MPI_Win_lock(lock_mode, target_rank, lock_assert, win);
-                MPI_Accumulate(buf, data_size, MPI_BYTE, target_rank,
-                               0, data_size, MPI_BYTE, MPI_SUM, win);
+                MPI_Accumulate(buf, data_size / sizeof(int), MPI_INT, target_rank,
+                               0, data_size / sizeof(int), MPI_INT, MPI_BXOR, win);
                 MPI_Win_unlock(target_rank, win);
             }
             t_acc = (MPI_Wtime() - t_acc) / num_iter;
@@ -124,17 +125,14 @@ static void run_test(int lock_mode, int lock_assert)
 
 int main(int argc, char **argv)
 {
-    MPI_Init(&argc, &argv);
+    MTest_Init(&argc, &argv);
 
     run_test(MPI_LOCK_EXCLUSIVE, 0);
     run_test(MPI_LOCK_EXCLUSIVE, MPI_MODE_NOCHECK);
     run_test(MPI_LOCK_SHARED, 0);
     run_test(MPI_LOCK_SHARED, MPI_MODE_NOCHECK);
 
-    MPI_Finalize();
-
-    if (rank == 0)
-        printf(" No Errors\n");
+    MTest_Finalize(0);
 
     return 0;
 }
index b610e1f..1a370eb 100644 (file)
@@ -27,8 +27,7 @@ constexpr int TESTSIZE = 100;
 static void check_block(const unsigned char* p, unsigned char b, int n)
 {
   for (int i = 0; i < n; i++)
-    if (p[i] != b)
-      xbt_die("value mismatch: %p[%d] = %#hhx, expected %#hhx", p, i, p[i], b);
+    xbt_assert(p[i] == b, "value mismatch: %p[%d] = %#hhx, expected %#hhx", p, i, p[i], b);
 }
 
 int main(int argc, char**argv)
@@ -80,8 +79,7 @@ int main(int argc, char**argv)
     } catch (const simgrid::Exception&) {
       gotit = true;
     }
-    if (not gotit)
-      xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
+    xbt_assert(gotit, "FAIL: A double-free went undetected (for size:%d)", size_of_block(i));
   }
 
   XBT_INFO("free again all blocks (to really check that double free are correctly caught)");
@@ -92,8 +90,7 @@ int main(int argc, char**argv)
     } catch (const simgrid::Exception&) {
       gotit = true;
     }
-    if (not gotit)
-      xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
+    xbt_assert(gotit, "FAIL: A double-free went undetected (for size:%d)", size_of_block(i));
   }
 
   XBT_INFO("Let's try different codepaths for mrealloc");
index f2db33c..1a686fe 100644 (file)
@@ -13,7 +13,7 @@ RUN apt install -y sudo && \
 
 # - Clone simgrid-template-s4u, as it is needed by the tutorial
 # - Add an empty makefile advising to run cmake before make, just in case
-RUN apt install -y pajeng r-base r-cran-ggplot2 r-cran-dplyr r-cran-devtools cmake g++ git libboost-all-dev flex bison libfmt-dev&& \
+RUN apt install -y pajeng r-base r-cran-ggplot2 r-cran-dplyr r-cran-devtools cmake g++ git libboost-dev flex bison libfmt-dev&& \
     cd /source && \
     git clone --depth=1 https://framagit.org/simgrid/simgrid-template-s4u.git simgrid-template-s4u.git && \
     printf "master-workers ping-pong:\n\t@echo \"Please run the following command before make:\";echo \"    cmake .\"; exit 1" > Makefile &&\
index 0ade62f..59f39a4 100644 (file)
@@ -12,7 +12,7 @@ RUN apt install -y sudo && \
     chown -R user:user /home/user
 
 # - Clone simgrid-template-smpi, as it is needed by the tutorial
-RUN apt install -y python3 pajeng libssl-dev r-base r-cran-ggplot2 r-cran-dplyr r-cran-devtools build-essential g++ gfortran git libboost-all-dev cmake flex bison libfmt-dev && \
+RUN apt install -y python3 pajeng libssl-dev r-base r-cran-ggplot2 r-cran-dplyr r-cran-devtools build-essential g++ gfortran git libboost-dev cmake flex bison libfmt-dev && \
     cd /source && \
     git clone --depth=1 https://framagit.org/simgrid/simgrid-template-smpi.git simgrid-template-smpi.git && \
     chown -R user:user /source && \