Skip to content

Commit

Permalink
Simplify init procedure as pika now uses command-line pool creation
Browse files Browse the repository at this point in the history
latest pika:: transform_mpi is enabled/disabled via the command line
and does not require explicit enabling via init_params
  • Loading branch information
biddisco committed Oct 17, 2024
1 parent 05743be commit 14cc6e3
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 36 deletions.
36 changes: 14 additions & 22 deletions include/dlaf/sender/transform_mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,31 +122,23 @@ template <typename F, typename Sender,
namespace mpi = pika::mpi::experimental;
namespace mpid = pika::mpi::experimental::detail;

if (mpi::get_completion_mode() >= static_cast<int>(mpid::handler_method::unspecified)) {
auto snd1 =
ex::transfer(std::forward<Sender>(sender), dlaf::internal::getMPIScheduler()) |
ex::then(dlaf::common::internal::ConsumeRvalues{MPIYieldWhileCallHelper{std::forward<F>(f)}});
return ex::make_unique_any_sender(std::move(snd1));
}
else {
#ifdef EXTRA_MPI_TYPES_DEBUGGING
auto snd1 =
std::forward<Sender>(sender) |
ex::let_value([=, f = std::move(f)]<typename... LArgs>(LArgs&&... largs) {
PIKA_DETAIL_DP(dla_debug<2>, debug(str<>("Args to MPI fn\n"),
pika::debug::print_type<LArgs...>(", "), "\nValues\n"));
return ex::just(std::move(largs)...) |
mpi::transform_mpi(dlaf::common::internal::ConsumeRvalues{MPICallHelper{std::move(f)}});
});
return ex::make_unique_any_sender(std::move(snd1));
auto snd1 =
std::forward<Sender>(sender) |
ex::let_value([=, f = std::move(f)]<typename... LArgs>(LArgs&&... largs) {
PIKA_DETAIL_DP(dla_debug<2>, debug(str<>("Args to MPI fn\n"),
pika::debug::print_type<LArgs...>(", "), "\nValues\n"));
return ex::just(std::move(largs)...) |
mpi::transform_mpi(dlaf::common::internal::ConsumeRvalues{MPICallHelper{std::move(f)}});
});
return ex::make_unique_any_sender(std::move(snd1));
#else
PIKA_DETAIL_DP(dla_debug<5>, debug(str<>("MPI fn\n")));
auto snd1 =
std::forward<Sender>(sender) |
mpi::transform_mpi(dlaf::common::internal::ConsumeRvalues{MPICallHelper{std::forward<F>(f)}});
return ex::make_unique_any_sender(std::move(snd1));
PIKA_DETAIL_DP(dla_debug<5>, debug(str<>("MPI fn\n")));
auto snd1 =
std::forward<Sender>(sender) |
mpi::transform_mpi(dlaf::common::internal::ConsumeRvalues{MPICallHelper{std::forward<F>(f)}});
return ex::make_unique_any_sender(std::move(snd1));
#endif
}
}

/// Fire-and-forget transformMPI. This submits the work and returns void.
Expand Down
1 change: 0 additions & 1 deletion miniapp/miniapp_band_to_tridiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_bt_band_to_tridiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_bt_reduction_to_band.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_cholesky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}

Expand Down
1 change: 0 additions & 1 deletion miniapp/miniapp_communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_eigensolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}

Expand Down
1 change: 0 additions & 1 deletion miniapp/miniapp_gen_eigensolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}

Expand Down
1 change: 0 additions & 1 deletion miniapp/miniapp_gen_to_std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_reduction_to_band.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_triangular_multiplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_triangular_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion miniapp/miniapp_tridiag_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,5 @@ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;
return pika::init(pika_main, argc, argv, p);
}
1 change: 0 additions & 1 deletion src/c_api/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ void dlaf_initialize(int argc_pika, const char** argv_pika, int argc_dlaf,

// pika initialization
pika::init_params params;
params.pool_creation_mode = ::pika::resource::mode_pika_decides;
params.desc_cmdline = desc;
// After pika 0.21.0 pika::start reports errors only by exception and returns void
#if PIKA_VERSION_FULL >= 0x001500
Expand Down
1 change: 0 additions & 1 deletion test/src/gtest_mpipika_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ GTEST_API_ int main(int argc, char** argv) {

pika::init_params p;
p.desc_cmdline = desc_commandline;
p.pool_creation_mode = ::pika::resource::mode_pika_decides;

// Initialize pika
auto ret = pika::init(test_main, argc, argv, p);
Expand Down

0 comments on commit 14cc6e3

Please sign in to comment.