From: Bruno Donassolo Date: Wed, 16 Mar 2022 18:04:40 +0000 (+0100) Subject: Disk: add solver as an option X-Git-Tag: v3.31~43 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/15b76a8173b81f1cc79b9cc01b9f2b67d59c4e0c?hp=8200ad44a2b045020ff78096333dafa775e56119 Disk: add solver as an option Select one random test which timing should be the same between maxmin and bmf --- diff --git a/src/kernel/resource/DiskImpl.cpp b/src/kernel/resource/DiskImpl.cpp index 5456626f0f..8a45da6319 100644 --- a/src/kernel/resource/DiskImpl.cpp +++ b/src/kernel/resource/DiskImpl.cpp @@ -6,11 +6,18 @@ #include "DiskImpl.hpp" #include "simgrid/s4u/Engine.hpp" +#include "simgrid/sg_config.hpp" #include "src/kernel/EngineImpl.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "src/kernel/resource/profile/Profile.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_disk, ker_resource, "Disk resources, that fuel I/O activities"); +/*********** + * Options * + ***********/ +static simgrid::config::Flag cfg_disk_solver("disk/solver", + "Set linear equations solver used by disk model", "maxmin", + &simgrid::kernel::lmm::System::validate_solver); namespace simgrid { namespace kernel { @@ -24,7 +31,7 @@ xbt::signal DiskAction::o DiskModel::DiskModel(const std::string& name) : Model(name) { - set_maxmin_system(lmm::System::build("maxmin", true /* selective update */)); + set_maxmin_system(lmm::System::build(cfg_disk_solver, true /* selective update */)); } /************ diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 18df2560c4..b2710f590f 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -70,7 +70,7 @@ CpuCas01Model::CpuCas01Model(const std::string& name) : CpuModel(name) select = true; } - set_maxmin_system(lmm::System::build(config::get_value("cpu/solver"), select)); + set_maxmin_system(lmm::System::build(cfg_cpu_solver, select)); } CpuImpl* CpuCas01Model::create_cpu(s4u::Host* host, const std::vector& speed_per_pstate) diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh b/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh index e450afc0f7..593a980a8b 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh @@ -35,3 +35,42 @@ $ ./concurrent_rw ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%a > [ 10.800000] (host@bob) actor 4 is reading again! > [ 11.800000] (host@bob) actor 5 is reading again! > [ 11.840000] (maestro@) Simulation time 11.84 + +$ ./concurrent_rw ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%a@%h)%e%m%n" --cfg=disk/solver:bmf +> [ 0.000000] (maestro@) Configuration change: Set 'disk/solver' to 'bmf' +> [ 0.000000] (host@bob) actor 1 is writing! +> [ 0.000000] (host@bob) actor 2 is writing! +> [ 0.000000] (host@bob) actor 3 is writing! +> [ 0.000000] (host@bob) actor 4 is writing! +> [ 0.000000] (host@bob) actor 5 is writing! +> [ 0.500000] (host@bob) actor 1 goes to sleep for 1 seconds +> [ 0.500000] (host@bob) actor 2 goes to sleep for 2 seconds +> [ 0.500000] (host@bob) actor 3 goes to sleep for 3 seconds +> [ 0.500000] (host@bob) actor 4 goes to sleep for 4 seconds +> [ 0.500000] (host@bob) actor 5 goes to sleep for 5 seconds +> [ 1.500000] (host@bob) actor 1 is writing again! +> [ 1.600000] (host@bob) actor 1 goes to sleep for 5 seconds +> [ 2.500000] (host@bob) actor 2 is writing again! +> [ 2.600000] (host@bob) actor 2 goes to sleep for 4 seconds +> [ 3.500000] (host@bob) actor 3 is writing again! +> [ 3.600000] (host@bob) actor 3 goes to sleep for 3 seconds +> [ 4.500000] (host@bob) actor 4 is writing again! +> [ 4.600000] (host@bob) actor 4 goes to sleep for 2 seconds +> [ 5.500000] (host@bob) actor 5 is writing again! +> [ 5.600000] (host@bob) actor 5 goes to sleep for 1 seconds +> [ 6.600000] (host@bob) actor 1 is reading! +> [ 6.600000] (host@bob) actor 2 is reading! +> [ 6.600000] (host@bob) actor 3 is reading! +> [ 6.600000] (host@bob) actor 4 is reading! +> [ 6.600000] (host@bob) actor 5 is reading! +> [ 6.800000] (host@bob) actor 1 goes to sleep for 1 seconds +> [ 6.800000] (host@bob) actor 2 goes to sleep for 2 seconds +> [ 6.800000] (host@bob) actor 3 goes to sleep for 3 seconds +> [ 6.800000] (host@bob) actor 4 goes to sleep for 4 seconds +> [ 6.800000] (host@bob) actor 5 goes to sleep for 5 seconds +> [ 7.800000] (host@bob) actor 1 is reading again! +> [ 8.800000] (host@bob) actor 2 is reading again! +> [ 9.800000] (host@bob) actor 3 is reading again! +> [ 10.800000] (host@bob) actor 4 is reading again! +> [ 11.800000] (host@bob) actor 5 is reading again! +> [ 11.840000] (maestro@) Simulation time 11.84