Skip to content

Commit

Permalink
merged master into bspline
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjharrison committed Nov 25, 2024
2 parents dad26c3 + 67ea7b5 commit 6edeab2
Show file tree
Hide file tree
Showing 214 changed files with 18,968 additions and 7,456 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ jobs:
CTEST_OUTPUT_ON_FAILURE : 1
BUILD_CONFIG : >
-G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
-DCMAKE_PREFIX_PATH=/usr/local/opt/bison
-DBUILD_SHARED_LIBS=OFF
-DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root'
-DBUILD_TESTING=ON
-DMADNESS_ENABLE_CEREAL=ON
-DMADNESS_BUILD_MADWORLD_ONLY=${{ matrix.task_backend != 'Threads' }}
-DMADNESS_BUILD_LIBRARIES_ONLY=${{ matrix.build_type != 'Debug' }}
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -66,7 +69,7 @@ jobs:
- name: Install prerequisite MacOS packages
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install ninja gcc@10 boost eigen open-mpi bison ccache
brew install ninja boost eigen open-mpi bison ccache
if [ "X${{ matrix.task_backend }}" = "XLegacyTBB" ]; then
brew install tbb@2020
echo "TBBROOT=/usr/local/opt/tbb@2020" >> $GITHUB_ENV
Expand Down Expand Up @@ -129,3 +132,22 @@ jobs:
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --target check-short-madness

- name: Install
if: matrix.build_type != 'Debug'
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --target install

- name: Test Install Tree
if: matrix.build_type != 'Debug'
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake -S $GITHUB_WORKSPACE/doc/tutorial -B test_install -DCMAKE_PREFIX_PATH=${{github.workspace}}/install
cmake --build test_install
test_install/test_runtime
# if built more than just MADWorld run the HF test
if [ "X${{ matrix.task_backend }}" = "XThreads" ]; then
test_install/simple_hf
fi
71 changes: 46 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
cmake_minimum_required (VERSION 3.11.0)
cmake_minimum_required (VERSION 3.12.0) # for FindPython

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

## I know this is obnoxious but I don't know any other way to keep
## things clean. Make the build verbose so that people see the warning
## messages and fix the issues --- some of them are real
#set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON")

# safety net for dev workflow: accidental install will not affect FindOrFetch*
if (NOT DEFINED CACHE{CMAKE_FIND_NO_INSTALL_PREFIX})
set(CMAKE_FIND_NO_INSTALL_PREFIX ON CACHE BOOL "Whether find_* commands will search CMAKE_INSTALL_PREFIX and CMAKE_STAGING_PREFIX; see https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_NO_INSTALL_PREFIX.html#variable:CMAKE_FIND_NO_INSTALL_PREFIX")
Expand Down Expand Up @@ -66,24 +71,26 @@ set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Whether to use extensions of C++ ISO St
add_options(CXX ALL_BUILDS ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION})

# Set install paths ============================================================

