-
Notifications
You must be signed in to change notification settings - Fork 71
Fixes for distributed and state tests #609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7be2a03
bc4def3
28e3390
06c6656
2b2989d
19bb197
6a48bb0
c1704e0
259b6b9
fa86182
ac090e2
c0d5e85
8f01b1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+4 −4 | func/omp/repeated_reduce.cpp | |
+0 −3 | func/omp/simple_atomic.cpp | |
+2 −0 | libfaasm/faasm/shared_mem.h |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,10 @@ using namespace faabric::scheduler; | |
using namespace WAVM; | ||
|
||
#define MPI_FUNC(str) \ | ||
SPDLOG_DEBUG("MPI-{} {}", executingContext.getRank(), str); | ||
SPDLOG_TRACE("MPI-{} {}", executingContext.getRank(), str); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were printing out so much logging information in the dist tests that it was difficult to debug. |
||
|
||
#define MPI_FUNC_ARGS(formatStr, ...) \ | ||
SPDLOG_DEBUG("MPI-{} " formatStr, executingContext.getRank(), __VA_ARGS__); | ||
SPDLOG_TRACE("MPI-{} " formatStr, executingContext.getRank(), __VA_ARGS__); | ||
|
||
namespace wasm { | ||
static thread_local faabric::scheduler::MpiContext executingContext; | ||
|
@@ -413,7 +413,7 @@ WAVM_DEFINE_INTRINSIC_FUNCTION(env, | |
I32 datatype, | ||
I32 countPtr) | ||
{ | ||
SPDLOG_DEBUG("S - MPI_Get_count {} {} {}", statusPtr, datatype, countPtr); | ||
SPDLOG_TRACE("S - MPI_Get_count {} {} {}", statusPtr, datatype, countPtr); | ||
|
||
MPI_Status* status = | ||
&Runtime::memoryRef<MPI_Status>(ctx->memory, statusPtr); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <catch2/catch.hpp> | ||
|
||
#include "fixtures.h" | ||
|
||
#include <faabric/scheduler/Scheduler.h> | ||
#include <faabric/util/logging.h> | ||
#include <faabric/util/string_tools.h> | ||
|
||
namespace tests { | ||
|
||
TEST_CASE_METHOD(DistTestsFixture, | ||
"Test running distributed Pi estimate", | ||
"[scheduler]") | ||
{ | ||
int nWorkers = 20; | ||
|
||
// Make sure only half can be executed on this host | ||
int nLocalSlots = 10; | ||
faabric::HostResources res; | ||
res.set_slots(nLocalSlots); | ||
sch.setThisHostResources(res); | ||
|
||
// Set up the message | ||
std::shared_ptr<faabric::BatchExecuteRequest> req = | ||
faabric::util::batchExecFactory("demo", "pi", 1); | ||
faabric::Message& msg = req->mutable_messages()->at(0); | ||
msg.set_inputdata(std::to_string(nWorkers)); | ||
|
||
// Call the functions | ||
sch.callFunctions(req); | ||
|
||
// Check it's successful | ||
faabric::Message result = | ||
sch.getFunctionResult(msg.id(), functionCallTimeout); | ||
REQUIRE(result.returnvalue() == 0); | ||
|
||
// Get the estimate (check one dp) | ||
std::string outputData = msg.outputdata(); | ||
REQUIRE(faabric::util::startsWith(outputData, "Pi estimate: 3.1")); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,14 @@ | |
#include "fixtures.h" | ||
|
||
#include <faabric/scheduler/Scheduler.h> | ||
#include <faabric/util/string_tools.h> | ||
|
||
#define PI_FUNCTION "pi_faasm" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very minor, but it feels a bit odd that this is the only function with its name |
||
|
||
namespace tests { | ||
// 10/02/22 Broken by latest Faabric | ||
TEST_CASE_METHOD(DistTestsFixture, | ||
"Test OpenMP across hosts", | ||
"[.][threads][openmp]") | ||
"[threads][openmp]") | ||
{ | ||
conf.overrideCpuCount = 6; | ||
|
||
|
@@ -26,6 +28,8 @@ TEST_CASE_METHOD(DistTestsFixture, | |
|
||
SECTION("Repeated reduce") { function = "repeated_reduce"; } | ||
|
||
SECTION("Pi estimation") { function = PI_FUNCTION; } | ||
|
||
// Set up the message | ||
std::shared_ptr<faabric::BatchExecuteRequest> req = | ||
faabric::util::batchExecFactory("omp", function, 1); | ||
|
@@ -48,5 +52,11 @@ TEST_CASE_METHOD(DistTestsFixture, | |
// Check other host is registered CEB7 | ||
std::set<std::string> expectedRegisteredHosts = { getDistTestWorkerIp() }; | ||
REQUIRE(sch.getFunctionRegisteredHosts(msg) == expectedRegisteredHosts); | ||
|
||
// Check specific results | ||
if (function == PI_FUNCTION) { | ||
REQUIRE( | ||
faabric::util::startsWith(result.outputdata(), "Pi estimate: 3.1")); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
#include <faabric/util/environment.h> | ||
#include <faabric/util/func.h> | ||
#include <faabric/util/logging.h> | ||
#include <faabric/util/string_tools.h> | ||
|
||
namespace tests { | ||
|
||
|
@@ -16,12 +17,12 @@ class MPIFuncTestFixture | |
, public MpiBaseTestFixture | ||
{ | ||
public: | ||
void checkMpiFunc(const char* funcName) | ||
faabric::Message checkMpiFunc(const char* funcName) | ||
{ | ||
// Note: we don't `set_mpiworldsize` here, so all tests run with the | ||
// default MPI world size (5). Some tests will fail if we change this. | ||
faabric::Message msg = faabric::util::messageFactory("mpi", funcName); | ||
execFuncWithPool(msg, true, 10000); | ||
faabric::Message result = execFuncWithPool(msg, true, 10000); | ||
|
||
// Check all other functions were successful | ||
auto& sch = faabric::scheduler::getScheduler(); | ||
|
@@ -32,13 +33,14 @@ class MPIFuncTestFixture | |
continue; | ||
} | ||
|
||
const faabric::Message& result = | ||
sch.getFunctionResult(messageId, 1); | ||
faabric::Message result = sch.getFunctionResult(messageId, 1); | ||
|
||
if (result.returnvalue() != 0) { | ||
FAIL(fmt::format("Message ID {} failed", messageId)); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
}; | ||
|
||
|
@@ -132,4 +134,11 @@ TEST_CASE_METHOD(MPIFuncTestFixture, "Test MPI async", "[mpi]") | |
{ | ||
checkMpiFunc("mpi_isendrecv"); | ||
} | ||
|
||
TEST_CASE_METHOD(MPIFuncTestFixture, "Test MPI Pi", "[mpi]") | ||
{ | ||
faabric::Message result = checkMpiFunc("mpi_pi"); | ||
std::string output = result.outputdata(); | ||
REQUIRE(faabric::util::startsWith(output, "Pi estimate: 3.1")); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noticed that this wasn't included in tests so I added it for good measure. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight rearrange of these distributed test docs which I found a little confusing before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree! 🤣