8000 Explicitly disable nested OpenMP by Shillaker · Pull Request #570 · faasm/faasm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Explicitly disable nested OpenMP #570

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

Merged
merged 3 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/wavm/openmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ WAVM_DEFINE_INTRINSIC_FUNCTION(env,
nextLevel->setSharedVarOffsets(sharedVarsPtr, nSharedVars);
}

if (nextLevel->depth > 1) {
SPDLOG_ERROR("Nested OpenMP support removed");
throw std::runtime_error("Nested OpenMP support removed");
}

// Set up the chained calls
std::shared_ptr<faabric::BatchExecuteRequest> req =
faabric::util::batchExecFactory(
Expand Down Expand Up @@ -597,8 +602,8 @@ void for_static_init(I32 schedule,
break;
}
default: {
throw std::runtime_error(
fmt::format("Unimplemented scheduler {}", schedule));
SPDLOG_ERROR("Unimplemented OpenMP scheduler {}", schedule);
throw std::runtime_error("Unimplemented OpenMP scheduler");
}
}
}
Expand Down
16 changes: 0 additions & 16 deletions tests/test/faaslet/test_errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
using namespace faaslet;

namespace tests {
faabric::Message execErrorFunction(faabric::Message& call)
{
auto fac = std::make_shared<faaslet::FaasletFactory>();
faabric::runner::FaabricMain m(fac);
m.startRunner();

faabric::scheduler::Scheduler& sch = faabric::scheduler::getScheduler();
sch.callFunction(call);

faabric::Message result = sch.getFunctionResult(call.id(), 1);

m.shutdown();

return result;
}

void checkError(const std::string& funcName, const std::string& expectedMsg)
{
cleanSystem();
Expand Down
25 changes: 25 additions & 0 deletions tests/test/wasm/test_openmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,29 @@ TEST_CASE_METHOD(OpenMPTestFixture,

execFuncWithPool(msg, false, OMP_TEST_TIMEOUT_MS);
}

TEST_CASE_METHOD(OpenMPTestFixture,
"Test nested openmp explicitly disabled",
"[wasm][openmp]")
{
faabric::scheduler::Scheduler& sch = faabric::scheduler::getScheduler();

// Make sure there's definitely enough slots
int nSlots = 20;
faabric::HostResources res;
res.set_slots(nSlots);
sch.setThisHostResources(res);

faabric::Message msg =
faabric::util::messageFactory("omp", "nested_parallel");
faabric::Message result = execErrorFunction(msg);

// Get result
REQUIRE(result.returnvalue() > 0);

std::string expectedOutput = fmt::format(
"Task {} threw exception. What: OpenMP threads failed", msg.id());
const std::string actualOutput = result.outputdata();
REQUIRE(actualOutput == expectedOutput);
}
}
2 changes: 2 additions & 0 deletions tests/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ void execFuncWithPool(faabric::Message& call,
bool clean = true,
int timeout = 1000);

faabric::Message execErrorFunction(faabric::Message& call);

void executeWithWamrPool(const std::string& user,
const std::string& func,
int timeout = 1000);
Expand Down
16 changes: 16 additions & 0 deletions tests/utils/worker_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ void doWamrPoolExecution(faabric::Message& msg, int timeout = 1000)
conf.wasmVm = originalVm;
}

faabric::Message execErrorFunction(faabric::Message& call)
{
auto fac = std::make_shared<faaslet::FaasletFactory>();
faabric::runner::FaabricMain m(fac);
m.startRunner();

faabric::scheduler::Scheduler& sch = faabric::scheduler::getScheduler();
sch.callFunction(call);

faabric::Message result = sch.getFunctionResult(call.id(), 1);

m.shutdown();

return result;
}

void executeWithWamrPool(const std::string& user,
const std::string& func,
int timeout)
Expand Down
0