Skip to content

Commit

Permalink
Remove madness (#127)
Browse files Browse the repository at this point in the history
* Remove MADNESS

* Remove MADNESS dependency

* Committing clang-format changes

* move find_package(MPI)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
yzhang-23 and github-actions[bot] authored Dec 29, 2023
1 parent b874e72 commit f9c04cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
24 changes: 4 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions src/parallelzone/runtime/detail_/runtime_view_pimpl.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#pragma once
#include "resource_set_pimpl.hpp"
#include <madness/world/MADworld.h>

/** @file runtime_view_pimpl.ipp
*
Expand All @@ -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(
Expand Down
11 changes: 4 additions & 7 deletions src/parallelzone/runtime/runtime_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "detail_/resource_set_pimpl.hpp"
#include "detail_/runtime_view_pimpl.hpp"
#include <mpi.h>
#include <parallelzone/logging/logger_factory.hpp>

// N.B. AFAIK the only way a RuntimeView can have no PIMPL is if an exception is
Expand All @@ -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());
Expand Down

0 comments on commit f9c04cf

Please sign in to comment.