From f9c04cf4defc1af3403317af634ea81ba5e0e5b0 Mon Sep 17 00:00:00 2001 From: Yu Zhang <121887470+yzhang-23@users.noreply.github.com> Date: Fri, 29 Dec 2023 11:43:22 -0600 Subject: [PATCH] Remove madness (#127) * Remove MADNESS * Remove MADNESS dependency * Committing clang-format changes * move find_package(MPI) --------- Co-authored-by: github-actions[bot] --- CMakeLists.txt | 24 ++++--------------- .../runtime/detail_/runtime_view_pimpl.ipp | 3 +-- src/parallelzone/runtime/runtime_view.cpp | 11 ++++----- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9986b8d..b281f79b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,28 +53,13 @@ set(project_inc_dir "${CMAKE_CURRENT_LIST_DIR}/include/${PROJECT_NAME}") set(project_src_dir "${CMAKE_CURRENT_LIST_DIR}/src/${PROJECT_NAME}") # Project dependencies -set(project_depends "") +set(project_depends "MPI::MPI_CXX") + +find_package(MPI REQUIRED) include(nwx_cxx_api_docs) nwx_cxx_api_docs("README.md" "${project_inc_dir}" "${project_src_dir}") -#TODO: Make sure MADworld uses the Cereal we build -cmaize_find_or_build_dependency( - MADNESS - URL github.com/m-a-d-n-e-s-s/madness - VERSION ${NWX_MADNESS_VERSION} - BUILD_TARGET MADworld - FIND_TARGET MADworld - CMAKE_ARGS ENABLE_UNITTESTS=OFF - MADNESS_BUILD_MADWORLD_ONLY=ON - MADNESS_ENABLE_CEREAL=ON - ENABLE_MKL=OFF - ENABLE_ACML=OFF - BUILD_TESTING=OFF -) - -list(APPEND project_depends MADNESS) - cmaize_find_or_build_dependency( spdlog URL github.com/gabime/spdlog @@ -130,7 +115,7 @@ if("${BUILD_TESTING}") test_unit_parallelzone SOURCE_DIR "${CXX_TEST_DIR}/unit_tests" INCLUDE_DIRS "${project_src_dir}" - DEPENDS Catch2::Catch2 ${PROJECT_NAME} + DEPENDS Catch2::Catch2 ${PROJECT_NAME} ) cmaize_add_tests( test_integration_parallelzone @@ -153,7 +138,6 @@ if("${BUILD_TESTING}") py_doc_snippets "${PYTHON_TEST_DIR}/doc_snippets/test_doc_snippets.py" ) - find_package(MPI REQUIRED) add_test( NAME "test_pz_under_mpi" COMMAND "${MPIEXEC_EXECUTABLE}" "${MPIEXEC_NUMPROC_FLAG}" "2" diff --git a/src/parallelzone/runtime/detail_/runtime_view_pimpl.ipp b/src/parallelzone/runtime/detail_/runtime_view_pimpl.ipp index 88cb3754..200e59c9 100644 --- a/src/parallelzone/runtime/detail_/runtime_view_pimpl.ipp +++ b/src/parallelzone/runtime/detail_/runtime_view_pimpl.ipp @@ -16,7 +16,6 @@ #pragma once #include "resource_set_pimpl.hpp" -#include /** @file runtime_view_pimpl.ipp * @@ -38,7 +37,7 @@ inline RuntimeViewPIMPL::RuntimeViewPIMPL(bool did_i_start_mpi, comm_type comm, inline RuntimeViewPIMPL::~RuntimeViewPIMPL() noexcept { if(!m_did_i_start_mpi) return; - madness::finalize(); + MPI_Finalize(); } inline RuntimeViewPIMPL::const_resource_set_reference RuntimeViewPIMPL::at( diff --git a/src/parallelzone/runtime/runtime_view.cpp b/src/parallelzone/runtime/runtime_view.cpp index af66a417..ac9558a9 100644 --- a/src/parallelzone/runtime/runtime_view.cpp +++ b/src/parallelzone/runtime/runtime_view.cpp @@ -16,6 +16,7 @@ #include "detail_/resource_set_pimpl.hpp" #include "detail_/runtime_view_pimpl.hpp" +#include #include // N.B. AFAIK the only way a RuntimeView can have no PIMPL is if an exception is @@ -30,13 +31,9 @@ namespace { // Basically a ternary statement dispatching on whether we need to initialize // MPI or not auto start_mpi(int argc, char** argv, const MPI_Comm& comm) { - bool mpi_initialized = madness::initialized(); - if(!mpi_initialized) { - if(comm == MPI_COMM_WORLD) - madness::initialize(argc, argv, true); - else - madness::initialize(argc, argv, comm, true); - } + int mpi_initialized; + MPI_Initialized(&(mpi_initialized)); + if(!mpi_initialized) MPI_Init(&argc, &argv); mpi_helpers::CommPP commpp(comm); auto log = LoggerFactory::default_global_logger(commpp.me());