diff --git a/cmake/spheral/SpheralAddLibs.cmake b/cmake/spheral/SpheralAddLibs.cmake index ed713a14a..2fd5e2121 100644 --- a/cmake/spheral/SpheralAddLibs.cmake +++ b/cmake/spheral/SpheralAddLibs.cmake @@ -121,7 +121,7 @@ function(spheral_add_pybind11_library package_name) # Set the r-path of the C++ lib such that it is independent of the build dir when installed set_target_properties(${MODULE_NAME} PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${boost_DIR}/lib;${python_DIR}/lib" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${boost_DIR}/lib;${python_DIR}/lib" ) endfunction() diff --git a/cmake/tpl/hdf5.cmake b/cmake/tpl/hdf5.cmake index a482a8bc2..bde5d9a4e 100644 --- a/cmake/tpl/hdf5.cmake +++ b/cmake/tpl/hdf5.cmake @@ -15,7 +15,7 @@ if(${lib_name}_BUILD) URL ${HDF5_URL} URL_HASH "MD5=${HDF5_MD5}" DOWNLOAD_DIR ${CACHE_DIR} - CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-fPIC CXXFLAGS=-fPIC FCFLAGS=-fPIC ${HDF5_PREFIX}/src/hdf5/configure --prefix=${${lib_name}_DIR} + CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CFLAGS=-fPIC CXXFLAGS=-fPIC FCFLAGS=-fPIC ${HDF5_PREFIX}/src/hdf5/configure --prefix=${${lib_name}_DIR} --enable-shared=no BUILD_COMMAND make INSTALL_COMMAND make install diff --git a/scripts/lc-builds/blueos_gcc8.3.1-debug-mpi-python.sh b/scripts/lc-builds/blueos_gcc8.3.1-debug-mpi-python.sh new file mode 100755 index 000000000..a445c8621 --- /dev/null +++ b/scripts/lc-builds/blueos_gcc8.3.1-debug-mpi-python.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load gcc/8.3.1 + +cmake \ + ../.. \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ + -C ${HOST_CONFIGS_DIR}/lc-builds/blueos/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ + -DENABLE_OPENMP=On \ + -DENABLE_MPI=On \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + "$@" \ + #-DSPHERAL_TPL_DIR=/usr/workspace/wsrzd/davis291/SPHERAL/blueos_Spheral_gcc8_noMPI/install/tpl \ diff --git a/scripts/lc-builds/blueos_gcc8.3.1-debug-seq-python.sh b/scripts/lc-builds/blueos_gcc8.3.1-debug-seq-python.sh new file mode 100755 index 000000000..aa6e66a63 --- /dev/null +++ b/scripts/lc-builds/blueos_gcc8.3.1-debug-seq-python.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load gcc/8.3.1 + +cmake \ + ../.. \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ + -C ${HOST_CONFIGS_DIR}/lc-builds/blueos/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ + -DENABLE_OPENMP=On \ + -DENABLE_MPI=Off \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + "$@" \ + #-DSPHERAL_TPL_DIR=/usr/workspace/wsrzd/davis291/SPHERAL/blueos_Spheral_gcc8_noMPI/install/tpl \ diff --git a/scripts/lc-builds/blueos_gcc8.3.1-release-mpi-cxx.sh b/scripts/lc-builds/blueos_gcc8.3.1-release-mpi-cxx.sh new file mode 100755 index 000000000..096f24b4b --- /dev/null +++ b/scripts/lc-builds/blueos_gcc8.3.1-release-mpi-cxx.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load gcc/8.3.1 + +cmake \ + ../.. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ + -C ${HOST_CONFIGS_DIR}/lc-builds/blueos/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ + -DENABLE_OPENMP=On \ + -DENABLE_MPI=On \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DENABLE_STATIC_CXXONLY=On \ + "$@" \ + #-DSPHERAL_TPL_DIR=/usr/workspace/wsrzd/davis291/SPHERAL/blueos_Spheral_gcc8_noMPI/install/tpl \ diff --git a/scripts/lc-builds/blueos_gcc8.3.1-release-mpi-python.sh b/scripts/lc-builds/blueos_gcc8.3.1-release-mpi-python.sh new file mode 100755 index 000000000..f686976e2 --- /dev/null +++ b/scripts/lc-builds/blueos_gcc8.3.1-release-mpi-python.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load gcc/8.3.1 + +cmake \ + ../.. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ + -C ${HOST_CONFIGS_DIR}/lc-builds/blueos/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ + -DENABLE_OPENMP=On \ + -DENABLE_MPI=On \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + "$@" \ + #-DSPHERAL_TPL_DIR=/usr/workspace/wsrzd/davis291/SPHERAL/blueos_Spheral_gcc8_noMPI/install/tpl \ diff --git a/scripts/lc-builds/blueos_gcc8.3.1-release-seq-cxx.sh b/scripts/lc-builds/blueos_gcc8.3.1-release-seq-cxx.sh new file mode 100755 index 000000000..d9d5e790b --- /dev/null +++ b/scripts/lc-builds/blueos_gcc8.3.1-release-seq-cxx.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load gcc/8.3.1 + +cmake \ + ../.. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ + -C ${HOST_CONFIGS_DIR}/lc-builds/blueos/gcc8.3.1_tpl.cmake \ + -DENABLE_OPENMP=On \ + -DENABLE_MPI=Off \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DENABLE_STATIC_CXXONLY=On \ + "$@" \ + #-DSPHERAL_TPL_DIR=/usr/workspace/wsrzd/davis291/SPHERAL/blueos_Spheral_gcc8_noMPI/install/tpl \ diff --git a/scripts/lc-builds/blueos_gcc8.3.1-release-seq-python.sh b/scripts/lc-builds/blueos_gcc8.3.1-release-seq-python.sh new file mode 100755 index 000000000..a9946855a --- /dev/null +++ b/scripts/lc-builds/blueos_gcc8.3.1-release-seq-python.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load gcc/8.3.1 + +cmake \ + ../.. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ + -C ${HOST_CONFIGS_DIR}/lc-builds/blueos/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ + -DENABLE_OPENMP=On \ + -DENABLE_MPI=Off \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + "$@" \ + #-DSPHERAL_TPL_DIR=/usr/workspace/wsrzd/davis291/SPHERAL/blueos_Spheral_gcc8_noMPI/install/tpl \ diff --git a/scripts/lc-builds/blueos_xl2021.03.11-release-seq-cxx.sh b/scripts/lc-builds/blueos_xl2021.03.11-release-seq-cxx.sh new file mode 100755 index 000000000..720649d96 --- /dev/null +++ b/scripts/lc-builds/blueos_xl2021.03.11-release-seq-cxx.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +SCRIPT_PATH=${0%/*} +. "$SCRIPT_PATH/utils/parse-args.sh" + +# Inherit build directory name from script name +BUILD_SUFFIX="lc_$(TMP=${BASH_SOURCE##*/}; echo ${TMP%.*})" + +rm -rf ${BUILD_SUFFIX} 2>/dev/null +mkdir -p ${BUILD_SUFFIX}/install +mkdir -p ${BUILD_SUFFIX}/build && cd ${BUILD_SUFFIX}/build + +module load cmake/3.14.5 +module load xl/2021.03.11 + +cmake \ + ${SRC_DIR} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_COMPILER=/usr/tce/packages/xl/xl-2021.03.11/bin/xlc++ \ + -DCMAKE_Fortran_COMPILER=/usr/tce/packages/xl/xl-2021.03.11/bin/xlf \ + -DENABLE_OPENMP=Off \ + -DENABLE_MPI=Off \ + -DENABLE_ANEOS=Off \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DENABLE_STATIC_CXXONLY=On \ + $CMAKE_ARGS \ + #-C ${HOST_CONFIGS_DIR}/lc-builds/toss3/gcc8.3.1_tpl.cmake \ diff --git a/scripts/lc-builds/toss3_gcc8.3.1-debug-mpi-python.sh b/scripts/lc-builds/toss3_gcc8.3.1-debug-mpi-python.sh index 4860ff100..4ae549c29 100755 --- a/scripts/lc-builds/toss3_gcc8.3.1-debug-mpi-python.sh +++ b/scripts/lc-builds/toss3_gcc8.3.1-debug-mpi-python.sh @@ -18,6 +18,7 @@ cmake \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ -C ${HOST_CONFIGS_DIR}/lc-builds/toss3/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ -DENABLE_OPENMP=On \ -DENABLE_MPI=On \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ diff --git a/scripts/lc-builds/toss3_gcc8.3.1-release-seq-python.sh b/scripts/lc-builds/toss3_gcc8.3.1-release-seq-python.sh index e02f26387..38bb3a0c4 100755 --- a/scripts/lc-builds/toss3_gcc8.3.1-release-seq-python.sh +++ b/scripts/lc-builds/toss3_gcc8.3.1-release-seq-python.sh @@ -18,6 +18,7 @@ cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER=/usr/tce/packages/gcc/gcc-8.3.1/bin/g++ \ -C ${HOST_CONFIGS_DIR}/lc-builds/toss3/gcc8.3.1_tpl.cmake \ + -DBLT_CXX_STD=c++14 \ -DENABLE_OPENMP=On \ -DENABLE_MPI=Off \ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index acb6ffe6f..ada70ee81 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,18 +45,11 @@ list(APPEND _packages if(NOT ENABLE_CXXONLY) list(APPEND _packages - PythonMPIInterfaces SimulationControl Pybind11Wraps ) endif() -if(NOT ENABLE_MPI) - list(REMOVE_ITEM _packages - Distributed - ) -endif() - foreach(_package ${_packages}) add_subdirectory(${_package}) endforeach() diff --git a/src/DataOutput/RestartRegistrar.cc b/src/DataOutput/RestartRegistrar.cc index 331ed5d61..97c90a0cc 100644 --- a/src/DataOutput/RestartRegistrar.cc +++ b/src/DataOutput/RestartRegistrar.cc @@ -41,27 +41,6 @@ struct CompareWeakPtr: public std::binary_function, std::weak_p } }; -//------------------------------------------------------------------------------ -// Get the instance. -//------------------------------------------------------------------------------ -RestartRegistrar& -RestartRegistrar:: -instance() { - return *RestartRegistrar::instancePtr(); -} - -//------------------------------------------------------------------------------ -// Get the instance (pointer). -//------------------------------------------------------------------------------ -RestartRegistrar* -RestartRegistrar:: -instancePtr() { - if (mInstancePtr == 0) mInstancePtr = new RestartRegistrar; - CHECK(mInstancePtr != 0); - mInstancePtr->removeExpiredPointers(); - return mInstancePtr; -} - //------------------------------------------------------------------------------ // Register a RestartHandle. //------------------------------------------------------------------------------ @@ -235,8 +214,3 @@ RestartRegistrar:: } } - -//------------------------------------------------------------------------------ -// Initialize the static instance pointer. -//----------------------------------------------------------------------------- -Spheral::RestartRegistrar* Spheral::RestartRegistrar::mInstancePtr = 0; diff --git a/src/DataOutput/RestartRegistrar.hh b/src/DataOutput/RestartRegistrar.hh index 68487fee0..279232155 100644 --- a/src/DataOutput/RestartRegistrar.hh +++ b/src/DataOutput/RestartRegistrar.hh @@ -32,7 +32,6 @@ public: // Get the instance. static RestartRegistrar& instance(); - static RestartRegistrar* instancePtr(); // Methods for registering a RestartHandle. void registerRestartHandle(std::shared_ptr restartHandlePtr, @@ -68,9 +67,6 @@ private: typedef PriorityContainer::const_iterator const_priority_iterator; typedef PriorityContainer::iterator priority_iterator; - // The one and only instance. - static RestartRegistrar* mInstancePtr; - // The list of RestartHandles and their priorities. RestartHandleContainer mRestartHandles; PriorityContainer mPriorities; diff --git a/src/DataOutput/RestartRegistrarInline.hh b/src/DataOutput/RestartRegistrarInline.hh index 97f1cf43c..a3c421d5e 100644 --- a/src/DataOutput/RestartRegistrarInline.hh +++ b/src/DataOutput/RestartRegistrarInline.hh @@ -1,5 +1,16 @@ namespace Spheral { +//------------------------------------------------------------------------------ +// Get the instance. +//------------------------------------------------------------------------------ +inline +RestartRegistrar& +RestartRegistrar:: +instance() { + static RestartRegistrar theInstance; + return theInstance; +} + //------------------------------------------------------------------------------ // The non-const iterators. //------------------------------------------------------------------------------ diff --git a/src/Distributed/BoundingVolumeDistributedBoundary.cc b/src/Distributed/BoundingVolumeDistributedBoundary.cc index 1aa472e9e..6c9c7220d 100644 --- a/src/Distributed/BoundingVolumeDistributedBoundary.cc +++ b/src/Distributed/BoundingVolumeDistributedBoundary.cc @@ -37,31 +37,6 @@ using std::abs; namespace Spheral { -// Static initialization of singleton instance. -template -BoundingVolumeDistributedBoundary* -BoundingVolumeDistributedBoundary::mInstance = 0; - -//------------------------------------------------------------------------------ -// Singleton instance method. -//------------------------------------------------------------------------------ -template -BoundingVolumeDistributedBoundary& -BoundingVolumeDistributedBoundary:: -instance() { - if (mInstance == 0) { - mInstance = new BoundingVolumeDistributedBoundary(); - } // end if - return *mInstance; -} - -template -BoundingVolumeDistributedBoundary* -BoundingVolumeDistributedBoundary:: -instancePtr() { - return &(instance()); -} - //------------------------------------------------------------------------------ // Constructor. //------------------------------------------------------------------------------ diff --git a/src/Distributed/BoundingVolumeDistributedBoundary.hh b/src/Distributed/BoundingVolumeDistributedBoundary.hh index c9e2858d4..59abf7491 100644 --- a/src/Distributed/BoundingVolumeDistributedBoundary.hh +++ b/src/Distributed/BoundingVolumeDistributedBoundary.hh @@ -37,7 +37,6 @@ public: // This method returns the singleton instance of the object. static BoundingVolumeDistributedBoundary& instance(); - static BoundingVolumeDistributedBoundary* instancePtr(); // Destructor. virtual ~BoundingVolumeDistributedBoundary(); @@ -50,9 +49,6 @@ public: private: //--------------------------- Private Interface ---------------------------// - // Singleton instance pointer. - static BoundingVolumeDistributedBoundary* mInstance; - // Disabled methods. BoundingVolumeDistributedBoundary(); BoundingVolumeDistributedBoundary(const BoundingVolumeDistributedBoundary&); @@ -68,6 +64,8 @@ private: } +#include "BoundingVolumeDistributedBoundaryInline.hh" + #else // Forward declaration. diff --git a/src/Distributed/BoundingVolumeDistributedBoundaryInline.hh b/src/Distributed/BoundingVolumeDistributedBoundaryInline.hh new file mode 100644 index 000000000..0288ad489 --- /dev/null +++ b/src/Distributed/BoundingVolumeDistributedBoundaryInline.hh @@ -0,0 +1,15 @@ +namespace Spheral { + +//------------------------------------------------------------------------------ +// Singleton instance method. +//------------------------------------------------------------------------------ +template +inline +BoundingVolumeDistributedBoundary& +BoundingVolumeDistributedBoundary:: +instance() { + static BoundingVolumeDistributedBoundary theInstance; + return theInstance; +} + +} diff --git a/src/Distributed/CMakeLists.txt b/src/Distributed/CMakeLists.txt index bba69b5f8..d230694be 100644 --- a/src/Distributed/CMakeLists.txt +++ b/src/Distributed/CMakeLists.txt @@ -1,65 +1,85 @@ include_directories(.) -set(Distributed_sources Communicator.cc) -if (ENABLE_1D) - list(APPEND Distributed_sources SortAndDivideRedistributeNodes1d.cc) -endif() +if (ENABLE_MPI) + #---------------------------------------------------------------------------- + # MPI parallel on + #---------------------------------------------------------------------------- + set(Distributed_sources Communicator.cc waitAllWithDeadlockDetection.cc) -if (ENABLE_2D) - list(APPEND Distributed_sources SortAndDivideRedistributeNodes2d.cc) -endif() + if (ENABLE_1D) + list(APPEND Distributed_sources SortAndDivideRedistributeNodes1d.cc) + endif() -if (ENABLE_3D) - list(APPEND Distributed_sources SortAndDivideRedistributeNodes3d.cc) -endif() + if (ENABLE_2D) + list(APPEND Distributed_sources SortAndDivideRedistributeNodes2d.cc) + endif() -if (ENABLE_MPI) - list(APPEND Distributed_sources waitAllWithDeadlockDetection.cc) -endif() + if (ENABLE_3D) + list(APPEND Distributed_sources SortAndDivideRedistributeNodes3d.cc) + endif() + + set(Distributed_inst + DistributedBoundary + NestedGridDistributedBoundary + TreeDistributedBoundary + BoundingVolumeDistributedBoundary + RedistributeNodes + DistributeByXPosition + SortAndDivideRedistributeNodes + SpaceFillingCurveRedistributeNodes + MortonOrderRedistributeNodes + PeanoHilbertOrderRedistributeNodes + VoronoiRedistributeNodes + ) + + instantiate(Distributed_inst Distributed_sources) -set(Distributed_inst - DistributedBoundary - NestedGridDistributedBoundary - TreeDistributedBoundary - BoundingVolumeDistributedBoundary - RedistributeNodes - DistributeByXPosition - SortAndDivideRedistributeNodes - SpaceFillingCurveRedistributeNodes - MortonOrderRedistributeNodes - PeanoHilbertOrderRedistributeNodes - VoronoiRedistributeNodes - ) + set(Distributed_headers + BoundingVolumeDistributedBoundary.hh + BoundingVolumeDistributedBoundaryInline.hh + Communicator.hh + CompareDomainNodesByPosition.hh + DistributeByXPosition.hh + DistributedBoundary.hh + DistributedBoundaryInline.hh + MortonOrderRedistributeNodes.hh + NestedGridDistributedBoundary.hh + NestedGridDistributedBoundaryInline.hh + NestedGridRedistributeNodes.hh + NestedGridRedistributeNodesInline.hh + NestedGridUtilities.hh + ParmetisRedistributeNodes.hh + ParmetisRedistributeNodesInline.hh + PeanoHilbertOrderRedistributeNodes.hh + RedistributeNodes.hh + RedistributeNodesInline.hh + SortAndDivideRedistributeNodes.hh + SortAndDivideRedistributeNodes1d.hh + SortAndDivideRedistributeNodes2d.hh + SortAndDivideRedistributeNodes3d.hh + SortAndDivideRedistributeNodesInline.hh + SpaceFillingCurveRedistributeNodes.hh + TreeDistributedBoundary.hh + TreeDistributedBoundaryInline.hh + VoronoiRedistributeNodes.hh + waitAllWithDeadlockDetection.hh + ) -instantiate(Distributed_inst Distributed_sources) + install(FILES mpi_mpi4py.py + DESTINATION Spheral + RENAME mpi.py + ) -set(Distributed_headers - BoundingVolumeDistributedBoundary.hh - Communicator.hh - CompareDomainNodesByPosition.hh - DistributeByXPosition.hh - DistributedBoundary.hh - DistributedBoundaryInline.hh - MortonOrderRedistributeNodes.hh - NestedGridDistributedBoundary.hh - NestedGridRedistributeNodes.hh - NestedGridRedistributeNodesInline.hh - NestedGridUtilities.hh - ParmetisRedistributeNodes.hh - ParmetisRedistributeNodesInline.hh - PeanoHilbertOrderRedistributeNodes.hh - RedistributeNodes.hh - RedistributeNodesInline.hh - SortAndDivideRedistributeNodes.hh - SortAndDivideRedistributeNodes1d.hh - SortAndDivideRedistributeNodes2d.hh - SortAndDivideRedistributeNodes3d.hh - SortAndDivideRedistributeNodesInline.hh - SpaceFillingCurveRedistributeNodes.hh - TreeDistributedBoundary.hh - VoronoiRedistributeNodes.hh - waitAllWithDeadlockDetection.hh - ) + spheral_add_cxx_library(Distributed) -spheral_add_cxx_library(Distributed) +else() + #---------------------------------------------------------------------------- + # MPI parallel off + #---------------------------------------------------------------------------- + install(FILES fakempi.py + DESTINATION Spheral + RENAME mpi.py + ) + +endif() diff --git a/src/Distributed/Communicator.cc b/src/Distributed/Communicator.cc index 897655582..96aa5a236 100644 --- a/src/Distributed/Communicator.cc +++ b/src/Distributed/Communicator.cc @@ -9,26 +9,6 @@ namespace Spheral { -//------------------------------------------------------------------------------ -// Get the instance. -//------------------------------------------------------------------------------ -Communicator& -Communicator:: -instance() { - return *Communicator::instancePtr(); -} - -//------------------------------------------------------------------------------ -// Get the instance (pointer). -//------------------------------------------------------------------------------ -Communicator* -Communicator:: -instancePtr() { - if (mInstancePtr == 0) mInstancePtr = new Communicator; - CHECK(mInstancePtr != 0); - return mInstancePtr; -} - //------------------------------------------------------------------------------ // Default constructor (private). //------------------------------------------------------------------------------ @@ -50,9 +30,3 @@ Communicator:: } } - -//------------------------------------------------------------------------------ -// Initialize the static instance pointer. -//----------------------------------------------------------------------------- -Spheral::Communicator* Spheral::Communicator::mInstancePtr = 0; - diff --git a/src/Distributed/Communicator.hh b/src/Distributed/Communicator.hh index 9aa20943c..14db79498 100644 --- a/src/Distributed/Communicator.hh +++ b/src/Distributed/Communicator.hh @@ -18,13 +18,12 @@ class Communicator { public: //------------------------===== Public Interface =====-----------------------// // Get the instance. - static Communicator& instance(); - static Communicator* instancePtr(); + static Communicator& instance() { static Communicator theInstance; return theInstance; } // Access the communicator. #ifdef USE_MPI - static MPI_Comm& communicator() { return instancePtr()->mCommunicator; } - static void communicator(MPI_Comm& comm) { instancePtr()->mCommunicator = comm; } + static MPI_Comm& communicator() { return instance().mCommunicator; } + static void communicator(MPI_Comm& comm) { instance().mCommunicator = comm; } #else static int communicator() { return 0; } static void communicator(int&) {} @@ -32,9 +31,6 @@ public: private: //------------------------===== Private Interface =====----------------------// - // The one and only instance. - static Communicator* mInstancePtr; - #ifdef USE_MPI MPI_Comm mCommunicator; #endif diff --git a/src/Distributed/NestedGridDistributedBoundary.cc b/src/Distributed/NestedGridDistributedBoundary.cc index c794245c5..e9bfef3c3 100644 --- a/src/Distributed/NestedGridDistributedBoundary.cc +++ b/src/Distributed/NestedGridDistributedBoundary.cc @@ -26,31 +26,6 @@ namespace Spheral { -// Static initialization of singleton instance. -template -NestedGridDistributedBoundary* -NestedGridDistributedBoundary::mInstance = 0; - -//------------------------------------------------------------------------------ -// Singleton instance method. -//------------------------------------------------------------------------------ -template -NestedGridDistributedBoundary& -NestedGridDistributedBoundary:: -instance() { - if (mInstance == 0) { - mInstance = new NestedGridDistributedBoundary(); - } // end if - return *mInstance; -} - -template -NestedGridDistributedBoundary* -NestedGridDistributedBoundary:: -instancePtr() { - return &(instance()); -} - //------------------------------------------------------------------------------ // Default constructor. //------------------------------------------------------------------------------ diff --git a/src/Distributed/NestedGridDistributedBoundary.hh b/src/Distributed/NestedGridDistributedBoundary.hh index c78375b8a..a238a6dc0 100644 --- a/src/Distributed/NestedGridDistributedBoundary.hh +++ b/src/Distributed/NestedGridDistributedBoundary.hh @@ -37,7 +37,6 @@ public: // This method returns the singleton instance of the object. static NestedGridDistributedBoundary& instance(); - static NestedGridDistributedBoundary* instancePtr(); // Destructor. virtual ~NestedGridDistributedBoundary(); @@ -86,9 +85,6 @@ public: private: //--------------------------- Private Interface ---------------------------// - // Singleton instance pointer. - static NestedGridDistributedBoundary* mInstance; - // List of the occupied grid cells, in the order [process][gridLevel][gridCell]. std::vector< std::vector< std::vector< GridCellIndex > > > mOccupiedGridCells; @@ -111,6 +107,8 @@ private: } +#include "NestedGridDistributedBoundaryInline.hh" + #else // Forward declaration. diff --git a/src/Distributed/NestedGridDistributedBoundaryInline.hh b/src/Distributed/NestedGridDistributedBoundaryInline.hh new file mode 100644 index 000000000..db3d87ce5 --- /dev/null +++ b/src/Distributed/NestedGridDistributedBoundaryInline.hh @@ -0,0 +1,15 @@ +namespace Spheral { + +//------------------------------------------------------------------------------ +// Singleton instance method. +//------------------------------------------------------------------------------ +template +inline +NestedGridDistributedBoundary& +NestedGridDistributedBoundary:: +instance() { + static NestedGridDistributedBoundary theInstance; + return theInstance; +} + +} diff --git a/src/Distributed/TreeDistributedBoundary.cc b/src/Distributed/TreeDistributedBoundary.cc index 28a96bade..7d6476641 100644 --- a/src/Distributed/TreeDistributedBoundary.cc +++ b/src/Distributed/TreeDistributedBoundary.cc @@ -33,31 +33,6 @@ using std::abs; namespace Spheral { -// Static initialization of singleton instance. -template -TreeDistributedBoundary* -TreeDistributedBoundary::mInstance = 0; - -//------------------------------------------------------------------------------ -// Singleton instance method. -//------------------------------------------------------------------------------ -template -TreeDistributedBoundary& -TreeDistributedBoundary:: -instance() { - if (mInstance == 0) { - mInstance = new TreeDistributedBoundary(); - } // end if - return *mInstance; -} - -template -TreeDistributedBoundary* -TreeDistributedBoundary:: -instancePtr() { - return &(instance()); -} - //------------------------------------------------------------------------------ // Default constructor. //------------------------------------------------------------------------------ diff --git a/src/Distributed/TreeDistributedBoundary.hh b/src/Distributed/TreeDistributedBoundary.hh index b40042bc4..bceac9db9 100644 --- a/src/Distributed/TreeDistributedBoundary.hh +++ b/src/Distributed/TreeDistributedBoundary.hh @@ -32,7 +32,6 @@ public: // This method returns the singleton instance of the object. static TreeDistributedBoundary& instance(); - static TreeDistributedBoundary* instancePtr(); // Destructor. virtual ~TreeDistributedBoundary(); @@ -44,9 +43,6 @@ public: private: //--------------------------- Private Interface ---------------------------// - // Singleton instance pointer. - static TreeDistributedBoundary* mInstance; - // Disabled methods. TreeDistributedBoundary(); TreeDistributedBoundary(const TreeDistributedBoundary&); @@ -62,6 +58,8 @@ private: } +#include "TreeDistributedBoundaryInline.hh" + #else // Forward declaration. diff --git a/src/Distributed/TreeDistributedBoundaryInline.hh b/src/Distributed/TreeDistributedBoundaryInline.hh new file mode 100644 index 000000000..602291f49 --- /dev/null +++ b/src/Distributed/TreeDistributedBoundaryInline.hh @@ -0,0 +1,15 @@ +namespace Spheral { + +//------------------------------------------------------------------------------ +// Singleton instance method. +//------------------------------------------------------------------------------ +template +inline +TreeDistributedBoundary& +TreeDistributedBoundary:: +instance() { + static TreeDistributedBoundary theInstance; + return theInstance; +} + +} diff --git a/src/PythonMPIInterfaces/fakempi.py b/src/Distributed/fakempi.py similarity index 93% rename from src/PythonMPIInterfaces/fakempi.py rename to src/Distributed/fakempi.py index 12166905b..1819bc66d 100644 --- a/src/PythonMPIInterfaces/fakempi.py +++ b/src/Distributed/fakempi.py @@ -8,6 +8,9 @@ MAX = -2 SUM = -3 +def is_fake_mpi(): + return True + def reduce(var, op): return var @@ -25,3 +28,4 @@ def bcast(obj, root=0): def barrier(): return + diff --git a/src/PythonMPIInterfaces/mpi_mpi4py.py b/src/Distributed/mpi_mpi4py.py similarity index 94% rename from src/PythonMPIInterfaces/mpi_mpi4py.py rename to src/Distributed/mpi_mpi4py.py index c37a3c991..e1692e256 100644 --- a/src/PythonMPIInterfaces/mpi_mpi4py.py +++ b/src/Distributed/mpi_mpi4py.py @@ -42,6 +42,12 @@ sys.stdout = __mpi_stdoutfile__ """, globalscope) +#------------------------------------------------------------------------------- +# Allow us to be discriminated against as not the fake MPI package +#------------------------------------------------------------------------------- +def is_fake_mpi(): + return False + #------------------------------------------------------------------------------- # A common helper to convert vector_of_* types to lists for communication #------------------------------------------------------------------------------- diff --git a/src/Geometry/CMakeLists.txt b/src/Geometry/CMakeLists.txt index e5182a6c7..d9553c6c3 100644 --- a/src/Geometry/CMakeLists.txt +++ b/src/Geometry/CMakeLists.txt @@ -26,6 +26,7 @@ instantiate(Geometry_inst Geometry_sources) set(Geometry_headers GeometryRegistrar.hh + GeometryRegistrarInline.hh Box1d.hh Box1dInline.hh CellFaceFlag.hh diff --git a/src/Geometry/GeometryRegistrar.cc b/src/Geometry/GeometryRegistrar.cc index 5f65373ac..6692937e1 100644 --- a/src/Geometry/GeometryRegistrar.cc +++ b/src/Geometry/GeometryRegistrar.cc @@ -12,36 +12,12 @@ namespace Spheral { -//------------------------------------------------------------------------------ -// Instance -//------------------------------------------------------------------------------ -GeometryRegistrar& -GeometryRegistrar::instance() { - if (mInstancePtr == 0) mInstancePtr = new GeometryRegistrar; - CHECK(mInstancePtr != 0); - return *mInstancePtr; -} - //------------------------------------------------------------------------------ // Constructor (private) //------------------------------------------------------------------------------ GeometryRegistrar::GeometryRegistrar(){ } -//------------------------------------------------------------------------------ -// Copy constructor (private) -//------------------------------------------------------------------------------ -GeometryRegistrar::GeometryRegistrar(const GeometryRegistrar&) { -} - -//------------------------------------------------------------------------------ -// Assignment (private) -//------------------------------------------------------------------------------ -GeometryRegistrar& -GeometryRegistrar::operator=(const GeometryRegistrar&) { - return *mInstancePtr; -} - //------------------------------------------------------------------------------ // Destructor (private) //------------------------------------------------------------------------------ @@ -51,6 +27,6 @@ GeometryRegistrar::~GeometryRegistrar() { //------------------------------------------------------------------------------ // Initializations //------------------------------------------------------------------------------ -GeometryRegistrar* GeometryRegistrar::mInstancePtr = 0; CoordinateType GeometryRegistrar::mCoords = CoordinateType::Cartesian; + } diff --git a/src/Geometry/GeometryRegistrar.hh b/src/Geometry/GeometryRegistrar.hh index f2211ac14..7e01075bb 100644 --- a/src/Geometry/GeometryRegistrar.hh +++ b/src/Geometry/GeometryRegistrar.hh @@ -30,7 +30,6 @@ public: private: //--------------------------- Private Interface --------------------------// - static GeometryRegistrar* mInstancePtr; static CoordinateType mCoords; // No public constructors, destructor, or assignment. @@ -42,4 +41,6 @@ private: } +#include "GeometryRegistrarInline.hh" + #endif diff --git a/src/Geometry/GeometryRegistrarInline.hh b/src/Geometry/GeometryRegistrarInline.hh new file mode 100644 index 000000000..00b6d9b8e --- /dev/null +++ b/src/Geometry/GeometryRegistrarInline.hh @@ -0,0 +1,13 @@ +namespace Spheral { + +//------------------------------------------------------------------------------ +// Instance +//------------------------------------------------------------------------------ +inline +GeometryRegistrar& +GeometryRegistrar::instance() { + static GeometryRegistrar theInstance; + return theInstance; +} + +} diff --git a/src/NodeGenerators/CMakeLists.txt b/src/NodeGenerators/CMakeLists.txt index 3a43509b7..5b580a0e6 100644 --- a/src/NodeGenerators/CMakeLists.txt +++ b/src/NodeGenerators/CMakeLists.txt @@ -33,6 +33,7 @@ spheral_install_python_files( CompositeNodeDistribution.py distributeNodesGeneric.py DistributeNodes.py + SortAndDivideRedistributeNodes.py ParMETISDistributeNodes.py MortonOrderDistributeNodes.py PeanoHilbertDistributeNodes.py diff --git a/src/NodeGenerators/DistributeNodes.py b/src/NodeGenerators/DistributeNodes.py index 66032840a..bc43863c2 100644 --- a/src/NodeGenerators/DistributeNodes.py +++ b/src/NodeGenerators/DistributeNodes.py @@ -4,71 +4,35 @@ import distributeNodesGeneric from NodeGeneratorBase import ConstantRho -#------------------------------------------------------------------------------- -# Domain decompose using the sort and divide scheme (1d method). -#------------------------------------------------------------------------------- -def distributeNodes1d(*listOfNodeTuples): - if mpi.procs > 1: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase1d, - globalNodeIDs1d, - SortAndDivideRedistributeNodes1d) - else: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase1d, - globalNodeIDs1d, - None) +from spheralDimensions import spheralDimensions +dims = spheralDimensions() #------------------------------------------------------------------------------- -# Domain decompose using the sort and divide scheme (2d method). +# A factory string pattern for making distributors based on different algorithms #------------------------------------------------------------------------------- -def distributeNodes2d(*listOfNodeTuples): - if mpi.procs > 1: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase2d, - globalNodeIDs2d, - SortAndDivideRedistributeNodes2d) - else: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase2d, - globalNodeIDs2d, - None) +def makeDistributeNodesMethod(distribute, SpheralModule): + assert type(distribute) == str + + def f(*listOfNodeTuples): + "Domain decompose using the %s method)" % distribute + import mpi + if mpi.procs > 1: + if not hasattr(SpheralModule, distribute): + raise RuntimeError, "ERROR: %s is not available in the Spheral module" % distribute + distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, + SpheralModule.DataBase, + SpheralModule.globalNodeIDs, + getattr(SpheralModule, distribute)) + else: + distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, + SpheralModule.DataBase, + SpheralModule.globalNodeIDs, + None) -#------------------------------------------------------------------------------- -# Domain decompose using the sort and divide scheme (3d method). -#------------------------------------------------------------------------------- -def distributeNodes3d(*listOfNodeTuples): - if mpi.procs > 1: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase3d, - globalNodeIDs3d, - SortAndDivideRedistributeNodes3d) - else: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase3d, - globalNodeIDs3d, - None) + return f -#------------------------------------------------------------------------------- -# Provide no-op versions of the distributer. -#------------------------------------------------------------------------------- -def nullDistributeNodes1d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase1d, - globalNodeIDs1d, - None) - -def nullDistributeNodes2d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase2d, - globalNodeIDs2d, - None) - -def nullDistributeNodes3d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - DataBase3d, - globalNodeIDs3d, - None) +# For backwards compatibility we provide a default distributor here +from PeanoHilbertDistributeNodes import * #------------------------------------------------------------------------------- # Old method for handling 1-D distributions. Deprecated now. diff --git a/src/NodeGenerators/MortonOrderDistributeNodes.py b/src/NodeGenerators/MortonOrderDistributeNodes.py index cd0ac1059..6e052d94c 100644 --- a/src/NodeGenerators/MortonOrderDistributeNodes.py +++ b/src/NodeGenerators/MortonOrderDistributeNodes.py @@ -1,30 +1,6 @@ -import Spheral -import distributeNodesGeneric - -#------------------------------------------------------------------------------- -# Domain decompose using Morton ordering (1d method). -#------------------------------------------------------------------------------- -def distributeNodes1d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase1d, - Spheral.globalNodeIDsAll1d, - Spheral.MortonOrderRedistributeNodes1d) - -#------------------------------------------------------------------------------- -# Domain decompose using Morton ordering (2d method). -#------------------------------------------------------------------------------- -def distributeNodes2d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase2d, - Spheral.globalNodeIDsAll2d, - Spheral.MortonOrderRedistributeNodes2d) - -#------------------------------------------------------------------------------- -# Domain decompose using Morton ordering (3d method). -#------------------------------------------------------------------------------- -def distributeNodes3d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase3d, - Spheral.globalNodeIDsAll3d, - Spheral.MortonOrderRedistributeNodes3d) +from DistributeNodes import makeDistributeNodesMethod +from spheralDimensions import spheralDimensions +dims = spheralDimensions() +for dim in dims: + exec("import Spheral{dim}d; distributeNodes{dim}d = makeDistributeNodesMethod('{distributor}', Spheral{dim}d)".format(dim=dim, distributor="MortonOrderRedistributeNodes")) diff --git a/src/NodeGenerators/NestedGridDistributeNodes.py b/src/NodeGenerators/NestedGridDistributeNodes.py index 7afc7906b..215c33d7a 100644 --- a/src/NodeGenerators/NestedGridDistributeNodes.py +++ b/src/NodeGenerators/NestedGridDistributeNodes.py @@ -1,29 +1,6 @@ -import Spheral -import ParMETISDistributeNodes +from DistributeNodes import makeDistributeNodesMethod +from spheralDimensions import spheralDimensions +dims = spheralDimensions() -#------------------------------------------------------------------------------- -# Domain decompose (1d method). -#------------------------------------------------------------------------------- -def distributeNodes1d(listOfNodeTuples): - return ParMETISDistributeNodes.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase1d, - Spheral.ScalarField1d, - Spheral.NestedGridRedistributeNodes1d) - -#------------------------------------------------------------------------------- -# Domain decompose (2d method). -#------------------------------------------------------------------------------- -def distributeNodes2d(listOfNodeTuples): - return ParMETISDistributeNodes.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase2d, - Spheral.ScalarField2d, - Spheral.NestedGridRedistributeNodes2d) - -#------------------------------------------------------------------------------- -# Domain decompose (3d method). -#------------------------------------------------------------------------------- -def distributeNodes3d(listOfNodeTuples): - return ParMETISDistributeNodes.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase3d, - Spheral.ScalarField3d, - Spheral.NestedGridRedistributeNodes3d) +for dim in dims: + exec("import Spheral{dim}d; distributeNodes{dim}d = makeDistributeNodesMethod('{distributor}', Spheral{dim}d)".format(dim=dim, distributor="NestedGridRedistributeNodes")) diff --git a/src/NodeGenerators/ParMETISDistributeNodes.py b/src/NodeGenerators/ParMETISDistributeNodes.py index 0b87b90ba..0c217e514 100644 --- a/src/NodeGenerators/ParMETISDistributeNodes.py +++ b/src/NodeGenerators/ParMETISDistributeNodes.py @@ -1,21 +1,6 @@ -import Spheral -import distributeNodesGeneric - -#------------------------------------------------------------------------------- -# Domain decompose using ParMETIS (2d method). -#------------------------------------------------------------------------------- -def distributeNodes2d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase2d, - Spheral.globalNodeIDs2d, - Spheral.ParmetisRedistributeNodes2d) - -#------------------------------------------------------------------------------- -# Domain decompose using ParMETIS (3d method). -#------------------------------------------------------------------------------- -def distributeNodes3d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase3d, - Spheral.globalNodeIDs3d, - Spheral.ParmetisRedistributeNodes3d) - +from DistributeNodes import makeDistributeNodesMethod +from spheralDimensions import spheralDimensions +dims = spheralDimensions() +for dim in dims: + if dims != '1': + exec("import Spheral{dim}d; distributeNodes{dim}d = makeDistributeNodesMethod('{distributor}', Spheral{dim}d)".format(dim=dim, distributor="ParmetisRedistributeNodes")) diff --git a/src/NodeGenerators/PeanoHilbertDistributeNodes.py b/src/NodeGenerators/PeanoHilbertDistributeNodes.py index 8fbf5ecc6..9d07580e9 100644 --- a/src/NodeGenerators/PeanoHilbertDistributeNodes.py +++ b/src/NodeGenerators/PeanoHilbertDistributeNodes.py @@ -1,30 +1,6 @@ -import Spheral -import distributeNodesGeneric - -#------------------------------------------------------------------------------- -# Domain decompose using PeanoHilbert ordering (1d method). -#------------------------------------------------------------------------------- -def distributeNodes1d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase1d, - Spheral.globalNodeIDsAll1d, - Spheral.PeanoHilbertOrderRedistributeNodes1d) - -#------------------------------------------------------------------------------- -# Domain decompose using PeanoHilbert ordering (2d method). -#------------------------------------------------------------------------------- -def distributeNodes2d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase2d, - Spheral.globalNodeIDsAll2d, - Spheral.PeanoHilbertOrderRedistributeNodes2d) - -#------------------------------------------------------------------------------- -# Domain decompose using PeanoHilbert ordering (3d method). -#------------------------------------------------------------------------------- -def distributeNodes3d(*listOfNodeTuples): - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase3d, - Spheral.globalNodeIDsAll3d, - Spheral.PeanoHilbertOrderRedistributeNodes3d) +from DistributeNodes import makeDistributeNodesMethod +from spheralDimensions import spheralDimensions +dims = spheralDimensions() +for dim in dims: + exec("import Spheral{dim}d; distributeNodes{dim}d = makeDistributeNodesMethod('{distributor}', Spheral{dim}d)".format(dim=dim, distributor="PeanoHilbertOrderRedistributeNodes")) diff --git a/src/NodeGenerators/SortAndDivideRedistributeNodes.py b/src/NodeGenerators/SortAndDivideRedistributeNodes.py new file mode 100644 index 000000000..c5cc46ace --- /dev/null +++ b/src/NodeGenerators/SortAndDivideRedistributeNodes.py @@ -0,0 +1,6 @@ +from DistributeNodes import makeDistributeNodesMethod +from spheralDimensions import spheralDimensions +dims = spheralDimensions() + +for dim in dims: + exec("import Spheral{dim}d; distributeNodes{dim}d = makeDistributeNodesMethod('{distributor}', Spheral{dim}d)".format(dim=dim, distributor="SortAndDivideRedistributeNodes")) diff --git a/src/NodeGenerators/VoronoiDistributeNodes.py b/src/NodeGenerators/VoronoiDistributeNodes.py index 83acb1d58..dd84f3b81 100644 --- a/src/NodeGenerators/VoronoiDistributeNodes.py +++ b/src/NodeGenerators/VoronoiDistributeNodes.py @@ -1,52 +1,6 @@ -import Spheral -import distributeNodesGeneric +from DistributeNodes import makeDistributeNodesMethod +from spheralDimensions import spheralDimensions +dims = spheralDimensions() -# Import mpi. -import mpi -rank = mpi.rank -procs = mpi.procs - -#------------------------------------------------------------------------------- -# Domain decompose using Voronoi ordering (1d method). -#------------------------------------------------------------------------------- -def distributeNodes1d(*listOfNodeTuples): - if procs > 1: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase1d, - Spheral.globalNodeIDsAll1d, - Spheral.VoronoiRedistributeNodes1d) - else: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase1d, - Spheral.globalNodeIDsAll1d, - None) - -#------------------------------------------------------------------------------- -# Domain decompose using Voronoi ordering (2d method). -#------------------------------------------------------------------------------- -def distributeNodes2d(*listOfNodeTuples): - if procs > 1: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase2d, - Spheral.globalNodeIDsAll2d, - Spheral.VoronoiRedistributeNodes2d) - else: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase2d, - Spheral.globalNodeIDsAll2d, - None) - -#------------------------------------------------------------------------------- -# Domain decompose using Voronoi ordering (3d method). -#------------------------------------------------------------------------------- -def distributeNodes3d(*listOfNodeTuples): - if procs > 1: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase3d, - Spheral.globalNodeIDsAll3d, - Spheral.VoronoiRedistributeNodes3d) - else: - distributeNodesGeneric.distributeNodesGeneric(listOfNodeTuples, - Spheral.DataBase3d, - Spheral.globalNodeIDsAll3d, - None) +for dim in dims: + exec("import Spheral{dim}d; distributeNodes{dim}d = makeDistributeNodesMethod('{distributor}', Spheral{dim}d)".format(dim=dim, distributor="VoronoiRedistributeNodes")) diff --git a/src/NodeList/NodeListRegistrar.hh b/src/NodeList/NodeListRegistrar.hh index 14cb68e2f..f9a4ff7b7 100644 --- a/src/NodeList/NodeListRegistrar.hh +++ b/src/NodeList/NodeListRegistrar.hh @@ -132,8 +132,6 @@ public: private: //--------------------------- Private Interface---------------------------// - // The one and only instance. - static NodeListRegistrar* mInstancePtr; // The current set of NodeLists. ContainerType mNodeLists; diff --git a/src/NodeList/NodeListRegistrarInline.hh b/src/NodeList/NodeListRegistrarInline.hh index cf888e06d..9e1c6f0bd 100644 --- a/src/NodeList/NodeListRegistrarInline.hh +++ b/src/NodeList/NodeListRegistrarInline.hh @@ -14,9 +14,8 @@ inline NodeListRegistrar& NodeListRegistrar:: instance() { - if (mInstancePtr == 0) mInstancePtr = new NodeListRegistrar; - CHECK(mInstancePtr != 0); - return *mInstancePtr; + static NodeListRegistrar theInstance; + return theInstance; } //------------------------------------------------------------------------------ diff --git a/src/NodeList/NodeListRegistrarInst.cc.py b/src/NodeList/NodeListRegistrarInst.cc.py index 3758e4f49..3a334ac6a 100644 --- a/src/NodeList/NodeListRegistrarInst.cc.py +++ b/src/NodeList/NodeListRegistrarInst.cc.py @@ -3,7 +3,5 @@ // Initialize the static instance pointer. //------------------------------------------------------------------------------ #include "NodeList/NodeListRegistrar.cc" - -template<> Spheral::NodeListRegistrar>* Spheral::NodeListRegistrar>::mInstancePtr = 0; template class Spheral::NodeListRegistrar>; """ diff --git a/src/Pybind11Wraps/DataOutput/DataOutputMOD.py b/src/Pybind11Wraps/DataOutput/DataOutputMOD.py index e2e749c73..3f4f9119b 100644 --- a/src/Pybind11Wraps/DataOutput/DataOutputMOD.py +++ b/src/Pybind11Wraps/DataOutput/DataOutputMOD.py @@ -53,7 +53,6 @@ def restoreState(self): # The instance attribute. We expose this as a property of the class. @PYB11static - @PYB11cppname("instancePtr") - @PYB11returnpolicy("take_ownership") + @PYB11returnpolicy("reference") def instance(self): - return "RestartRegistrar*" + return "RestartRegistrar&" diff --git a/src/Pybind11Wraps/Distributed/BoundingVolumeDistributedBoundary.py b/src/Pybind11Wraps/Distributed/BoundingVolumeDistributedBoundary.py index 4d3abfa99..eaa86946c 100644 --- a/src/Pybind11Wraps/Distributed/BoundingVolumeDistributedBoundary.py +++ b/src/Pybind11Wraps/Distributed/BoundingVolumeDistributedBoundary.py @@ -31,10 +31,9 @@ class BoundingVolumeDistributedBoundary(DistributedBoundary): # The instance attribute. We expose this as a property of the class. @PYB11static - @PYB11cppname("instancePtr") - @PYB11returnpolicy("take_ownership") + @PYB11returnpolicy("reference") def instance(self): - return "BoundingVolumeDistributedBoundary<%(Dimension)s>*" + return "BoundingVolumeDistributedBoundary<%(Dimension)s>&" #........................................................................... # Virtual methods diff --git a/src/Pybind11Wraps/Distributed/NestedGridDistributedBoundary.py b/src/Pybind11Wraps/Distributed/NestedGridDistributedBoundary.py index db5be7e6c..0466aac0f 100644 --- a/src/Pybind11Wraps/Distributed/NestedGridDistributedBoundary.py +++ b/src/Pybind11Wraps/Distributed/NestedGridDistributedBoundary.py @@ -28,10 +28,9 @@ class NestedGridDistributedBoundary(DistributedBoundary): # The instance attribute. We expose this as a property of the class. @PYB11static - @PYB11cppname("instancePtr") - @PYB11returnpolicy("take_ownership") + @PYB11returnpolicy("reference") def instance(self): - return "NestedGridDistributedBoundary<%(Dimension)s>*" + return "NestedGridDistributedBoundary<%(Dimension)s>&" #........................................................................... # Methods diff --git a/src/Pybind11Wraps/Distributed/TreeDistributedBoundary.py b/src/Pybind11Wraps/Distributed/TreeDistributedBoundary.py index 5ad8a8a19..3cbf4fa9a 100644 --- a/src/Pybind11Wraps/Distributed/TreeDistributedBoundary.py +++ b/src/Pybind11Wraps/Distributed/TreeDistributedBoundary.py @@ -28,10 +28,9 @@ class TreeDistributedBoundary(DistributedBoundary): # The instance attribute. We expose this as a property of the class. @PYB11static - @PYB11cppname("instancePtr") - @PYB11returnpolicy("take_ownership") + @PYB11returnpolicy("reference") def instance(self): - return "TreeDistributedBoundary<%(Dimension)s>*" + return "TreeDistributedBoundary<%(Dimension)s>&" #........................................................................... # Virtual methods diff --git a/src/PythonMPIInterfaces/CMakeLists.txt b/src/PythonMPIInterfaces/CMakeLists.txt deleted file mode 100644 index 16fe2d0b2..000000000 --- a/src/PythonMPIInterfaces/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -if (ENABLE_MPI) - set(PythonMPIInterfaces_python_targets - mpi_mpi4py.py - ) -else() - set(PythonMPIInterfaces_python_targets - fakempi.py - ) -endif() - -install(FILES ${PythonMPIInterfaces_python_targets} - DESTINATION Spheral - RENAME mpi.py - ) diff --git a/src/PythonMPIInterfaces/makefile.in b/src/PythonMPIInterfaces/makefile.in deleted file mode 100644 index d2240ad4c..000000000 --- a/src/PythonMPIInterfaces/makefile.in +++ /dev/null @@ -1,20 +0,0 @@ -# -*-makefile-*- -# Spheral++ PythonMPIInterfaces package makefile -#------------------------------------------------------------------------------- -srcdir = @abs_srcdir@ -VPATH = @abs_srcdir@ -SPHERALTOP = @abs_top_srcdir@ -BUILDTOP = @abs_top_builddir@ - -PKGNAME = SimulationControl -PKGDIR = $(PKGNAME)/ -PYTHONTARGETS = \ - $(MPIPYTHONINTERFACETARGET) -INSTALLTARGETS = mpi.py - -#------------------------------------------------------------------------------- -include $(BUILDTOP)/helpers/makefile_master - -mpi.py: $(srcdir)/$(MPIPYTHONINTERFACETARGET) - rm -f $(PYTHONLIBDIR)/Spheral/mpi.py - ln -s $(PYTHONLIBDIR)/Spheral/$(MPIPYTHONINTERFACETARGET) $(PYTHONLIBDIR)/Spheral/mpi.py diff --git a/src/SimulationControl/Spheral.py b/src/SimulationControl/Spheral.py index 263a0d880..9c5b17206 100644 --- a/src/SimulationControl/Spheral.py +++ b/src/SimulationControl/Spheral.py @@ -8,18 +8,18 @@ # do some magic 'cause type info and dynamic_casts get screwed up between # g++ built libraries. Sigh. # ------------------------------------------------------------------------------ -try: - import sys, ctypes - sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) - #sys.setdlopenflags(ctypes.RTLD_NOW | ctypes.RTLD_GLOBAL) - #import sys, DLFCN - #sys.setdlopenflags(sys.getdlopenflags() | DLFCN.RTLD_GLOBAL) - #sys.setdlopenflags(DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) - #import sys - #sys.setdlopenflags(0x100|0x2) -except: - print "WARNING: unable to set python dl flags on Spheral import." - pass +#try: +# import sys, ctypes +# sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) +# #sys.setdlopenflags(ctypes.RTLD_NOW | ctypes.RTLD_GLOBAL) +# #import sys, DLFCN +# #sys.setdlopenflags(sys.getdlopenflags() | DLFCN.RTLD_GLOBAL) +# #sys.setdlopenflags(DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) +# #import sys +# #sys.setdlopenflags(0x100|0x2) +#except: +# print "WARNING: unable to set python dl flags on Spheral import." +# pass # ------------------------------------------------------------------------------ # Load up MPI. diff --git a/src/Utilities/CMakeLists.txt b/src/Utilities/CMakeLists.txt index e1ade5459..de6786813 100644 --- a/src/Utilities/CMakeLists.txt +++ b/src/Utilities/CMakeLists.txt @@ -67,6 +67,7 @@ set(Utilities_headers RedistributionRegistrar.hh RedistributionRegistrarInline.hh RegisterMPIDataTypes.hh + RegisterMPIDataTypesInline.hh SafeIndexMap.hh SidreDataCollection.hh SpheralFunctions.hh diff --git a/src/Utilities/RedistributionRegistrar.cc b/src/Utilities/RedistributionRegistrar.cc index 033f04a64..38219d26c 100644 --- a/src/Utilities/RedistributionRegistrar.cc +++ b/src/Utilities/RedistributionRegistrar.cc @@ -39,27 +39,6 @@ struct CompareWeakPtr: public std::binary_function, std::weak_p } }; -//------------------------------------------------------------------------------ -// Get the instance. -//------------------------------------------------------------------------------ -RedistributionRegistrar& -RedistributionRegistrar:: -instance() { - return *RedistributionRegistrar::instancePtr(); -} - -//------------------------------------------------------------------------------ -// Get the instance (pointer). -//------------------------------------------------------------------------------ -RedistributionRegistrar* -RedistributionRegistrar:: -instancePtr() { - if (mInstancePtr == 0) mInstancePtr = new RedistributionRegistrar; - CHECK(mInstancePtr != 0); - mInstancePtr->removeExpiredPointers(); - return mInstancePtr; -} - //------------------------------------------------------------------------------ // Register a RedistributionNotificationHandle. //------------------------------------------------------------------------------ @@ -156,8 +135,3 @@ RedistributionRegistrar:: } } - -//------------------------------------------------------------------------------ -// Initialize the static instance pointer. -//----------------------------------------------------------------------------- -Spheral::RedistributionRegistrar* Spheral::RedistributionRegistrar::mInstancePtr = 0; diff --git a/src/Utilities/RedistributionRegistrar.hh b/src/Utilities/RedistributionRegistrar.hh index 4d46e2c87..24b3d3919 100644 --- a/src/Utilities/RedistributionRegistrar.hh +++ b/src/Utilities/RedistributionRegistrar.hh @@ -26,7 +26,6 @@ public: // Get the instance. static RedistributionRegistrar& instance(); - static RedistributionRegistrar* instancePtr(); // Methods for registering a RedistributionNotificationHandle. void registerRedistributionNotificationHandle(std::shared_ptr redistributionHandlePtr); @@ -49,9 +48,6 @@ public: private: //------------------------===== Private Interface =====----------------------// - // The one and only instance. - static RedistributionRegistrar* mInstancePtr; - // The list of RedistributionNotificationHandles. RedistributionNotificationHandleContainer mRedistributionNotificationHandles; @@ -64,9 +60,7 @@ private: } -#ifndef __GCCXML__ #include "RedistributionRegistrarInline.hh" -#endif #else diff --git a/src/Utilities/RedistributionRegistrarInline.hh b/src/Utilities/RedistributionRegistrarInline.hh index aeecc931b..ea67a1f7f 100644 --- a/src/Utilities/RedistributionRegistrarInline.hh +++ b/src/Utilities/RedistributionRegistrarInline.hh @@ -1,5 +1,16 @@ namespace Spheral { +//------------------------------------------------------------------------------ +// Get the instance. +//------------------------------------------------------------------------------ +inline +RedistributionRegistrar& +RedistributionRegistrar:: +instance() { + static RedistributionRegistrar theInstance; + return theInstance; +} + //------------------------------------------------------------------------------ // The non-const iterators. //------------------------------------------------------------------------------ diff --git a/src/Utilities/RegisterMPIDataTypes.cc b/src/Utilities/RegisterMPIDataTypes.cc index 65f6a28c5..b1ae641cc 100644 --- a/src/Utilities/RegisterMPIDataTypes.cc +++ b/src/Utilities/RegisterMPIDataTypes.cc @@ -12,17 +12,6 @@ namespace Spheral { -//------------------------------------------------------------------------------ -// Get the instance. -//------------------------------------------------------------------------------ -RegisterMPIDataTypes& -RegisterMPIDataTypes:: -instance() { - if (mInstancePtr == 0) mInstancePtr = new RegisterMPIDataTypes; - CHECK(mInstancePtr != 0); - return *mInstancePtr; -} - //------------------------------------------------------------------------------ // Constructor (private). //------------------------------------------------------------------------------ @@ -109,9 +98,11 @@ RegisterMPIDataTypes() { } +//------------------------------------------------------------------------------ +// Destructor (private) +//------------------------------------------------------------------------------ +RegisterMPIDataTypes:: +~RegisterMPIDataTypes() { } -//------------------------------------------------------------------------------ -// Initialize the static instance pointer. -//----------------------------------------------------------------------------- -Spheral::RegisterMPIDataTypes* Spheral::RegisterMPIDataTypes::mInstancePtr = 0; +} diff --git a/src/Utilities/RegisterMPIDataTypes.hh b/src/Utilities/RegisterMPIDataTypes.hh index 517dc1961..88142cc0d 100644 --- a/src/Utilities/RegisterMPIDataTypes.hh +++ b/src/Utilities/RegisterMPIDataTypes.hh @@ -33,10 +33,6 @@ public: #endif private: - - // The one and only instance. - static RegisterMPIDataTypes* mInstancePtr; - RegisterMPIDataTypes(); RegisterMPIDataTypes(const RegisterMPIDataTypes&); RegisterMPIDataTypes& operator=(const RegisterMPIDataTypes&); @@ -45,5 +41,7 @@ private: } +#include "RegisterMPIDataTypesInline.hh" + #endif diff --git a/src/Utilities/RegisterMPIDataTypesInline.hh b/src/Utilities/RegisterMPIDataTypesInline.hh new file mode 100644 index 000000000..a996f3f2c --- /dev/null +++ b/src/Utilities/RegisterMPIDataTypesInline.hh @@ -0,0 +1,14 @@ +namespace Spheral { + +//------------------------------------------------------------------------------ +// Get the instance. +//------------------------------------------------------------------------------ +inline +RegisterMPIDataTypes& +RegisterMPIDataTypes:: +instance() { + static RegisterMPIDataTypes theInstance; + return theInstance; +} + +} diff --git a/tests/functional/Gravity/CollisionlessSphereCollapse.py b/tests/functional/Gravity/CollisionlessSphereCollapse.py index 03bd5a969..0839caf97 100644 --- a/tests/functional/Gravity/CollisionlessSphereCollapse.py +++ b/tests/functional/Gravity/CollisionlessSphereCollapse.py @@ -1,10 +1,10 @@ -#ATS:t0 = test(SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice AccelerationRatio --steps=40 --restartStep 20 --dataDir 'Collisionless_Sphere_Collapse_AccelerationRatio' --clearDirectories True --outputFile 'Collisionless_sphere_collapse_AccelerationRatio_data.gnu' --checkRef True", np=1, label="Collisionless sphere gravitational collapse restart test (serial, acceleration ratio) INITIAL RUN") +#ATS:t0 = test(SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice AccelerationRatio --steps=40 --restartStep 20 --dataDir 'Collisionless_Sphere_Collapse_AccelerationRatio' --clearDirectories True --outputFile 'Collisionless_sphere_collapse_AccelerationRatio_data.gnu' --checkRef True", np=1, dist=1, label="Collisionless sphere gravitational collapse restart test (serial, acceleration ratio) INITIAL RUN") # -#ATS:t1 = testif(t0, SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice AccelerationRatio --steps 20 --restartStep 100 --dataDir 'Collisionless_Sphere_Collapse_AccelerationRatio' --clearDirectories False --outputFile 'Collisionless_sphere_collapse_AccelerationRatio_data.gnu' --checkRef True --restoreCycle 20 --checkRestart True", np=1, label="Collisionless sphere gravitational collapse restart test (serial, acceleration ratio) RESTARTED CHECK") +#ATS:t1 = testif(t0, SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice AccelerationRatio --steps 20 --restartStep 100 --dataDir 'Collisionless_Sphere_Collapse_AccelerationRatio' --clearDirectories False --outputFile 'Collisionless_sphere_collapse_AccelerationRatio_data.gnu' --checkRef True --restoreCycle 20 --checkRestart True", np=1, dist=1, label="Collisionless sphere gravitational collapse restart test (serial, acceleration ratio) RESTARTED CHECK") # -#ATS:t2 = test(SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice DynamicalTime --steps=40 --restartStep 20 --dataDir 'Collisionless_Sphere_Collapse_DynamicalTime' --clearDirectories True --outputFile 'Collisionless_sphere_collapse_DynamicalTime_data.gnu' --checkRef True", np=1, label="Collisionless sphere gravitational collapse restart test (serial, dynamical time) INITIAL RUN") +#ATS:t2 = test(SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice DynamicalTime --steps=40 --restartStep 20 --dataDir 'Collisionless_Sphere_Collapse_DynamicalTime' --clearDirectories True --outputFile 'Collisionless_sphere_collapse_DynamicalTime_data.gnu' --checkRef True", np=1, dist=1, label="Collisionless sphere gravitational collapse restart test (serial, dynamical time) INITIAL RUN") # -#ATS:t3 = testif(t2, SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice DynamicalTime --steps 20 --restartStep 100 --dataDir 'Collisionless_Sphere_Collapse_DynamicalTime' --clearDirectories False --outputFile 'Collisionless_sphere_collapse_DynamicalTime_data.gnu' --checkRef True --restoreCycle 20 --checkRestart True", np=1, label="Collisionless sphere gravitational collapse restart test (serial, dynamical time) RESTARTED CHECK") +#ATS:t3 = testif(t2, SELF, "--nr 10 --numViz 0 --graphics None --timeStepChoice DynamicalTime --steps 20 --restartStep 100 --dataDir 'Collisionless_Sphere_Collapse_DynamicalTime' --clearDirectories False --outputFile 'Collisionless_sphere_collapse_DynamicalTime_data.gnu' --checkRef True --restoreCycle 20 --checkRestart True", np=1, dist=1, label="Collisionless sphere gravitational collapse restart test (serial, dynamical time) RESTARTED CHECK") #------------------------------------------------------------------------------- # Create a spherical distribution of collisionless points, which will of course @@ -57,7 +57,7 @@ outputFile = "Collisionless_sphere_collapse.gnu", checkRestart = False, checkRef = False, - tol = 1.0e-5, + tol = 5.0e-5, ) # Reference values for tests @@ -65,7 +65,7 @@ coefsRef = np.array([ 8.33175998e+00, 1.24358171e-12, -2.83895427e-23]) sigmaPhiRef = 9.25853628363647 elif timeStepChoice == DynamicalTime: - coefsRef = np.array([ 8.29012807e+00, 1.20195868e-12, -2.60750402e-23]) + coefsRef = np.array([ 8.29009280e+00, 1.20192051e-12, -2.60731358e-23]) sigmaPhiRef = 8.968145544554178 # Convert to MKS units. diff --git a/tests/functional/Hydro/Noh/Noh-planar-1d.py b/tests/functional/Hydro/Noh/Noh-planar-1d.py index f81a14995..214c84b71 100644 --- a/tests/functional/Hydro/Noh/Noh-planar-1d.py +++ b/tests/functional/Hydro/Noh/Noh-planar-1d.py @@ -281,7 +281,7 @@ # Set the node properties. #------------------------------------------------------------------------------- from GenerateNodeDistribution1d import GenerateNodeDistribution1d -from DistributeNodes import distributeNodes1d +from SortAndDivideRedistributeNodes import distributeNodes1d gen = GenerateNodeDistribution1d(n = nx1, rho = rho1, xmin = x0, diff --git a/tests/integration.ats b/tests/integration.ats index 2be94b106..e97f22b67 100644 --- a/tests/integration.ats +++ b/tests/integration.ats @@ -67,7 +67,7 @@ source("unit/Mesh/testLineMesh.py") # source("unit/Mesh/testPolyhedralMesh.py") # Suspended until we fix the polytope with Spheral issues. # MPI python interface unit tests -source("unit/PythonMPIInterfaces/testMPI4PYasPYMPI.py") +source("unit/Distributed/testMPI4PYasPYMPI.py") # C++ unit tests. source("functional/CXXTests/test_r3d_utils.py") diff --git a/tests/unit/PythonMPIInterfaces/testMPI4PYasPYMPI.py b/tests/unit/Distributed/testMPI4PYasPYMPI.py similarity index 100% rename from tests/unit/PythonMPIInterfaces/testMPI4PYasPYMPI.py rename to tests/unit/Distributed/testMPI4PYasPYMPI.py diff --git a/tests/unit/FieldOperations/testSampleMultipleFields2Lattice2d.py b/tests/unit/FieldOperations/testSampleMultipleFields2Lattice2d.py index f5d1feba2..4659f0fd8 100644 --- a/tests/unit/FieldOperations/testSampleMultipleFields2Lattice2d.py +++ b/tests/unit/FieldOperations/testSampleMultipleFields2Lattice2d.py @@ -1,5 +1,5 @@ -#ATS:test(SELF, label="sampleMultipleFields2Lattice 2D unit tests (serial)") -#ATS:test(SELF, np=4, label="sampleMultipleFields2Lattice 2D unit tests (4 proc)") +#ATS:test(SELF, dist=1, label="sampleMultipleFields2Lattice 2D unit tests (serial)") +#ATS:test(SELF, np=4, dist=1, label="sampleMultipleFields2Lattice 2D unit tests (4 proc)") import unittest diff --git a/tests/unit/Neighbor/testDistributedConnectivity.py b/tests/unit/Neighbor/testDistributedConnectivity.py index e9b408a39..2192537c5 100644 --- a/tests/unit/Neighbor/testDistributedConnectivity.py +++ b/tests/unit/Neighbor/testDistributedConnectivity.py @@ -1,10 +1,11 @@ -#ATS:t0 = test( SELF, label="test distributed connectivity (1 proc)") -#ATS:t2 = testif(t0, SELF, np=2, label="test distributed connectivity (2 proc)") -#ATS:t4 = testif(t0, SELF, np=4, label="test distributed connectivity (4 proc)") +#ATS:t0 = test( SELF, dist=1, label="test distributed connectivity (1 proc)") +#ATS:t2 = testif(t0, SELF, np=2, dist=1, label="test distributed connectivity (2 proc)") +#ATS:t4 = testif(t0, SELF, np=4, dist=1, label="test distributed connectivity (4 proc)") from Spheral import * from SpheralTestUtilities import * -import os, shutil, time +import os, shutil, time, sys +import mpi title("distributed connectivity") @@ -37,6 +38,12 @@ else: from Spheral3d import * +#------------------------------------------------------------------------------- +# This test only has any meaning if we're testing an MPI enabled build +#------------------------------------------------------------------------------- +if mpi.is_fake_mpi(): + sys.exit(0) + #------------------------------------------------------------------------------- # Set up the output directories #------------------------------------------------------------------------------- diff --git a/tests/unit/Neighbor/testNestedGridNeighbor.py b/tests/unit/Neighbor/testNestedGridNeighbor.py index dc456b15d..d3fed3b80 100644 --- a/tests/unit/Neighbor/testNestedGridNeighbor.py +++ b/tests/unit/Neighbor/testNestedGridNeighbor.py @@ -9,6 +9,7 @@ # NestedGridNeighbor doesn't do ghost->ghost connectivity, so the overlap # neighbor tests will choke. del NeighborTestBase.testConnectivityMapOverlapNeighbors +del NeighborTestBase.testConnectivityComputeIntersection #=============================================================================== # Radom node distribution -- 1-D.