set(MADNESS_INSTALL_BINDIR "bin"
CACHE PATH "MADNESS binary install directory")
set(MADNESS_INSTALL_INCLUDEDIR "include"
include(GNUInstallDirs)
set(MADNESS_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}"
CACHE PATH "MADNESS BIN install directory")
set(MADNESS_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}"
CACHE PATH "MADNESS INCLUDE install directory")
set(MADNESS_INSTALL_LIBDIR "lib"
set(MADNESS_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}"
CACHE PATH "MADNESS LIB install directory")
set(MADNESS_INSTALL_DATADIR "share/madness/${MADNESS_VERSION}/data"
set(MADNESS_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}/madness/${MADNESS_VERSION}/data"
CACHE PATH "MADNESS DATA install directory")
# TODO this matches Automake value, should be adjusted to the convention: share/madness/${MADNESS_VERSION}/doc
set(MADNESS_INSTALL_DOCDIR "share/doc/madness"
set(MADNESS_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/madness/${MADNESS_VERSION}/doc"
CACHE PATH "MADNESS DOC install directory")
set(MADNESS_INSTALL_CMAKEDIR "lib/cmake/madness"
set(MADNESS_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/madness"
CACHE PATH "MADNESS CMAKE install directory")

# Build options ==============================================================

redefaultable_option(MADNESS_BUILD_MADWORLD_ONLY "Build only MADWorld runtime (excluding BLAS/LAPACK interfaces)" OFF)
redefaultable_option(MADNESS_BUILD_LIBRARIES_ONLY "Build only MADNESS libraries" OFF)
if (NOT MADNESS_BUILD_LIBRARIES_ONLY)
redefaultable_option(MADNESS_BUILD_MADWORLD_ONLY "Build only MADWorld runtime (excluding BLAS/LAPACK interfaces)" OFF)
endif()
redefaultable_option(MADNESS_ENABLE_CEREAL "Support use of Cereal archives as backends for MADNESS serialization" OFF)

# Enable optional libraries ====================================================
Expand All @@ -107,8 +114,23 @@ option(ENABLE_LIBUNWIND
option(ENABLE_PAPI "Enables use of PAPI" OFF)
option(ENABLE_LIBXC "Enables use of the libxc library of density functionals" ON)
option(ENABLE_PCM "Enables use of the polarizable continuum model library" ON)
option(ENABLE_INTEGRATORXX "Enables use of the IntegratorXX for building DFT quadrature grids" ON)

####### preferred task backend
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
check_cxx_source_compiles(
"
namespace madness {
template <typename T>
void mTxmq(long dimi, long dimj, long dimk,
T* __restrict__ c, const T* a, const T* b, long ldb=-1);
template <>
void mTxmq(long dimi, long dimj, long dimk, double* __restrict__ c, const double* a, const double* b, long ldb);
}
int main() { double a[1], b[1], c[1]; madness::mTxmq(1,1,1,c,a,b,1); return 0; }
" HAVE_MTXMQ)

####### preferred task backend
set(MADNESS_TASK_VALID_BACKENDS Pthreads TBB PaRSEC)
set(MADNESS_TASK_BACKEND Pthreads CACHE STRING "The backend to use for dispatching tasks")
set_property(CACHE MADNESS_TASK_BACKEND PROPERTY STRINGS ${MADNESS_TASK_VALID_BACKENDS})
Expand Down Expand Up @@ -226,8 +248,7 @@ add_feature_info(DQ_PREBUF ENABLE_DQ_PREBUF
set(MADNESS_DQ_USE_PREBUF ${ENABLE_DQ_PREBUF} CACHE BOOL
"Enables thread-local buffer for task aggregation to reduce lock contention")

set(MADNESS_DQ_PREBUF_SIZE 20 CACHE STRING "Numberof entries in the thread-pool prebuffer for task aggregation to reduce lock contention")
#set(MADNESS_DQ_PREBUF_SZ ${MADNESS_DQ_PREBUF_SIZE} CACHE STRING "Numberof entries in the thread-pool prebuffer for task aggregation to reduce lock contention")
set(MADNESS_DQ_PREBUF_SIZE 20 CACHE STRING "Number of entries in the thread-pool prebuffer for task aggregation to reduce lock contention")

option(ENABLE_BSEND_ACKS
"Use MPI Send instead of MPI Bsend for huge message acknowledgements" ON)
Expand All @@ -247,6 +268,12 @@ add_feature_info(TASK_DEBUG_TRACE ENABLE_TASK_DEBUG_TRACE "supports debug trace
set(MADNESS_TASK_DEBUG_TRACE ${ENABLE_TASK_DEBUG_TRACE} CACHE BOOL
"Enable task debug tracing.")

option(ENABLE_WORLDOBJECT_FUTURE_TRACE
"Enable tracing of futures assicuated with WorldObjects." OFF)
add_feature_info(WORLDOBJECT_FUTURE_TRACE ENABLE_WORLDOBJECT_FUTURE_TRACE "supports tracing of futures associated with WorldObjects")
set(MADNESS_WORLDOBJECT_FUTURE_TRACE ${ENABLE_WORLDOBJECT_FUTURE_TRACE} CACHE BOOL
"Enable tracing of futures assicuated with WorldObjects.")

set(FORTRAN_INTEGER_SIZE 4 CACHE STRING "The fortran integer size (4 or 8 bytes) used for BLAS and LAPACK function calls")
if(NOT (FORTRAN_INTEGER_SIZE EQUAL 4 OR FORTRAN_INTEGER_SIZE EQUAL 8))
message(FATAL_ERROR "Incorrect fortran integer size '${FORTRAN_INTEGER_SIZE}'\n"
Expand Down Expand Up @@ -351,7 +378,7 @@ if (NOT DEFINED MADNESS_CONFIGURATION_DATE)
set(MADNESS_CONFIGURATION_DATE "${madness_configuration_date}" CACHE INTERNAL "")
endif (NOT DEFINED MADNESS_CONFIGURATION_DATE)

set(MAD_BIND_DEFAULT "-1 -1 -1" CACHE STRING "The default binding for threads")
set(MAD_BIND_DEFAULT "OFF" CACHE STRING "The default binding for threads")

# Check if the target platform is CRAY XE
check_cxx_source_compiles(
Expand Down Expand Up @@ -640,11 +667,12 @@ include(external/gperftools.cmake)
include(external/tbb.cmake)
include(external/parsec.cmake)
include(external/boost.cmake)
if (NOT MADNESS_BUILD_MADWORLD_ONLY)
if (NOT MADNESS_BUILD_MADWORLD_ONLY OR MADNESS_BUILD_LIBRARIES_ONLY)
include(external/lapack.cmake)
include(external/libxc.cmake)
include(external/pcm.cmake)
endif (NOT MADNESS_BUILD_MADWORLD_ONLY)
include(external/integratorxx.cmake)
endif ()

if (DEFINED ELEMENTAL_TAG)
include(external/elemental.cmake)
Expand All @@ -656,7 +684,7 @@ endif (DEFINED ELEMENTAL_TAG)
add_custom_target(everything)
add_dependencies(everything madness)

if(NOT MADNESS_BUILD_MADWORLD_ONLY AND LAPACK_FOUND)
if(NOT (MADNESS_BUILD_MADWORLD_ONLY OR MADNESS_BUILD_LIBRARIES_ONLY) AND LAPACK_FOUND)
add_custom_target_subproject(madness numerical-examples)
add_custom_target_subproject(madness applications)
endif()
Expand Down Expand Up @@ -728,13 +756,6 @@ install(FILES
DESTINATION "${MADNESS_INSTALL_CMAKEDIR}/modules"
COMPONENT madness-config)

# sample CMakeLists.txt
configure_file(
${PROJECT_SOURCE_DIR}/doc/devsamp/CMakeLists.txt.sample.in
${PROJECT_BINARY_DIR}/doc/devsamp/CMakeLists.txt.sample
@ONLY
)

# Create the version file
write_basic_package_version_file(madness-config-version.cmake
VERSION ${MADNESS_VERSION} COMPATIBILITY AnyNewerVersion)
Expand Down
16 changes: 15 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ The following CMake cache variables turn features on and off.
otherwise the default is OFF.
* MADNESS_BUILD_MADWORLD_ONLY --- whether to build the MADNESS runtime only; if `ON`, discovery of BLAS/LAPACK
and building of numerical components and applications will be disabled [default=`OFF`]
* MADNESS_BUILD_LIBRARIES_ONLY --- whether to build the MADNESS libraries only; if `ON`,
building of numerical components and applications will be disabled and
the value of `MADNESS_BUILD_MADWORLD_ONLY` ignored [default=`OFF`]

## External libraries

Expand Down Expand Up @@ -198,6 +201,17 @@ If GPERFTOOLS_ROOT_DIR is not given, it will be set to the value of the GPERFTOO

If LIBUNWIND_DIR is not given, it will be set to the value of the LIBUNWIND_DIR environment variable if it is set.

### IntegratorXX for numerical integration via DFT grids
* ENABLE_INTEGRATORXX --- Enables use of IntegratorXX
* INTEGRATORXX_ROOT_DIR --- The install prefix for IntegratorXX
* INTEGRATORXX_INCLUDE_DIR --- The path to the IntegratorXX include directory (should be added automatically when the correct PCM_ROOT_DIR is given)

IntegratorXX is a library for numerical integration via DFT grids. It is used in the MP3 code of Madness for
generating low-rank representations of 6D functions.
If IntegratorXX absent, a Gaussian-distributed random grid will be used, leading to slightly varying results in
different MP3 runs.


### Polarizable Conitinuum Solver (PCM):

* ENABLE_PCM --- Enables use of PCM
Expand All @@ -211,7 +225,7 @@ madness/external/pcm.cmake
madness/modules/FindPCM.cmake
madness/src/apps/chem/CMakeLists.txt

3## Performance Application Programming Interface (PAPI):
### Performance Application Programming Interface (PAPI):

* ENABLE_PAPI --- Enables use of PAPI [default=OFF]
* PAPI_ROOT_DIR --- The install prefix for PAPI.
Expand Down
8 changes: 8 additions & 0 deletions cmake/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#endif

/* Define MADNESS has access to the library. */
#cmakedefine HAVE_MTXMQ 1
#cmakedefine HAVE_ACML 1
#cmakedefine HAVE_INTEL_TBB 1
#cmakedefine MADNESS_CAN_USE_TBB_PRIORITY 1
Expand All @@ -57,6 +58,7 @@
#cmakedefine HAVE_PAPI 1
#cmakedefine MADNESS_HAS_PCM 1
#cmakedefine MADNESS_HAS_LIBXC 1
#cmakedefine MADNESS_HAS_INTEGRATORXX 1
#cmakedefine MADNESS_HAS_BOOST 1
#cmakedefine MADNESS_HAS_ELEMENTAL 1
#cmakedefine MADNESS_HAS_ELEMENTAL_EMBEDDED 1
Expand Down Expand Up @@ -100,6 +102,9 @@
#cmakedefine MADNESS_ASSERTIONS_DISABLE 1
#cmakedefine MADNESS_ASSERTIONS_THROW 1

/* The default binding for threads */
#define MADNESS_TASK_BACKEND "@MADNESS_TASK_BACKEND@"

/* Thread-safety level requested from MPI by MADNESS */
#define MADNESS_MPI_THREAD_LEVEL @MADNESS_MPI_THREAD_LEVEL@
#cmakedefine STUBOUTMPI 1
Expand All @@ -126,6 +131,9 @@
#cmakedefine MADNESS_DQ_USE_PREBUF 1
#cmakedefine MADNESS_DQ_PREBUF_SIZE @MADNESS_DQ_PREBUF_SIZE@
#cmakedefine MADNESS_ASSUMES_ASLR_DISABLED 1
#cmakedefine MADNESS_WORLDOBJECT_FUTURE_TRACE 1
#cmakedefine MADNESS_WORLDOBJECT_FUTURE_TRACE_WORLD_ID @MADNESS_WORLDOBJECT_FUTURE_TRACE_WORLD_ID@
#cmakedefine MADNESS_WORLDOBJECT_FUTURE_TRACE_MAX_NOBJECTS @MADNESS_WORLDOBJECT_FUTURE_TRACE_MAX_NOBJECTS@

/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
Expand Down
Loading

0 comments on commit 6edeab2

Please sign in to comment.