From 0950a475b4ee67079a97297b8aada8a1cb0e0e38 Mon Sep 17 00:00:00 2001 From: Doak P W Date: Wed, 27 Mar 2024 10:51:40 -0400 Subject: [PATCH] fix breakage in non adios2 build --- applications/dca/CMakeLists.txt | 2 +- .../no_concurrency/no_concurrency.cpp | 2 ++ .../math/function_transform/CMakeLists.txt | 2 +- .../function_transform_test.cpp | 23 ------------------- .../std_random_wrapper_default_seed_test.cpp | 2 +- test/unit/phys/dca_algorithms/CMakeLists.txt | 9 ++++++-- 6 files changed, 12 insertions(+), 28 deletions(-) diff --git a/applications/dca/CMakeLists.txt b/applications/dca/CMakeLists.txt index 4f5cb0b53..aac9a9cf6 100644 --- a/applications/dca/CMakeLists.txt +++ b/applications/dca/CMakeLists.txt @@ -8,5 +8,5 @@ if (DCA_BUILD_DCA) target_link_libraries(main_dca PRIVATE ${DCA_KERNEL_LIBS}) endif() - target_link_libraries(main_dca PUBLIC FFTW::Double signals ${DCA_LIBS} dca_io dca_adios2) + target_link_libraries(main_dca PUBLIC FFTW::Double signals ${DCA_LIBS} dca_io) endif() diff --git a/src/parallel/no_concurrency/no_concurrency.cpp b/src/parallel/no_concurrency/no_concurrency.cpp index 697fc44e0..9ecd492b5 100644 --- a/src/parallel/no_concurrency/no_concurrency.cpp +++ b/src/parallel/no_concurrency/no_concurrency.cpp @@ -19,6 +19,8 @@ namespace parallel { #ifdef DCA_HAVE_ADIOS2 NoConcurrency::NoConcurrency(int argc, char** argv) : adios_(std::make_unique("", MPI_COMM_SELF)) {} +#else + NoConcurrency::NoConcurrency(int argc, char** argv) {} #endif void NoConcurrency::abort() const { diff --git a/test/unit/math/function_transform/CMakeLists.txt b/test/unit/math/function_transform/CMakeLists.txt index 00a3481c7..8d7d818d1 100644 --- a/test/unit/math/function_transform/CMakeLists.txt +++ b/test/unit/math/function_transform/CMakeLists.txt @@ -1,7 +1,7 @@ # unit/math/function_transform dca_add_gtest(function_transform_test INCLUDE_DIRS ${DCA_INCLUDES};${PROJECT_SOURCE_DIR};${FFTW_INCLUDE_DIR} - LIBS FFTW::Double ${DCA_LIBS} parallel_no_concurrency) + LIBS FFTW::Double parallel_no_concurrency ${DCA_LIBS} ) dca_add_gtest(space_transform_2D_test INCLUDE_DIRS ${DCA_INCLUDES};${PROJECT_SOURCE_DIR};${FFTW_INCLUDE_DIR} diff --git a/test/unit/math/function_transform/function_transform_test.cpp b/test/unit/math/function_transform/function_transform_test.cpp index a742316ae..76febd7c5 100644 --- a/test/unit/math/function_transform/function_transform_test.cpp +++ b/test/unit/math/function_transform/function_transform_test.cpp @@ -31,16 +31,6 @@ using McOptions = MockMcOptions; #include "dca/parallel/no_concurrency/no_concurrency.hpp" #include "dca/parallel/no_threading/no_threading.hpp" #include "dca/profiling/null_profiler.hpp" -#ifdef DCA_HAVE_ADIOS2 -adios2::ADIOS* adios_ptr; -#endif -#ifdef DCA_HAVE_MPI -#include "dca/parallel/mpi_concurrency/mpi_concurrency.hpp" -dca::parallel::MPIConcurrency* concurrency_ptr; -#else -#include "dca/parallel/no_concurrency/no_concurrency.hpp" -dca::parallel::NoConcurrency* concurrency_ptr; -#endif using Model = dca::phys::models::TightBindingModel>; @@ -160,19 +150,6 @@ TEST(FunctionTransformTest, MomentumToSpaceCmplx) { } int main(int argc, char** argv) { -#ifdef DCA_HAVE_MPI - dca::parallel::MPIConcurrency concurrency(argc, argv); - concurrency_ptr = &concurrency; -#else - dca::parallel::NoConcurrency concurrency(argc, argv); - concurrency_ptr = &concurrency; -#endif - -#ifdef DCA_HAVE_ADIOS2 - //ADIOS expects MPI_COMM pointer or nullptr - adios2::ADIOS adios("", concurrency_ptr->get(), "C++"); - adios_ptr = &adios; -#endif ::testing::InitGoogleTest(&argc, argv); // ::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners(); diff --git a/test/unit/math/random/std_random_wrapper_default_seed_test.cpp b/test/unit/math/random/std_random_wrapper_default_seed_test.cpp index d1315e6df..4ff99bb51 100644 --- a/test/unit/math/random/std_random_wrapper_default_seed_test.cpp +++ b/test/unit/math/random/std_random_wrapper_default_seed_test.cpp @@ -35,8 +35,8 @@ inline std::vector& getFirstRandomNumbersDefaultSeed() 0.79004886762619775, 0.73670732232143421}; return vec; } -template <> #if defined (__clang__) +template <> inline std::vector& getFirstRandomNumbersDefaultSeed() { static std::vector vec{0.67052872832964927, 0.89987293212401465, 0.48383422722711483,0.28699620000273923,0.37575706648963081}; return vec; diff --git a/test/unit/phys/dca_algorithms/CMakeLists.txt b/test/unit/phys/dca_algorithms/CMakeLists.txt index 24b3dffc0..5531b7c4f 100644 --- a/test/unit/phys/dca_algorithms/CMakeLists.txt +++ b/test/unit/phys/dca_algorithms/CMakeLists.txt @@ -1,5 +1,10 @@ # DCA algorithms unit tests +set(gtest_main_flag GTEST_MAIN) +if(DCA_HAVE_ADIOS2) + set(gtest_main_flag GTEST_MPI_MAIN) +endif(DCA_HAVE_ADIOS2) + dca_add_gtest(compute_band_structure_test GTEST_MPI_MAIN INCLUDE_DIRS ${PROJECT_SOURCE_DIR} @@ -12,10 +17,10 @@ endif() # \todo I think this should be able to run without GPU dca_add_gtest(compute_free_greens_function_test - GTEST_MPI_MAIN + ${gtest_main_flag} CUDA LIBS function FFTW::Double ${DCA_THREADING_LIBS} ${LAPACK_LIBRARIES} ${UTIL_LIBS} ${DCA_GPU_LIBS} ${optional_io_lib} parallel_util parallel_no_concurrency) dca_add_gtest(compute_greens_function_test - GTEST_MPI_MAIN + ${gtest_main_flag} LIBS function FFTW::Double ${DCA_THREADING_LIBS} ${LAPACK_LIBRARIES} ${UTIL_LIBS} ${DCA_GPU_LIBS} ${optional_io_lib} parallel_util parallel_no_concurrency)