examples/c/app-bittorrent/c-app-bittorrent
examples/c/app-chainsend/c-app-chainsend
examples/c/app-masterworker/c-app-masterworker
-examples/c/app-pingpong/c-app-pingpong
examples/c/app-token-ring/c-app-token-ring
examples/c/cloud-capping/c-cloud-capping
examples/c/cloud-masterworker/c-cloud-masterworker
examples/c/cloud-migration/c-cloud-migration
examples/c/cloud-simple/c-cloud-simple
+examples/c/comm-pingpong/c-comm-pingpong
+examples/c/comm-wait/c-comm-wait
+examples/c/comm-waitall/c-comm-waitall
+examples/c/comm-waitany/c-comm-waitany
examples/c/dht-kademlia/c-dht-kademlia
examples/c/dht-pastry/c-dht-pastry
examples/c/energy-exec/c-energy-exec
examples/c/io-file-system/c-io-file-system
examples/c/platform-failures/c-platform-failures
examples/c/platform-properties/c-platform-properties
-examples/c/plugin-hostload/c-plugin-hostload
+examples/c/plugin-host-load/c-plugin-host-load
examples/c/synchro-semaphore/c-synchro-semaphore
examples/deprecated/msg/mc/bugged2_liveness
examples/deprecated/msg/mc/centralized_mutex
examples/cpp/app-chainsend/s4u-app-chainsend
examples/cpp/app-masterworkers/s4u-app-masterworkers-class
examples/cpp/app-masterworkers/s4u-app-masterworkers-fun
-examples/cpp/app-pingpong/s4u-app-pingpong
examples/cpp/app-token-ring/s4u-app-token-ring
examples/cpp/cloud-capping/s4u-cloud-capping
examples/cpp/cloud-migration/s4u-cloud-migration
examples/cpp/cloud-simple/s4u-cloud-simple
examples/cpp/comm-dependent/s4u-comm-dependent
+examples/cpp/comm-host2host/s4u-comm-host2host
+examples/cpp/comm-pingpong/s4u-comm-pingpong
+examples/cpp/comm-ready/s4u-comm-ready
+examples/cpp/comm-suspend/s4u-comm-suspend
+examples/cpp/comm-wait/s4u-comm-wait
+examples/cpp/comm-waitall/s4u-comm-waitall
+examples/cpp/comm-waitany/s4u-comm-waitany
+examples/cpp/comm-waituntil/s4u-comm-waituntil
examples/cpp/dht-chord/s4u-dht-chord
examples/cpp/dht-kademlia/s4u-dht-kademlia
examples/cpp/energy-boot/s4u-energy-boot
examples/cpp/energy-exec-ptask/s4u-energy-exec-ptask
examples/cpp/energy-link/s4u-energy-link
examples/cpp/energy-vm/s4u-energy-vm
+examples/cpp/energy-wifi/s4u-energy-wifi
examples/cpp/engine-filtering/s4u-engine-filtering
examples/cpp/exec-async/s4u-exec-async
examples/cpp/exec-basic/s4u-exec-basic
examples/cpp/exec-dvfs/s4u-exec-dvfs
examples/cpp/exec-ptask/s4u-exec-ptask
examples/cpp/exec-remote/s4u-exec-remote
+examples/cpp/exec-unassigned/s4u-exec-unassigned
examples/cpp/exec-waitany/s4u-exec-waitany
examples/cpp/exec-waitfor/s4u-exec-waitfor
examples/cpp/io-async/s4u-io-async
examples/cpp/mc-electric-fence/s4u-mc-electric-fence
examples/cpp/mc-failing-assert/s4u-mc-failing-assert
examples/cpp/network-ns3/s4u-network-ns3
+examples/cpp/network-ns3-wifi/s4u-network-ns3-wifi
+examples/cpp/network-wifi/s4u-network-wifi
examples/cpp/platform-failures/s4u-platform-failures
examples/cpp/platform-profile/s4u-platform-profile
examples/cpp/platform-properties/s4u-platform-properties
+examples/cpp/plugin-host-load/s4u-plugin-host-load
+examples/cpp/plugin-link-load/s4u-plugin-link-load
examples/cpp/replay-comm/s4u-replay-comm
examples/cpp/replay-io/s4u-replay-io
examples/cpp/routing-get-clusters/s4u-routing-get-clusters
examples/cpp/synchro-barrier/s4u-synchro-barrier
examples/cpp/synchro-condition-variable/s4u-synchro-condition-variable
+examples/cpp/synchro-condition-variable-waituntil/s4u-synchro-condition-variable-waituntil
examples/cpp/synchro-mutex/s4u-synchro-mutex
examples/cpp/synchro-semaphore/s4u-synchro-semaphore
examples/cpp/trace-categories/s4u-trace-categories
examples/deprecated/simdag/dag-dotload/sd_dag-dotload
examples/deprecated/simdag/daxload/sd_daxload
examples/deprecated/simdag/fail/sd_fail
-examples/deprecated/simdag/properties/sd_properties
examples/deprecated/simdag/ptg-dotload/sd_ptg-dotload
examples/deprecated/simdag/schedule-dotload/sd_schedule-dotload
examples/deprecated/simdag/scheduling/sd_scheduling
examples/deprecated/simdag/test/sd_test
examples/deprecated/simdag/throttling/sd_throttling
examples/deprecated/simdag/typed_tasks/sd_typed_tasks
+examples/smpi/ampi_test/smpi_ampi_test
examples/smpi/energy/smpi_energy
+examples/smpi/gemm/smpi_gemm
examples/smpi/mc/smpi_bugged1
examples/smpi/mc/smpi_bugged1_liveness
examples/smpi/mc/smpi_bugged2
examples/smpi/trace_simple/smpi_trace_simple
examples/smpi/trace/smpi_trace
teshsuite/kernel/context-defaults/context-defaults
+teshsuite/kernel/simcall-generic/simcall-generic
+teshsuite/kernel/stack-overflow/stack-overflow
teshsuite/java/semaphoregc/java-semaphoregc_compiled
teshsuite/java/sleephostoff/java-sleephostoff_compiled
teshsuite/mc/dwarf/dwarf
teshsuite/mc/mutex-handling/mutex-handling
teshsuite/mc/mutex-handling/without-mutex-handling
teshsuite/mc/random-bug/random-bug
+teshsuite/models/cloud-sharing/cloud-sharing
+teshsuite/models/ptask_L07_usage/ptask_L07_usage
+teshsuite/models/wifi_usage/wifi_usage
+teshsuite/models/wifi_usage_decay/wifi_usage_decay
teshsuite/msg/task_destroy_cancel/task_destroy_cancel
teshsuite/s4u/activity-lifecycle/activity-lifecycle
teshsuite/s4u/actor/actor
teshsuite/s4u/actor-autorestart/actor-autorestart
+teshsuite/s4u/actor-suspend/actor-suspend
teshsuite/s4u/basic-link-test/basic-link-test
+teshsuite/s4u/basic-parsing-test/basic-parsing-test
teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration
-teshsuite/s4u/cloud-sharing/cloud-sharing
teshsuite/s4u/cloud-two-execs/cloud-two-execs
+teshsuite/s4u/comm-get-sender/comm-get-sender
teshsuite/s4u/comm-pt2pt/comm-pt2pt
teshsuite/s4u/concurrent_rw/concurrent_rw
teshsuite/s4u/evaluate-get-route-time/evaluate-get-route-time
teshsuite/s4u/host-on-off/host-on-off
teshsuite/s4u/is-router/is-router
teshsuite/s4u/listen_async/listen_async
+teshsuite/s4u/ns3-from-src-to-itself/ns3-from-src-to-itself
teshsuite/s4u/ns3-simultaneous-send-rcv/ns3-simultaneous-send-rcv
teshsuite/s4u/pid/pid
teshsuite/s4u/storage_client_server/storage_client_server
teshsuite/s4u/trace-integration/trace-integration
+teshsuite/s4u/vm-live-migration/vm-live-migration
teshsuite/s4u/wait-any-for/wait-any-for
teshsuite/simdag/availability/availability
-teshsuite/simdag/basic-parsing-test/basic-parsing-test
-teshsuite/simdag/basic0/basic0
-teshsuite/simdag/basic1/basic1
-teshsuite/simdag/basic3/basic3
-teshsuite/simdag/basic4/basic4
-teshsuite/simdag/basic5/basic5
-teshsuite/simdag/basic6/basic6
-teshsuite/simdag/comm-mxn-all2all/comm-mxn-all2all
-teshsuite/simdag/comm-mxn-independent/comm-mxn-independent
-teshsuite/simdag/comm-mxn-scatter/comm-mxn-scatter
-teshsuite/simdag/comm-p2p-latency-1/comm-p2p-latency-1
-teshsuite/simdag/comm-p2p-latency-2/comm-p2p-latency-2
-teshsuite/simdag/comm-p2p-latency-3/comm-p2p-latency-3
-teshsuite/simdag/comm-p2p-latency-bound/comm-p2p-latency-bound
-teshsuite/simdag/comp-only-par/comp-only-par
-teshsuite/simdag/comp-only-seq/comp-only-seq
teshsuite/simdag/flatifier/flatifier
teshsuite/simdag/incomplete/incomplete
-teshsuite/simix/generic-simcalls/generic-simcalls
-teshsuite/simix/stack-overflow/stack-overflow
+teshsuite/smpi/auto-shared/auto-shared
teshsuite/smpi/bug-17132/bug-17132
teshsuite/smpi/coll-allgather/coll-allgather
teshsuite/smpi/coll-allgatherv/coll-allgatherv
teshsuite/smpi/io-all/io-all
teshsuite/smpi/io-ordered/io-ordered
teshsuite/smpi/io-shared/io-shared
-teshsuite/smpi/io-shared/titi
-teshsuite/smpi/io-shared/toto
teshsuite/smpi/io-simple-at/io-simple-at
teshsuite/smpi/io-simple/io-simple
teshsuite/smpi/isp/umpire/abort
teshsuite/smpi/mpich3-test/datatype/zero-blklen-vector
teshsuite/smpi/mpich3-test/datatype/zeroblks
teshsuite/smpi/mpich3-test/datatype/zeroparms
+teshsuite/smpi/mpich3-test/errhan/adderr
+teshsuite/smpi/mpich3-test/errhan/commcall
+teshsuite/smpi/mpich3-test/errhan/dynamic_errcode_predefined_errclass
+teshsuite/smpi/mpich3-test/errhan/errfatal
+teshsuite/smpi/mpich3-test/errhan/errstring2
+teshsuite/smpi/mpich3-test/errhan/predef_eh
+teshsuite/smpi/mpich3-test/f77/attr/attrmpi1f
+teshsuite/smpi/mpich3-test/f77/attr/baseattr2f
+teshsuite/smpi/mpich3-test/f77/attr/baseattrf
+teshsuite/smpi/mpich3-test/f77/attr/commattr2f
+teshsuite/smpi/mpich3-test/f77/attr/commattr3f
+teshsuite/smpi/mpich3-test/f77/attr/commattrf
+teshsuite/smpi/mpich3-test/f77/attr/typeattr2f
+teshsuite/smpi/mpich3-test/f77/attr/typeattr3f
+teshsuite/smpi/mpich3-test/f77/attr/typeattrf
teshsuite/smpi/mpich3-test/f77/coll/allredint8f
teshsuite/smpi/mpich3-test/f77/coll/allredopttf
teshsuite/smpi/mpich3-test/f77/coll/alltoallvf
teshsuite/smpi/mpich3-test/f77/coll/alltoallwf
teshsuite/smpi/mpich3-test/f77/coll/exscanf
teshsuite/smpi/mpich3-test/f77/coll/inplacef
+teshsuite/smpi/mpich3-test/f77/coll/nonblockingf
+teshsuite/smpi/mpich3-test/f77/coll/nonblocking_inpf
teshsuite/smpi/mpich3-test/f77/coll/red_scat_blockf
teshsuite/smpi/mpich3-test/f77/coll/redscatf
teshsuite/smpi/mpich3-test/f77/coll/reducelocalf
teshsuite/smpi/mpich3-test/f77/datatype/typenamef
teshsuite/smpi/mpich3-test/f77/datatype/typesnamef
teshsuite/smpi/mpich3-test/f77/datatype/typesubf
+teshsuite/smpi/mpich3-test/f77/ext/c2f2cf
+teshsuite/smpi/mpich3-test/f77/ext/c2fmult
teshsuite/smpi/mpich3-test/f77/info/infotest2f
teshsuite/smpi/mpich3-test/f77/info/infotestf
teshsuite/smpi/mpich3-test/f77/init/baseenvf
teshsuite/smpi/mpich3-test/f77/pt2pt/allpairf
teshsuite/smpi/mpich3-test/f77/pt2pt/greqf
teshsuite/smpi/mpich3-test/f77/pt2pt/statusesf
+teshsuite/smpi/mpich3-test/f77/rma/baseattrwinf
teshsuite/smpi/mpich3-test/f77/rma/c2f2cwinf
teshsuite/smpi/mpich3-test/f77/rma/winaccf
+teshsuite/smpi/mpich3-test/f77/rma/winattr2f
+teshsuite/smpi/mpich3-test/f77/rma/winattrf
teshsuite/smpi/mpich3-test/f77/rma/winfencef
teshsuite/smpi/mpich3-test/f77/rma/wingetf
teshsuite/smpi/mpich3-test/f77/rma/wingroupf
teshsuite/smpi/mpich3-test/f90/coll/array.mod
teshsuite/smpi/mpich3-test/f90/coll/exscanf90
teshsuite/smpi/mpich3-test/f90/coll/inplacef90
+teshsuite/smpi/mpich3-test/f90/coll/nonblockingf90
+teshsuite/smpi/mpich3-test/f90/coll/nonblocking_inpf90
teshsuite/smpi/mpich3-test/f90/coll/red_scat_blockf90
teshsuite/smpi/mpich3-test/f90/coll/redscatf90
teshsuite/smpi/mpich3-test/f90/coll/reducelocalf90
teshsuite/smpi/mpich3-test/f90/datatype/indtype
teshsuite/smpi/mpich3-test/f90/datatype/kinds
teshsuite/smpi/mpich3-test/f90/datatype/packef90
+teshsuite/smpi/mpich3-test/f90/datatype/structf
teshsuite/smpi/mpich3-test/f90/datatype/typecntsf90
teshsuite/smpi/mpich3-test/f90/datatype/typem2f90
teshsuite/smpi/mpich3-test/f90/datatype/typename3f90
teshsuite/smpi/mpich3-test/f90/pt2pt/array.mod
teshsuite/smpi/mpich3-test/f90/pt2pt/greqf90
teshsuite/smpi/mpich3-test/f90/pt2pt/statusesf90
+teshsuite/smpi/mpich3-test/f90/rma/baseattrwinf90
teshsuite/smpi/mpich3-test/f90/rma/c2f2cwinf90
teshsuite/smpi/mpich3-test/f90/rma/winaccf90
+teshsuite/smpi/mpich3-test/f90/rma/winattr2f90
+teshsuite/smpi/mpich3-test/f90/rma/winattrf90
teshsuite/smpi/mpich3-test/f90/rma/winfencef90
teshsuite/smpi/mpich3-test/f90/rma/wingetf90
teshsuite/smpi/mpich3-test/f90/rma/wingroupf90
teshsuite/smpi/mpich3-test/group/gtranksperf
teshsuite/smpi/mpich3-test/info/infodel
teshsuite/smpi/mpich3-test/info/infodup
+teshsuite/smpi/mpich3-test/info/infoenv
teshsuite/smpi/mpich3-test/info/infoget
teshsuite/smpi/mpich3-test/info/infomany
teshsuite/smpi/mpich3-test/info/infomany2
teshsuite/smpi/mpich3-test/init/library_version
teshsuite/smpi/mpich3-test/init/timeout
teshsuite/smpi/mpich3-test/init/version
+teshsuite/smpi/mpich3-test/io/async
+teshsuite/smpi/mpich3-test/io/async_any
+teshsuite/smpi/mpich3-test/io/bigtype
+teshsuite/smpi/mpich3-test/io/external32-derived-dtype
+teshsuite/smpi/mpich3-test/io/getextent
+teshsuite/smpi/mpich3-test/io/hindexed_io
+teshsuite/smpi/mpich3-test/io/rdwrord
+teshsuite/smpi/mpich3-test/io/rdwrzero
+teshsuite/smpi/mpich3-test/io/resized
+teshsuite/smpi/mpich3-test/io/resized2
+teshsuite/smpi/mpich3-test/io/setinfo
+teshsuite/smpi/mpich3-test/io/setviewcur
+teshsuite/smpi/mpich3-test/io/simple_collective
+teshsuite/smpi/mpich3-test/io/userioerr
teshsuite/smpi/mpich3-test/perf/commcreatep
teshsuite/smpi/mpich3-test/perf/dtpack
teshsuite/smpi/mpich3-test/perf/indexperf
teshsuite/smpi/mpich3-test/rma/lockall_dt_flushlocalall
teshsuite/smpi/mpich3-test/rma/lockcontention
teshsuite/smpi/mpich3-test/rma/lockcontention2
+teshsuite/smpi/mpich3-test/rma/lockcontention3
teshsuite/smpi/mpich3-test/rma/locknull
teshsuite/smpi/mpich3-test/rma/lockopts
teshsuite/smpi/mpich3-test/rma/manyget
teshsuite/smpi/mpich3-test/rma/transpose5
teshsuite/smpi/mpich3-test/rma/transpose6
teshsuite/smpi/mpich3-test/rma/transpose7
+teshsuite/smpi/mpich3-test/rma/wincall
teshsuite/smpi/mpich3-test/rma/window_creation
teshsuite/smpi/mpich3-test/rma/win_dynamic_acc
teshsuite/smpi/mpich3-test/rma/win_info
teshsuite/smpi/mpich3-test/rma/winname
+teshsuite/smpi/mpich3-test/rma/win_shared
+teshsuite/smpi/mpich3-test/rma/win_shared_put_flush_get
teshsuite/smpi/mpich3-test/topo/cartcreates
teshsuite/smpi/mpich3-test/topo/cartshift1
teshsuite/smpi/mpich3-test/topo/cartsuball
teshsuite/smpi/pt2pt-dsend/pt2pt-dsend
teshsuite/smpi/pt2pt-pingpong/pt2pt-pingpong
teshsuite/smpi/timers/timers
+teshsuite/smpi/topo-cart-sub/topo-cart-sub
teshsuite/smpi/type-hvector/type-hvector
teshsuite/smpi/type-indexed/type-indexed
teshsuite/smpi/type-struct/type-struct
teshsuite/surf/maxmin_bench/maxmin_bench
teshsuite/surf/surf_usage/surf_usage
teshsuite/surf/surf_usage2/surf_usage2
-teshsuite/surf/wifi_usage/wifi_usage
teshsuite/xbt/cmdline/cmdline
teshsuite/xbt/log_large/log_large
teshsuite/xbt/log_usage/log_usage
- New functions: Comm::sendto_{init,async} to initiate a communication
on between two (possibly remote) hosts.
+XBT:
+ - Drop simgrid::xbt::demangle. Please use boost::core::demangle instead.
+
Documentation:
- New section: Configuring the logs from the command line.
- New section: Programming API of logs.
include teshsuite/mc/random-bug/random-bug.tesh
include teshsuite/models/cloud-sharing/cloud-sharing.cpp
include teshsuite/models/cloud-sharing/cloud-sharing.tesh
-include teshsuite/models/ptask_L07/ptask_L07.cpp
-include teshsuite/models/ptask_L07/ptask_L07.tesh
+include teshsuite/models/ptask_L07_usage/ptask_L07_usage.cpp
+include teshsuite/models/ptask_L07_usage/ptask_L07_usage.tesh
include teshsuite/models/wifi_usage/wifi_usage.cpp
include teshsuite/models/wifi_usage/wifi_usage.tesh
include teshsuite/models/wifi_usage_decay/wifi_usage_decay.cpp
include teshsuite/s4u/wait-any-for/wait-any-for.tesh
include teshsuite/simdag/availability/availability.c
include teshsuite/simdag/availability/availability.tesh
-include teshsuite/simdag/basic1/basic1.c
-include teshsuite/simdag/basic1/basic1.tesh
-include teshsuite/simdag/basic3/basic3.c
-include teshsuite/simdag/basic3/basic3.tesh
-include teshsuite/simdag/basic4/basic4.c
-include teshsuite/simdag/basic4/basic4.tesh
-include teshsuite/simdag/basic5/basic5.c
-include teshsuite/simdag/basic5/basic5.tesh
include teshsuite/simdag/flatifier/bogus_missing_gateway.tesh
include teshsuite/simdag/flatifier/bogus_two_hosts_asymetric.tesh
include teshsuite/simdag/flatifier/flatifier.cpp
include include/simgrid/simix.h
include include/simgrid/simix.hpp
include include/simgrid/simix/blocking_simcall.hpp
-include include/simgrid/smpi/replay.hpp
+include include/simgrid/smpi/smpi_replay.hpp
include include/simgrid/version.h.in
include include/simgrid/vm.h
include include/simgrid/zone.h
include include/xbt/file.hpp
include include/xbt/function_types.h
include include/xbt/functional.hpp
-include include/xbt/future.hpp
include include/xbt/graph.h
include include/xbt/log.h
include include/xbt/log.hpp
include include/xbt/module.h
include include/xbt/parmap.h
include include/xbt/parse_units.hpp
+include include/xbt/promise.hpp
include include/xbt/random.hpp
include include/xbt/range.hpp
include include/xbt/replay.hpp
if (err == SG_ERROR_TIMEOUT) {
XBT_DEBUG("Timeout expired when joining ring with node %d", node->known_id);
message_free(request);
+ return 0;
}
return 1;
/** Return the information about where the exception was thrown */
xbt::ThrowPoint const& throw_point() const { return throwpoint_; }
+ /** Allow to carry a value (used by testany/waitany) */
+ int get_value() const { return value_; }
+ void set_value(int value) { value_ = value; }
+
std::string resolve_backtrace() const { return throwpoint_.backtrace_.resolve(); }
virtual void rethrow_nested(const simgrid::xbt::ThrowPoint& throwpoint, const std::string& message) const
std::throw_with_nested(Exception(throwpoint, message));
}
- /** Allow to carry a value (used by waitall/waitany) */
- int value = 0;
-
private:
xbt::ThrowPoint throwpoint_;
+ int value_ = 0;
};
#define DECLARE_SIMGRID_EXCEPTION(AnyException, ...) \
#include <xbt/base.h>
#include <xbt/functional.hpp>
-#include <xbt/future.hpp>
+#include <xbt/promise.hpp>
namespace simgrid {
namespace kernel {
* @details This is the ancestor class of every resources in SimGrid, such as links, CPU or disk
*/
class XBT_PUBLIC Resource {
- std::string name_;
- Model* model_;
- bool is_on_ = true;
+ std::string name_ = "unnamed";
+ Model* model_ = nullptr;
+ bool is_on_ = true;
- lmm::Constraint* const constraint_;
+ lmm::Constraint* constraint_ = nullptr;
protected:
struct Metric {
profile::Event* state_event_ = nullptr;
public:
- /**
- * @brief Constructor of LMM Resources
- *
- * @param model Model associated to this Resource
- * @param name The name of the Resource
- * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
- */
- Resource(Model* model, const std::string& name, lmm::Constraint* constraint)
- : name_(name), model_(model), constraint_(constraint)
- {
- }
-
+ Resource() = default;
virtual ~Resource() = default;
/** @brief Get the Model of the current Resource */
Model* get_model() const { return model_; }
+ Resource* set_model(Model* model);
/** @brief Get the name of the current Resource */
const std::string& get_name() const { return name_; }
/** @brief Get the name of the current Resource */
const char* get_cname() const { return name_.c_str(); }
+ Resource* set_name(const std::string& name);
+
+ /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
+ lmm::Constraint* get_constraint() const { return constraint_; }
+ Resource* set_constraint(lmm::Constraint* constraint);
bool operator==(const Resource& other) const { return name_ == other.name_; }
/** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */
virtual void set_state_profile(profile::Profile* profile);
- /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
- lmm::Constraint* get_constraint() const { return constraint_; }
};
} // namespace resource
} // namespace kernel
int get_host_count() const;
/** @brief Make a host within that NetZone */
- s4u::Host* create_host(const std::string& name, const std::vector<double>& speed_per_pstate, int core_count,
- const std::unordered_map<std::string, std::string>* props);
+ s4u::Host* create_host(const std::string& name, const std::vector<double>& speed_per_pstate, int core_count);
/** @brief Make a link within that NetZone */
virtual s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths, double latency,
- s4u::Link::SharingPolicy policy,
- const std::unordered_map<std::string, std::string>* props);
+ s4u::Link::SharingPolicy policy);
/** @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);
void seal() override;
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, double latency,
- s4u::Link::SharingPolicy policy,
- const std::unordered_map<std::string, std::string>* props) override;
+ s4u::Link::SharingPolicy policy) override;
NetPoint* get_access_point() {return access_point_;}
private:
public:
#ifndef DOXYGEN
- explicit Disk(const std::string& name, kernel::resource::DiskImpl* pimpl) : pimpl_(pimpl), name_(name) {}
+ explicit Disk(kernel::resource::DiskImpl* pimpl) : pimpl_(pimpl) {}
#endif
/** @brief Callback signal fired when a new Disk is created */
static xbt::signal<void(Disk const&)> on_state_change;
/** @brief Retrieves the name of that disk as a C++ string */
+ Disk* set_name(std::string const& name);
std::string const& get_name() const { return name_; }
/** @brief Retrieves the name of that disk as a C string */
const char* get_cname() const { return name_.c_str(); }
+
+ Disk* set_read_bandwidth(double read_bw);
double get_read_bandwidth() const;
+
+ Disk* set_write_bandwidth(double write_bw);
double get_write_bandwidth() const;
+
const std::unordered_map<std::string, std::string>* get_properties() const;
const char* get_property(const std::string& key) const;
void set_property(const std::string&, const std::string& value);
explicit Host(const std::string& name);
protected:
- virtual ~Host();
- void set_netpoint(kernel::routing::NetPoint* netpoint) { pimpl_netpoint_ = netpoint; }
-
-private:
- bool currently_destroying_ = false;
+ virtual ~Host(); // Call destroy() instead of manually deleting it.
+ Host* set_netpoint(kernel::routing::NetPoint* netpoint);
#endif
public:
bool is_on() const;
const char* get_property(const std::string& key) const;
- void set_property(const std::string& key, const std::string& value);
+ Host* set_property(const std::string& key, const std::string& value);
const std::unordered_map<std::string, std::string>* get_properties() const;
- void set_properties(const std::unordered_map<std::string, std::string>& properties);
+ Host* set_properties(const std::unordered_map<std::string, std::string>& properties);
void set_state_profile(kernel::profile::Profile* p);
void set_speed_profile(kernel::profile::Profile* p);
int get_pstate() const;
std::vector<Disk*> get_disks() const;
+ Disk* create_disk();
void add_disk(const Disk* disk);
void remove_disk(const std::string& disk_name);
void set_latency_profile(kernel::profile::Profile* profile);
const char* get_property(const std::string& key) const;
- void set_property(const std::string& key, const std::string& value);
+ Link* set_property(const std::string& key, const std::string& value);
+ const std::unordered_map<std::string, std::string>* get_properties() const;
+ Link* set_properties(const std::unordered_map<std::string, std::string>& properties);
/* The signals */
/** @brief Callback signal fired when a new Link is created */
#include <simgrid/simix.h>
#include <xbt/functional.hpp>
-#include <xbt/future.hpp>
+#include <xbt/promise.hpp>
#include <xbt/signal.hpp>
#include <xbt/utility.hpp>
#include <xbt/sysdep.h>
-#include <xbt/future.hpp>
#include <simgrid/kernel/future.hpp>
#include <simgrid/simix.h>
#include <simgrid/simix.hpp>
+#include <xbt/promise.hpp>
namespace simgrid {
namespace simix {
#include "src/smpi/include/smpi_actor.hpp"
#include <boost/algorithm/string/join.hpp>
-#include <xbt/replay.hpp>
#include <xbt/ex.h>
+#include <xbt/replay.hpp>
#include <memory>
#include <sstream>
double comp_size;
int send_size;
int recv_size;
- int root = 0;
+ int root = 0;
MPI_Datatype datatype1 = MPI_DEFAULT_TYPE;
MPI_Datatype datatype2 = MPI_DEFAULT_TYPE;
};
namespace simgrid {
namespace xbt {
-/** Try to demangle a C++ name
- *
- * Return the origin string if this fails.
- */
-XBT_PUBLIC std::unique_ptr<char, std::function<void(char*)>> demangle(const char* name);
-
class BacktraceImpl;
/** A backtrace
*
SG_BEGIN_DECL
/** Helper function used to throw exceptions in C */
-XBT_ATTRIB_NORETURN XBT_PUBLIC void _xbt_throw(char* message, int value, const char* file, int line, const char* func);
-
-/** Builds and throws an exception
- * @ingroup XBT_ex_c
- * @hideinitializer
- */
-#define THROW(v) _xbt_throw(NULL, (v), __FILE__, __LINE__, __func__)
+XBT_ATTRIB_NORETURN XBT_PUBLIC void _xbt_throw(char* message, const char* file, int line, const char* func);
/** Builds and throws an exception with a printf-like formatted message
* @ingroup XBT_ex_c
* @hideinitializer
*/
-#define THROWF(v, ...) _xbt_throw(bprintf(__VA_ARGS__), (v), __FILE__, __LINE__, __func__)
+#define THROW(...) _xbt_throw(bprintf(__VA_ARGS__), __FILE__, __LINE__, __func__)
XBT_ATTRIB_NORETURN void xbt_throw_impossible(const char* file, int line, const char* func);
/** Throw an exception because something impossible happened
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#ifndef XBT_FUTURE_HPP
-#define XBT_FUTURE_HPP
+#ifndef XBT_PROMISE_HPP
+#define XBT_PROMISE_HPP
#include <cstddef>
*
* Also the name is not so great.
**/
-template<class T>
-class Result {
+template <class T> class Result {
public:
- bool is_valid() const
- {
- return value_.which() > 0;
- }
- void set_exception(std::exception_ptr e)
- {
- value_ = std::move(e);
- }
- void set_value(T&& value)
- {
- value_ = std::move(value);
- }
- void set_value(T const& value)
- {
- value_ = value;
- }
+ bool is_valid() const { return value_.which() > 0; }
+ void set_exception(std::exception_ptr e) { value_ = std::move(e); }
+ void set_value(T&& value) { value_ = std::move(value); }
+ void set_value(T const& value) { value_ = value; }
/** Extract the value from the future
*
boost::variant<boost::blank, T, std::exception_ptr> value_;
};
-template<>
-class Result<void> : public Result<std::nullptr_t>
-{
+template <> class Result<void> : public Result<std::nullptr_t> {
public:
- void set_value()
- {
- Result<std::nullptr_t>::set_value(nullptr);
- }
- void get()
- {
- Result<std::nullptr_t>::get();
- }
+ void set_value() { Result<std::nullptr_t>::set_value(nullptr); }
+ void get() { Result<std::nullptr_t>::get(); }
};
-template<class T>
-class Result<T&> : public Result<std::reference_wrapper<T>>
-{
+template <class T> class Result<T&> : public Result<std::reference_wrapper<T>> {
public:
- void set_value(T& value)
- {
- Result<std::reference_wrapper<T>>::set_value(std::ref(value));
- }
- T& get()
- {
- return Result<std::reference_wrapper<T>>::get();
- }
+ void set_value(T& value) { Result<std::reference_wrapper<T>>::set_value(std::ref(value)); }
+ T& get() { return Result<std::reference_wrapper<T>>::get(); }
};
/** Execute some code and set a promise or result accordingly
{
fulfill_promise(promise, [&future] { return std::forward<F>(future).get(); });
}
-
}
}
-/* xbt/replay_reader.h -- Tools to parse a replay file */
+/* xbt/replay.hpp -- Tools to parse a replay file */
/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
double amount_ = 0;
public:
- int endpoint = 0;
- int send_size = 0;
- std::shared_ptr<std::vector<int>> sendcounts = nullptr;
- int recv_size = 0;
- std::shared_ptr<std::vector<int>> recvcounts = nullptr;
- std::string send_type = "";
- std::string recv_type = "";
-
- // NoOpTI: init, finalize, test, wait, barrier
explicit TIData(const std::string& name) : name_(name){};
- // CPuTI: compute, sleep (+ waitAny and waitall out of laziness)
explicit TIData(const std::string& name, double amount) : name_(name), amount_(amount){};
- // Pt2PtTI: send, isend, ssend, issend, recv, irecv
- explicit TIData(const std::string& name, int endpoint, int size, const std::string& datatype)
- : name_(name), endpoint(endpoint), send_size(size), send_type(datatype){};
- // CollTI: bcast, reduce, allreduce, gather, scatter, allgather, alltoall
- explicit TIData(const std::string& name, int root, double amount, int send_size, int recv_size,
- const std::string& send_type, const std::string& recv_type)
- : name_(name)
- , amount_(amount)
- , endpoint(root)
- , send_size(send_size)
- , recv_size(recv_size)
- , send_type(send_type)
- , recv_type(recv_type){};
- // VarCollTI: gatherv, scatterv, allgatherv, alltoallv (+ reducescatter out of laziness)
- explicit TIData(const std::string& name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
- int recv_size, std::shared_ptr<std::vector<int>> recvcounts, const std::string& send_type,
- const std::string& recv_type)
- : name_(name)
- , endpoint(root)
- , send_size(send_size)
- , sendcounts(sendcounts)
- , recv_size(recv_size)
- , recvcounts(recvcounts)
- , send_type(send_type)
- , recv_type(recv_type){};
virtual ~TIData() = default;
virtual std::string display_size() = 0;
};
+// NoOpTI: init, finalize, test, wait, barrier
class NoOpTIData : public TIData {
+ explicit NoOpTIData(const std::string&, double); // disallow this constructor inherited from TIData
+
public:
- explicit NoOpTIData(const std::string& name) : TIData(name){};
+ using TIData::TIData;
std::string print() override { return get_name(); }
std::string display_size() override { return "NA"; }
};
+// CPuTI: compute, sleep (+ waitAny and waitall out of laziness)
class CpuTIData : public TIData {
+ explicit CpuTIData(const std::string&); // disallow this constructor inherited from TIData
+
public:
- explicit CpuTIData(const std::string& name, double amount) : TIData(name, amount){};
+ using TIData::TIData;
std::string print() override
{
std::stringstream stream;
std::string display_size() override { return std::to_string(get_amount()); }
};
+// Pt2PtTI: send, isend, ssend, issend, recv, irecv
class Pt2PtTIData : public TIData {
- int tag = 0;
+ int endpoint_;
+ int size_;
+ std::string type_;
+ int tag_ = 0;
public:
- explicit Pt2PtTIData(const std::string& name, int endpoint, int size, int tag, const std::string& datatype)
- : TIData(name, endpoint, size, datatype), tag(tag){};
+ Pt2PtTIData(const std::string& name, int endpoint, int size, const std::string& datatype)
+ : TIData(name), endpoint_(endpoint), size_(size), type_(datatype){};
+ Pt2PtTIData(const std::string& name, int endpoint, int size, int tag, const std::string& datatype)
+ : TIData(name), endpoint_(endpoint), size_(size), type_(datatype), tag_(tag){};
- explicit Pt2PtTIData(const std::string& name, int endpoint, int size, const std::string& datatype)
- : TIData(name, endpoint, size, datatype){};
std::string print() override
{
std::stringstream stream;
- stream << get_name() << " " << endpoint << " ";
- stream << tag << " " << send_size << " " << send_type;
+ stream << get_name() << " " << endpoint_ << " " << tag_ << " " << size_ << " " << type_;
return stream.str();
}
- std::string display_size() override { return std::to_string(send_size); }
+ std::string display_size() override { return std::to_string(size_); }
};
+// CollTI: bcast, reduce, allreduce, gather, scatter, allgather, alltoall
class CollTIData : public TIData {
+ int root_;
+ int send_size_;
+ int recv_size_;
+ std::string send_type_;
+ std::string recv_type_;
+
public:
- explicit CollTIData(const std::string& name, int root, double amount, int send_size, int recv_size,
- const std::string& send_type, const std::string& recv_type)
- : TIData(name, root, amount, send_size, recv_size, send_type, recv_type){};
+ CollTIData(const std::string& name, int root, double amount, int send_size, int recv_size,
+ const std::string& send_type, const std::string& recv_type)
+ : TIData(name, amount)
+ , root_(root)
+ , send_size_(send_size)
+ , recv_size_(recv_size)
+ , send_type_(send_type)
+ , recv_type_(recv_type){};
+
std::string print() override
{
std::stringstream stream;
- stream << get_name() << " " << send_size << " ";
- if (recv_size >= 0)
- stream << recv_size << " ";
+ stream << get_name() << " " << send_size_ << " ";
+ if (recv_size_ >= 0)
+ stream << recv_size_ << " ";
if (get_amount() >= 0.0)
stream << get_amount() << " ";
- if (endpoint > 0 || (endpoint == 0 && not send_type.empty()))
- stream << endpoint << " ";
- stream << send_type << " " << recv_type;
+ if (root_ > 0 || (root_ == 0 && not send_type_.empty()))
+ stream << root_ << " ";
+ stream << send_type_ << " " << recv_type_;
return stream.str();
}
- std::string display_size() override { return std::to_string(send_size); }
+ std::string display_size() override { return std::to_string(send_size_); }
};
+// VarCollTI: gatherv, scatterv, allgatherv, alltoallv (+ reducescatter out of laziness)
class VarCollTIData : public TIData {
+ int root_;
+ int send_size_;
+ std::shared_ptr<std::vector<int>> sendcounts_;
+ int recv_size_;
+ std::shared_ptr<std::vector<int>> recvcounts_;
+ std::string send_type_;
+ std::string recv_type_;
+
public:
- explicit VarCollTIData(const std::string& name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
- int recv_size, std::shared_ptr<std::vector<int>> recvcounts, const std::string& send_type,
- const std::string& recv_type)
- : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+ VarCollTIData(const std::string& name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
+ int recv_size, std::shared_ptr<std::vector<int>> recvcounts, const std::string& send_type,
+ const std::string& recv_type)
+ : TIData(name)
+ , root_(root)
+ , send_size_(send_size)
+ , sendcounts_(sendcounts)
+ , recv_size_(recv_size)
+ , recvcounts_(recvcounts)
+ , send_type_(send_type)
+ , recv_type_(recv_type){};
std::string print() override
{
std::stringstream stream;
stream << get_name() << " ";
- if (send_size >= 0)
- stream << send_size << " ";
- if (sendcounts != nullptr)
- for (auto count : *sendcounts)
+ if (send_size_ >= 0)
+ stream << send_size_ << " ";
+ if (sendcounts_ != nullptr)
+ for (auto count : *sendcounts_)
stream << count << " ";
- if (recv_size >= 0)
- stream << recv_size << " ";
- if (recvcounts != nullptr)
- for (auto count : *recvcounts)
+ if (recv_size_ >= 0)
+ stream << recv_size_ << " ";
+ if (recvcounts_ != nullptr)
+ for (auto count : *recvcounts_)
stream << count << " ";
- if (endpoint > 0 || (endpoint == 0 && not send_type.empty()))
- stream << endpoint << " ";
- stream << send_type << " " << recv_type;
+ if (root_ > 0 || (root_ == 0 && not send_type_.empty()))
+ stream << root_ << " ";
+ stream << send_type_ << " " << recv_type_;
return stream.str();
}
- std::string display_size() override { return std::to_string(send_size > 0 ? send_size : recv_size); }
+ std::string display_size() override { return std::to_string(send_size_ > 0 ? send_size_ : recv_size_); }
};
/**
* to identify this request. We do this by searching for a request identified by (src, dest, tag).
*/
class WaitTIData : public TIData {
- int src;
- int dest;
- int tag;
+ int src_;
+ int dest_;
+ int tag_;
public:
- explicit WaitTIData(int src, int dest, int tag) : TIData("wait"), src(src), dest(dest), tag(tag){};
+ WaitTIData(int src, int dest, int tag) : TIData("wait"), src_(src), dest_(dest), tag_(tag){};
std::string print() override
{
std::stringstream stream;
- stream << get_name() << " " << src << " " << dest << " " << tag;
-
+ stream << get_name() << " " << src_ << " " << dest_ << " " << tag_;
return stream.str();
}
-
std::string display_size() override { return "NA"; }
};
class AmpiMigrateTIData : public TIData {
- size_t memory_consumption;
+ size_t memory_consumption_;
+
public:
- explicit AmpiMigrateTIData(size_t memory_conso) : TIData("migrate"), memory_consumption(memory_conso) { };
+ explicit AmpiMigrateTIData(size_t memory_conso) : TIData("migrate"), memory_consumption_(memory_conso){};
std::string print() override
{
std::stringstream stream;
- stream << get_name() << " " << memory_consumption;
-
+ stream << get_name() << " " << memory_consumption_;
return stream.str();
}
-
std::string display_size() override { return "NA"; }
};
} // namespace instr
}
CommImpl** element = std::find(comms, comms + count, this);
int rank = (element != comms + count) ? element - comms : -1;
-
// In order to modify the exception we have to rethrow it:
try {
std::rethrow_exception(simcall->issuer_->exception_);
} catch (simgrid::Exception& e) {
- e.value = rank;
+ e.set_value(rank);
}
}
#include "src/surf/HostImpl.hpp"
#include "src/surf/cpu_interface.hpp"
+#include <boost/core/demangle.hpp>
#include <boost/range/algorithm.hpp>
#include <utility>
try {
std::rethrow_exception(std::move(exception));
} catch (const simgrid::Exception& e) {
- std::string name = simgrid::xbt::demangle(typeid(e).name()).get();
- e.rethrow_nested(XBT_THROW_POINT, name + " raised in kernel mode.");
+ e.rethrow_nested(XBT_THROW_POINT, boost::core::demangle(typeid(e).name()) + " raised in kernel mode.");
}
}
#include "src/kernel/context/ContextSwapped.hpp"
+#include <boost/core/demangle.hpp>
#include <memory>
#ifdef _WIN32
} catch (simgrid::ForcefulKillException const&) {
XBT_DEBUG("Caught a ForcefulKillException");
} catch (simgrid::Exception const& e) {
- XBT_INFO("Actor killed by an uncaught exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ XBT_INFO("Actor killed by an uncaught exception %s", boost::core::demangle(typeid(e).name()).c_str());
throw;
}
#if HAVE_SANITIZER_ADDRESS_FIBER_SUPPORT
#include "src/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
#include "xbt/function_types.h"
+#include <boost/core/demangle.hpp>
#include <functional>
#include <utility>
XBT_DEBUG("Caught a ForcefulKillException in Thread::wrapper");
xbt_assert(not context->is_maestro(), "Maestro shall not receive ForcefulKillExceptions, even when detached.");
} catch (simgrid::Exception const& e) {
- XBT_INFO("Actor killed by an uncaught exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ XBT_INFO("Actor killed by an uncaught exception %s", boost::core::demangle(typeid(e).name()).c_str());
throw;
}
// Signal to the caller (normally the maestro) that we have finished:
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/lmm/maxmin.hpp"
-#include "xbt/backtrace.hpp"
+#include <boost/core/demangle.hpp>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
Constraint* cnst;
while ((var = extract_variable())) {
- auto demangled = simgrid::xbt::demangle(var->id_ ? typeid(*var->id_).name() : "(unidentified)");
- XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.", demangled.get(),
+ std::string demangled = boost::core::demangle(var->id_ ? typeid(*var->id_).name() : "(unidentified)");
+ XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.", demangled.c_str(),
var->rank_);
var_free(var);
}
* Resource *
************/
-DiskImpl::DiskImpl(kernel::resource::Model* model, const std::string& name, kernel::lmm::System* maxminSystem,
- double read_bw, double write_bw)
- : Resource(model, name, maxminSystem->constraint_new(this, std::max(read_bw, write_bw)))
- , piface_(name, this)
- , read_bw_(read_bw)
- , write_bw_(write_bw)
+DiskImpl* DiskImpl::set_read_bandwidth(double read_bw)
{
- DiskImpl::turn_on();
- XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw_, write_bw_);
- constraint_read_ = maxminSystem->constraint_new(this, read_bw);
- constraint_write_ = maxminSystem->constraint_new(this, write_bw);
+ read_bw_ = read_bw;
+ return this;
}
-DiskImpl::~DiskImpl()
+DiskImpl* DiskImpl::set_write_bandwidth(double write_bw)
{
- xbt_assert(currently_destroying_, "Don't delete Disks directly. Call destroy() instead.");
+ write_bw_ = write_bw;
+ return this;
+}
+
+DiskImpl* DiskImpl::set_read_constraint(lmm::Constraint* constraint_read)
+{
+ constraint_read_ = constraint_read;
+ return this;
+}
+
+DiskImpl* DiskImpl::set_write_constraint(lmm::Constraint* constraint_write)
+{
+ constraint_write_ = constraint_write;
+ return this;
}
/** @brief Fire the required callbacks and destroy the object
*/
void DiskImpl::destroy()
{
- if (not currently_destroying_) {
- currently_destroying_ = true;
- s4u::Disk::on_destruction(this->piface_);
- delete this;
- }
+ s4u::Disk::on_destruction(this->piface_);
+ delete this;
}
bool DiskImpl::is_used() const
DiskModel& operator=(const DiskModel&) = delete;
~DiskModel() override;
- virtual DiskImpl* createDisk(const std::string& id, double read_bw, double write_bw) = 0;
+ virtual DiskImpl* create_disk() = 0;
};
/************
* Resource *
************/
class DiskImpl : public Resource, public xbt::PropertyHolder {
- bool currently_destroying_ = false;
s4u::Host* host_ = nullptr;
s4u::Disk piface_;
- double read_bw_;
- double write_bw_;
- lmm::Constraint* constraint_write_; /* Constraint for maximum write bandwidth*/
- lmm::Constraint* constraint_read_; /* Constraint for maximum read bandwidth*/
+ double read_bw_ = -1.0;
+ double write_bw_ = 1.0;
+ lmm::Constraint* constraint_write_ = nullptr; /* Constraint for maximum write bandwidth*/
+ lmm::Constraint* constraint_read_ = nullptr; /* Constraint for maximum read bandwidth*/
+
+protected:
+ ~DiskImpl() override = default; // Disallow direct deletion. Call destroy() instead.
public:
- DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
+ DiskImpl() : piface_(this){}
DiskImpl(const DiskImpl&) = delete;
DiskImpl& operator=(const DiskImpl&) = delete;
- ~DiskImpl() override;
-
/** @brief Public interface */
const s4u::Disk* get_iface() const { return &piface_; }
s4u::Disk* get_iface() { return &piface_; }
s4u::Host* get_host() const { return host_; }
void set_host(s4u::Host* host) { host_ = host; }
+ DiskImpl* set_read_bandwidth(double read_bw);
double get_read_bandwidth() const { return read_bw_; }
+
+ DiskImpl* set_write_bandwidth(double write_bw);
double get_write_bandwidth() const { return write_bw_; }
+
+ DiskImpl* set_read_constraint(lmm::Constraint* constraint_read);
lmm::Constraint* get_read_constraint() const { return constraint_read_; }
+
+ DiskImpl* set_write_constraint(lmm::Constraint* constraint_write);
lmm::Constraint* get_write_constraint() const { return constraint_write_; }
/** @brief Check if the Disk is used (if an action currently uses its resources) */
namespace kernel {
namespace resource {
+Resource* Resource::set_name(const std::string& name)
+{
+ name_ = name;
+ return this;
+}
+
+Resource* Resource::set_model(Model* model)
+{
+ model_ = model;
+ return this;
+}
+
+Resource* Resource::set_constraint(lmm::Constraint* constraint)
+{
+ constraint_ = constraint;
+ return this;
+}
+
double Resource::get_load() const
{
return constraint_->get_usage();
public:
static double the_date;
- explicit MockedResource() : simgrid::kernel::resource::Resource(nullptr, "fake", nullptr) {}
+ explicit MockedResource() { this->set_name("fake"); }
void apply_event(simgrid::kernel::profile::Event* event, double value) override
{
XBT_VERB("t=%.1f: Change value to %lg (idx: %u)", the_date, value, event->idx);
}
s4u::Link* NetZoneImpl::create_link(const std::string& name, const std::vector<double>& bandwidths, double latency,
- s4u::Link::SharingPolicy policy,
- const std::unordered_map<std::string, std::string>* props)
+ s4u::Link::SharingPolicy policy)
{
static double last_warned_latency = sg_surf_precision;
if (latency != 0.0 && latency < last_warned_latency) {
auto* l = surf_network_model->create_link(name, bandwidths, latency, policy);
- if (props)
- l->set_properties(*props);
-
return l->get_iface();
}
+
s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<double>& speed_per_pstate,
- int coreAmount, const std::unordered_map<std::string, std::string>* props)
+ int coreAmount)
{
- auto* res = new s4u::Host(name);
-
if (hierarchy_ == RoutingMode::unset)
hierarchy_ = RoutingMode::base;
- res->set_netpoint(new NetPoint(name, NetPoint::Type::Host, this));
+ auto* res = (new s4u::Host(name))->set_netpoint(new NetPoint(name, NetPoint::Type::Host, this));
surf_cpu_model_pm->create_cpu(res, speed_per_pstate, coreAmount);
- if (props != nullptr)
- res->set_properties(*props);
-
- s4u::Host::on_creation(*res); // notify the signal
-
return res;
}
}
}
s4u::Link* WifiZone::create_link(const std::string& name, const std::vector<double>& bandwidths, double latency,
- s4u::Link::SharingPolicy policy,
- const std::unordered_map<std::string, std::string>* props)
+ s4u::Link::SharingPolicy policy)
{
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, latency, policy, props);
+ auto s4u_link = NetZoneImpl::create_link(name, bandwidths, latency, policy);
wifi_link_ = s4u_link->get_impl();
return s4u_link;
}
#include "src/mc/mc_smx.hpp"
#include "src/mc/remote/AppSide.hpp"
#include "src/mc/sosp/Snapshot.hpp"
-#include "xbt/backtrace.hpp"
#include <array>
+#include <boost/core/demangle.hpp>
#include <libunwind.h>
#endif
do {
const char* name = not unw_get_proc_name(cursor, buffer.data(), buffer.size(), &off) ? buffer.data() : "?";
// Unmangle C++ names:
- auto realname = simgrid::xbt::demangle(name);
+ std::string realname = boost::core::demangle(name);
#if defined(__x86_64__)
unw_word_t rip = 0;
unw_word_t rsp = 0;
unw_get_reg(cursor, UNW_X86_64_RIP, &rip);
unw_get_reg(cursor, UNW_X86_64_RSP, &rsp);
- fprintf(file, " %i: %s (RIP=0x%" PRIx64 " RSP=0x%" PRIx64 ")\n", nframe, realname.get(), (std::uint64_t)rip,
+ fprintf(file, " %i: %s (RIP=0x%" PRIx64 " RSP=0x%" PRIx64 ")\n", nframe, realname.c_str(), (std::uint64_t)rip,
(std::uint64_t)rsp);
#else
- fprintf(file, " %i: %s\n", nframe, realname.get());
+ fprintf(file, " %i: %s\n", nframe, realname.c_str());
#endif
++nframe;
try {
finished_index = simcall_comm_testany(s_comms.data(), s_comms.size());
} catch (const simgrid::TimeoutException& e) {
- finished_index = e.value;
+ finished_index = e.get_value();
status = MSG_TIMEOUT;
} catch (const simgrid::CancelException& e) {
- finished_index = e.value;
+ finished_index = e.get_value();
status = MSG_TASK_CANCELED;
} catch (const simgrid::NetworkFailureException& e) {
- finished_index = e.value;
+ finished_index = e.get_value();
status = MSG_TRANSFER_FAILURE;
}
try {
finished_index = simcall_comm_waitany(s_comms.data(), s_comms.size(), -1);
} catch (const simgrid::TimeoutException& e) {
- finished_index = e.value;
+ finished_index = e.get_value();
status = MSG_TIMEOUT;
} catch (const simgrid::CancelException& e) {
- finished_index = e.value;
+ finished_index = e.get_value();
status = MSG_TASK_CANCELED;
} catch (const simgrid::NetworkFailureException& e) {
- finished_index = e.value;
+ finished_index = e.get_value();
status = MSG_TRANSFER_FAILURE;
}
xbt::signal<void(Disk const&)> Disk::on_destruction;
xbt::signal<void(Disk const&)> Disk::on_state_change;
+Disk* Disk::set_name(const std::string& name)
+{
+ name_ = name;
+ return this;
+}
+
+Disk* Disk::set_read_bandwidth(double read_bw)
+{
+ pimpl_->set_read_bandwidth(read_bw);
+ return this;
+}
+
+Disk* Disk::set_write_bandwidth(double write_bw)
+{
+ pimpl_->set_write_bandwidth(write_bw);
+ return this;
+}
+
double Disk::get_read_bandwidth() const
{
return this->pimpl_->get_read_bandwidth();
new surf::HostImpl(this);
}
-Host::~Host()
+Host* Host::set_netpoint(kernel::routing::NetPoint* netpoint)
{
- xbt_assert(currently_destroying_, "Please call h->destroy() instead of manually deleting it.");
+ pimpl_netpoint_ = netpoint;
+ return this;
+}
+Host::~Host()
+{
delete pimpl_;
if (pimpl_netpoint_ != nullptr) // not removed yet by a children class
Engine::get_instance()->netpoint_unregister(pimpl_netpoint_);
*/
void Host::destroy()
{
- if (not currently_destroying_) {
- currently_destroying_ = true;
- on_destruction(*this);
- Engine::get_instance()->host_unregister(std::string(name_));
- delete this;
- }
+ on_destruction(*this);
+ Engine::get_instance()->host_unregister(std::string(name_));
+ delete this;
}
Host* Host::by_name(const std::string& name)
return this->pimpl_->get_property(key);
}
-void Host::set_property(const std::string& key, const std::string& value)
+Host* Host::set_property(const std::string& key, const std::string& value)
{
kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
+ return this;
}
-void Host::set_properties(const std::unordered_map<std::string, std::string>& properties)
+Host* Host::set_properties(const std::unordered_map<std::string, std::string>& properties)
{
kernel::actor::simcall([this, &properties] { this->pimpl_->set_properties(properties); });
+ return this;
}
/** Specify a profile turning the host on and off according to an exhaustive list or a stochastic law.
return kernel::actor::simcall([this] { return this->pimpl_->get_disks(); });
}
+Disk* Host::create_disk()
+{
+ auto pimpl = surf_disk_model->create_disk();
+ return pimpl->get_iface();
+}
+
void Host::add_disk(const Disk* disk)
{
kernel::actor::simcall([this, disk] { this->pimpl_->add_disk(disk); });
{
return this->pimpl_->get_property(key);
}
-void Link::set_property(const std::string& key, const std::string& value)
+Link* Link::set_property(const std::string& key, const std::string& value)
{
simgrid::kernel::actor::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
+ return this;
}
+
+const std::unordered_map<std::string, std::string>* Link::get_properties() const
+{
+ return this->pimpl_->get_properties();
+}
+
+Link* Link::set_properties(const std::unordered_map<std::string, std::string>& properties)
+{
+ kernel::actor::simcall([this, &properties] { this->pimpl_->set_properties(properties); });
+ return this;
+}
+
} // namespace s4u
} // namespace simgrid
atexit(SIMIX_clean);
}
-int smx_cleaned = 0;
/**
* @ingroup SIMIX_API
* @brief Clean the SIMIX simulation
*/
void SIMIX_clean()
{
+ static bool smx_cleaned = false;
if (smx_cleaned)
return; // to avoid double cleaning by java and C
- smx_cleaned = 1;
+ smx_cleaned = true;
XBT_DEBUG("SIMIX_clean called. Simulation's over.");
if (not simix_global->actors_to_run.empty() && SIMIX_get_clock() <= 0.0) {
XBT_CRITICAL(" ");
#ifndef SMPI_F2C_HPP_INCLUDED
#define SMPI_F2C_HPP_INCLUDED
+#include <memory>
#include <unordered_map>
namespace simgrid{
class F2C {
private:
+ using f2c_lookup_type = std::unordered_map<unsigned int, F2C*>;
+
// We use a single lookup table for every type.
// Beware of collisions if id in mpif.h is not unique
- static std::unordered_map<unsigned int, F2C*>* f2c_lookup_;
+ static std::unique_ptr<f2c_lookup_type> f2c_lookup_;
static int f2c_id_;
- static std::unordered_map<unsigned int, F2C*>::size_type num_default_handles_;
+ static f2c_lookup_type::size_type num_default_handles_;
int my_f2c_id_ = -1;
protected:
- static void set_f2c_lookup(std::unordered_map<unsigned int, F2C*>* map) { f2c_lookup_ = map; }
+ static void allocate_lookup()
+ {
+ if (not f2c_lookup_)
+ f2c_lookup_ = std::make_unique<f2c_lookup_type>();
+ }
static int f2c_id() { return f2c_id_; }
static void f2c_id_increment() { f2c_id_++; }
public:
- static void delete_lookup() { delete f2c_lookup_; f2c_lookup_ = nullptr ;}
- static std::unordered_map<unsigned int, F2C*>* lookup() { return f2c_lookup_; }
+ static f2c_lookup_type* lookup() { return f2c_lookup_.get(); }
F2C();
virtual ~F2C() = default;
// For the default one, the MPI_*_NULL returned is assumed to be NULL.
static F2C* f2c(int id);
static void finish_initialization() { num_default_handles_ = f2c_lookup_->size(); }
- static std::unordered_map<unsigned int, F2C*>::size_type get_num_default_handles() { return num_default_handles_;}
+ static f2c_lookup_type::size_type get_num_default_handles() { return num_default_handles_; }
};
}
if (smpi_cfg_privatization() == SmpiPrivStrategies::MMAP)
smpi_destroy_global_memory_segments();
- if (simgrid::smpi::F2C::lookup() != nullptr){
- if (simgrid::smpi::F2C::lookup()->size() > simgrid::smpi::F2C::get_num_default_handles()){
- XBT_WARN("Probable 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());
- int n = simgrid::config::get_value<int>("smpi/list-leaks");
- if (n > 0) {
- std::for_each(simgrid::smpi::F2C::lookup()->begin(),
- simgrid::smpi::F2C::lookup()->end(),
- [n](const std::pair<unsigned int, simgrid::smpi::F2C*> &p) {
- static int printed = 0;
- if(p.first >= simgrid::smpi::F2C::get_num_default_handles() && printed < n){
- XBT_WARN ("Leak %p of type %s", p.second, boost::core::demangle(typeid(*(p.second)).name()).c_str() );
- printed++;
- }
- });
+ if (simgrid::smpi::F2C::lookup() != nullptr &&
+ simgrid::smpi::F2C::lookup()->size() > simgrid::smpi::F2C::get_num_default_handles()) {
+ XBT_WARN("Probable 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());
+ int n = simgrid::config::get_value<int>("smpi/list-leaks");
+ for (auto const& p : *simgrid::smpi::F2C::lookup()) {
+ static int printed = 0;
+ if (printed >= n)
+ break;
+ if (p.first >= simgrid::smpi::F2C::get_num_default_handles()) {
+ XBT_WARN("Leak %p of type %s", p.second, boost::core::demangle(typeid(*(p.second)).name()).c_str());
+ printed++;
}
}
- simgrid::smpi::F2C::delete_lookup();
}
}
#include "smpi_group.hpp"
#include "smpi_request.hpp"
#include "xbt/replay.hpp"
-#include <simgrid/smpi/replay.hpp>
+#include <simgrid/smpi/smpi_replay.hpp>
#include <src/smpi/include/private.hpp>
#include <memory>
// Internal use only
CREATE_MPI_DATATYPE(MPI_PTR, 54, void*)
CREATE_MPI_DATATYPE(MPI_COUNT, 55, long long)
-#define NUM_BASIC_DATATYPES 57
namespace simgrid{
namespace smpi{
namespace simgrid{
namespace smpi{
-std::unordered_map<unsigned int, F2C*>* F2C::f2c_lookup_ = nullptr;
+std::unique_ptr<F2C::f2c_lookup_type> F2C::f2c_lookup_ = nullptr;
int F2C::f2c_id_ = 0;
-std::unordered_map<unsigned int, F2C*>::size_type F2C::num_default_handles_ = 0;
+F2C::f2c_lookup_type::size_type F2C::num_default_handles_ = 0;
// Keep it non trivially-constructible, or it will break MC+smpi on FreeBSD with Clang (don't ask why)
F2C::F2C() = default;
int F2C::add_f()
{
- if (f2c_lookup_ == nullptr)
- f2c_lookup_ = new std::unordered_map<unsigned int, F2C*>();
+ allocate_lookup();
my_f2c_id_ = f2c_id();
(*f2c_lookup_)[my_f2c_id_] = this;
int F2C::c2f()
{
- if (f2c_lookup_ == nullptr) {
- f2c_lookup_ = new std::unordered_map<unsigned int, F2C*>();
- }
+ allocate_lookup();
if(my_f2c_id_==-1)
/* this function wasn't found, add it */
F2C* F2C::f2c(int id)
{
- if (f2c_lookup_ == nullptr)
- f2c_lookup_ = new std::unordered_map<unsigned int, F2C*>();
+ allocate_lookup();
if(id >= 0){
auto comm = f2c_lookup_->find(id);
static bool is_rank_in_range(int rank, int first, int last)
{
- if (first < last)
- return rank <= last;
- else
- return rank >= last;
+ return (first <= rank && rank <= last) || (first >= rank && rank >= last);
}
-int Group::range_incl(int n, int ranges[][3], MPI_Group * newgroup){
- int newsize = 0;
- for (int i = 0; i < n; i++) {
- for (int rank = ranges[i][0]; /* First */
- rank >= 0 && rank < size_; /* Last */
- ) {
- newsize++;
- if(rank == ranges[i][1]){/*already last ?*/
- break;
- }
- rank += ranges[i][2]; /* Stride */
- if (not is_rank_in_range(rank, ranges[i][0], ranges[i][1]))
- break;
- }
- }
- *newgroup = new Group(newsize);
- int j = 0;
- for (int i = 0; i < n; i++) {
- for (int rank = ranges[i][0]; /* First */
- rank >= 0 && rank < size_; /* Last */
- ) {
- s4u::Actor* actor = this->actor(rank);
- (*newgroup)->set_mapping(actor, j);
- j++;
- if(rank == ranges[i][1]){/*already last ?*/
- break;
- }
- rank += ranges[i][2]; /* Stride */
- if (not is_rank_in_range(rank, ranges[i][0], ranges[i][1]))
- break;
- }
+int Group::range_incl(int n, int ranges[][3], MPI_Group* newgroup)
+{
+ std::vector<int> to_incl;
+ for (int i = 0; i < n; i++)
+ for (int j = ranges[i][0]; j >= 0 && j < size_ && is_rank_in_range(j, ranges[i][0], ranges[i][1]);
+ j += ranges[i][2])
+ to_incl.push_back(j);
+
+ int newsize = static_cast<int>(to_incl.size());
+ *newgroup = new Group(newsize);
+
+ for (int j = 0; j < newsize; j++) {
+ int rank = to_incl[j];
+ s4u::Actor* actor = this->actor(rank);
+ (*newgroup)->set_mapping(actor, j);
}
if((*newgroup)!=MPI_GROUP_EMPTY)
(*newgroup)->add_f();
return MPI_SUCCESS;
}
-int Group::range_excl(int n, int ranges[][3], MPI_Group * newgroup){
+int Group::range_excl(int n, int ranges[][3], MPI_Group* newgroup)
+{
+ std::vector<bool> to_excl(size_, false);
int newsize = size_;
for (int i = 0; i < n; i++) {
- for (int rank = ranges[i][0]; /* First */
- rank >= 0 && rank < size_; /* Last */
- ) {
+ for (int j = ranges[i][0]; j >= 0 && j < size_ && is_rank_in_range(j, ranges[i][0], ranges[i][1]);
+ j += ranges[i][2]) {
+ to_excl[j] = true;
newsize--;
- if(rank == ranges[i][1]){/*already last ?*/
- break;
- }
- rank += ranges[i][2]; /* Stride */
- if (not is_rank_in_range(rank, ranges[i][0], ranges[i][1]))
- break;
}
}
if (newsize == 0) {
*newgroup = MPI_GROUP_EMPTY;
} else {
- *newgroup = new Group(newsize);
- int newrank = 0;
- int oldrank = 0;
- while (newrank < newsize) {
- int add = 1;
- for (int i = 0; i < n; i++) {
- for (int rank = ranges[i][0]; rank >= 0 && rank < size_;) {
- if(rank==oldrank){
- add = 0;
- break;
- }
- if(rank == ranges[i][1]){/*already last ?*/
- break;
- }
- rank += ranges[i][2]; /* Stride */
- if (not is_rank_in_range(rank, ranges[i][0], ranges[i][1]))
- break;
- }
- }
- if(add==1){
- s4u::Actor* actor = this->actor(oldrank);
- (*newgroup)->set_mapping(actor, newrank);
- newrank++;
+ *newgroup = new Group(newsize);
+
+ int j = 0;
+ for (int rank = 0; rank < size_; rank++) {
+ if (not to_excl[rank]) {
+ s4u::Actor* actor = this->actor(rank);
+ (*newgroup)->set_mapping(actor, j);
+ j++;
}
- oldrank++;
}
}
if((*newgroup)!=MPI_GROUP_EMPTY)
Cpu::Cpu(Model* model, s4u::Host* host, lmm::Constraint* constraint, const std::vector<double>& speed_per_pstate,
int core)
- : Resource(model, host->get_cname(), constraint)
- , core_count_(core)
+ : core_count_(core)
, host_(host)
, speed_per_pstate_(speed_per_pstate)
{
+ this->set_name(host->get_cname())->set_model(model)->set_constraint(constraint);
+
xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->get_cname());
speed_.peak = speed_per_pstate_.front();
all_existing_models.push_back(this);
}
-DiskImpl* DiskS19Model::createDisk(const std::string& id, double read_bw, double write_bw)
+DiskImpl* DiskS19Model::create_disk()
{
- XBT_DEBUG("SURF disk create resource\n\t\tid '%s'\n\t\tread_bw '%f'\n", id.c_str(), read_bw);
-
- return new DiskS19(this, id, get_maxmin_system(), read_bw, write_bw);
+ return new DiskS19();
}
double DiskS19Model::next_occurring_event(double now)
* Resource *
************/
-DiskS19::DiskS19(DiskModel* model, const std::string& name, lmm::System* maxminSystem, double read_bw, double write_bw)
- : DiskImpl(model, name, maxminSystem, read_bw, write_bw)
-{
- XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", read_bw, write_bw);
-}
-
DiskAction* DiskS19::io_start(sg_size_t size, s4u::Io::OpType type)
{
return new DiskS19Action(get_model(), static_cast<double>(size), not is_on(), this, type);
class DiskS19Model : public DiskModel {
public:
DiskS19Model();
- DiskImpl* createDisk(const std::string& id, double read_bw, double write_bw) override;
+ DiskImpl* create_disk() override;
double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
};
class DiskS19 : public DiskImpl {
public:
- DiskS19(DiskModel* model, const std::string& name, kernel::lmm::System* maxminSystem, double read_bw,
- double write_bw);
- ~DiskS19() override = default;
+ DiskS19() = default;
DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) override;
DiskAction* read(sg_size_t size) override;
DiskAction* write(sg_size_t size) override;
************/
LinkImpl::LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint)
- : Resource(model, name, constraint), piface_(this)
+ : piface_(this)
{
+ this->set_name(name)->set_model(model)->set_constraint(constraint);
if (name != "__loopback__")
xbt_assert(not s4u::Link::by_name_or_null(name), "Link '%s' declared several times in the platform.", name.c_str());
XBT_DEBUG("Create link '%s'", name.c_str());
}
-/** @brief use destroy() instead of this destructor */
-LinkImpl::~LinkImpl()
-{
- xbt_assert(currently_destroying_, "Don't delete Links directly. Call destroy() instead.");
-}
/** @brief Fire the required callbacks and destroy the object
*
* Don't delete directly a Link, call l->destroy() instead.
*/
void LinkImpl::destroy()
{
- if (not currently_destroying_) {
- currently_destroying_ = true;
- s4u::Link::on_destruction(this->piface_);
- delete this;
- }
+ s4u::Link::on_destruction(this->piface_);
+ delete this;
}
bool LinkImpl::is_used() const
* @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
*/
class LinkImpl : public Resource, public xbt::PropertyHolder {
- bool currently_destroying_ = false;
s4u::Link piface_;
protected:
LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint);
LinkImpl(const LinkImpl&) = delete;
LinkImpl& operator=(const LinkImpl&) = delete;
- ~LinkImpl() override;
+ ~LinkImpl() override = default; // Use destroy() instead of this destructor.
public:
void destroy(); // Must be called instead of the destructor
stack.Install(ns3_node_);
}
+void resumeWifiDevice(ns3::Ptr<ns3::WifiNetDevice> device) {
+ device->GetPhy()->ResumeFromOff();
+}
+
/*************
* Callbacks *
*************/
netDevices.Add(wifi.Install(wifiPhy, wifiMac, station_ns3_node));
}
+ const char* start_time = wifizone->get_property("start_time");
+ int start_time_value = start_time ? atoi(start_time) : 0;
+ auto resume = [](ns3::Ptr<ns3::WifiNetDevice> device){device->GetPhy()->ResumeFromOff();};
+ for (int i = 0; i < netDevices.GetN(); i++) {
+ ns3::Ptr<ns3::WifiNetDevice> device = ns3::StaticCast<ns3::WifiNetDevice>(netDevices.Get(i));
+ device->GetPhy()->SetOffMode();
+ ns3::Simulator::Schedule(
+ ns3::Seconds(start_time_value),
+ &resumeWifiDevice,
+ device);
+ }
+
ns3::Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", ns3::UintegerValue(40));
mobility.SetPositionAllocator(positionAllocS);
/** @brief Add a host to the current AS */
void sg_platf_new_host(const simgrid::kernel::routing::HostCreationArgs* args)
{
- std::unordered_map<std::string, std::string> props;
+ simgrid::s4u::Host* host = routing_get_current()->create_host(args->id, args->speed_per_pstate, args->core_amount);
+
if (args->properties) {
- for (auto const& elm : *args->properties)
- props.insert({elm.first, elm.second});
+ host->set_properties(*args->properties);
delete args->properties;
}
- simgrid::s4u::Host* host =
- routing_get_current()->create_host(args->id, args->speed_per_pstate, args->core_amount, &props);
-
host->pimpl_->set_disks(args->disks, host);
/* Change from the defaults */
host->set_pstate(args->pstate);
if (not args->coord.empty())
new simgrid::kernel::routing::vivaldi::Coords(host->get_netpoint(), args->coord);
+
+ simgrid::s4u::Host::on_creation(*host); // notify the signal
}
/** @brief Add a "router" to the network element list */
static void sg_platf_new_link(const simgrid::kernel::routing::LinkCreationArgs* args, const std::string& link_name)
{
- std::unordered_map<std::string, std::string> props;
- if (args->properties)
- for (auto const& elm : *args->properties)
- props.insert({elm.first, elm.second});
+ simgrid::s4u::Link* link = routing_get_current()->create_link(link_name, args->bandwidths, args->latency, args->policy);
- const simgrid::s4u::Link* link =
- routing_get_current()->create_link(link_name, args->bandwidths, args->latency, args->policy, &props);
+ if (args->properties)
+ link->set_properties(*args->properties);
simgrid::kernel::resource::LinkImpl* l = link->get_impl();
if (args->latency_trace)
simgrid::kernel::resource::DiskImpl* sg_platf_new_disk(const simgrid::kernel::routing::DiskCreationArgs* disk)
{
- simgrid::kernel::resource::DiskImpl* d = surf_disk_model->createDisk(disk->id, disk->read_bw, disk->write_bw);
+ simgrid::kernel::lmm::System* maxmin_system = surf_disk_model->get_maxmin_system();
+ simgrid::kernel::resource::DiskImpl* pimpl = surf_disk_model->create_disk();
+
+ // This should be done using s4u::Disk methods and passed to the pimpl
+ pimpl->set_read_bandwidth(disk->read_bw)
+ ->set_write_bandwidth(disk->write_bw)
+ ->set_name(disk->id);
if (disk->properties) {
- d->set_properties(*disk->properties);
+ pimpl->set_properties(*disk->properties);
delete disk->properties;
}
- simgrid::s4u::Disk::on_creation(*d->get_iface());
- return d;
+
+ // This should be done in the seal() of a Disk creation
+ pimpl->set_read_constraint(maxmin_system->constraint_new(pimpl,disk->read_bw))
+ ->set_write_constraint(maxmin_system->constraint_new(pimpl, disk->write_bw))
+ ->set_model(surf_disk_model)
+ ->set_constraint(maxmin_system->constraint_new(pimpl, std::max(disk->read_bw, disk->write_bw)));
+
+ XBT_DEBUG("Create resource with read_bw '%f' write_bw '%f'", disk->read_bw, disk->write_bw);
+ pimpl->turn_on();
+
+ // Temporary hack
+ pimpl->get_iface()->set_name(disk->id);
+ simgrid::s4u::Disk::on_creation(*pimpl->get_iface());
+ return pimpl;
}
void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
std::vector<double> speed_per_pstate;
speed_per_pstate.push_back(peer->speed);
- simgrid::s4u::Host* host = as->create_host(peer->id, speed_per_pstate, 1, nullptr);
+ simgrid::s4u::Host* host = as->create_host(peer->id, speed_per_pstate, 1);
as->set_peer_link(host->get_netpoint(), peer->bw_in, peer->bw_out, peer->coord);
host->set_state_profile(peer->state_trace);
if (peer->speed_trace)
host->set_speed_profile(peer->speed_trace);
+ simgrid::s4u::Host::on_creation(*host); // notify the signal
}
/* Pick the right models for CPU, net and host, and call their model_init_preparse */
}
/**
- * @brief Specify that the description of the current AS is finished
+ * @brief Specify that the description of the current Zone is finished
*
- * Once you've declared all the content of your AS, you have to seal
- * it with this call. Your AS is not usable until you call this function.
+ * Once you've declared all the content of your Zone, you have to seal
+ * it with this call. Your Zone is not usable until you call this function.
*/
void sg_platf_new_Zone_seal()
{
- xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
+ xbt_assert(current_routing, "Cannot seal the current Zone: zone under construction");
current_routing->seal();
simgrid::s4u::NetZone::on_seal(*current_routing->get_iface());
current_routing = current_routing->get_father();
}
-/** @brief Add a link connecting a host to the rest of its AS (which must be cluster or vivaldi) */
+/** @brief Add a link connecting a host to the rest of its Zone (which must be cluster or vivaldi) */
void sg_platf_new_hostlink(const simgrid::kernel::routing::HostLinkCreationArgs* hostlink)
{
const simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->get_netpoint();
xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
- "Only hosts from Cluster and Vivaldi ASes can get a host_link.");
+ "Only hosts from Cluster and Vivaldi Zones can get a host_link.");
const simgrid::s4u::Link* linkUp = simgrid::s4u::Link::by_name_or_null(hostlink->link_up);
const simgrid::s4u::Link* linkDown = simgrid::s4u::Link::by_name_or_null(hostlink->link_down);
#include <cstdlib>
#include <sstream>
-// Try to detect and use the C++ itanium ABI for name demangling:
-#ifdef __GXX_ABI_VERSION
-#include <cxxabi.h>
-#endif
-
#if HAVE_BOOST_STACKTRACE_BACKTRACE
#define BOOST_STACKTRACE_USE_BACKTRACE
#include <boost/stacktrace.hpp>
namespace simgrid {
namespace xbt {
-std::unique_ptr<char, std::function<void(char*)>> demangle(const char* name)
-{
-#ifdef __GXX_ABI_VERSION
- int status;
- std::unique_ptr<char, std::function<void(char*)>> res(abi::__cxa_demangle(name, nullptr, nullptr, &status),
- &std::free);
- if (res != nullptr)
- return res;
- // We did not manage to resolve this. Probably because this is not a mangled symbol:
-#endif
- // Return the symbol:
- return std::unique_ptr<char, std::function<void(char*)>>(xbt_strdup(name), &xbt_free_f);
-}
-
class BacktraceImpl {
#if HAVE_BOOST_STACKTRACE_BACKTRACE || HAVE_BOOST_STACKTRACE_ADDR2LINE
- const boost::stacktrace::stacktrace st = boost::stacktrace::stacktrace();
+ const boost::stacktrace::stacktrace st;
public:
std::string resolve() const
#include <xbt/config.hpp>
#include <xbt/log.hpp>
+#include <boost/core/demangle.hpp>
#include <mutex>
#include <sstream>
XBT_LOG_EXTERNAL_CATEGORY(xbt);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
-void _xbt_throw(char* message, int value, const char* file, int line, const char* func)
+void _xbt_throw(char* message, const char* file, int line, const char* func)
{
simgrid::Exception e(
simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid()),
message ? message : "");
xbt_free(message);
- e.value = value;
throw e;
}
void log_exception(e_xbt_log_priority_t prio, const char* context, std::exception const& exception)
{
try {
- auto name = simgrid::xbt::demangle(typeid(exception).name());
+ std::string name = boost::core::demangle(typeid(exception).name());
auto* with_context = dynamic_cast<const simgrid::Exception*>(&exception);
if (with_context != nullptr) {
- XBT_LOG(prio, "%s %s by %s/%d: %s", context, name.get(), with_context->throw_point().procname_.c_str(),
+ XBT_LOG(prio, "%s %s by %s/%d: %s", context, name.c_str(), with_context->throw_point().procname_.c_str(),
with_context->throw_point().pid_, exception.what());
// Do we have a backtrace?
if (not simgrid::config::get_value<bool>("exception/cutpath")) {
XBT_LOG(prio, "Backtrace:\n%s", backtrace.c_str());
}
} else {
- XBT_LOG(prio, "%s %s: %s", context, name.get(), exception.what());
+ XBT_LOG(prio, "%s %s: %s", context, name.c_str(), exception.what());
}
} catch (...) {
// Don't log exceptions we got when trying to log exception
switch (type) {
case MMALLOC_TYPE_HEAPINFO:
UNLOCK(mdp);
- THROWF(0, "Asked to free a fragment in a heapinfo block. I'm confused.\n");
+ THROW("Asked to free a fragment in a heapinfo block. I'm confused.\n");
break;
case MMALLOC_TYPE_FREE: /* Already free */
UNLOCK(mdp);
- THROWF(0, "Asked to free a fragment in a block that is already free. I'm puzzled.\n");
+ THROW("Asked to free a fragment in a block that is already free. I'm puzzled.\n");
break;
case MMALLOC_TYPE_UNFRAGMENTED:
if( mdp->heapinfo[block].busy_frag.frag_size[frag_nb] == -1){
UNLOCK(mdp);
- THROWF(0, "Asked to free a fragment that is already free. I'm puzzled\n");
+ THROW("Asked to free a fragment that is already free. I'm puzzled\n");
}
if (MC_is_active() && mdp->heapinfo[block].busy_frag.ignore[frag_nb] > 0)
void *mmalloc_preinit(void);
void mmalloc_postexit(void);
-extern int smx_cleaned;
extern int xbt_initialized;
SG_END_DECL
#include <memory>
#include <stdexcept>
-#include <xbt/future.hpp>
+#include <xbt/promise.hpp>
#include <simgrid/kernel/future.hpp>
#include <simgrid/s4u/Actor.hpp>
-foreach(x cloud-sharing ptask_L07 wifi_usage wifi_usage_decay)
+foreach(x cloud-sharing ptask_L07_usage wifi_usage wifi_usage_decay)
add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+++ /dev/null
-/* Copyright g(c) 2019-2021. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/s4u.hpp"
-#include "xbt/asserts.h"
-#include "xbt/log.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(ptask_L07_tes, "[usage] ptask_LO7 <platform-file>");
-
-namespace sg4 = simgrid::s4u;
-
-/* We need a separate actor so that it can sleep after each test */
-static void main_dispatcher()
-{
- const sg4::Engine* e = sg4::Engine::get_instance();
- double start_time;
- double end_time;
- std::vector<sg4::Host*> hosts = e->get_all_hosts();
-
- XBT_INFO("TEST: Create and run a sequential execution.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to compute 1 flop on a 1 flop/s host.");
- XBT_INFO("Should be done in exactly one second.");
- start_time = sg4::Engine::get_clock();
- sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: computing 1 flop at 1 flop/s takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Create and run two concurrent sequential executions.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to compute 2 x 1 flop on a 1 flop/s host.");
- XBT_INFO("Should be done in exactly 2 seconds because of sharing.");
- start_time = sg4::Engine::get_clock();
- sg4::ExecPtr e1 = sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->start();
- sg4::ExecPtr e2 = sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->start();
- e1->wait();
- e2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: computing 2x1 flop at 1 flop/s takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Create and run a parallel execution on 2 homogeneous hosts.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to compute 2 flops across two hosts running at 1 flop/s.");
- XBT_INFO("Should be done in exactly one second.");
- start_time = sg4::Engine::get_clock();
- sg4::Exec::init()->set_flops_amounts(std::vector<double>({1.0, 1.0}))
- ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1]}))
- ->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: computing 2 flops on 2 hosts at 1 flop/s takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Create and run a parallel execution on 2 heterogeneous hosts.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to compute 2 flops across two hosts, one running at 1 flop/s and one at 2 flop/s.");
- XBT_INFO("Should be done in exactly one second.");
- start_time = sg4::Engine::get_clock();
- sg4::Exec::init()->set_flops_amounts(std::vector<double>({1.0, 1.0}))
- ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[5]}))
- ->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: computing 2 flops on 2 heterogeneous hosts takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a shared link.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 500ms.");
- XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte on a shared link at 1Bps + 500ms takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a fatpipe link.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 500ms.");
- XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte on a fatpipe link at 1Bps + 500ms takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a 3-link route.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 2 x 500ms + 1s.");
- XBT_INFO("Should be done in 3 seconds (2 x 500ms + 1s latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a link with large latency.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B from one host to another on a link at 2Bps with a latency of 2 x 1024^2s.");
- XBT_INFO("This latency is half the default TCP window size (4MiB). This limits the bandwidth to 1B");
- XBT_INFO("Should be done in 2 x 1024^2s + 1 seconds (large latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- sg4::Comm::sendto_async(hosts[0], hosts[6], 1.0)->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte on a large latency link takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a shared link with 2 comms in same direction.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 500ms.");
- XBT_INFO("Should be done in 2.5 seconds (500ms latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
- sg4::CommPtr c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
- sg4::CommPtr c2 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 2x1 bytes on a shared link at 1Bps + 500ms takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a fatpipe link with 2 comms in same direction.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 500ms.");
- XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- c1 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
- c2 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 2x1 bytes on a fatpipe link at 1Bps + 500ms takes %.2f seconds.", end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a 3-link route with 2 comms in same direction.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 2 x 500ms + 1s.");
- XBT_INFO("Should be done in 4 seconds (2 x 500ms + 1s latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
- c1 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
- c2 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 2x1 bytes on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a shared link with 2 comms in opposite direction.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 500ms.");
- XBT_INFO("Should be done in 2.5 seconds (500ms latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
- c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
- c2 = sg4::Comm::sendto_async(hosts[4], hosts[0], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte in both directions on a shared link at 1Bps + 500ms takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a fatpipe link with 2 comms in opposite direction.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 500ms.");
- XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- c1 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
- c2 = sg4::Comm::sendto_async(hosts[5], hosts[0], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte in both directions on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Latency test between hosts connected by a 3-link route with 2 comms in opposite direction.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 2 x 500ms + 1s.");
- XBT_INFO("Should be done in 4 seconds (2 x 500ms + 1s latency + 2s transfert).");
- start_time = sg4::Engine::get_clock();
- c1 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
- c2 = sg4::Comm::sendto_async(hosts[1], hosts[0], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 1 byte in both directions on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: 4-host parallel communication with independent transfers.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("'cpu0' sends 1B to 'cpu1' and 'cpu2' sends 1B to 'cpu3'. The only shared link is the fatpipe switch.");
- XBT_INFO("Should be done in 3 seconds (2 x 500ms + 1s latency + 1s transfert).");
- start_time = sg4::Engine::get_clock();
- sg4::Exec::init()->set_bytes_amounts(std::vector<double>({0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 1.0,
- 0.0, 0.0, 0.0, 0.0 }))
- ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
- ->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: sending 2 x 1 byte in a parallel communication without interference takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: 4-host parallel communication with scatter pattern.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("'cpu0' sends 1B to 'cpu1', 2B to 'cpu2' and 3B to 'cpu3'.");
- XBT_INFO("Should be done in 8 seconds: 2 x 500ms + 1s of initial latency and :");
- XBT_INFO(" - For 3 seconds, three flows share a link to transfer 3 x 1B. 'cpu1' received its payload");
- XBT_INFO(" - For 2 seconds, two lows share a link to transfer 1 x 1B. 'cpu2' received is payload");
- XBT_INFO(" - For 1 second, one flow has the full bandwidth to transfer 1B. 'cpu3' received is payload");
-
- start_time = sg4::Engine::get_clock();
- sg4::Exec::init()->set_bytes_amounts(std::vector<double>({0.0, 1.0, 2.0, 3.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0 }))
- ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
- ->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: scattering an increasing number of bytes to 3 hosts takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: 4-host parallel communication with all-to-all pattern.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("Each host sends 1B to every other hosts.");
- XBT_INFO("Should be done in 8 seconds: 2 x 500ms + 1s of initial latency and 6 seconds for transfer");
- XBT_INFO("Each SHARED link is traversed by 6 flows (3 in and 3 out). ");
- XBT_INFO("Each 1B transfer thus takes 6 seconds on a 1Bps link");
-
- start_time = sg4::Engine::get_clock();
- sg4::Exec::init()->set_bytes_amounts(std::vector<double>({0.0, 1.0, 1.0, 1.0,
- 1.0, 0.0, 1.0, 1.0,
- 1.0, 1.0, 0.0, 1.0,
- 1.0, 1.0, 1.0, 0.0 }))
- ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
- ->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: 1-byte all-too-all in a parallel communication takes %.2f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-
- sg4::this_actor::sleep_for(5);
-
- XBT_INFO("TEST: Two concurrent communications, 1 large and 1 small.");
- XBT_INFO("------------------------------------------------------------");
- XBT_INFO("A host sends two messages of 100MB and 1B to the other host.");
- XBT_INFO("Should be done in 0.8001 seconds: 1e8/1.25e8 for transfer + 1e-4 of latency");
- XBT_INFO("The small communication has a negligible impact on the large one.");
- XBT_INFO("This corresponds to paying latency once and having the full bandwidth for the large communication.");
-
- start_time = sg4::Engine::get_clock();
- c1 = sg4::Comm::sendto_async(hosts[0], hosts[7], 1e8);
- c2 = sg4::Comm::sendto_async(hosts[0], hosts[7], 1.0);
- c1->wait();
- c2->wait();
- end_time = sg4::Engine::get_clock();
- XBT_INFO("Actual result: 1 small and 1 large concurrent communications take %.4f seconds.",
- end_time - start_time);
- XBT_INFO("\n");
-}
-
-int main(int argc, char** argv)
-{
- sg4::Engine engine(&argc, argv);
- engine.load_platform(argv[1]);
- sg4::Actor::create("dispatcher", sg4::Host::by_name("cpu0"), main_dispatcher);
- engine.run();
-
- return 0;
-}
-
--- /dev/null
+/* Copyright g(c) 2019-2021. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/s4u.hpp"
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(ptask_L07_usage, "[usage] ptask_L07_usage <platform-file>");
+
+namespace sg4 = simgrid::s4u;
+
+/* We need a separate actor so that it can sleep after each test */
+static void main_dispatcher()
+{
+ const sg4::Engine* e = sg4::Engine::get_instance();
+ double start_time;
+ double end_time;
+ std::vector<sg4::Host*> hosts = e->get_all_hosts();
+
+ XBT_INFO("TEST: Create and run a sequential execution.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to compute 1 flop on a 1 flop/s host.");
+ XBT_INFO("Should be done in exactly one second.");
+ start_time = sg4::Engine::get_clock();
+ sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: computing 1 flop at 1 flop/s takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Create and run two concurrent sequential executions.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to compute 2 x 1 flop on a 1 flop/s host.");
+ XBT_INFO("Should be done in exactly 2 seconds because of sharing.");
+ start_time = sg4::Engine::get_clock();
+ sg4::ExecPtr e1 = sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->start();
+ sg4::ExecPtr e2 = sg4::Exec::init()->set_flops_amount(1)->set_host(hosts[0])->start();
+ e1->wait();
+ e2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: computing 2x1 flop at 1 flop/s takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Create and run a parallel execution on 2 homogeneous hosts.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to compute 2 flops across two hosts running at 1 flop/s.");
+ XBT_INFO("Should be done in exactly one second.");
+ start_time = sg4::Engine::get_clock();
+ sg4::Exec::init()
+ ->set_flops_amounts(std::vector<double>({1.0, 1.0}))
+ ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1]}))
+ ->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: computing 2 flops on 2 hosts at 1 flop/s takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Create and run a parallel execution on 2 heterogeneous hosts.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to compute 2 flops across two hosts, one running at 1 flop/s and one at 2 flop/s.");
+ XBT_INFO("Should be done in exactly one second.");
+ start_time = sg4::Engine::get_clock();
+ sg4::Exec::init()
+ ->set_flops_amounts(std::vector<double>({1.0, 1.0}))
+ ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[5]}))
+ ->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: computing 2 flops on 2 heterogeneous hosts takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a shared link.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 500ms.");
+ XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0)->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte on a shared link at 1Bps + 500ms takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a fatpipe link.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 500ms.");
+ XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0)->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a 3-link route.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B from one host to another at 1Bps with a latency of 2 x 500ms + 1s.");
+ XBT_INFO("Should be done in 3 seconds (2 x 500ms + 1s latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0)->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a link with large latency.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B from one host to another on a link at 2Bps with a latency of 2 x 1024^2s.");
+ XBT_INFO("This latency is half the default TCP window size (4MiB). This limits the bandwidth to 1B");
+ XBT_INFO("Should be done in 2 x 1024^2s + 1 seconds (large latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ sg4::Comm::sendto_async(hosts[0], hosts[6], 1.0)->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte on a large latency link takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a shared link with 2 comms in same direction.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 500ms.");
+ XBT_INFO("Should be done in 2.5 seconds (500ms latency + 2s transfert).");
+ start_time = sg4::Engine::get_clock();
+ sg4::CommPtr c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
+ sg4::CommPtr c2 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 2x1 bytes on a shared link at 1Bps + 500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a fatpipe link with 2 comms in same direction.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 500ms.");
+ XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
+ c2 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 2x1 bytes on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a 3-link route with 2 comms in same direction.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 2 x 1B from one host to another at 1Bps with a latency of 2 x 500ms + 1s.");
+ XBT_INFO("Should be done in 4 seconds (2 x 500ms + 1s latency + 2s transfert).");
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
+ c2 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 2x1 bytes on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a shared link with 2 comms in opposite direction.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 500ms.");
+ XBT_INFO("Should be done in 2.5 seconds (500ms latency + 2s transfert).");
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
+ c2 = sg4::Comm::sendto_async(hosts[4], hosts[0], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte in both directions on a shared link at 1Bps + 500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a fatpipe link with 2 comms in opposite direction.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 500ms.");
+ XBT_INFO("Should be done in 1.5 seconds (500ms latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[5], 1.0);
+ c2 = sg4::Comm::sendto_async(hosts[5], hosts[0], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte in both directions on a fatpipe link at 1Bps + 500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Latency test between hosts connected by a 3-link route with 2 comms in opposite direction.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Have to send 1B between two hosts in each direction at 1Bps with a latency of 2 x 500ms + 1s.");
+ XBT_INFO("Should be done in 4 seconds (2 x 500ms + 1s latency + 2s transfert).");
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[1], 1.0);
+ c2 = sg4::Comm::sendto_async(hosts[1], hosts[0], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 1 byte in both directions on a 3-link route at 1Bps + 2,500ms takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: 4-host parallel communication with independent transfers.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("'cpu0' sends 1B to 'cpu1' and 'cpu2' sends 1B to 'cpu3'. The only shared link is the fatpipe switch.");
+ XBT_INFO("Should be done in 3 seconds (2 x 500ms + 1s latency + 1s transfert).");
+ start_time = sg4::Engine::get_clock();
+ sg4::Exec::init()
+ ->set_bytes_amounts(std::vector<double>({0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0,
+ 0.0, 0.0, 0.0, 0.0 }))
+ ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
+ ->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: sending 2 x 1 byte in a parallel communication without interference takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: 4-host parallel communication with scatter pattern.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("'cpu0' sends 1B to 'cpu1', 2B to 'cpu2' and 3B to 'cpu3'.");
+ XBT_INFO("Should be done in 8 seconds: 2 x 500ms + 1s of initial latency and :");
+ XBT_INFO(" - For 3 seconds, three flows share a link to transfer 3 x 1B. 'cpu1' received its payload");
+ XBT_INFO(" - For 2 seconds, two lows share a link to transfer 1 x 1B. 'cpu2' received is payload");
+ XBT_INFO(" - For 1 second, one flow has the full bandwidth to transfer 1B. 'cpu3' received is payload");
+
+ start_time = sg4::Engine::get_clock();
+ sg4::Exec::init()
+ ->set_bytes_amounts(std::vector<double>({0.0, 1.0, 2.0, 3.0,
+ 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0 }))
+ ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
+ ->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: scattering an increasing number of bytes to 3 hosts takes %.2f seconds.",
+ end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: 4-host parallel communication with all-to-all pattern.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("Each host sends 1B to every other hosts.");
+ XBT_INFO("Should be done in 8 seconds: 2 x 500ms + 1s of initial latency and 6 seconds for transfer");
+ XBT_INFO("Each SHARED link is traversed by 6 flows (3 in and 3 out). ");
+ XBT_INFO("Each 1B transfer thus takes 6 seconds on a 1Bps link");
+
+ start_time = sg4::Engine::get_clock();
+ sg4::Exec::init()
+ ->set_bytes_amounts(std::vector<double>({0.0, 1.0, 1.0, 1.0,
+ 1.0, 0.0, 1.0, 1.0,
+ 1.0, 1.0, 0.0, 1.0,
+ 1.0, 1.0, 1.0, 0.0 }))
+ ->set_hosts(std::vector<sg4::Host*>({hosts[0], hosts[1], hosts[2], hosts[3]}))
+ ->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: 1-byte all-too-all in a parallel communication takes %.2f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Two concurrent communications, 1 large and 1 small.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("A host sends two messages of 100MB and 1B to the other host.");
+ XBT_INFO("Should be done in 0.8001 seconds: 1e8/1.25e8 for transfer + 1e-4 of latency");
+ XBT_INFO("The small communication has a negligible impact on the large one.");
+ XBT_INFO("This corresponds to paying latency once and having the full bandwidth for the large communication.");
+
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[7], 1e8);
+ c2 = sg4::Comm::sendto_async(hosts[0], hosts[7], 1.0);
+ c1->wait();
+ c2->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: 1 small and 1 large concurrent communications take %.4f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+
+ sg4::this_actor::sleep_for(5);
+
+ XBT_INFO("TEST: Concurrent communication and computation.");
+ XBT_INFO("------------------------------------------------------------");
+ XBT_INFO("A host sends 1B to another while the latter compute 2 flop.");
+ XBT_INFO("Should be done in 2 seconds: 1.5s to transfer and 2 seconds to compute.");
+ XBT_INFO("The two activities should overlap smoothly as they use different resources.");
+ XBT_INFO("The completion time is thus the maximum of the time to complete the two activities.");
+
+ start_time = sg4::Engine::get_clock();
+ c1 = sg4::Comm::sendto_async(hosts[0], hosts[4], 1.0);
+ e1 = sg4::Exec::init()->set_flops_amount(2.0)->set_host(hosts[4])->start();
+ e1->wait();
+ c1->wait();
+ end_time = sg4::Engine::get_clock();
+ XBT_INFO("Actual result: Sending 1B while computing 2 flops takes %.4f seconds.", end_time - start_time);
+ XBT_INFO("\n");
+}
+
+int main(int argc, char** argv)
+{
+ sg4::Engine engine(&argc, argv);
+ engine.load_platform(argv[1]);
+ sg4::Actor::create("dispatcher", sg4::Host::by_name("cpu0"), main_dispatcher);
+ engine.run();
+
+ return 0;
+}
#!/usr/bin/env tesh
-$ ${bindir:=.}/ptask_L07 --cfg=host/model:ptask_L07 ${platfdir}/ptask_L07.xml --log=root.fmt=%m%n
+$ ${bindir:=.}/ptask_L07_usage --cfg=host/model:ptask_L07 ${platfdir}/ptask_L07.xml --log=root.fmt=%m%n
> Configuration change: Set 'host/model' to 'ptask_L07'
> Switching to the L07 model to handle parallel tasks.
> TEST: Create and run a sequential execution.
> The small communication has a negligible impact on the large one.
> This corresponds to paying latency once and having the full bandwidth for the large communication.
> Actual result: 1 small and 1 large concurrent communications take 0.8001 seconds.
+>
+>
+> TEST: Concurrent communication and computation.
+> ------------------------------------------------------------
+> A host sends 1B to another while the latter compute 2 flop.
+> Should be done in 2 seconds: 1.5s to transfer and 2 seconds to compute.
+> The two activities should overlap smoothly as they use different resources.
+> The completion time is thus the maximum of the time to complete the two activities.
+> Actual result: Sending 1B while computing 2 flops takes 2.0000 seconds.
-foreach(x availability basic1 basic3 basic4 basic5 incomplete)
+foreach(x availability incomplete)
add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
${CMAKE_CURRENT_SOURCE_DIR}/platforms/link.fail
${CMAKE_CURRENT_SOURCE_DIR}/platforms/link.lat PARENT_SCOPE)
-foreach(x availability basic1 basic3 basic4 basic5 flatifier incomplete)
+foreach(x availability flatifier incomplete)
ADD_TESH(tesh-simdag-${x} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/${x} ${x}.tesh)
endforeach()
+++ /dev/null
-/* Copyright (c) 2007-2021. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/simdag.h"
-#include "xbt/str.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic1, sd, "SimDag test basic1");
-
-/* Basic SimDag Test 1
- * Scenario:
- * - Create a no-op Init task
- * - Create two communication tasks: 1GB and 1GB
- * - Schedule them concurrently on the two hosts of the platform
- * The two communications occur simultaneously. They share the network for the
- * whole duration of the simulation.
- * Simulated time should be:
- * 1e9/(1/2*1.25e8) + 1e-4 = 16.0001 seconds
- */
-int main(int argc, char **argv)
-{
-
- /* initialization of SD */
- SD_init(&argc, argv);
-
- /* creation of the environment */
- SD_create_environment(argv[1]);
- /* scheduling parameters */
- double communication_amount1 = xbt_str_parse_double(argv[2], "Invalid communication size: %s");
- double communication_amount2 = xbt_str_parse_double(argv[3], "Invalid communication size: %s");
-
- /* creation of the tasks and their dependencies */
- SD_task_t taskInit = SD_task_create("Init", NULL, 1.0);
- SD_task_t taskA = SD_task_create("Task Comm A", NULL, 1.0);
- SD_task_t taskB = SD_task_create("Task Comm B", NULL, 1.0);
-
- SD_task_dependency_add(taskInit, taskA);
- SD_task_dependency_add(taskInit, taskB);
-
- sg_host_t *hosts = sg_host_list();
- SD_task_schedule(taskInit, 1, hosts, SD_SCHED_NO_COST, SD_SCHED_NO_COST, -1.0);
- SD_task_schedule(taskA, 1, &hosts[0], SD_SCHED_NO_COST, &communication_amount1, -1.0);
- SD_task_schedule(taskB, 1, &hosts[1], SD_SCHED_NO_COST, &communication_amount2, -1.0);
- xbt_free(hosts);
-
- /* let's launch the simulation! */
- SD_simulate(-1.0);
- SD_task_destroy(taskA);
- SD_task_destroy(taskB);
- SD_task_destroy(taskInit);
-
- XBT_INFO("Simulation time: %f", SD_get_clock());
-
- return 0;
-}
+++ /dev/null
-$ ${bindir:=.}/basic1 ../../../examples/platforms/two_hosts_platform_shared.xml 1e9 1e9 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
-> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
-> [ 16.000100] (0:maestro@) Simulation time: 16.000100
-
-$ ${bindir:=.}/basic1 ../../../examples/platforms/two_hosts_platform_shared.xml 1e9 1e8 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
-> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
-> [ 8.800100] (0:maestro@) Simulation time: 8.800100
+++ /dev/null
-/* Copyright (c) 2007-2021. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/simdag.h"
-#include "xbt/log.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic3, sd, "SimDag test basic3");
-
-/* Basic SimDag Test 3
- * Scenario:
- * - Create a chain of tasks (Init, A, Fin)
- * Verify that the tasks are actually simulated in the right order.
- */
-int main(int argc, char **argv)
-{
- /* scheduling parameters */
- double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
-
- /* initialization of SD */
- SD_init(&argc, argv);
-
- /* creation of the environment */
- SD_create_environment(argv[1]);
-
- /* creation of the tasks and their dependencies */
- SD_task_t taskInit = SD_task_create("Task Init", NULL, 1.0);
- SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
- SD_task_t taskFin = SD_task_create("Task Fin", NULL, 1.0);
-
- SD_task_dependency_add(taskInit, taskA);
- SD_task_dependency_add(taskA, taskFin);
-
- sg_host_t *hosts = sg_host_list();
- SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
- SD_task_schedule(taskA, 2, hosts, no_cost, no_cost, -1.0);
- SD_task_schedule(taskFin, 1, hosts, no_cost, no_cost, -1.0);
- xbt_free(hosts);
-
- /* let's launch the simulation! */
- SD_simulate(-1.0);
- SD_task_destroy(taskInit);
- SD_task_destroy(taskA);
- SD_task_destroy(taskFin);
-
- XBT_INFO("Simulation time: %f", SD_get_clock());
-
- return 0;
-}
+++ /dev/null
-$ ${bindir:=.}/basic3 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n" --log=sd.thresh:verbose
-> [ 0.000000] Switching to the L07 model to handle parallel tasks.
-> [ 0.000000] Starting simulation...
-> [ 0.000000] Run simulation for -1.000000 seconds
-> [ 0.000000] Executing task 'Task Init'
-> [ 0.000000] Task 'Task Init' done
-> [ 0.000000] Executing task 'Task A'
-> [ 0.000000] Task 'Task A' done
-> [ 0.000000] Executing task 'Task Fin'
-> [ 0.000000] Task 'Task Fin' done
-> [ 0.000000] Simulation time: 0.000000
+++ /dev/null
-/* Copyright (c) 2007-2021. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/simdag.h"
-#include "xbt/log.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic4, sd, "SimDag test basic4");
-
-/* Basic SimDag Test 4
- * Scenario:
- * - Create a chain of tasks (Init, A, Fin)
- * - Have a 1B communication between two no-op tasks.
- * Verify that the tasks are actually simulated in the right order.
- * The simulated time should be equal to the network latency: 0.0001 seconds.
- */
-int main(int argc, char **argv)
-{
- /* scheduling parameters */
- double no_cost[] = { 0., 0., 0., 0. };
- double amount[] = { 0., 1., 0., 0. };
-
- /* SD initialization */
- SD_init(&argc, argv);
-
- /* creation of the environment */
- SD_create_environment(argv[1]);
-
- /* creation of the tasks and their dependencies */
- SD_task_t taskInit = SD_task_create("Task Init", NULL, 1.0);
- SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
- SD_task_t taskFin = SD_task_create("Task Fin", NULL, 1.0);
-
- SD_task_dependency_add(taskInit, taskA);
- SD_task_dependency_add(taskA, taskFin);
-
- sg_host_t *hosts = sg_host_list();
- SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
- SD_task_schedule(taskA, 2, hosts, no_cost, amount, -1.0);
- SD_task_schedule(taskFin, 1, hosts, no_cost, no_cost, -1.0);
- xbt_free(hosts);
-
- /* let's launch the simulation! */
- SD_simulate(-1.0);
- SD_task_destroy(taskInit);
- SD_task_destroy(taskA);
- SD_task_destroy(taskFin);
-
- XBT_INFO("Simulation time: %f", SD_get_clock());
-
- return 0;
-}
+++ /dev/null
-$ ${bindir:=.}/basic4 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n" --log=sd.thresh:verbose
-> [ 0.000000] Switching to the L07 model to handle parallel tasks.
-> [ 0.000000] Starting simulation...
-> [ 0.000000] Run simulation for -1.000000 seconds
-> [ 0.000000] Executing task 'Task Init'
-> [ 0.000000] Task 'Task Init' done
-> [ 0.000000] Executing task 'Task A'
-> [ 0.000100] Task 'Task A' done
-> [ 0.000100] Executing task 'Task Fin'
-> [ 0.000100] Task 'Task Fin' done
-> [ 0.000100] Simulation time: 0.000100
+++ /dev/null
-/* Copyright (c) 2007-2021. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "simgrid/simdag.h"
-#include "xbt/log.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic5, sd, "SimDag test basic5");
-
-/* Basic SimDag Test 5
- * Scenario:
- * - Create a no-op Init task
- * - Create two tasks: send 100kB and compute 10Mflops
- * - Schedule them concurrently
- * The two tasks should overlap smoothly as they use different resources.
- * Simulated time should be:
- * MAX(1e5/(1.25e8), 1e7/4e9) = MAX(.0009, .0025) = 0.0025 seconds
- */
-int main(int argc, char **argv)
-{
- /* scheduling parameters */
- double no_cost[] = { 0., 0., 0., 0. };
- double amount[] = { 0., 100000., 0., 0. };
- double comput[] = { 10000000. };
-
- /* initialization of SD */
- SD_init(&argc, argv);
-
- /* creation of the environment */
- SD_create_environment(argv[1]);
-
- /* creation of the tasks and their dependencies */
- SD_task_t taskInit = SD_task_create("Task Init", NULL, 1.0);
- SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
- SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
-
- SD_task_dependency_add(taskInit, taskA);
- SD_task_dependency_add(taskInit, taskB);
-
- sg_host_t *hosts = sg_host_list();
- SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
- SD_task_schedule(taskA, 2, hosts, no_cost, amount, -1.0);
- SD_task_schedule(taskB, 1, hosts, comput, no_cost, -1.0);
- xbt_free(hosts);
-
- /* let's launch the simulation! */
- SD_simulate(-1.0);
- SD_task_destroy(taskInit);
- SD_task_destroy(taskA);
- SD_task_destroy(taskB);
-
- XBT_INFO("Simulation time: %f", SD_get_clock());
-
- return 0;
-}
+++ /dev/null
-$ ${bindir:=.}/basic5 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n"
-> [ 0.000000] Switching to the L07 model to handle parallel tasks.
-> [ 0.002500] Simulation time: 0.002500
#include "src/internal_config.h" // HAVE_FUTEX_H
#include <simgrid/s4u/Engine.hpp>
-#include <xbt.h>
+#include <xbt/log.h>
#include <xbt/parmap.hpp>
#include <algorithm>
+#include <chrono>
#include <cstdlib>
#include <numeric> // std::iota
#include <thread>
XBT_LOG_NEW_DEFAULT_CATEGORY(parmap_test, "Test for parmap");
-static void fun_double(unsigned* arg)
-{
- *arg = 2 * *arg + 1;
-}
-
static int test_parmap_basic(e_xbt_parmap_mode_t mode)
{
int ret = 0;
std::iota(begin(data), end(data), &a[0]);
for (unsigned i = 0; i < num; i++)
- parmap.apply(fun_double, data);
+ parmap.apply([](unsigned* arg) { *arg = 2 * *arg + 1; }, data);
for (unsigned i = 0; i < len; i++) {
unsigned expected = (1U << num) * (i + 1) - 1;
return ret;
}
-static void fun_get_id(std::thread::id* arg)
-{
- *arg = std::this_thread::get_id();
- xbt_os_sleep(0.05);
-}
-
static int test_parmap_extended(e_xbt_parmap_mode_t mode)
{
int ret = 0;
std::vector<std::thread::id*> data(len);
std::iota(begin(data), end(data), &a[0]);
- parmap.apply(fun_get_id, data);
-
- std::sort(begin(a), end(a));
- unsigned count = static_cast<unsigned>(std::distance(begin(a), std::unique(begin(a), end(a))));
+ unsigned sleep_ms = 10;
+ unsigned count;
+ while (true) {
+ parmap.apply(
+ [sleep_ms](std::thread::id* arg) {
+ *arg = std::this_thread::get_id();
+ std::this_thread::sleep_for(std::chrono::milliseconds(sleep_ms));
+ },
+ data);
+ std::sort(begin(a), end(a));
+ count = static_cast<unsigned>(std::distance(begin(a), std::unique(begin(a), end(a))));
+ if (count == num_workers || sleep_ms > 250)
+ break;
+ sleep_ms *= 2;
+ XBT_DEBUG("Failure. Try again with duration = %ums", sleep_ms);
+ }
if (count != num_workers) {
XBT_CRITICAL("only %u/%u threads did some work", count, num_workers);
ret = 1;
include/simgrid/plugins/file_system.h
include/simgrid/plugins/live_migration.h
include/simgrid/plugins/load.h
- include/simgrid/smpi/replay.hpp
+ include/simgrid/smpi/smpi_replay.hpp
include/simgrid/instr.h
include/simgrid/mailbox.h
include/simgrid/simdag.h
include/xbt/file.hpp
include/xbt/functional.hpp
include/xbt/function_types.h
- include/xbt/future.hpp
include/xbt/graph.h
include/xbt/log.h
include/xbt/log.hpp
include/xbt/PropertyHolder.hpp
include/xbt/parmap.h
include/xbt/parse_units.hpp
+ include/xbt/promise.hpp
include/xbt/range.hpp
include/xbt/random.hpp
include/xbt/replay.hpp