Skip to content

Commit

Permalink
Replace thread_manager::wait with pika::wait
Browse files Browse the repository at this point in the history
  • Loading branch information
msimberg committed Sep 5, 2023
1 parent f467da9 commit 3d3a4a0
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 41 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ else()
endif()

# ----- pika
find_package(pika 0.15.1 REQUIRED)
find_package(pika 0.17.0 REQUIRED)
find_package(pika-algorithms 0.1.1 REQUIRED)

# ----- BLASPP/LAPACKPP
Expand Down
3 changes: 2 additions & 1 deletion include/dlaf/eigensolver/reduction_to_band/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <pika/barrier.hpp>
#include <pika/execution.hpp>
#include <pika/init.hpp>

#include <dlaf/blas/tile.h>
#include <dlaf/common/assert.h>
Expand Down Expand Up @@ -1088,7 +1089,7 @@ Matrix<T, Device::CPU> ReductionToBand<B, D, T>::call(comm::CommunicatorGrid gri
// Note:
// This is a temporary workaround.
// See issue https://github.com/eth-cscs/DLA-Future/issues/729
pika::threads::get_thread_manager().wait();
pika::wait();

common::Pipeline<comm::Communicator> mpi_col_chain_panel(grid.colCommunicator().clone());
common::Pipeline<comm::Communicator> mpi_row_chain(grid.rowCommunicator().clone());
Expand Down
1 change: 1 addition & 0 deletions spack/packages/dla-future/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class DlaFuture(CMakePackage, CudaPackage, ROCmPackage):

depends_on("[email protected]:", when="@0.1")
depends_on("[email protected]:", when="@0.2.0:")
depends_on("[email protected]:", when="@master")
depends_on("[email protected]:")
depends_on("pika +mpi")
depends_on("pika +cuda", when="+cuda")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include <blas.hh>

#include <pika/init.hpp>

#include <dlaf/common/single_threaded_blas.h>
#include <dlaf/communication/communicator_grid.h>
#include <dlaf/matrix/matrix.h>
Expand Down Expand Up @@ -42,7 +44,7 @@ void testEigensolverCorrectness(const blas::Uplo uplo, Matrix<const T, Device::C
// calls that might lead to deadlocks.
constexpr bool isDistributed = (sizeof...(grid) == 1);
if constexpr (isDistributed)
pika::threads::get_thread_manager().wait();
pika::wait();

const SizeType m = reference.size().rows();

Expand Down
3 changes: 1 addition & 2 deletions test/src/gtest_mpipika_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

#include <pika/init.hpp>
#include <pika/program_options.hpp>
#include <pika/runtime.hpp>

#include <dlaf/init.h>

Expand Down Expand Up @@ -89,7 +88,7 @@ GTEST_API_ int main(int argc, char** argv) {

protected:
virtual void OnTestEnd(const ::testing::TestInfo& test_info) override {
pika::threads::get_thread_manager().wait();
pika::wait();
MPIListener::OnTestEnd(test_info);
}
};
Expand Down
10 changes: 6 additions & 4 deletions test/unit/eigensolver/test_bt_band_to_tridiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// SPDX-License-Identifier: BSD-3-Clause
//

#include <pika/init.hpp>

#include <dlaf/common/single_threaded_blas.h>
#include <dlaf/communication/communicator_grid.h>
#include <dlaf/eigensolver/band_to_tridiag.h> // for nrSweeps/nrStepsForSweep
Expand Down Expand Up @@ -267,7 +269,7 @@ TYPED_TEST(BacktransformationBandToTridiagTestMC, CorrectnessDistributed) {
for (const auto& [m, n, mb, nb, group_size, b] : configs) {
getTuneParameters().bt_band_to_tridiag_hh_apply_group_size = group_size;
testBacktransformation<Backend::MC, Device::CPU, TypeParam>(comm_grid, m, n, mb, nb, b);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -285,7 +287,7 @@ TYPED_TEST(BacktransformationBandToTridiagTestGPU, CorrectnessDistributed) {
for (const auto& [m, n, mb, nb, group_size, b] : configs) {
getTuneParameters().bt_band_to_tridiag_hh_apply_group_size = group_size;
testBacktransformation<Backend::GPU, Device::GPU, TypeParam>(comm_grid, m, n, mb, nb, b);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -308,7 +310,7 @@ TYPED_TEST(BacktransformationBandToTridiagTestMC, CorrectnessDistributedSubBand)
for (const auto& [m, n, mb, nb, group_size, b] : configs_subband) {
getTuneParameters().bt_band_to_tridiag_hh_apply_group_size = group_size;
testBacktransformation<Backend::MC, Device::CPU, TypeParam>(comm_grid, m, n, mb, nb, b);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -326,7 +328,7 @@ TYPED_TEST(BacktransformationBandToTridiagTestGPU, CorrectnessDistributedSubBand
for (const auto& [m, n, mb, nb, group_size, b] : configs_subband) {
getTuneParameters().bt_band_to_tridiag_hh_apply_group_size = group_size;
testBacktransformation<Backend::GPU, Device::GPU, TypeParam>(comm_grid, m, n, mb, nb, b);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/eigensolver/test_bt_reduction_to_band.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <tuple>
#include <vector>

#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/common/assert.h>
#include <dlaf/common/index2d.h>
Expand Down Expand Up @@ -253,7 +253,7 @@ TYPED_TEST(BackTransformationReductionToBandEigenSolverTestMC, CorrectnessDistri
for (const auto& [m, n, mb, nb, b] : sizes) {
testBackTransformationReductionToBand<TypeParam, Backend::MC, Device::CPU>(comm_grid, m, n, mb, nb,
b);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -264,7 +264,7 @@ TYPED_TEST(BackTransformationReductionToBandEigenSolverTestGPU, CorrectnessDistr
for (const auto& [m, n, mb, nb, b] : sizes) {
testBackTransformationReductionToBand<TypeParam, Backend::GPU, Device::GPU>(comm_grid, m, n, mb,
nb, b);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion test/unit/eigensolver/test_gen_eigensolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <functional>
#include <tuple>

#include <pika/init.hpp>

#include <dlaf/common/single_threaded_blas.h>
#include <dlaf/eigensolver/gen_eigensolver.h>
#include <dlaf/matrix/copy.h>
Expand Down Expand Up @@ -73,7 +75,7 @@ void testGenEigensolverCorrectness(const blas::Uplo uplo, Matrix<const T, Device
// calls that might lead to deadlocks.
constexpr bool isDistributed = (sizeof...(grid) == 1);
if constexpr (isDistributed)
pika::threads::get_thread_manager().wait();
pika::wait();

const SizeType m = reference_a.size().rows();

Expand Down
6 changes: 3 additions & 3 deletions test/unit/eigensolver/test_gen_to_std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <functional>
#include <tuple>

#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/communication/communicator_grid.h>
#include <dlaf/eigensolver/gen_to_std.h>
Expand Down Expand Up @@ -124,7 +124,7 @@ TYPED_TEST(EigensolverGenToStdTestMC, CorrectnessDistributed) {
for (const auto uplo : blas_uplos) {
for (const auto& [m, mb] : sizes) {
testGenToStdEigensolver<TypeParam, Backend::MC, Device::CPU>(comm_grid, uplo, m, mb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -144,7 +144,7 @@ TYPED_TEST(EigensolverGenToStdTestGPU, CorrectnessDistributed) {
for (const auto uplo : blas_uplos) {
for (const auto& [m, mb] : sizes) {
testGenToStdEigensolver<TypeParam, Backend::GPU, Device::GPU>(comm_grid, uplo, m, mb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/eigensolver/test_reduction_to_band.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <cmath>

#include <pika/execution.hpp>
#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/common/index2d.h>
#include <dlaf/common/pipeline.h>
Expand Down Expand Up @@ -405,7 +405,7 @@ void testReductionToBand(comm::CommunicatorGrid grid, const LocalElementSize siz
checkUpperPartUnchanged(reference, matrix_a_h);

// Wait for all work to finish before doing blocking communication
pika::threads::get_thread_manager().wait();
pika::wait();

auto mat_v = allGather(blas::Uplo::Lower, matrix_a_h, grid);
auto mat_b = makeLocal(matrix_a_h);
Expand Down
10 changes: 5 additions & 5 deletions test/unit/eigensolver/test_tridiag_solver_distributed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// SPDX-License-Identifier: BSD-3-Clause
//

#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/communication/kernels.h>
#include <dlaf/eigensolver/tridiag_solver.h>
Expand Down Expand Up @@ -251,7 +251,7 @@ TYPED_TEST(TridiagSolverDistTestMC, Laplace1D) {
for (const auto& comm_grid : this->commGrids()) {
for (auto [n, nb] : tested_problems) {
solveDistributedLaplace1D<Backend::MC, Device::CPU, TypeParam>(comm_grid, n, nb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -260,7 +260,7 @@ TYPED_TEST(TridiagSolverDistTestMC, Random) {
for (const auto& comm_grid : this->commGrids()) {
for (auto [n, nb] : tested_problems) {
solveRandomTridiagMatrix<Backend::MC, Device::CPU, TypeParam>(comm_grid, n, nb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -270,7 +270,7 @@ TYPED_TEST(TridiagSolverDistTestGPU, Laplace1D) {
for (const auto& comm_grid : this->commGrids()) {
for (auto [n, nb] : tested_problems) {
solveDistributedLaplace1D<Backend::GPU, Device::GPU, TypeParam>(comm_grid, n, nb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -279,7 +279,7 @@ TYPED_TEST(TridiagSolverDistTestGPU, Random) {
for (const auto& comm_grid : this->commGrids()) {
for (auto [n, nb] : tested_problems) {
solveRandomTridiagMatrix<Backend::GPU, Device::GPU, TypeParam>(comm_grid, n, nb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/factorization/test_cholesky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <functional>
#include <tuple>

#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/communication/communicator_grid.h>
#include <dlaf/factorization/cholesky.h>
Expand Down Expand Up @@ -111,7 +111,7 @@ TYPED_TEST(CholeskyTestMC, CorrectnessDistributed) {
for (auto uplo : blas_uplos) {
for (const auto& [m, mb] : sizes) {
testCholesky<TypeParam, Backend::MC, Device::CPU>(comm_grid, uplo, m, mb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -131,7 +131,7 @@ TYPED_TEST(CholeskyTestGPU, CorrectnessDistributed) {
for (auto uplo : blas_uplos) {
for (const auto& [m, mb] : sizes) {
testCholesky<TypeParam, Backend::GPU, Device::GPU>(comm_grid, uplo, m, mb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/matrix/test_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <vector>

#include <pika/execution.hpp>
#include <pika/init.hpp>

#include <dlaf/communication/communicator_grid.h>
#include <dlaf/matrix/copy.h>
Expand Down Expand Up @@ -1892,7 +1893,7 @@ void testReshuffling(const TestReshuffling& config, CommunicatorGrid grid) {

// Note: ensure that everything finishes before next call to Communicator::clone() that might block a
// working thread (and if it is just one, it would deadlock)
pika::threads::get_thread_manager().wait();
pika::wait();
}

TYPED_TEST(MatrixTest, CopyReshuffling) {
Expand Down
6 changes: 4 additions & 2 deletions test/unit/multiplication/test_multiplication_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// SPDX-License-Identifier: BSD-3-Clause
//

#include <pika/init.hpp>

#include <dlaf/blas/enum_output.h>
#include <dlaf/common/assert.h>
#include <dlaf/communication/communicator_grid.h>
Expand Down Expand Up @@ -172,7 +174,7 @@ TYPED_TEST(GeneralSubMultiplicationDistTestMC, CorrectnessDistributed) {
const TypeParam beta = TypeUtilities<TypeParam>::element(-2.6, .7);
testGeneralSubMultiplication<TypeParam, Backend::MC, Device::CPU>(comm_grid, a, b, alpha, beta, m,
mb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand All @@ -185,7 +187,7 @@ TYPED_TEST(GeneralSubMultiplicationDistTestGPU, CorrectnessDistributed) {
const TypeParam beta = TypeUtilities<TypeParam>::element(-2.6, .7);
testGeneralSubMultiplication<TypeParam, Backend::GPU, Device::GPU>(comm_grid, a, b, alpha, beta, m,
mb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/multiplication/test_multiplication_hermitian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <functional>
#include <tuple>

#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/blas/tile.h>
#include <dlaf/communication/communicator_grid.h>
Expand Down Expand Up @@ -175,7 +175,7 @@ TYPED_TEST(HermitianMultiplicationTestMC, CorrectnessDistributed) {

testHermitianMultiplication<TypeParam, Backend::MC, Device::CPU>(comm_grid, side, uplo, m, n,
mb, nb, alpha, beta);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down Expand Up @@ -212,7 +212,7 @@ TYPED_TEST(HermitianMultiplicationTestGPU, CorrectnessDistributed) {

testHermitianMultiplication<TypeParam, Backend::GPU, Device::GPU>(comm_grid, side, uplo, m, n,
mb, nb, alpha, beta);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/multiplication/test_multiplication_triangular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <functional>
#include <tuple>

#include <pika/runtime.hpp>
#include <pika/init.hpp>

#include <dlaf/blas/tile.h>
#include <dlaf/communication/communicator_grid.h>
Expand Down Expand Up @@ -172,7 +172,7 @@ TYPED_TEST(TriangularMultiplicationTestMC, CorrectnessDistributed) {
testTriangularMultiplication<TypeParam, Backend::MC, Device::CPU>(comm_grid, side, uplo,
op, diag, alpha, m, n,
mb, nb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down Expand Up @@ -213,7 +213,7 @@ TYPED_TEST(TriangularMultiplicationTestGPU, CorrectnessDistributed) {
testTriangularMultiplication<TypeParam, Backend::GPU, Device::GPU>(comm_grid, side, uplo,
op, diag, alpha, m, n,
mb, nb);
pika::threads::get_thread_manager().wait();
pika::wait();
}
}
}
Expand Down
Loading

0 comments on commit 3d3a4a0

Please sign in to comment.