Skip to content
Snippets Groups Projects
Commit 0da4cd55 authored by Philipp Suffa's avatar Philipp Suffa
Browse files

Allow multiGPU by setting correct device to MPI process[skip ci]

parent 5cf0f412
Branches suffa/SYCL
No related merge requests found
......@@ -142,8 +142,19 @@ int main(int argc, char** argv)
auto blocks = blockforest::createUniformBlockGridFromConfig(walberlaEnv.config());
#if defined(WALBERLA_BUILD_WITH_SYCL)
WALBERLA_LOG_PROGRESS("Create SYCL queue")
auto syclQueue = make_shared<sycl::queue> (sycl::default_selector_v);
WALBERLA_LOG_INFO("Running SYCL for MPI process " << mpi::MPIManager::instance()->worldRank() << " on " << (*syclQueue).get_device().get_info<cl::sycl::info::device::name>())
auto mpiRank = mpi::MPIManager::instance()->worldRank();
//FOR MULTI GPU
std::vector<sycl::device> Devs;
for (const auto &plt : sycl::platform::get_platforms()) {
if (plt.get_backend() == sycl::backend::ext_oneapi_cuda)
Devs.push_back(plt.get_devices()[0]);
}
auto syclQueue = make_shared<sycl::queue> (Devs[mpiRank]);
//FOR CPU
//auto syclQueue = make_shared<sycl::queue> (sycl::default_selector_v);
WALBERLA_LOG_INFO("Running SYCL for MPI process " << mpiRank << " on " << (*syclQueue).get_device().get_info<cl::sycl::info::device::name>())
//WALBERLA_LOG_INFO("Max hardware threads are " << sycl::default_selector().select_device().get_info<sycl::info::device::max_compute_units>());
blocks->setSYCLQueue(syclQueue);
#endif
......@@ -239,7 +250,6 @@ int main(int argc, char** argv)
// Timeloop
if (timestepStrategy == "fullSim") {
communication();
timeloop.add() << BeforeFunction(communication, "communication") << Sweep(deviceSyncWrapper(SYCLTestSweep), "SYCL Sweep");
}
else if (timestepStrategy == "kernelOnly") {
......
......@@ -22,7 +22,7 @@ ShearFlowSetup
DomainSetup
{
blocks < 1, 1, 1 >;
blocks < 2, 1, 1 >;
cellsPerBlock < 1000, 1000, 1 >;
periodic < 0, 0, 0 >;
oneBlockPerProcess true;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment