Skip to content

Commit

Permalink
allow setting the scheduling policy from an environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Nov 30, 2021
1 parent 27ffd58 commit 6be0388
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/scheduler/MpiWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,14 @@ void MpiWorld::create(faabric::Message& call, int newId, int newSize)
std::vector<std::string> executedAt;
if (size > 1) {
// Send the init messages (note that message i corresponds to rank i+1)
// By default, we use the NEVER_ALONE policy for MPI executions to
// If enabled, we use the NEVER_ALONE policy for MPI executions to
// minimise cross-host messaging
faabric::util::SchedulingDecision decision = sch.callFunctions(
req, faabric::util::SchedulingTopologyHint::NEVER_ALONE);
auto topologyHint = faabric::util::SchedulingTopologyHint::NORMAL;
if (faabric::util::getSystemConfig().useTopologyHints == "on") {
topologyHint = faabric::util::SchedulingTopologyHint::NEVER_ALONE;
}
faabric::util::SchedulingDecision decision =
sch.callFunctions(req, topologyHint);
executedAt = decision.hosts;
}
assert(executedAt.size() == size - 1);
Expand Down
2 changes: 2 additions & 0 deletions src/util/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void SystemConfig::initialise()
// Scheduling
noScheduler = this->getSystemConfIntParam("NO_SCHEDULER", "0");
overrideCpuCount = this->getSystemConfIntParam("OVERRIDE_CPU_COUNT", "0");
useTopologyHints = getEnvVar("USE_TOPOLOGY_HINTS", "off");

// Worker-related timeouts (all in seconds)
globalMessageTimeout =
Expand Down Expand Up @@ -100,6 +101,7 @@ void SystemConfig::print()
SPDLOG_INFO("--- Scheduling ---");
SPDLOG_INFO("NO_SCHEDULER {}", noScheduler);
SPDLOG_INFO("OVERRIDE_CPU_COUNT {}", overrideCpuCount);
SPDLOG_INFO("USE_TOPOLOGY_HINTS {}", useTopologyHints);

SPDLOG_INFO("--- Timeouts ---");
SPDLOG_INFO("GLOBAL_MESSAGE_TIMEOUT {}", globalMessageTimeout);
Expand Down
4 changes: 4 additions & 0 deletions tests/test/util/test_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ TEST_CASE("Test default system config initialisation", "[util]")

REQUIRE(conf.noScheduler == 0);
REQUIRE(conf.overrideCpuCount == 0);
REQUIRE(conf.useTopologyHints == "off");

REQUIRE(conf.globalMessageTimeout == 60000);
REQUIRE(conf.boundTimeout == 30000);
Expand All @@ -44,6 +45,7 @@ TEST_CASE("Test overriding system config initialisation", "[util]")

std::string noScheduler = setEnvVar("NO_SCHEDULER", "1");
std::string overrideCpuCount = setEnvVar("OVERRIDE_CPU_COUNT", "4");
std::string useTopologyHints = setEnvVar("USE_TOPOLOGY_HINTS", "on");

std::string globalTimeout = setEnvVar("GLOBAL_MESSAGE_TIMEOUT", "9876");
std::string boundTimeout = setEnvVar("BOUND_TIMEOUT", "6666");
Expand All @@ -70,6 +72,7 @@ TEST_CASE("Test overriding system config initialisation", "[util]")

REQUIRE(conf.noScheduler == 1);
REQUIRE(conf.overrideCpuCount == 4);
REQUIRE(conf.useTopologyHints == "on");

REQUIRE(conf.globalMessageTimeout == 9876);
REQUIRE(conf.boundTimeout == 6666);
Expand All @@ -95,6 +98,7 @@ TEST_CASE("Test overriding system config initialisation", "[util]")

setEnvVar("NO_SCHEDULER", noScheduler);
setEnvVar("OVERRIDE_CPU_COUNT", overrideCpuCount);
setEnvVar("USE_TOPOLOGY_HINTS", useTopologyHints);

setEnvVar("GLOBAL_MESSAGE_TIMEOUT", globalTimeout);
setEnvVar("BOUND_TIMEOUT", boundTimeout);
Expand Down

0 comments on commit 6be0388

Please sign in to comment.