diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000000..d6370b7f304 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,148 @@ +# Generated from CLion Inspection settings +--- +Checks: '-*, +bugprone-argument-comment, +bugprone-assert-side-effect, +bugprone-bad-signal-to-kill-thread, +bugprone-branch-clone, +bugprone-copy-constructor-init, +bugprone-dangling-handle, +bugprone-dynamic-static-initializers, +bugprone-fold-init-type, +bugprone-forward-declaration-namespace, +bugprone-forwarding-reference-overload, +bugprone-inaccurate-erase, +bugprone-incorrect-roundings, +bugprone-integer-division, +bugprone-lambda-function-name, +bugprone-macro-parentheses, +bugprone-macro-repeated-side-effects, +bugprone-misplaced-operator-in-strlen-in-alloc, +bugprone-misplaced-pointer-arithmetic-in-alloc, +bugprone-misplaced-widening-cast, +bugprone-move-forwarding-reference, +bugprone-multiple-statement-macro, +bugprone-no-escape, +bugprone-not-null-terminated-result, +bugprone-parent-virtual-call, +bugprone-posix-return, +bugprone-reserved-identifier, +bugprone-sizeof-container, +bugprone-sizeof-expression, +bugprone-spuriously-wake-up-functions, +bugprone-string-constructor, +bugprone-string-integer-assignment, +bugprone-string-literal-with-embedded-nul, +bugprone-suspicious-enum-usage, +bugprone-suspicious-include, +bugprone-suspicious-memset-usage, +bugprone-suspicious-missing-comma, +bugprone-suspicious-semicolon, +bugprone-suspicious-string-compare, +bugprone-suspicious-memory-comparison, +bugprone-suspicious-realloc-usage, +bugprone-swapped-arguments, +bugprone-terminating-continue, +bugprone-throw-keyword-missing, +bugprone-too-small-loop-variable, +bugprone-undefined-memory-manipulation, +bugprone-undelegated-constructor, +bugprone-unhandled-self-assignment, +bugprone-unused-raii, +bugprone-unused-return-value, +bugprone-use-after-move, +bugprone-virtual-near-miss, +cert-dcl21-cpp, +cert-dcl58-cpp, +cert-err34-c, +cert-err52-cpp, +cert-err60-cpp, +cert-flp30-c, +cert-msc50-cpp, +cert-msc51-cpp, +cert-str34-c, +cppcoreguidelines-interfaces-global-init, +cppcoreguidelines-narrowing-conversions, +cppcoreguidelines-pro-type-member-init, +cppcoreguidelines-pro-type-static-cast-downcast, +cppcoreguidelines-slicing, +google-default-arguments, +google-explicit-constructor, +google-runtime-operator, +hicpp-exception-baseclass, +hicpp-multiway-paths-covered, +misc-misplaced-const, +misc-new-delete-overloads, +misc-no-recursion, +misc-non-copyable-objects, +misc-throw-by-value-catch-by-reference, +misc-unconventional-assign-operator, +misc-uniqueptr-reset-release, +modernize-avoid-bind, +modernize-concat-nested-namespaces, +modernize-deprecated-headers, +modernize-deprecated-ios-base-aliases, +modernize-loop-convert, +modernize-make-shared, +modernize-make-unique, +modernize-pass-by-value, +modernize-raw-string-literal, +modernize-redundant-void-arg, +modernize-replace-auto-ptr, +modernize-replace-disallow-copy-and-assign-macro, +modernize-replace-random-shuffle, +modernize-return-braced-init-list, +modernize-shrink-to-fit, +modernize-unary-static-assert, +modernize-use-auto, +modernize-use-bool-literals, +modernize-use-emplace, +modernize-use-equals-default, +modernize-use-equals-delete, +modernize-use-nodiscard, +modernize-use-noexcept, +modernize-use-nullptr, +modernize-use-override, +modernize-use-transparent-functors, +modernize-use-uncaught-exceptions, +mpi-buffer-deref, +mpi-type-mismatch, +openmp-use-default-none, +performance-faster-string-find, +performance-for-range-copy, +performance-implicit-conversion-in-loop, +performance-inefficient-algorithm, +performance-inefficient-string-concatenation, +performance-inefficient-vector-operation, +performance-move-const-arg, +performance-move-constructor-init, +performance-no-automatic-move, +performance-noexcept-move-constructor, +performance-trivially-destructible, +performance-type-promotion-in-math-fn, +performance-unnecessary-copy-initialization, +performance-unnecessary-value-param, +portability-simd-intrinsics, +readability-avoid-const-params-in-decls, +readability-const-return-type, +readability-container-size-empty, +readability-convert-member-functions-to-static, +readability-delete-null-pointer, +readability-deleted-default, +readability-inconsistent-declaration-parameter-name, +readability-make-member-function-const, +readability-misleading-indentation, +readability-misplaced-array-index, +readability-non-const-parameter, +readability-redundant-control-flow, +readability-redundant-declaration, +readability-redundant-function-ptr-dereference, +readability-redundant-smartptr-get, +readability-redundant-string-cstr, +readability-redundant-string-init, +readability-simplify-subscript-expr, +readability-static-accessed-through-instance, +readability-static-definition-in-anonymous-namespace, +readability-string-compare, +readability-uniqueptr-delete-release, +readability-use-anyofallof' \ No newline at end of file diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index efa4f094dc6..e8543aedef5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,7 +14,7 @@ jobs: matrix: build_type : [ Release, Debug ] os : [ macos-latest, ubuntu-20.04 ] - task_backend : [Pthreads, TBB, PaRSEC] + task_backend : [Threads, OneTBB, PaRSEC] # OneTBB and LegacyTBB control which version of TBB to install include: - os: ubuntu-20.04 cxx: /usr/bin/g++-9 @@ -38,8 +38,7 @@ jobs: -DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' -DBUILD_TESTING=ON -DMADNESS_ENABLE_CEREAL=ON - -DMADNESS_TASK_BACKEND=${{ matrix.task_backend }} - -DMADNESS_BUILD_MADWORLD_ONLY=${{ matrix.task_backend != 'Pthreads' }} + -DMADNESS_BUILD_MADWORLD_ONLY=${{ matrix.task_backend != 'Threads' }} steps: - uses: actions/checkout@v2 @@ -49,21 +48,48 @@ jobs: # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory ${{github.workspace}}/build + - name: Process task_backend + run: | + if [ "X${{ matrix.task_backend }}" = "XLegacyTBB" ]; then + echo "TASK_BACKEND=TBB" >> $GITHUB_ENV + fi + if [ "X${{ matrix.task_backend }}" = "XOneTBB" ]; then + echo "TASK_BACKEND=TBB" >> $GITHUB_ENV + fi + if [ "X${{ matrix.task_backend }}" = "XThreads" ]; then + echo "TASK_BACKEND=Pthreads" >> $GITHUB_ENV + fi + if [ "X${{ matrix.task_backend }}" = "XPaRSEC" ]; then + echo "TASK_BACKEND=PaRSEC" >> $GITHUB_ENV + fi + - name: Install prerequisite MacOS packages if: ${{ matrix.os == 'macos-latest' }} run: | - brew install ninja gcc@10 boost eigen open-mpi bison tbb@2020 ccache - if [ "X${{ matrix.build_type }}" = "XDebug" ]; then - brew install cereal + brew install ninja gcc@10 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 + fi + if [ "X${{ matrix.task_backend }}" = "XOneTBB" ]; then + brew install tbb + echo "TBBROOT=/usr/local/opt/tbb" >> $GITHUB_ENV fi - echo "TBBROOT=/usr/local/opt/tbb@2020" >> $GITHUB_ENV - echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH - name: Install prerequisites Ubuntu packages if: ${{ matrix.os == 'ubuntu-20.04' }} run: | sudo apt-get update - sudo apt-get install ninja-build g++-9 liblapack-dev libboost-dev libboost-serialization-dev libeigen3-dev openmpi-bin libopenmpi-dev libtbb-dev ccache + sudo apt-get install ninja-build g++-9 liblapack-dev libboost-dev libboost-serialization-dev libeigen3-dev openmpi-bin libopenmpi-dev ccache + if [ "X${{ matrix.task_backend }}" = "XOneTBB" ]; then + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -O - | sudo apt-key add - + sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" + sudo apt-get install intel-oneapi-tbb-devel + echo "TBBROOT=/opt/intel/oneapi/tbb/latest" >> $GITHUB_ENV + fi + if [ "X${{ matrix.task_backend }}" = "XLegacyTBB" ]; then + sudo apt-get install libtbb-dev + fi if [ "X${{ matrix.build_type }}" = "XDebug" ]; then sudo apt-get install libcereal-dev fi @@ -91,7 +117,7 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE $BUILD_CONFIG + run: cmake $GITHUB_WORKSPACE $BUILD_CONFIG -DMADNESS_TASK_BACKEND=$TASK_BACKEND - name: Build working-directory: ${{github.workspace}}/build @@ -102,4 +128,4 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build shell: bash - run: cmake --build . --target check-madness + run: cmake --build . --target check-short-madness diff --git a/.github/workflows/make_doxygen.yml b/.github/workflows/make_doxygen.yml new file mode 100644 index 00000000000..f7ae299847e --- /dev/null +++ b/.github/workflows/make_doxygen.yml @@ -0,0 +1,60 @@ +name: publish-doxygen + +# Trigger this when a pull request is merged (which implies pushing to master). +on: + push: + branches: + - master + +jobs: + doxygen: + runs-on: ubuntu-latest + + steps: + + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Create clean gh-pages branch + run: git checkout -b gh-pages + + - name: Install prerequisites Ubuntu packages + run: | + sudo apt-get update + sudo apt-get install ninja-build g++-9 liblapack-dev openmpi-bin libopenmpi-dev libtbb-dev doxygen doxygen-latex graphviz + + - name: configure + shell: bash + working-directory: ${{github.workspace}} + run: | + cmake -E make_directory ${{github.workspace}}/build + cd build && cmake $GITHUB_WORKSPACE + + - name: build + shell: bash + working-directory: ${{github.workspace}}/build + run: + cd ${{github.workspace}}/build && make docs + + - name: Move generated autodocs to target directory + working-directory: ${{github.workspace}}/build + run: mv doc/html ../api-doc + + - name: Add generated autodocs to Git repo in the gh-pages branch + working-directory: ${{github.workspace}} + run: | + git config --global user.email "florian.bischoff@hu-berlin.de" + git config --global user.name "$GITHUB_WORKFLOW GitHub action" + git add api-doc + git commit -am "Generated API doc" + + - name: Publish autodocs as GitHub pages + run: git push -f origin gh-pages:gh-pages + + - name: Result URLs + run: | + REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 1) + REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2) + echo "Formatted API docs: https://$REPO_OWNER.github.io/$REPO_NAME/api-doc" + echo "" + echo "GitHub pages branch: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/tree/gh-pages" diff --git a/.gitignore b/.gitignore index 10988c085e8..ec171f19b2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ build* +cmake-build-debug* +.history* # Compiled Object files *.slo @@ -59,3 +61,7 @@ Makefile-prog.in compile_commands.json *.idx .clang-format +/cmake-build-debug/.ninja_deps +compile_commands +.history/src/apps/molresponse/global_functions_20230530165227.cc +.history/src/apps/molresponse/global_functions_20230530165428.cc diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000000..d913b8a085c --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,30 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-20.04 + tools: + python: "3.9" + # You can also specify other tool versions: + # nodejs: "16" + # rust: "1.55" + # golang: "1.17" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: doc/conf.py + +# If using Sphinx, optionally build your docs in additional formats such as PDF +# formats: +# - pdf + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: doc/requirements.txt + diff --git a/CMakeLists.txt b/CMakeLists.txt index ff91685b299..dc0a37ac066 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,13 @@ cmake_minimum_required (VERSION 3.11.0) -project(MADNESS CXX C ASM) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# 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") +endif() # Set MADNESS version set(MADNESS_MAJOR_VERSION 0) @@ -7,6 +15,14 @@ set(MADNESS_MINOR_VERSION 10) set(MADNESS_MICRO_VERSION 1) set(MADNESS_VERSION "${MADNESS_MAJOR_VERSION}.${MADNESS_MINOR_VERSION}.${MADNESS_MICRO_VERSION}") +# Declare ourselves ============================================================ + +project(MADNESS + VERSION ${MADNESS_VERSION} + DESCRIPTION "MADNESS: fast, adaptive multiresolution integrodifferential calculus in 1..6 dimensions" + LANGUAGES CXX C ASM + HOMEPAGE_URL "https://madness.readthedocs.io/") + # Add source directory ========================================================= add_definitions(-DMAD_ROOT_DIR="${PROJECT_SOURCE_DIR}") @@ -25,6 +41,7 @@ include(CMakeDependentOption) include(AddMADLibrary) include(AddMADExecutable) include(AddUnittests) +include(AddScriptedTests) include(CMakePackageConfigHelpers) include(CopyTargetProperties) include(FeatureSummary) @@ -79,7 +96,8 @@ include(external/versions.cmake) # failure to find the library is an error. option(ENABLE_MPI "Enable Message Passing Interface (MPI) Library" ON) -redefaultable_option(ENABLE_MKL "Search for Intel Math Kernel Library (MKL) for BLAS and LAPACK support" ON) +#redefaultable_option(ENABLE_MKL "Search for Intel Math Kernel Library (MKL) for BLAS and LAPACK support" ON) +option(ENABLE_MKL "Search for Intel Math Kernel Library (MKL) for BLAS and LAPACK support" ON) option(ENABLE_ACML "Search for AMD Core Math Library (ACML) for BLAS and LAPACK support" ON) option(ENABLE_TCMALLOC_MINIMAL "Enable use of tcmalloc_minimal library from Google Performance Tools (gperftools)" OFF) option(ENABLE_GPERFTOOLS "Enable use of full Google Performance Tools (gperftools)" OFF) @@ -146,6 +164,8 @@ option(ENABLE_BOOST "Enable C++ Boost Libraries" OFF) option(ENABLE_GENTENSOR "Enable generic tensor support" OFF) add_feature_info(GENTENSOR ENABLE_GENTENSOR "enables use of MRA Function compression that allows computing in 6 dimensions") +set(MADNESS_USE_GENTENSOR ${ENABLE_GENTENSOR} CACHE BOOL + "enables use of MRA Function compression that allows computing in 6 dimensions") if(ENABLE_GENTENSOR) add_definitions(-DUSE_GENTENSOR) @@ -605,9 +625,10 @@ endif() # ccache for caching builds find_program(CCACHE ccache) if(CCACHE) - message (STATUS "Found ccache: ${CCACHE}") - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) + mark_as_advanced(CCACHE) + message (STATUS "Found ccache: ${CCACHE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C++") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C") endif(CCACHE) # Check for external dependencies ============================================== @@ -652,26 +673,14 @@ include(CTest) if(BUILD_TESTING) set(MADNESS_HAS_GOOGLE_TEST 1) add_custom_target_subproject(madness unittests) + add_custom_target_subproject(madness scripted_tests) add_custom_target_subproject(madness check COMMAND ${CMAKE_CTEST_COMMAND} -V -R "madness/test/" USES_TERMINAL) # to be GNU compatible + add_custom_target_subproject(madness check-short COMMAND ${CMAKE_CTEST_COMMAND} -L \"short|medium\" -V -R "madness/test/" USES_TERMINAL) # to be GNU compatible add_dependencies(everything unittests) endif() add_subdirectory(src) add_subdirectory(doc) -# Get the git revision tag information ========================================= - -if(EXISTS ${PROJECT_SOURCE_DIR}/.git) - find_package(Git REQUIRED) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse -q HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE MADNESS_REVISION ) - string(REGEX MATCH "[0-9a-f]*" - MADNESS_REVISION "${MADNESS_REVISION}") -else() - set(MADNESS_REVISION "unknown") -endif() - # Generate configure files ===================================================== configure_file( diff --git a/INSTALL b/INSTALL.md similarity index 56% rename from INSTALL rename to INSTALL.md index e123fcf2dfa..3733af3e53e 100644 --- a/INSTALL +++ b/INSTALL.md @@ -1,49 +1,65 @@ -# Introduction +## Introduction -When configuring MADNESS with CMake, you must specify cache variables and the -path to the MADNESS source directory. To specify a cache variable prefix it with -the -D command line flag and set it equal to the desired value (see below for a -valid cache variables). For example, to specify the C/C++ compilers +Linux and MacOS are supported with x86, Arm64, and IBM Power processors. GPUs are not yet utilized. - $ cmake -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++ \ - /path/to/madness/source +MADNESS uses CMake to configure the build. Assuming that necessary prerequisites (below) are installed on your system in default locations and the source has been downloaded into the directory `/path/to/madness/source`, you can make a directory (outside the source tree) to build in and configure the build as follows +``` +mkdir build +cd build +cmake /path/to/madness/source +make applications +``` +The default make target builds only the numerical library and underlying runtime. To build applications (e.g., `moldft`, `nemo`) specify either `applications` (for all of them) or the name of the desired application on the make command. The target `everything` does what you expect. You can run executables and use libraries from the build directory, but to install into the default location (`/usr`) use `make install` (after first building the applications). -The resulting build directory will be the current working directory specified -where the CMake command it run. It is recommended that you configure and build -MADNESS outside the source tree. Boolean values for cache variables are -considered true if the constant is 1, ON, YES, TRUE, Y, or a non-zero number; or -false if the constant is 0, OFF, NO, FALSE, N, or IGNORE. +If required libraries are not in default locations or if you wish to override defaults, you may have to set CMake cache variables as described below. For instance, to build a debug version, without MPI, and with installation in `/home/me/madinstall` +``` +cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_MPI=OFF -DCMAKE_INSTALL_PREFIX=/home/me/madinstall /path/to/madness/source +make applications +make install +``` -# Toolchain files -MADNESS provides toolchain files for select systems. It is recommended that you -use these files if provided as they contain the platform specific settings -neccessary to build on the given platform. The toolchain files are included wiht -the MADNESS source in the cmake/toolchains directory. +Boolean values for cache variables (specified to CMake using the `-DVARIABLE_NAME` notation in the example above) are +considered true if the constant is 1, ON, YES, TRUE, Y, or a non-zero number; or false if the constant is 0, OFF, NO, FALSE, N, or IGNORE. -* CMAKE_TOOLCHAIN_FILE --- Specifies the path (including the file name) to the - toolchain file. +## Prerequisites -For example, to specify the toolchain file for Mira: +Fast BLAS and linear algebra libraries are essential. These must be sequential (single thread) implementations since MADNESS uses tasks/threads for parallelism and invokes the BLAS within a single-threaded task. On X86, we recommend the free [Intel MKL library](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html#gs.8bsxug), which is auto detected on all platforms if the environment variable `MKLROOT` is set. On MacOS, the Apple [Accelerate](https://developer.apple.com/documentation/accelerate) framework (installed as part of [Xcode](https://developer.apple.com/xcode/)) is also autodetected. AMD ACML has not been tested in a while but can be enabled with the CMake variables below. Other libraries need to have their link (and possibly also header) paths and flags provided in the CMake variables for the compiler and linker. On ARM, we recommend the ARM performance library available with their optimized LLVM compiler and enabled with the `-armpl`` compiler+linker flag. The OpenBLAS libary for ARM (not on x86) had a major peformance problem when we last tested it in circa 2020 due to a mutex around a memory block shared by all threads (this issue was reported and might be fixed by now). - $ cmake -D CMAKE_TOOLCHAIN_FILE=/path/to/madness/source/cmake/toolchains/mira-gcc-essl.cmake \ - /path/to/madness/source +An MPI library is required by default, and should be autodected primarily by looking for the `mpicxx` command to compile C++ code with MPI. If you wish to overide this, use the appropriate cmake or environment variables (below). You can also disable use of MPI using `-DENABLE_MPI=OFF` --- in this case you can still use all cores within a shared memory computer. + +MADNESS will autodetect the [Intel TBB library](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html#gs.8byhgg), which is available for free from Intel or via standard Linux package managers (even on ARM). TBB provides a fast task pool. If this is not detected, MADNESS will employ its own task pool. [PaRSEC](https://icl.utk.edu/parsec/) can also be used (see variables below) but is not recommended unless you are using MADNESS with the [Template Task Graph](https://github.com/TESSEorg/ttg). + +### Minimal Ubuntu packages + +If you are using a different distribution, just change the name of the command to install packages. + +From a vanilla desktop install of Ubuntu (tested with 23.0.4) +``` + sudo apt install build-essential cmake gcc g++ git intel-mkl mpich +``` +If you want to build the documentation then also +``` + sudo apt install doxygen graphviz texlive +``` + +### Minimal MacOS packages -Additional cache variables may be specified. +To be written -# Compiler variables + +The below summarizes some of the most useful CMake variables. + +## Compiler variables The following CMake cache variables are used to specify the compilers, compiler flags, and linker flags. * CMAKE_C_COMPILER --- C compiler [default=search] * CMAKE_CXX_COMPILER --- C++ compiler [default=search] -* CMAKE_ASM_COMPILER --- Assembly compiler (set only if required) - [default=search] -* MPI_CXX_COMPILER --- MPI C++ compiler wrapper (required if ENABLE_MPI=ON) - [default=search] -* MPI_C_COMPILER --- MPI C compiler wrapper (required if ENABLE_MPI=ON) - [default=search] +* CMAKE_ASM_COMPILER --- Assembly compiler [default=search] +* MPI_CXX_COMPILER --- MPI C++ compiler wrapper [default=search] +* MPI_C_COMPILER --- MPI C compiler wrapper [default=search] You can specify compile flags with the following variables. These cache variables are optional, and it is typically not necessary to specify these variables. @@ -56,10 +72,11 @@ are optional, and it is typically not necessary to specify these variables. * CMAKE_SHARED_LINKER_FLAGS --- Linker flags to be used to create shared libraries. -# Build options +## Build options -The following CMake cache variables turn MADNESS features on and off. +The following CMake cache variables turn features on and off. +* CMAKE_BUILD_TYPE --- Debug or Release * ENABLE_GENTENSOR --- Enable generic tensors; only useful if need compressed 6-d tensors, e.g. in MP2 [default=OFF] * ENABLE_TASK_PROFILER - Enable task profiler that collects per-task start and @@ -88,40 +105,7 @@ The following CMake cache variables turn MADNESS features on and 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 Runtime and the Address Space Layout Randomization (ASLR) - -ASLR is a standard technique for increasing platform security implemented by the OS kernel and/or -the dynamic linker. By randomizing both where the shared libraries are loaded as well as (when enabled) the absolute -position of the executable in memory (such executables are known as position-independent executables). Until recently -MADNESS could not be used on platforms with ASLR if ran with more than 1 MPI rank; -if properly configured and built it can now be used on ASLR platforms. Use the following -variables to control the ASLR-related aspects of MADNESS runtime. - -* MADNESS_ASSUMES_ASLR_DISABLED --- MADNESS runtime will assume that the Address Space Layout Randomization (ASLR) is off. - By default MADNESS_ASSUMES_ASLR_DISABLED is set to OFF (i.e. MADNESS will assume that ASLR is enabled); - this will cause all libraries by default to be static (BUILD_SHARED_LIBS=OFF) - and compiled as position-independent code (CMAKE_POSITION_INDEPENDENT_CODE=ON). - This will also enable a runtime check for ASLR. -* CMAKE_POSITION_INDEPENDENT_CODE --- This standard CMake variable controls whether targets are compiled by default - as position-independent code or not. If BUILD_SHARED_LIBS=OFF need to set this to ON if want to use the MADNESS - libraries to build shared libraries or position-independent executables. - -To make things more concrete, consider the following 2 scenarios: -* Platform with ASLR disabled --- set MADNESS_ASSUMES_ASLR_DISABLED=ON to set defaults correctly and enable the ASLR check. - BUILD_SHARED_LIBS can be set to ON (to produce shared libraries, e.g. to save space) or to OFF to - produce static libraries. If the static libraries will be linked into shared libraries set - CMAKE_POSITION_INDEPENDENT_CODE=ON, otherwise CMAKE_POSITION_INDEPENDENT_CODE will be set to OFF for maximum efficiency - of function calls. -* Platform with ASLR enabled --- this is the default. Setting BUILD_SHARED_LIBS=ON in this scenario will produce - executables that can only be safely used with 1 MPI rank, thus BUILD_SHARED_LIBS will be defaulted to OFF (i.e. - MADNESS libraries will be build as static libraries). CMAKE_POSITION_INDEPENDENT_CODE is by default set to ON, - thus MADNESS libraries can be linked into position-independent executables safely. MADNESS libraries can also be - linked into a shared library, provided that *ALL* code using MADNESS is part of the *SAME* shared library. - E.g. to link MADNESS into a Python module compile MADNESS and all libraries using MADNESS as static libraries - (with CMAKE_POSITION_INDEPENDENT_CODE=ON) and link them all together into a single module - (same logic applies to shared libraries using MADNESS). - -# External libraries +## External libraries The following CMake cache variables enable the use of external libraries with MADNESS. If the WITH_* variable is set to "ON" by default, failure to find the @@ -153,20 +137,32 @@ search for specific dependencies. If the external library is not found in these given paths, or if the paths are not given, CMake will search the paths in CMAKE_PREFIX_PATH as well as other system paths. -# Intel Threading Building Blocks (TBB): +### Library of Exchange-Correlation DFT functionals (LIBXC): -* ENABLE_TBB --- Enables use of Intel TBB as the task scheduler [default=OFF] -* TBB_ROOT_DIR --- The install prefix for TBB -* TBB_INCLUDE_DIR --- The path to the TBB include directory -* TBB_LIBRARY --- The path to the TBB library directory. By default, the library +* ENABLE_LIBXC --- Enables use of the libxc library of density functionals. + [default=ON] +* LIBXC_ROOT_DIR --- The install prefix for LIBXC. +* LIBXC_INCLUDE_DIR --- The path to the LIBXC include directory. +* LIBXC_LIBRARY --- The path to the LIBXC library. + +E.g., +``` +cmake -DENABLE_LIBXC=ON -DLIBXC_LIBRARIES=/home/rjh/install/lib/libxc.a -DLIBXC_INCLUDE_DIRS=/home/rjh/install/include ../madness +``` + +### Intel Threading Building Blocks (TBB): + +* Define MADNESS_TASK_BACKEND=TBB --- this should auto detect TBB if it is installed in a standard location. If it is not, you'll have to also define + * TBB_ROOT_DIR --- The install prefix for TBB. If TBB_ROOT_DIR is not given, it will be set to the value of the TBBROOT environment variable if it is set. And if `cmake` still does not detect things you can set + * TBB_INCLUDE_DIR --- The path to the TBB include directory + * TBB_LIBRARY --- The path to the TBB library directory. By default, the library search path is ${TBB_ROOT_DIR}/(lib/intel64/gcc4.4|lib) on Linux and ${TBB_ROOT_DIR}/(lib/libc++|lib) on OS X, if TBB_ROOT_DIR is specified in the configure command. -* MADNESS_EXPLOIT_TBB_PRIORITY --- If ON, MADNESS will try to use Intel TBB task priorities [default=OFF] + * Optionally, MADNESS_EXPLOIT_TBB_PRIORITY --- If ON, MADNESS will try to use Intel TBB task priorities [default=OFF] -If TBB_ROOT_DIR is not given, it will be set to the value of the TBBROOT environment variable if it is set. -# Intel Math Kernel Library (MKL): +### Intel Math Kernel Library (MKL): * ENABLE_MKL --- Search for Intel MKL for BLAS and LAPACK support [default=ON] * MKL_ROOT_DIR --- The install prefix for MKL. @@ -174,14 +170,16 @@ If TBB_ROOT_DIR is not given, it will be set to the value of the TBBROOT environ If MKL_ROOT_DIR is not given, it will be set to the value of the MKLROOT environment variable if it is set. -# AMD Core Math Library (ACML): +### AMD Core Math Library (ACML): + +*This is out of date since ACML is now AOCL.* * ENABLE_ACML --- Search for AMD math library for BLAS and LAPACK support [default=ON] * ACML_ROOT_DIR --- The install prefix for ACML. * ACML_LIBRARY --- The path to the ACML library directory. -# Google Performance Tools (Gperftools): +### Google Performance Tools (Gperftools): * ENABLE_GPERFTOOLS --- Enable use of gperftools, including tcmalloc. [default=OFF] @@ -193,22 +191,14 @@ If MKL_ROOT_DIR is not given, it will be set to the value of the MKLROOT environ If GPERFTOOLS_ROOT_DIR is not given, it will be set to the value of the GPERFTOOLS_DIR environment variable if it is set. -# Libunwind: +### Libunwind: * ENABLE_LIBUNWIND --- Force detection of gperftools [default=OFF, i.e. Libunwind will be searched for when needed] * LIBUNWIND_DIR --- The install prefix for Libunwind. If LIBUNWIND_DIR is not given, it will be set to the value of the LIBUNWIND_DIR environment variable if it is set. -# Library of Exchange-Correlation DFT functionals (LIBXC): - -* ENABLE_LIBXC --- Enables use of the libxc library of density functionals. - [default=ON] -* LIBXC_ROOT_DIR --- The install prefix for LIBXC. -* LIBXC_INCLUDE_DIR --- The path to the LIBXC include directory. -* LIBXC_LIBRARY --- The path to the LIBXC library directory. - -# Polarizable Conitinuum Solver (PCM): +### Polarizable Conitinuum Solver (PCM): * ENABLE_PCM --- Enables use of PCM * PCM_ROOT_DIR --- The install prefix for PCM @@ -221,15 +211,17 @@ madness/external/pcm.cmake madness/modules/FindPCM.cmake madness/src/apps/chem/CMakeLists.txt -# Performance Application Programming Interface (PAPI): +3## Performance Application Programming Interface (PAPI): * ENABLE_PAPI --- Enables use of PAPI [default=OFF] * PAPI_ROOT_DIR --- The install prefix for PAPI. * PAPI_INCLUDE_DIR --- The path to the PAPI include directory. * PAPI_LIBRARY --- The path to the PAPI library directory. -# Elemental parallel linear algebra library: +### Elemental parallel linear algebra library: +*This has not been tested in some time.* + Elemental provides optional distributed-memory linear algebra for some MADNESS application codes. MADNESS source includes (modified) Elemental v0.84, which has been validated to work with the few MADNESS apps that can use Elemental. You can instruct MADNESS to download and compile @@ -242,9 +234,69 @@ madness::initialize will call El::initialize() . MADNESS (numerical codes of MADNESS will not use Elemental). If not set, will use the included Elemental source. -# Parallel Runtime Scheduling and Execution Controller (PaRSEC): +### Parallel Runtime Scheduling and Execution Controller (PaRSEC): + +Recommended only for TTG development. * ENABLE_PARSEC --- Enables use of PaRSEC as the task scheduler [default=OFF]. The use of Intel TBB should be disabled to use PaRSEC. If ENABLE_PARSEC is set but PaRSEC is not found, it will be built from source. + +## MADNESS Runtime and the Address Space Layout Randomization (ASLR) + +If you can run with one process and are getting almost immediate segmentation violations with more processes, this might be the issue. + +ASLR (Linux relevant documentation [here](https://linux-audit.com/linux-aslr-and-kernelrandomize_va_space-setting/)) +is a standard technique for increasing platform security implemented by the OS kernel and/or +the dynamic linker. By randomizing both where the shared libraries are loaded as well as (when enabled) the absolute +position of the executable in memory (such executables are known as position-independent executables). Until recently +MADNESS could only be used with MPI on platforms with ASLR if built with static libraries (for MADNESS code; system and other libraries could still be shared). However, static libraries make it hard to integrate with Python and other frameworks that demand shared libraries. + +If properly configured and built, MADNESS can now be used on ASLR platforms using either static (the default and easiest) or shared libraries. Use the following variables to control the ASLR-related aspects of MADNESS runtime. + +* MADNESS_ASSUMES_ASLR_DISABLED --- MADNESS runtime will assume that the Address Space Layout Randomization (ASLR) is off. + By default MADNESS_ASSUMES_ASLR_DISABLED is set to OFF (i.e. MADNESS will assume that ASLR is enabled); + this will cause all libraries by default to be static (BUILD_SHARED_LIBS=OFF) + and compiled as position-independent code (CMAKE_POSITION_INDEPENDENT_CODE=ON). + This will also enable a runtime check for ASLR. +* CMAKE_POSITION_INDEPENDENT_CODE --- This standard CMake variable controls whether targets are compiled by default + as position-independent code or not. If BUILD_SHARED_LIBS=OFF need to set this to ON if want to use the MADNESS + libraries to build shared libraries or position-independent executables. + +To make things more concrete, consider the following 2 scenarios: +* Platform with ASLR disabled --- set MADNESS_ASSUMES_ASLR_DISABLED=ON to set defaults correctly and enable the ASLR check. + BUILD_SHARED_LIBS can be set to ON (to produce shared libraries, e.g. to save space) or to OFF to + produce static libraries. If the static libraries will be linked into shared libraries set + CMAKE_POSITION_INDEPENDENT_CODE=ON, otherwise CMAKE_POSITION_INDEPENDENT_CODE will be set to OFF for maximum efficiency + of function calls. +* Platform with ASLR enabled --- this is the default. Setting BUILD_SHARED_LIBS=ON in this scenario will produce + executables that can only be safely used with 1 MPI rank, thus BUILD_SHARED_LIBS will be defaulted to OFF (i.e. + MADNESS libraries will be build as static libraries). CMAKE_POSITION_INDEPENDENT_CODE is by default set to ON, + thus MADNESS libraries can be linked into position-independent executables safely. MADNESS libraries can also be + linked into a shared library and used with more than 1 MPI rank, provided that *ALL* code using MADNESS is part of the *SAME* shared library. + E.g. to link MADNESS into a Python module compile MADNESS and all libraries using MADNESS as shared libraries + (with CMAKE_POSITION_INDEPENDENT_CODE=ON) and link them all together into a single module. + +## Warning about fast memory allocators + +Summary: Only use fast memory allocators if you are using just 1 MPI process or have configured without MPI. + +Depending on the calculation and the number of threads being used, MADNESS can receive about a 10% or even more speedup from fast memory allocators such as tcmalloc, jemalloc, tbbmalloc, etc. However, these **do not work with MPI over InfiniBand** and probably most other transport layers. It can appear to work, and then fail with either wrong numbers or MPI errors. The reason is that IB requires that memory be pinned and hence MPI introduces its own memory allocator(s) to manage this. By overriding the allocator, you will break the guarantee that memory is pinned. + +## Toolchain files + +**Use of these files is now deprecated --- configuration should usually work without this.** However, they can be useful if all else fails or on "bleeding-edge" supercomputers with non-standard software environments. + +MADNESS provides toolchain files for select systems. They contain the platform specific settings +neccessary to build on the given platform. The toolchain files are included with +the MADNESS source in the cmake/toolchains directory. + +* CMAKE_TOOLCHAIN_FILE --- Specifies the path (including the file name) to the + toolchain file. + +For example, to specify the toolchain file for Mira: + + $ cmake -D CMAKE_TOOLCHAIN_FILE=/path/to/madness/source/cmake/toolchains/mira-gcc-essl.cmake \ + /path/to/madness/source + diff --git a/README.md b/README.md index 795f1328f1e..b4377ac956f 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,234 @@ -madness +# Fork Info + +This is a seaparate fork of madness. If you want to use madness as backend for [tequila](https://github/tequilahub) you are in the right place. +Just follow the installation instructions below. + +MADNESS ======= Multiresolution Adaptive Numerical Environment for Scientific Simulation # Summary -MADNESS provides a high-level environment for the solution of integral and differential equations in many dimensions using adaptive, fast methods with guaranteed precision based on multi-resolution analysis and novel separated representations. There are three main components to MADNESS. At the lowest level is a new petascale parallel programming environment that increases programmer productivity and code performance/scalability while maintaining backward compatibility with current programming tools such as MPI and Global Arrays. The numerical capabilities built upon the parallel tools provide a high-level environment for composing and solving numerical problems in many (1-6+) dimensions. Finally, built upon the numerical tools are new applications with initial focus upon chemistry, atomic and molecular physics, material science, and nuclear structure. +MADNESS provides a high-level environment for the solution of integral and differential equations in many dimensions using adaptive, fast methods with guaranteed precision based on multi-resolution analysis and novel separated representations. + +There are three main components to MADNESS. At the lowest level is a new petascale parallel programming environment that increases programmer productivity and code performance/scalability while maintaining backward compatibility with current programming tools such as MPI and Global Arrays. The numerical capabilities built upon the parallel tools provide a high-level environment for composing and solving numerical problems in many (1-6+) dimensions. + +Finally, built upon the numerical tools are new applications with initial focus upon chemistry, atomic and molecular physics, material science, and nuclear structure. + +User documentation can be found on [readthedocs](https://madness.readthedocs.io/en/latest/). -Please look in the [wiki](https://github.com/m-a-d-n-e-s-s/madness/wiki) for more information and project activity. +Developer documentation generated by doxygen can be found [here](https://m-a-d-n-e-s-s.github.io/madness/api-doc/). Here's a [video](http://www.youtube.com/watch?v=dBwWjmf5Tic) about MADNESS. +# Tequila Support + +This fork of madness holds the necessary structures to interface with [tequila](https://github.com/tequilahub). +Those part of the code are currently not merged into the main madness repository (but will be at some point). +Follow the next section to install madness. + +`tequila` needs to find the executable `$MAD_ROOT_DIR/src/apps/pno/pno_integrals`. +It can detect it automatically if you add the directory to your current `PATH` or if you export the `MAD_ROOT_DIR` variable: +```bash +export MAD_ROOT_DIR=$MAD_ROOT_DIR +``` + +`$MAD_ROOT_DIR` is the directory where madness was compiled. + +If you are using conda environments and follow the instructions below, the `MAD_ROOT_DIR` variable will automatically be exported in the environment you are using. + +# Install with conda +If you have `conda` available you can install this version of madness by executing the [`build.sh`](build.sh) script. +If you are on a Linux system this will also install the necessary compilers. +Fot Mac or Win you will need to install them yourself (you need at least GNU c++ compilers >7 and a suitable MPI compiler like MPICH). +Some notes on manual installation are listed below. + +```bash +# download or copy the build.sh script +# then run the following command to install +bash build.sh +``` +You can modify where you want the compiled madness code to be placed with the variable `MADNESS_BUILD`, e.g. +```bash +MADNESS_BUILD=~/mystuff/ bash build.sh +``` +In the same manner you can set different other variables (just check the content of [`build.sh`](build.sh)) + +# Install without conda + +In case you are not using conda environments, here is how you can install dependencies manually (might be necessary on some compute clusters). + +In order to get the most out of madness you should install intel-mkl and configure madness with it. +You can download and install it from the intel website, it is free. +Later down is a small recipe on how to install it on ubuntu or similar operating systems. +You furhtermore need a working MPI compiler (MPICH should do the job) and cmake. +To compile the pno_integrals executable that `tequila` needs, you furthermore need boost and numcpp. + +## MKL +```bash + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB + echo "trying to install mkl ..." + sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' + sudo apt-get update + sudo apt-get install -y intel-mkl-64bit-2020.1-102 +``` +This will install mkl into the directory: +`/opt/intel/compilers_and_libraries_2020.1.102/linux/mkl` +You can export that as MKLROOT, and cmake will be able to detect it later: +```bash +export MKLROOT=/opt/intel/compilers_and_libraries_2020.1.102/linux/mkl +``` +Alternatively you can pass the following to the cmake command: +`-D MKL_ROOT_DIR=/opt/intel/compilers_and_libraries_2020.1.102/linux/mkl` + +## MPICH +install with +```bash +sudo apt-get install -y mpich +``` +and cmake will detect it automatically. + +## MPICH on Clusters (no root rights) +Check if you can load an mpich module. +Alternative OpenMPI or IntelMPI might work. It depends on compiler version and which c++ compiler is used in the end. + +You can compile MPICH yourself with the following steps: +1. Get the sources and unpack them +```bash +cd $MPICHSOURCE +wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz +tar -xzf mpich-3.3.2.tar.gz +``` +2. Make sure you have gcc and g++ >= 7 (check if you can load modules) +3. Configure and install mpich, the `CC` and `CXX` statements ensure that the right compilers are used. $MPICH_ROOT_DIR is the directory where you want mpich to be installed (chose one, where you have write permissions!) +```bash +cd $MPICHSOURCE/mpich-3.3.2 +mkdir build +cd build +../configure CC=gcc CXX=g++ --prefix=$MPICH_ROOT_DIR +make +make install +``` +4. Make sure your OS finds mpich (you need to do this again, after every login; or add it to your .bashrc). `$PATH` is literally `$PATH` here (this adds the old content of PATH that they don't get lost). +```bash +export PATH=$MPICH_ROOT_DIR/bin/:$PATH +``` +5. Test if it worked. +```bash +# should result in $MPICH_ROOT_DIR/bin/mpicxx +which mpicxx +# should return the same as g++ --version +mpicxx --version +``` + +## cmake +```bash +pip install cmake +``` +or +```bash +sudo apt-get install -y cmake +``` + +## NumCPP +It is header only, you only need to get the code from github and remember where it is. +The path where the code is located will be refered to as `NUMCPPROOT` and `$NUMCPPROOT` will mean that this path has to be inserted in the command. +So when we write `$NUMCPPROOT` you will need to insert `/path/to/numcpp/sources/`. +The only thing left to do is get the sources: +`cd $NUMCPPROOT` +`git clone https://github.com/dpilger26/NumCpp.git` + +## Boost +Similar procedure as for NumCPP: You only need the headers here. +If you have boost installed madness might detect it if you add `-D ENABLE_BOOST=ON` to the cmake command. +Note that boost versions installed with `apt-get` are too old (need 1.68 or higher). +`cd $BOOSTROOT` +`wget https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2` +`tar --bzip2 -xf boost_1_73_0.tar.bz2` + +## Install Madness +We use the following directories: +`$MADSOURCE`: The directory with the madness source code +`$MAD_ROOT_DIR`: The directory with the compiled madness code +either export both variables, or replace them by the corresponding paths in the following. + +Get the sources (note that the `tequila` branch should be checked out, it is the default in this fork): +```bash +git clone https://github.com/kottmanj/madness.git $MADSOURCE +``` + +Configure +```bash +cd $MAD_ROOT_DIR +cmake -D ENABLE_MKL=ON -D CMAKE_CXX_FLAGS='-O3 -DNDEBUG -march=native -I/$NUMCPPROOT/include -I/$BOOSTROOT/include' $MADSOURCE/ +``` +If you wish to specifiy which compilers are used: Do so with `-D MPI_CXX_COMPILER=...` and `-D MPI_C_COMPILER=...`. +If you have not exported MKLROOT you can add the MKL paths over `-D MKL_ROOT_DIR=...` (directory that contains `include` and `lib`). + +Compile +```bash +cd $MAD_ROOT_DIR +make +``` + +## Let tequila know where madness was compiled +tequila will look for the `MAD_ROOT_DIR` variable in your system. This should contain the path to the directory where madness was compiled above (the directory where the `cmake` and `make` commands where executed. +Export like +```bash +export MAD_ROOT_DIR=/path/to/where/it/was/compiled/ +``` +in order to test if you have the right path, make sure that the following executable exists +```bash +$MAD_ROOT_DIR/src/apps/pno/pno_integrals +``` + +# Use with Docker +If you are getting frustrated with the madness compilation you can resort to a Docker image. +In the following there will be a short description how to make it work with tequila. +Hereby it is assumed that you have installed Docker and are familiar with the basics. +Note that docker requires administrator priviliges, so everything has to be executed in su mode, so you might want to consider using docker in rootless mode ([see here](https://docs.docker.com/engine/security/rootless/), not tested by me). + +1. Pull the docker image: +```bash +docker pull kottmanj/mra-pno +``` +2. Create a small script that will replace the madness executable in tequila. Let's also name it `pno_integrals`. This is what goes into the file: +```bash +#!/bin/bash" > pno_integrals +name=$(docker run -t -d kottmanj/mra-pno) +docker cp input $name:/ +docker exec $name pno_integrals +docker cp $name:molecule_htensor.bin . +docker cp $name:molecule_gtensor.bin . +docker cp $name:pnoinfo.txt . +docker stop $name +docker rm $name +``` +3. Initialize the tequila molecule like this: +```bash +molecule = tq.Molecule(geometry=geomfile.xyz, n_pno=1, executable="/wherever/it/is/pno_integrals") +``` + + + # Funding -The developers gratefully acknowledge the support of the Department of Energy, Office of Science, Office of Basic Energy Sciences and Office of Advanced Scientific Computing Research, under contract DE-AC05-00OR22725 with Oak Ridge National Laboratory. -The developers gratefully acknowledge the support of the National Science Foundation under grant 0509410 to the University of Tennessee in collaboration with The Ohio State University (P. Sadayappan). The MADNESS parallel runtime and parallel tree-algorithms include concepts and software developed under this project. +The developers gratefully acknowledge the support of: + +* The Department of Energy, Office of Science, Office of Basic Energy Sciences "Numerically-Exact Relativistic ManyBody Electronic Structure of Heavy Elements" grant DE-SC0022327 ((Valeev, Virginia Tech, PI). + +* The EPEXA project, currently supported by the National Science Foundation under grants 1931387 at Stony Brook University, 1931347 at Virginia Tech, and 1931384 at the University of Tennesse, Knoxville. + +* The TESSE project, supported by the National Science Foundation under grants 1450344 at Stony Brook University, 1450262 at Virginia Tech, and 1450300 at the University of Tennesse, Knoxville. + +* The Department of Energy, Office of Science, Office of Basic Energy Sciences and Office of Advanced Scientific Computing Research, under contract DE-AC05-00OR22725 with Oak Ridge National Laboratory. -The developers gratefully acknowledge the support of the National Science Foundation under grant NSF OCI-0904972 to the University of Tennessee. The solid state physics and multiconfiguration SCF capabilities are being developed by this project. +* The National Science Foundation under grant 0509410 to the University of Tennessee in collaboration with The Ohio State University (P. Sadayappan). The MADNESS parallel runtime and parallel tree-algorithms include concepts and software developed under this project. -The developers gratefully acknowledge the support of the National Science Foundation under grant NSF CHE-0625598 to the University of Tennessee, in collaboration with UIUC/NCSA. Some of the multi-threading and preliminary GPGPU ports were developed by this project. +* The National Science Foundation under grant NSF OCI-0904972 to the University of Tennessee. The solid state physics and multiconfiguration SCF capabilities are being developed by this project. -The developers gratefully acknowledge the support of the Defense Advanced Research Projects Agency (DARPA) under subcontract from Argonne National Laboratory as part of the High-Productivity Computer Systems (HPCS) language evaluation project. +* The National Science Foundation under grant NSF CHE-0625598 to the University of Tennessee, in collaboration with UIUC/NCSA. Some of the multi-threading and preliminary GPGPU ports were developed by this project. +* The Defense Advanced Research Projects Agency (DARPA) under subcontract from Argonne National Laboratory as part of the High-Productivity Computer Systems (HPCS) language evaluation project. diff --git a/_config.yml b/_config.yml new file mode 100644 index 00000000000..c7418817439 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/admin/docker/README.md b/admin/docker/README.md new file mode 100644 index 00000000000..a0866c56b71 --- /dev/null +++ b/admin/docker/README.md @@ -0,0 +1,6 @@ +# What +This repo contains scripts for building MADNESS containers usable for running applications and for development. + +# How +- Authenticate with Docker Hub: `docker login -u ` +- Build and push: `cd docker-images && make push/all` diff --git a/admin/docker/images/Makefile b/admin/docker/images/Makefile new file mode 100644 index 00000000000..49a8dea901c --- /dev/null +++ b/admin/docker/images/Makefile @@ -0,0 +1,24 @@ +repo = rjharrison +latest ?= 22.04 +ALL = ${repo}/ubuntu\:22.04 + +${repo}/ubuntu\:%: build = docker build --build-arg ubuntuImage=ubuntu:$* -f ../ubuntu/Dockerfile ../ubuntu/ + +${repo}/ubuntu: ${repo}/ubuntu\:${latest} + docker tag ${repo}/ubuntu:${latest} $@ + +${repo}/ubuntu\:%: + ${build} -t $@ + +${repo}/ubuntu\:%.tar: + mkdir -p ${repo} + DOCKER_BUILDKIT=1 ${build} -o - > $@ + +all: ${ALL} ${repo}/ubuntu + +all/tar: $(ALL:%=%.tar) + +push/%: ${repo}/ubuntu\:% + docker push $? + +push/all: push/22.04 diff --git a/admin/docker/ubuntu/Dockerfile b/admin/docker/ubuntu/Dockerfile new file mode 100644 index 00000000000..924c905bbe7 --- /dev/null +++ b/admin/docker/ubuntu/Dockerfile @@ -0,0 +1,38 @@ +ARG ubuntuImage +FROM ${ubuntuImage} + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y locales && \ + locale-gen "en_US.UTF-8" && \ + update-locale LANG=en_US.UTF-8 + +ENV LANGUAGE en_US:en +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +# NB to enable nvidia docker runtime *with* --runtime nvidia +ENV NVIDIA_VISIBLE_DEVICES all + +RUN mkdir -p /home/m-a-d-n-e-s-s/ +COPY ./Makefile /home/m-a-d-n-e-s-s/ +WORKDIR /home/m-a-d-n-e-s-s/ + +RUN DEBIAN_FRONTEND=noninteractive \ + apt-get -yq update && \ + apt-get -yq install make wget curl + +# main, cmake, clang +RUN make install/main && \ + make install/cmake && \ + make install/clang && \ + apt-get clean + +# Add MKL repo, download +RUN make apt-add-repository/intel-mkl && \ + make download/intel-mkl && \ + make install/intel-mkl + +# build MADNESS +RUN make build/madness + + diff --git a/admin/docker/ubuntu/Makefile b/admin/docker/ubuntu/Makefile new file mode 100644 index 00000000000..16e57f45927 --- /dev/null +++ b/admin/docker/ubuntu/Makefile @@ -0,0 +1,77 @@ +ubuntu_codename ?= $(shell lsb_release -sc) +clang_version ?= 13 + +export DEBIAN_FRONTEND=noninteractive + +ubuntu_release = $(shell lsb_release -sr) + +intel_mkl_version ?= 2020.4-304 +intel_mkl := intel-mkl-\*-${intel_mkl_version} + +install/main: + apt-get update + apt-get -yq install \ + lsb-release coreutils sudo bash-completion \ + apt-transport-https software-properties-common ca-certificates gnupg \ + linux-tools-common time pciutils \ + build-essential wget curl \ + git make ninja-build \ + gcc g++ gfortran gdb valgrind \ + libeigen3-dev \ + libblas-dev liblapack-dev liblapacke-dev \ + libunwind-dev libtbb-dev libomp-dev \ + libopenmpi-dev openmpi-bin libscalapack-openmpi-dev \ + libxc-dev \ + python3 python3-pip python3-numpy python3-dev python3-pytest \ + vim emacs-nox ccache + +install/docker: + sudo apt-get install docker.io + +install/g++-%: + apt-get -yq install gcc-$* g++-$* gfortran-$* + +install/add-apt-repository: + apt-get update + apt-get -yq install software-properties-common + +# CMake +install/cmake: + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - + apt-add-repository "deb https://apt.kitware.com/ubuntu/ ${ubuntu_codename} main" + apt-get -yq update + apt-get -yq install cmake cmake-curses-gui + + +# LLVM +install/clang-%: + wget https://apt.llvm.org/llvm-snapshot.gpg.key -O - | apt-key add - + add-apt-repository "deb http://apt.llvm.org/${ubuntu_codename}/ llvm-toolchain-${ubuntu_codename}-$* main" + apt-get -yq update + apt-get -yq install clang-$* libomp-$*-dev + +install/clang: install/clang-${clang_version} + + +# Intel +apt-add-repository/intel-mkl: + wget -O - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB | apt-key add - + apt-add-repository "deb https://apt.repos.intel.com/mkl all main" + apt-get -yq update + +download/intel-mkl: + apt-get install -yq --download-only ${intel_mkl} + +install/intel-mkl: + apt-get -yq install ${intel_mkl} + rm -rf /opt/intel/mkl + ln -s /opt/intel/compilers_and_libraries_$(subst -,.,${intel_mkl_version})/linux/mkl /opt/intel/mkl + test -x /opt/intel/mkl/bin/mklvars.sh + +# MADNESS +build/madness: + git clone https://github.com/m-a-d-n-e-s-s/madness /home/m-a-d-n-e-s-s/source + MKLROOT=/opt/intel/mkl cmake -S /home/m-a-d-n-e-s-s/source -B /home/m-a-d-n-e-s-s/build -GNinja -DCMAKE_INSTALL_PREFIX=/home/m-a-d-n-e-s-s/install + cmake --build /home/m-a-d-n-e-s-s/build --target applications-madness + cmake --build /home/m-a-d-n-e-s-s/build --target install + diff --git a/admin/docker/ubuntu/sudoers b/admin/docker/ubuntu/sudoers new file mode 100644 index 00000000000..95e1ff2f88c --- /dev/null +++ b/admin/docker/ubuntu/sudoers @@ -0,0 +1,30 @@ +# +# This file MUST be edited with the 'visudo' command as root. +# +# Please consider adding local content in /etc/sudoers.d/ instead of +# directly modifying this file. +# +# See the man page for details on how to write a sudoers file. +# +Defaults env_reset +Defaults mail_badpass +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" + +# Host alias specification + +# User alias specification + +# Cmnd alias specification + +# User privilege specification +root ALL=(ALL:ALL) ALL + +# Members of the admin group may gain root privileges +%admin ALL=(ALL) ALL + +# Allow members of group sudo to execute any command +%sudo ALL= (ALL:ALL) NOPASSWD: ALL + +# See sudoers(5) for more information on "#include" directives: + +#includedir /etc/sudoers.d diff --git a/bin/madjsoncompare.py b/bin/madjsoncompare.py new file mode 100644 index 00000000000..9f71ccc5bf4 --- /dev/null +++ b/bin/madjsoncompare.py @@ -0,0 +1,51 @@ +import json + +class madjsoncompare: + # """takes two json output files and compares individual keys, accessed by a list of descending keys""" + def __init__(self, file1, file2): + self.file1=file1 + self.file2=file2 + self.success=True + + with open(file1, 'r') as f: + self.data1 = json.load(f) + + with open(file2, 'r') as f: + self.data2 = json.load(f) + + def exitcode(self): + if self.success: + return 0 + else: + return 1 + + def compare(self, subsequentkeys, tolerance): + value1=self.data1 + value2=self.data2 + for i in subsequentkeys: + value1=value1[i] + value2=value2[i] + + # print("type of key/value",type(i),type(value1)) + success=False + diff='is different' + if (type(value1)==float): + diff=abs(value1-value2) + success=diff /dev/null +then + echo "conda is not installed" + exit 1 +fi + +set -e + +# install compilers (linux only: others need to install manually) +echo building on $(uname -a) +os=$(uname -a | cut -d ' ' -f 1) +if [ "$os" = "Linux" ]; then + echo "This is a Linux system, we can install compilers with conda" + conda install gxx_linux-64 -y + conda install mkl-devel +else + echo "please check and install compilers g++ >8 and mpich manually" +fi + + +# define your target directories +# to override: just call the script like e.g. "CC=whatever bash build.sh" +CC=${CC-mpicc} +MPI_CC=${MPI_CC-mpicc} +CXX=${CXX-mpicxx} +MPI_CXX=${MPI_CXX-mpicxx} +MAD_SRC_DIR=${MAD_SRC_DIR-madness_src} +MAD_ROOT_DIR=${MAD_ROOT_DIR-madness} +NUMCPP_SRC_DIR=${NUMCPP_SRC_DIR-numcpp} + +mkdir ${MAD_ROOT_DIR} + +export MAD_SRC_DIR=${MAD_SRC_DIR} # add path to directory where you want the source code +export MAD_ROOT_DIR=${MAD_ROOT_DIR} # add path to directory where you want the compiled code +export NUMCPP_SRC_DIR=${NUMCPP_SRC_DIR} # add path to directory where you want the numcpp dependency + +# make sure that tequila will find it later +echo "added by madness install script" >> ~/.bashrc +echo "export MAD_ROOT_DIR=${MAD_ROOT_DIR}" >> ~/.bashrc + +# get the sources +git clone https://github.com/kottmanj/madness.git $MAD_SRC_DIR +git clone https://github.com/dpilger26/numcpp $NUMCPP_SRC_DIR + +# install dependencies +conda install cmake boost -y + +# export paths to dependencies +export CPLUS_INCLUDE_PATH=$(realpath $NUMCPP_SRC_DIR/include):$CPLUS_INCLUDE_PATH +# make sure that the right boost and mkl are found and used +export CPLUS_INCLUDE_PATH=$(realpath $CONDA_PREFIX/include):$CPLUS_INCLUDE_PATH + +cmake -D ENABLE_MKL=ON -D ENABLE_MPI=OFF -D CMAKE_CXX_FLAGS='-O3 -DNDEBUG -march=native' -S $MAD_SRC_DIR -B $MAD_ROOT_DIR + +# compile +make -j -C $MAD_ROOT_DIR +make -j -C $MAD_ROOT_DIR/src/apps/pno pno_integrals + +# add MAD_ROOT_DIR to conda env +conda env config vars set MAD_ROOT_DIR=$(realpath ${MAD_ROOT_DIR}) +~ diff --git a/cmake/config.h.in b/cmake/config.h.in index 247561021cc..97ead7074e7 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -8,7 +8,6 @@ #define MADNESS_MAJOR_VERSION @MADNESS_MAJOR_VERSION@ #define MADNESS_MINOR_VERSION @MADNESS_MAJOR_VERSION@ #define MADNESS_MICRO_VERSION @MADNESS_MAJOR_VERSION@ -#define MADNESS_REVISION "@MADNESS_REVISION@" /* Configured information */ #define MADNESS_CONFIGURATION_CXX "@CMAKE_CXX_COMPILER@" @@ -114,6 +113,7 @@ /* Define to enable MADNESS features */ #cmakedefine MADNESS_TASK_PROFILING 1 #cmakedefine MADNESS_USE_BSEND_ACKS 1 +#cmakedefine ENABLE_GENTENSOR 1 #cmakedefine NEVER_SPIN 1 #cmakedefine TENSOR_BOUNDS_CHECKING 1 #cmakedefine TENSOR_INSTANCE_COUNT 1 diff --git a/cmake/doxygen.cfg.in b/cmake/doxygen.cfg.in index 562c9408730..36aca54f0b6 100755 --- a/cmake/doxygen.cfg.in +++ b/cmake/doxygen.cfg.in @@ -397,6 +397,19 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 10 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -804,7 +817,7 @@ EXCLUDE = "@PROJECT_SOURCE_DIR@/src/madness/external" \ "@PROJECT_SOURCE_DIR@/src/apps/ii" \ "@PROJECT_SOURCE_DIR@/src/apps/jacob" \ "@PROJECT_SOURCE_DIR@/src/apps/nick" \ - "@PROJECT_SOURCE_DIR@/src/apps/polar" + "@PROJECT_SOURCE_DIR@/src/apps/polar" # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -822,7 +835,8 @@ EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = LIBS.h \ mraX.cc \ - mraX.h + mraX.h \ + *.tex # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -2119,7 +2133,7 @@ HAVE_DOT = @DOXYGEN_DOT_FOUND@ # Minimum value: 0, maximum value: 32, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_NUM_THREADS = 0 +DOT_NUM_THREADS = 10 # When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make diff --git a/cmake/git_version.cmake b/cmake/git_version.cmake deleted file mode 100644 index bf31368bd41..00000000000 --- a/cmake/git_version.cmake +++ /dev/null @@ -1,71 +0,0 @@ -cmake_minimum_required(VERSION 3.0.0) - -message(STATUS "Resolving GIT Version") - -set(_build_version "unknown") - - -find_package(Git) -if(GIT_FOUND) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY "${local_dir}" - OUTPUT_VARIABLE _build_version_only - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - execute_process( - COMMAND ${GIT_EXECUTABLE} diff --quiet - WORKING_DIRECTORY "${local_dir}" - RESULT_VARIABLE differs - ) - -# add a trailing plus if the code was change compared to the revision - if (${differs} EQUAL 0) -# message(STATUS "GIT_DIFF not differing") - string(CONCAT _build_version ${_build_version_only}) - else() -# message(STATUS "GIT_DIFF differing") - string(CONCAT _build_version ${_build_version_only}+) - endif() - message(STATUS "GIT hash: ${_build_version}") -else() - message(STATUS "GIT not found") -endif() - -string(TIMESTAMP _time_stamp) - -#configure_file(${local_dir}/git_version.h.in ${output_dir}/git_version.h @ONLY) - -#configure_file(${local_dir}/gitinfo.cc.in ${output_dir}/gitinfo.cc @ONLY) - -set(VERSION "const char* MADNESS_GITREVISION=\"${_build_version}\";") - -set(VERSIONFILE "${output_dir}/gitversion.h") -set(VERSIONSOURCE "${source_dir}/gitinfo.cc") - -#message(STATUS "looking for file ${VERSIONFILE}") - -if(EXISTS ${VERSIONFILE}) -# message(STATUS "reading file ${VERSIONFILE}") - file(READ ${VERSIONFILE} VERSION_) - message(STATUS "contents of the gitversion file: ${VERSION_}") -else() - set(VERSION_ "") - message(STATUS "cannot find file ${VERSIONFILE}") -endif() - - -if (NOT "${VERSION}" STREQUAL "${VERSION_}") - file(WRITE ${VERSIONFILE} "${VERSION}") - message(STATUS "creating file ${VERSIONFILE}") - execute_process( - COMMAND touch "gitinfo.cc" - WORKING_DIRECTORY "${source_dir}" - ) - -else() - message(STATUS "file ${FILE} is up to date") -endif() - - diff --git a/cmake/madness-config.cmake.in b/cmake/madness-config.cmake.in index 0be7ea1b6a7..6683525d379 100644 --- a/cmake/madness-config.cmake.in +++ b/cmake/madness-config.cmake.in @@ -95,8 +95,8 @@ set(MADNESS_HAS_ELEMENTAL @MADNESS_HAS_ELEMENTAL@) set(MADNESS_HAS_ELEMENTAL_EMBEDDED @MADNESS_HAS_ELEMENTAL_EMBEDDED@) set(MADNESS_INSTALL_LIBRARY_DIR "@PACKAGE_MADNESS_INSTALL_LIBDIR@") -set(MADNESS_BUILD_INCLUDE_DIRS "${MADNESS_SOURCE_DIR}/src" "${MADNESS_BINARY_DIR}/src") -set(MADNESS_INSTALL_INCLUDE_DIRS "@PACKAGE_MADNESS_INSTALL_INCLUDEDIR@" +set(MADNESS_BUILD_INCLUDE_DIRS "${MADNESS_SOURCE_DIR}/src" ":" "${MADNESS_BINARY_DIR}/src") +set(MADNESS_INSTALL_INCLUDE_DIRS "@PACKAGE_MADNESS_INSTALL_INCLUDEDIR@" ":" "@PACKAGE_MADNESS_INSTALL_INCLUDEDIR@/madness/external") if (MADNESS_HAS_ELEMENTAL) @@ -203,4 +203,26 @@ if (TBB::tbb IN_LIST _madworld_link_libraries) find_dependency(TBB MODULE REQUIRED COMPONENTS tbb PATHS "${_tbb_root_dir}" NO_DEFAULT_PATH) endif() endif() -endif() \ No newline at end of file +endif() + +########### LibXC ############ +if (@LIBXC_FOUND@) + message("Hello worl") + message(@LIBXC_INCLUDE_DIRS@/..) + +# cmake_path(GET @LIBXC_INCLUDE_DIRS@ PARENT_PATH LIBXC_ROOT_DIR) +# message("ay ay" "${LIBXC_INCLUDE_DIRS}") +# +# +# set(MADNESS_INCLUDE_DIRS "${MADNESS_INCLUDE_DIRS}" ":" "@LIBXC_INCLUDE_DIRS@") +# get_filename_component(LIBXC_ROOT_DIR "@LIBXC_INCLUDE_DIRS@/.." DIRECTORY) + + message("LIBXC_ROOT_DIR" "${LIBXC_ROOT_DIR}") + + set(LIBXC_ROOT_DIR "@LIBXC_INCLUDE_DIRS@/..") + message("LIBXC_ROOT_DIR" "${LIBXC_ROOT_DIR}") + set(LIBXC_INCLUDE_DIRS "${LIBXC_INCLUDE_DIRS}" ":" "@LIBXC_INCLUDE_DIRS@") + set(LIBXC_LIBRARIES "@LIBXC_LIBRARIES@") + set(LIBXC_FOUND 1) +endif() + diff --git a/cmake/modules/AddMADLibrary.cmake b/cmake/modules/AddMADLibrary.cmake index d13e2805b0e..13b373f4084 100644 --- a/cmake/modules/AddMADLibrary.cmake +++ b/cmake/modules/AddMADLibrary.cmake @@ -87,6 +87,13 @@ macro(add_mad_library _name _source_files _header_files _dep_mad_comp _include_d endforeach(_dep ${_dep_mad_comp}) set_target_properties(${targetname} PROPERTIES LINK_FLAGS "${LINK_FLAGS}") target_compile_features(${targetname} INTERFACE "cxx_std_${CMAKE_CXX_STANDARD}") + # if (CMAKE_CXX_STANDARD GREATER_EQUAL 20) # volatile issues now (mostly) fixed properly, so restore warnings + # if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # target_compile_options(MAD${_name} PUBLIC "-Wno-deprecated-volatile") + # elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + # target_compile_options(MAD${_name} PUBLIC "-Wno-volatile") + # endif() + # endif() endmacro() @@ -138,6 +145,13 @@ macro(add_mad_hdr_library _name _header_files _dep_mad_comp _include_dir) endforeach() target_compile_features(MAD${_name} INTERFACE "cxx_std_${CMAKE_CXX_STANDARD}") - + if (CMAKE_CXX_STANDARD GREATER_EQUAL 20) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(MAD${_name} INTERFACE "-Wno-deprecated-volatile") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_compile_options(MAD${_name} INTERFACE "-Wno-volatile") + endif() + endif() + set(${_name}_is_mad_hdr_lib TRUE) endmacro() diff --git a/cmake/modules/AddScriptedTests.cmake b/cmake/modules/AddScriptedTests.cmake new file mode 100644 index 00000000000..32f08b91261 --- /dev/null +++ b/cmake/modules/AddScriptedTests.cmake @@ -0,0 +1,53 @@ +# macro will build (i.e. copy the test script to the build directory) and execute the script + +# example +# CMakeLists.txt: add_scripted_tests(nemo_test1.py nemo) + + +macro(add_scripted_tests _testcase_in _binary _labels) + + # convert test.py.in to test.py +# get_filename_component(_testcase "${_testcase_in}" NAME_WLE) + # possibly path/to/src/test.py.in and path/to/build/test.py + set(_testcase ${_testcase_in}) + + # Add targets and for scripted tests + add_custom_target_subproject(madness ${_testcase}_${_binary}_scripted_tests) + add_dependencies(scripted_tests-madness ${_testcase}_${_binary}_scripted_tests-madness) + +# Add a test that builds the binary + add_test(madness/test/${_binary}/build + "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_binary}) + set_tests_properties(madness/test/${_binary}/build PROPERTIES DEPENDS ${_binary}) + + # make sure that the build step has all labels + set_property(TEST madness/test/${_binary}/build PROPERTY LABELS "${_labels}" APPEND) + +# Add a test that copies the test scripts and replaces the variable to the source directory +# containing the reference json outputs + if (0) + add_test(madness/test/scripted_tests/${_binary}/${_testcase}/copy + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/${_testcase} + ${CMAKE_CURRENT_BINARY_DIR}/${_testcase}) + set_tests_properties(madness/test/scripted_tests/${_binary}/${_testcase}/copy + PROPERTIES DEPENDS ${_binary} LABELS "${_labels}") + endif() + # copy the test scripts and replaces the variable to the source directory containing the reference json outputs + set(SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(BINARY ${_binary}) + set(TESTCASE ${_testcase}) + configure_file(${_testcase} ${_testcase} @ONLY) + +# message(STATUS "testcase: " ${_testcase}) +# message(STATUS "binary: " ${_binary}) +# message(STATUS "labels: " ${_labels}) +# message(STATUS "sourcedir " ${CMAKE_CURRENT_SOURCE_DIR}) +# message(STATUS "binarydir " ${CMAKE_CURRENT_BINARY_DIR}) + + # Add the tests (execution and result) and set dependencies + add_test(NAME madness/test/scripted_tests/${_binary}/${_testcase}/run COMMAND ${_testcase} --reference_directory=${CMAKE_CURRENT_SOURCE_DIR}) + set_tests_properties(madness/test/scripted_tests/${_binary}/${_testcase}/run + PROPERTIES LABELS "${_labels}") + +endmacro() \ No newline at end of file diff --git a/cmake/modules/AddUnittests.cmake b/cmake/modules/AddUnittests.cmake index 30ab8db394f..fb56e1fd268 100644 --- a/cmake/modules/AddUnittests.cmake +++ b/cmake/modules/AddUnittests.cmake @@ -1,13 +1,17 @@ -macro(add_unittests _component _sources _libs) +macro(add_unittests _component _sources _libs _labels) # Add targets and for world_unittests - add_custom_target_subproject(madness ${_component}_unittests) - add_dependencies(unittests-madness ${_component}_unittests-madness) + if (NOT TARGET ${_component}_unittests) + add_custom_target_subproject(madness ${_component}_unittests) + add_dependencies(unittests-madness ${_component}_unittests-madness) + endif() # Add a test that builds the unit tests add_test(madness/test/${_component}/build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target ${_component}_unittests-madness) - + # make sure that the build step has all labels + set_property(TEST madness/test/${_component}/build PROPERTY LABELS "${_labels}" APPEND) + foreach(_source ${_sources}) # Get the test name (the file name of the first source) string(REGEX MATCH "[A-Za-z_][A-Za-z0-9_]*\\.cc" _test_source "${_source}") @@ -21,7 +25,7 @@ macro(add_unittests _component _sources _libs) add_test(NAME madness/test/${_component}/${_test}/run COMMAND ${_test}) add_dependencies(${_component}_unittests-madness ${_test}) set_tests_properties(madness/test/${_component}/${_test}/run - PROPERTIES DEPENDS madness/test/${_component}/build) + PROPERTIES DEPENDS madness/test/${_component}/build LABELS "${_labels}") endforeach() diff --git a/cmake/modules/FindMKL.cmake b/cmake/modules/FindMKL.cmake index eb66727ae78..5d9a597d125 100644 --- a/cmake/modules/FindMKL.cmake +++ b/cmake/modules/FindMKL.cmake @@ -53,7 +53,7 @@ if(NOT MKL_FOUND) # Search for MKL header files find_path(MKL_INCLUDE_DIRS mkl.h - HINTS ${MKL_INCLUDE_DIR}) + HINTS ${MKL_INCLUDE_DIR} /usr/include/mkl) # Get MKL version if(MKL_INCLUDE_DIRS) diff --git a/cmake/modules/FindOrFetchPARSEC.cmake b/cmake/modules/FindOrFetchPARSEC.cmake index e85eed6094e..5d522e14d91 100644 --- a/cmake/modules/FindOrFetchPARSEC.cmake +++ b/cmake/modules/FindOrFetchPARSEC.cmake @@ -14,7 +14,7 @@ if (NOT TARGET PaRSEC::parsec) FetchContent_Declare( PARSEC - GIT_REPOSITORY https://github.com/TESSEorg/parsec.git + GIT_REPOSITORY https://github.com/ICLDisco/parsec.git GIT_TAG ${MADNESS_TRACKED_PARSEC_TAG} ) FetchContent_MakeAvailable(PARSEC) diff --git a/cmake/modules/GetGitMetadata.cmake b/cmake/modules/GetGitMetadata.cmake new file mode 100644 index 00000000000..a07148b0cc6 --- /dev/null +++ b/cmake/modules/GetGitMetadata.cmake @@ -0,0 +1,83 @@ +# +# SPDX-FileCopyrightText: 2022 Eduard Valeyev +# +# SPDX-License-Identifier: BSD-2-Clause +# + +# +# vgkit_cmake_git_revision() defines variable ${PROJECT_NAME_UPPER}_GIT_REVISION, +# where ${PROJECT_NAME_UPPER} is the upper-case version of ${PROJECT_NAME}, to +# the "long-form" GIT revision produced by `git rev-parse -q HEAD` command. +# N.B. If the variable is already defined will print a warning message but not change the value of +# ${PROJECT_NAME_UPPER}_GIT_REVISION +# +macro(vgkit_cmake_git_revision) + string(TOUPPER "${PROJECT_NAME}_GIT_REVISION" vgkit_cmake_git_revision_result) + if (DEFINED ${vgkit_cmake_git_revision_result}) + message(WARNING "vgkit_cmake_git_revision() called for project ${PROJECT_NAME} but the result variable ${vgkit_cmake_git_revision_result} already defined; will not change its value") + else() + if(EXISTS ${PROJECT_SOURCE_DIR}/.git) + find_package(Git REQUIRED) + if (GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse -q HEAD + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE vgkit_cmake_git_revision_errcod + OUTPUT_VARIABLE ${vgkit_cmake_git_revision_result} + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT vgkit_cmake_git_revision_errcod EQUAL 0) + set(${vgkit_cmake_git_revision_result} "unknown") + endif() + unset(vgkit_cmake_git_revision_errcod) + else() + set(${vgkit_cmake_git_revision_result} "unknown") + endif() + else() + set(${vgkit_cmake_git_revision_result} "unknown") + endif() + endif() + unset(vgkit_cmake_git_revision_result) +endmacro() + +# +# vgkit_cmake_git_description() defines variable ${PROJECT_NAME_UPPER}_GIT_DESCRIPTION, +# where ${PROJECT_NAME_UPPER} is the upper-case version of ${PROJECT_NAME}, to +# the human-readable form produced by `git describe --dirty` command. +# If the variable is already defined will print a warning message but not change the value of +# ${PROJECT_NAME_UPPER}_GIT_DESCRIPTION +# +macro(vgkit_cmake_git_description) + string(TOUPPER "${PROJECT_NAME}_GIT_DESCRIPTION" vgkit_cmake_git_description_result) + if (DEFINED ${vgkit_cmake_git_description_result}) + message(WARNING "vgkit_cmake_git_description() called for project ${PROJECT_NAME} but the result variable ${vgkit_cmake_git_description_result} already defined; will not change its value") + else() + if(EXISTS ${PROJECT_SOURCE_DIR}/.git) + find_package(Git REQUIRED) + if (GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --dirty + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE vgkit_cmake_git_description_errcod + OUTPUT_VARIABLE ${vgkit_cmake_git_description_result} + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT vgkit_cmake_git_description_errcod EQUAL 0) + set(${vgkit_cmake_git_description_errcod} "unknown") + endif() + unset(vgkit_cmake_git_description_errcod) + else() + set(${vgkit_cmake_git_description_errcod} "unknown") + endif() + else() + set(${vgkit_cmake_git_description_errcod} "unknown") + endif() + endif() + unset(vgkit_cmake_git_description_errcod) +endmacro() + +# +# vgkit_cmake_git_metadata() invokes vgkit_cmake_git_revision and vgkit_cmake_git_description +# +macro(vgkit_cmake_git_metadata) + vgkit_cmake_git_revision() + vgkit_cmake_git_description() +endmacro() diff --git a/config/MakeGlobal.am b/config/MakeGlobal.am deleted file mode 100644 index 8ce113a2c70..00000000000 --- a/config/MakeGlobal.am +++ /dev/null @@ -1,64 +0,0 @@ -# Define paths for includes (note convention #include ) -AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/src/apps - -if LINK_ALL_STATIC -AM_LDFLAGS = -all-static -endif - -# Define directories holding libraries and variables for corresponding libraries -LIBGTESTDIR=$(top_builddir)/src/madness/external/gtest -LIBWORLDDIR=$(top_builddir)/src/madness/world -LIBTENSORDIR=$(top_builddir)/src/madness/tensor -LIBMISCDIR=$(top_builddir)/src/madness/misc -LIBMRADIR=$(top_builddir)/src/madness/mra -LIBCHEMDIR=$(top_builddir)/src/apps/chem -LIBTINYXMLDIR=$(top_builddir)/src/madness/external/tinyxml -LIBMUPARSERDIR=$(top_builddir)/src/madness/external/muParser - -LIBGTEST=$(LIBGTESTDIR)/libMADgtest.la -LIBWORLD=$(LIBWORLDDIR)/libMADworld.la -LIBTENSOR=$(LIBTENSORDIR)/libMADtensor.la -LIBLINALG=$(LIBTENSORDIR)/libMADlinalg.la -LIBMISC=$(LIBMISCDIR)/libMADmisc.la -LIBMRA=$(LIBMRADIR)/libMADmra.la -LIBCHEM=$(LIBCHEMDIR)/libMADchem.la -LIBTINYXML=$(LIBTINYXMLDIR)/libMADtinyxml.la -LIBMUPARSER=$(LIBMUPARSERDIR)/libMADmuparser.la - -# Most scientific/numeric applications will link against these libraries -MRALIBS=$(LIBMRA) $(LIBLINALG) $(LIBTENSOR) $(LIBMISC) $(LIBMUPARSER) $(LIBTINYXML) $(LIBWORLD) - -LIBGTEST_CPPFLAGS = $(GTEST_CPPFLAGS) -DGTEST_HAS_PTHREAD=1 -isystem $(top_srcdir)/src/madness/external/gtest/include $(AM_CPPFLAGS) -LIBGTEST_CXXFLAGS = $(GTEST_CXXFLAGS) $(AM_CXXFLAGS) -LIBGTEST_LIBS = $(GTEST_LDFLAGS) $(GTEST_LIBS) - -# External library targets -$(LIBGTEST): - $(MAKE) -C $(LIBGTESTDIR) libMADgtest.la - -$(LIBTINYXML): - $(MAKE) -C $(LIBTINYXMLDIR) libMADtinyxml.la - -$(LIBMUPARSER): - $(MAKE) -C $(LIBMUPARSERDIR) libMADmuparser.la - -# MADNESS library targets -$(LIBWORLD): - $(MAKE) -C $(LIBWORLDDIR) libMADworld.la - -$(LIBMISC): $(LIBWORLD) - $(MAKE) -C $(LIBMISCDIR) libMADmisc.la - -$(LIBTENSOR): $(LIBMISC) - $(MAKE) -C $(LIBTENSORDIR) libMADtensor.la - -$(LIBLINALG): $(LIBTENSOR) - $(MAKE) -C $(LIBTENSORDIR) libMADlinalg.la - - -$(LIBMRA): $(LIBLINALG) - $(MAKE) -C $(LIBMRADIR) libMADmra.la - -$(LIBCHEM): $(LIBMRA) - $(MAKE) -C $(LIBCHEMDIR) libMADchem.la - diff --git a/config/acx_check_compiler_flags.m4 b/config/acx_check_compiler_flags.m4 deleted file mode 100644 index 3ca11291480..00000000000 --- a/config/acx_check_compiler_flags.m4 +++ /dev/null @@ -1,22 +0,0 @@ -#ACX_CHECK_COMPILER_FLAGS(compiler, flag_var, flag, success, fail) -AC_DEFUN([ACX_CHECK_COMPILER_FLAG], [ - AC_LANG_SAVE - - AC_LANG([$1]) - acx_check_compiler_flags="no" - acx_check_compiler_flags_save=$[$2] - [$2]="$3" - AC_MSG_CHECKING([whether $1 compiler accepts $3]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], - [ - acx_check_compiler_flags="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - [$2]=$acx_check_compiler_flags_save - AC_LANG_RESTORE - - AS_IF([test $acx_check_compiler_flags != no], [$4], [$5]) -]) \ No newline at end of file diff --git a/config/acx_check_tls.m4 b/config/acx_check_tls.m4 deleted file mode 100644 index a2c8d431db8..00000000000 --- a/config/acx_check_tls.m4 +++ /dev/null @@ -1,63 +0,0 @@ -AC_DEFUN([ACX_CHECK_TLS],[ - # Check for thread local storage support. - # thread_local, __thread_local, __declspec(thread) - - AC_LANG_PUSH([C++]) - - # Check for shared_ptr in std namespace - AC_MSG_CHECKING([for C++ thread_local keyword]) - acx_check_tls=no - - # Check for the key word thread_local (C++11) - AC_COMPILE_IFELSE( - [ - AC_LANG_PROGRAM( - [[thread_local int i = 0;]], - [[i = 1;]] - ) - ], - [acx_check_tls="thread_local"] - ) - - # Check for the key word __thread - if test "$acx_check_tls" = no; then - AC_COMPILE_IFELSE( - [ - AC_LANG_PROGRAM( - [[__thread int i = 0;]], - [[i = 1;]] - ) - ], - [ - acx_check_tls="__thread" - AC_DEFINE([thread_local],[__thread],[Define the thread_local key word.]) - ] - ) - fi - - # Check for the key word __declspec(thread) -# if test "$acx_check_tls" = no; then -# AC_COMPILE_IFELSE( -# [ -# AC_LANG_PROGRAM( -# [[__declspec(thread) int i = 0;]], -# [[i = 1;]] -# ) -# ], -# [ -# acx_check_tls="__declspec(thread)" -# AC_DEFINE([thread_local],[__declspec(thread)],[Define the thread_local key word.]) -# ] -# ) -# fi - - if test "$acx_check_tls" = no; then - AC_MSG_ERROR([Unable to detect mandatory support for thread-local storage]) - fi - - - AC_MSG_RESULT([$acx_check_tls]) - - AC_LANG_POP -]) - diff --git a/config/acx_crayxe.m4 b/config/acx_crayxe.m4 deleted file mode 100644 index 56aa51fa22c..00000000000 --- a/config/acx_crayxe.m4 +++ /dev/null @@ -1,48 +0,0 @@ -AC_DEFUN([ACX_CRAYXE], [ - # If on a Cray XE - # - defines HAVE_CRAYXE=1 in headers - # - defines HAVE_CRAYXE=yes in the script - # - sets MPICXX=CC and MPICC=cc if the user has not already set them - # - sets thread binding to "1 0 2" TODO: this has to be wrong on AMD Magny Cours - # - enables spinlocks - echo "int main()" > __crayxe.cc - echo "{" >> __crayxe.cc - echo "#ifdef __CRAYXE" >> __crayxe.cc - echo "return 0;" >> __crayxe.cc - echo "#else" >> __crayxe.cc - echo "choke me" >> __crayxe.cc - echo "#endif" >> __crayxe.cc - echo "}" >> __crayxe.cc - CC __crayxe.cc >& /dev/null - if test $? = 0; then - AC_MSG_NOTICE([Cray XE detected]) - HAVE_CRAYXE=yes - AC_DEFINE(HAVE_CRAYXE,[1],[Defined if we are running on an Cray XE]) - fi - /bin/rm __crayxe.cc - if test "x$HAVE_CRAYXE" = xyes; then - AC_DEFINE(AMD_QUADCORE_TUNE,[1],[Target for tuning mtxmq kernels]) - if test "x$MPICC" = x; then - AC_MSG_NOTICE([Choosing MPICC=cc for Cray XE]) - MPICC=cc; - fi - if test "x$MPICXX" = x; then - AC_MSG_NOTICE([Choosing MPICXX=CC for Cray XE]) - MPICXX=CC; - fi - echo "int main(){return 0;}" > __acml.cc - CC __acml.cc -lacml >& /dev/null - if test $? = 0; then - AC_MSG_NOTICE([AMD ACML library detected]) - LIBS="$LIBS -lacml" - AC_DEFINE(HAVE_ACML,[1],[Define if AMD math library available - ACML]) - fi - /bin/rm __acml.cc - BIND="1 0 2" - AC_DEFINE(USE_SPINLOCKS, [1], [Define if should use spinlocks]) - fi -]) - - - - diff --git a/config/acx_crayxt.m4 b/config/acx_crayxt.m4 deleted file mode 100644 index fef104529b2..00000000000 --- a/config/acx_crayxt.m4 +++ /dev/null @@ -1,48 +0,0 @@ -AC_DEFUN([ACX_CRAYXT], [ - # If on a Cray XT - # - defines HAVE_CRAYXT=1 in headers - # - defines HAVE_CRAYXT=yes in the script - # - sets MPICXX=CC and MPICC=cc if the user has not already set them - # - sets thread binding to "1 0 2" - # - enables spinlocks - echo "int main()" > __crayxt.cc - echo "{" >> __crayxt.cc - echo "#ifdef __CRAYXT" >> __crayxt.cc - echo "return 0;" >> __crayxt.cc - echo "#else" >> __crayxt.cc - echo "choke me" >> __crayxt.cc - echo "#endif" >> __crayxt.cc - echo "}" >> __crayxt.cc - CC __crayxt.cc >& /dev/null - if test $? = 0; then - AC_MSG_NOTICE([Cray XT detected]) - HAVE_CRAYXT=yes - AC_DEFINE(HAVE_CRAYXT,[1],[Defined if we are running on an Cray XT]) - fi - /bin/rm __crayxt.cc - if test "x$HAVE_CRAYXT" = xyes; then - AC_DEFINE(AMD_QUADCORE_TUNE,[1],[Target for tuning mtxmq kernels]) - if test "x$MPICC" = x; then - AC_MSG_NOTICE([Choosing MPICC=cc for Cray XT]) - MPICC=cc; - fi - if test "x$MPICXX" = x; then - AC_MSG_NOTICE([Choosing MPICXX=CC for Cray XT]) - MPICXX=CC; - fi - echo "int main(){return 0;}" > __acml.cc - CC __acml.cc -lacml >& /dev/null - if test $? = 0; then - AC_MSG_NOTICE([AMD ACML library detected]) - LIBS="$LIBS -lacml" - AC_DEFINE(HAVE_ACML,[1],[Define if AMD math library available - ACML]) - fi - /bin/rm __acml.cc - BIND="1 0 2" - AC_DEFINE(USE_SPINLOCKS, [1], [Define if should use spinlocks]) - fi -]) - - - - diff --git a/config/acx_cxx_restrict.m4 b/config/acx_cxx_restrict.m4 deleted file mode 100644 index 70cf79705ae..00000000000 --- a/config/acx_cxx_restrict.m4 +++ /dev/null @@ -1,36 +0,0 @@ -dnl @synopsis ACX_CXX_RESTRICT -dnl -dnl This macro determines whether the C++ compiler supports the -dnl "restrict" keyword introduced in C99, or an equivalent. Does -dnl nothing if the compiler accepts the keyword. Otherwise, if the -dnl compiler supports an equivalent (like GCC's __restrict__) defines -dnl "restrict" to be that. Otherwise, defines "restrict" to be empty. -dnl -dnl @category Obsolete -dnl @author Steven G. Johnson -dnl @version 2005-05-31 -dnl @license GPLWithACException - -AC_DEFUN([ACX_CXX_RESTRICT], -[AC_CACHE_CHECK([for C++ restrict keyword], acx_cv_cxx_restrict, -[acx_cv_cxx_restrict=unsupported - AC_LANG_SAVE - AC_LANG_PUSH([C++]) - # Try the official restrict keyword, then gcc's __restrict__, then - # SGI's __restrict. __restrict has slightly different semantics than - # restrict (it's a bit stronger, in that __restrict pointers can't - # overlap even with non __restrict pointers), but I think it should be - # okay under the circumstances where restrict is normally used. - for acx_kw in restrict __restrict__ __restrict; do - AC_TRY_COMPILE([], [float * $acx_kw x;], [acx_cv_cxx_restrict=$acx_kw; break]) - done - AC_LANG_RESTORE -]) - if test "$acx_cv_cxx_restrict" != "restrict"; then - acx_kw="$acx_cv_cxx_restrict" - if test "$acx_kw" = unsupported; then acx_kw=""; fi - AC_DEFINE_UNQUOTED(MADNESS_RESTRICT, $acx_kw, [Define to equivalent of C99 restrict keyword, or to nothing if this is not supported. Do not define if restrict is supported directly.]) - fi - AC_MSG_RESULT([$acx_cv_cxx_restrict]) - AC_LANG_POP -]) diff --git a/config/acx_detect_cxx.m4 b/config/acx_detect_cxx.m4 deleted file mode 100644 index 93c838d35be..00000000000 --- a/config/acx_detect_cxx.m4 +++ /dev/null @@ -1,49 +0,0 @@ -AC_DEFUN([ACX_DETECT_CXX], [ - # Sets environment variable CXXVENDOR to one of - # [GNU,Intel,Portland,Pathscale,IBM,unknown] - AC_CACHE_CHECK([compiler vendor], [acx_cv_detect_cxx], [ - acx_cv_detect_cxx=unknown - if test $acx_cv_detect_cxx = unknown; then - $CXX --version 2>&1 | egrep -q "clang" - if test $? = 0; then - acx_cv_detect_cxx=clang - fi - fi - if test $acx_cv_detect_cxx = unknown; then - $CXX --version 2>&1 | egrep -q "GCC|GNU|gcc|gnu|g\+\+|Free S" - if test $? = 0; then - acx_cv_detect_cxx=GNU - fi - fi - if test $acx_cv_detect_cxx = unknown; then - $CXX --version 2>&1 | grep -q "Intel" - if test $? = 0; then - acx_cv_detect_cxx=Intel - fi - fi - if test $acx_cv_detect_cxx = unknown; then - $CXX --version 2>&1 | grep -q "Portland" - if test $? = 0; then - acx_cv_detect_cxx=Portland - fi - fi - if test $acx_cv_detect_cxx = unknown; then - $CXX -v 2>&1 | grep -q "Pathscale" - if test $? = 0; then - acx_cv_detect_cxx=Pathscale - fi - fi - if test $acx_cv_detect_cxx = unknown; then - $CXX -qversion 2>&1 | grep -q "IBM" - if test $? = 0; then - acx_cv_detect_cxx=IBM - fi - fi - ]) - - CXXVENDOR="$acx_cv_detect_cxx" -]) - - - - diff --git a/config/acx_enable_debugging.m4 b/config/acx_enable_debugging.m4 deleted file mode 100644 index 55c81628daf..00000000000 --- a/config/acx_enable_debugging.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# This function is used to add debug flags (e.g. -g) to CFLAGS and CXXFLAGS -# environment variables. Users are expected to specify their own debug flags for -# special use cases by adding appropriate values to CFLAGS and CXXFLAGS. -AC_DEFUN([ACX_ENABLE_DEBUGGING], [ - acx_enable_debugging="no" - acx_enable_debugging_flags="" - - # Allow the user to enable or disable debugging flag - AC_ARG_ENABLE([debugging], - [AC_HELP_STRING([--enable-debugging@<:@=yes|no|LEVEL@:>@], - [Enable debugging C and C++ compilers. You can also specify debug level (e.g. 3). @<:@default=no@:>@]) ], - [ - case $enableval in - yes) - acx_enable_debugging="yes" - acx_enable_debugging_flags="-g" - ;; - no) - ;; - *) - acx_enable_debugging="yes" - acx_enable_debugging_flags="-g$enableval" - ;; - esac - ]) - - # Test the flags and add them to flag variables if successful. - if test $acx_enable_debugging != no; then - ACX_CHECK_COMPILER_FLAG([C], [CFLAGS], [$acx_enable_debugging_flags], - [CFLAGS="$CFLAGS $acx_enable_debugging_flags"], - [AC_MSG_WARN([$CC does not accept $acx_enable_debugging_flags, no debugging flags will be used.])]) - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [$acx_enable_debugging_flags], - [CXXFLAGS="$CXXFLAGS $acx_enable_debugging_flags"], - [AC_MSG_WARN([$CXX does not accept $acx_enable_debugging_flags, no debugging flags will be used.])]) - fi -]) \ No newline at end of file diff --git a/config/acx_enable_gentensor.m4 b/config/acx_enable_gentensor.m4 deleted file mode 100644 index dafe4827ca7..00000000000 --- a/config/acx_enable_gentensor.m4 +++ /dev/null @@ -1,34 +0,0 @@ -# This function is used to add the gentensor flags and CXXFLAGS. These flags are -# necessary for the correlated quantum chemistry (e.g. mp2), but gentensor -# can't handle complex tensors. In this case disable gentensor (default behavior) -AC_DEFUN([ACX_ENABLE_GENTENSOR], [ - acx_enable_gentensor="no" - acx_enable_gentensor_flags="" - - # Allow the user to enable or disable gentensor flag - AC_ARG_ENABLE([gentensor], - [AC_HELP_STRING([--enable-gentensor@<:@=yes|no], - [Enable gentensor C and C++ compilers.]) ], - [ - case $enableval in - yes) - acx_enable_gentensor="yes" - acx_enable_gentensor_flags="-DUSE_GENTENSOR" - ;; - no) - ;; - *) - ;; - esac - ]) - - # Test the flags and add them to flag variables if successful. - if test $acx_enable_gentensor != no; then - ACX_CHECK_COMPILER_FLAG([C], [CFLAGS], [$acx_enable_gentensor_flags], - [CFLAGS="$CFLAGS $acx_enable_gentensor_flags"], - [AC_MSG_WARN([$CC does not accept $acx_enable_gentensor_flags, no gentensor flags will be used.])]) - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [$acx_enable_gentensor_flags], - [CXXFLAGS="$CXXFLAGS $acx_enable_gentensor_flags"], - [AC_MSG_WARN([$CXX does not accept $acx_enable_gentensor_flags, no gentensor flags will be used.])]) - fi -]) diff --git a/config/acx_enable_optimal.m4 b/config/acx_enable_optimal.m4 deleted file mode 100644 index a91aa9d286e..00000000000 --- a/config/acx_enable_optimal.m4 +++ /dev/null @@ -1,121 +0,0 @@ -# This function is used to add performace or system specific compiler flags to -# to CFLAGS and CXXFLAGS environment variables. Users are expected to specify -# their own optimization flags for unknown compilers, unknown systems, or -# special use cases by adding appropriate values to CFLAGS and CXXFLAGS. It -# should not be used for warning (e.g. -Wall), optimization (e.g. -O3), or debug -# (e.g. -g) flags. Those handled in acx_enable_warn.m4, acx_enable_optimization.m4, -# and acx_enable_debugging.m4 respectively. -AC_DEFUN([ACX_ENABLE_OPTIMAL], [ - acx_enable_optimal="" - acx_enable_optimal_save_cxxflags="$CXXFLAGS" - acx_enable_optimal_flags="" - acx_enable_optimal_compiler="$CXXVENDOR" - - # Allow the user to enable or disable optimal flag - AC_ARG_ENABLE([optimal], - [AC_HELP_STRING([--enable-optimal@<:@=yes|no|GNU|clang|Pathscale|Portland|Intel|IBM@:>@], - [Auto detect optimal CXXFLAGS for compiler and known systems.@<:@default=yes@:>@])], - [ - case $enableval in - yes) - acx_enable_optimal="yes" - ;; - no) - acx_enable_optimal="no" - ;; - *) - acx_enable_optimal="yes" - acx_enable_optimal_compiler="$enableval" - esac - ], - [acx_enable_optimal="yes"] - ) - - # Set the flags for the specific compilers and systems - if test $acx_enable_optimal != "no"; then - AC_LANG_SAVE - AC_LANG([C++]) - case $acx_enable_optimal_compiler in - GNU) - # Delete trailing -stuff from X.X.X-stuff then parse - CXXVERSION=[`$CXX -dumpversion | sed -e 's/-.*//'`] - CXXMAJOR=[`echo $CXXVERSION | sed -e 's/\.[.0-9a-zA-Z\-_]*//'`] - CXXMINOR=[`echo $CXXVERSION | sed -e 's/[0-9]*\.//' -e 's/\.[0-9]*//'`] - CXXMICRO=[`echo $CXXVERSION | sed -e 's/[0-9]*\.[0-9]*\.//'`] - AC_MSG_NOTICE([Setting compiler flags for GNU C++ major=$CXXMAJOR minor=$CXXMINOR micro=$CXXMICRO]) - - # Flags for all GCC variants - acx_enable_optimal_flags="$acx_enable_optimal_flags -ffast-math" - if test $enable_cpp0x = "yes"; then - acx_enable_optimal_flags="$acx_enable_optimal_flags -std=c++0x" - fi - - # Add GCC system specific flags - if test "x$HAVE_CRAYXT" = xyes; then - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [-march=barcelona], - [acx_enable_optimal_flags="$acx_enable_optimal_flags -march=barcelona"]) - elif test "x$HAVE_IBMBGP" = xyes; then - acx_enable_optimal_flags="" - else - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [-march=native], - [acx_enable_optimal_flags="$acx_enable_optimal_flags -march=native"]) - fi - - # Add flags for Intel x86 architectures. - case $host_cpu in - ??86*) - acx_enable_optimal_flags="$acx_enable_optimal_flags -mfpmath=sse -msse -mpc64" - ;; - esac - ;; - - clang) - acx_enable_optimal_flags="$acx_enable_optimal_flags" - ;; - - Pathscale) - acx_enable_optimal_flags="$acx_enable_optimal_flags" - if test "x$HAVE_CRAYXT" = xyes; then - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [-march=barcelona], - [acx_enable_optimal_flags="$acx_enable_optimal_flags -march=barcelona"]) - fi - ;; - - Portland) - acx_enable_optimal_flags="$acx_enable_optimal_flags -fastsse -Mflushz -Mcache_align" - AC_MSG_NOTICE([Appending -pgf90libs to LIBS so can link against Fortran BLAS/linalg]) - LIBS="$LIBS -pgf90libs" - if test "x$HAVE_CRAYXT" = xyes; then - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [-tp barcelona-64], - [acx_enable_optimal_flags="$acx_enable_optimal_flags -tp barcelona-64"]) - fi - ;; - - Intel) - acx_enable_optimal_flags="$acx_enable_optimal_flags -ip -no-prec-div -mkl=sequential -xHOST" - if test $enable_cpp0x = "yes"; then - acx_enable_optimal_flags="$acx_enable_optimal_flags -std=c++0x" - fi -#-use-intel-optimized-headers -fp-model fast=2 -inline-level=2 - ;; - - IBM) - acx_enable_optimal_flags="$acx_enable_optimal_flags" - if test "x$HAVE_IBMBGP" = xyes; then - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [ -qtune=450 -qarch=450d -qlanglvl=extended], - [acx_enable_optimal_flags="$acx_enable_optimal_flags -qtune=450 -qarch=450d -qlanglvl=extended "]) - fi - ;; - - *) - AC_MSG_WARN([Optimal flags not set for $acx_enable_optimal_compile compiler]) - ;; - esac - - # Test the flags and add them to flag variables if successful. - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [$acx_enable_optimal_flags], - [CXXFLAGS="$CXXFLAGS $acx_enable_optimal_flags"], - [AC_MSG_WARN([$CXX does not accept $acx_enable_optimal_flags, no optimal flags will be used.])]) - fi - -]) diff --git a/config/acx_enable_optimization.m4 b/config/acx_enable_optimization.m4 deleted file mode 100644 index 49c8ea38b8a..00000000000 --- a/config/acx_enable_optimization.m4 +++ /dev/null @@ -1,73 +0,0 @@ -# This function is used to add compiler specific optimization flags (e.g. -O3) -# to CFLAGS and CXXFLAGS environment variables. Users are expected to specify -# their own optimization flags for unknown compilers or special use cases by -# adding appropriate values to CFLAGS and CXXFLAGS. -AC_DEFUN([ACX_ENABLE_OPTIMIZATION], [ - # Specify the default optimization level for a given compiler. This value is - # appended to "-O" in the flag variables. - default_optimization="" - case $CXXVENDOR in - GNU) - default_optimization="3" - ;; - clang) - default_optimization="3" - ;; - Pathscale) - default_optimization="fast" - ;; - Portland) - default_optimization="3" - ;; - Intel) - default_optimization="3" - ;; - IBM) - default_optimization="3" - ;; - *) - default_optimization="2" - ;; - esac - - acx_enable_optimization="yes" - acx_enable_optimization_flags="" - - # Allow the user to enable or disable optimization flag - AC_ARG_ENABLE([optimization], - [AC_HELP_STRING([--enable-optimization@<:@=yes|no|OPTION@:>@], - [Enable optimization for C and C++ (e.g. -O2) @<:@default=yes@:>@]) ], - [ - case $enableval in - yes) - acx_enable_optimization_flags="-O$default_optimization" - ;; - no) - acx_enable_optimization="no" - ;; - *) - acx_enable_optimization_flags="-O$enableval" - ;; - esac - ], - [ - if test "x$acx_enable_debugging" == xno; then - acx_enable_optimization_flags="-O$default_optimization" - else - acx_enable_optimization_flags="-O0" - AC_MSG_WARN([Optimizations is disabled, because debugging is enabled. Add --enable-optimization to overide this behavior.]) - fi - ] - ) - - # Test the flags and add them to flag variables if successful. - if test $acx_enable_optimization != no; then - ACX_CHECK_COMPILER_FLAG([C], [CFLAGS], [$acx_enable_optimization_flags], - [CFLAGS="$CFLAGS $acx_enable_optimization_flags"], - [AC_MSG_WARN([$CC does not accept $acx_enable_optimization_flags, no optimization flags will be used.])]) - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [$acx_enable_optimization_flags], - [CXXFLAGS="$CXXFLAGS $acx_enable_optimization_flags"], - [AC_MSG_WARN([$CXX does not accept $acx_enable_optimization_flags, no optimization flags will be used.])]) - fi - -]) \ No newline at end of file diff --git a/config/acx_enable_task_profiler.m4 b/config/acx_enable_task_profiler.m4 deleted file mode 100644 index 3745e57c9c7..00000000000 --- a/config/acx_enable_task_profiler.m4 +++ /dev/null @@ -1,60 +0,0 @@ -AC_DEFUN([ACX_ENABLE_TASK_PROFILER], [ - AC_LANG_SAVE - AC_LANG([C++]) - - acx_enable_task_profiler="" - - # Allow the user to enable or disable warnings - AC_ARG_ENABLE([task-profiler], - [AC_HELP_STRING([--enable-task-profiler], - [Enable task profiler that collects per-task start and stop times.])], - [ - case $enableval in - yes) - acx_enable_task_profiler="yes" - ;; - no) - acx_enable_task_profiler="no" - ;; - *) - acx_enable_task_profiler="yes" - esac - ], - [acx_enable_task_profiler="no"] - ) - - # Automatically specify the warning flags for known compilers. - if test $acx_enable_task_profiler != "no"; then - AC_CHECK_HEADER([execinfo.h], [], [AC_MSG_ERROR([execinfo.h is required by the task profiler.])]) - AC_CHECK_HEADER([cxxabi.h], [], [AC_MSG_ERROR([cxxabi.h is required by the task profiler.])]) - AC_DEFINE([MADNESS_TASK_PROFILING],[1],[Define to enable task profiler.]) - if test $ON_A_MAC = "no"; then - case $acx_enable_optimal_compiler in - GNU) - LDFLAGS="$LDFLAGS -rdynamic" - ;; - - clang) - LDFLAGS="$LDFLAGS -rdynamic" - ;; - - Pathscale) - ;; - - Portland) - ;; - - Intel) - ;; - - IBM) - ;; - - *) - ;; - esac - fi - fi - - AC_LANG_RESTORE -]) diff --git a/config/acx_enable_warn.m4 b/config/acx_enable_warn.m4 deleted file mode 100644 index 9ef0fb5782a..00000000000 --- a/config/acx_enable_warn.m4 +++ /dev/null @@ -1,66 +0,0 @@ -# This function is used to add compiler specific warning flags to CFLAGS and -# CXXFLAGS environment variables. Users are expected to specify their own warning -# flags for unknown compilers or special use cases by adding appropriate values -# to CFLAGS and CXXFLAGS. -AC_DEFUN([ACX_ENABLE_WARN], [ - acx_enable_warn="" - acx_enable_warn_flags="" - acx_enable_warn_compiler="$CXXVENDOR" - - # Allow the user to enable or disable warnings - AC_ARG_ENABLE([warning], - [AC_HELP_STRING([--enable-warning@<:@=yes|no|GNU|clang|Pathscale|Portland|Intel|IBM@:>@], - [Automatically set warnings for compiler.@<:@default=yes@:>@])], - [ - case $enableval in - yes) - acx_enable_warn="yes" - ;; - no) - acx_enable_warn="no" - ;; - *) - acx_enable_warn="yes" - acx_enable_warn_compiler="$enableval" - esac - ], - [acx_enable_warn="yes"] - ) - - # Automatically specify the warning flags for known compilers. - if test $acx_enable_warn != "no"; then - case $acx_enable_warn_compiler in - GNU) - acx_enable_warn_flags="-Wall -Wno-strict-aliasing -Wno-deprecated -Wno-unused-local-typedefs" - ;; - clang) - acx_enable_warn_flags="-Wall" - ;; - Pathscale) - acx_enable_warn_flags="-Wall" - ;; - Portland) - acx_enable_warn_flags="" - ;; - Intel) - acx_enable_warn_flags="-Wall -diag-disable remark,279,654,1125" - ;; - IBM) - acx_enable_warn_flags="-qflag=w:w" - ;; - *) - AC_MSG_WARN([Warning flags not set for $acx_enable_optimal_compile compiler]) - ;; - esac - - # Test the flags and add them to flag variables if successful. - ACX_CHECK_COMPILER_FLAG([C], [CFLAGS], [$acx_enable_warn_flags], - [CFLAGS="$CFLAGS $acx_enable_warn_flags"], - [AC_MSG_WARN([$CC does not accept $acx_enable_warn_flags, no warning flags will be used.])]) - ACX_CHECK_COMPILER_FLAG([C++], [CXXFLAGS], [$acx_enable_warn_flags], - [CXXFLAGS="$CXXFLAGS $acx_enable_warn_flags"], - [AC_MSG_WARN([$CXX does not accept $acx_enable_warn_flags, no warning flags will be used.])]) - fi - - -]) diff --git a/config/acx_fortran_symbols.m4 b/config/acx_fortran_symbols.m4 deleted file mode 100644 index bcdc89f4a1e..00000000000 --- a/config/acx_fortran_symbols.m4 +++ /dev/null @@ -1,125 +0,0 @@ -AC_DEFUN([ACX_FORTRAN_SYMBOLS], [ -# Dubiously checks for Fortran linking conventions and BLAS+LAPACK at the same time -# mostly to avoid the need for having a fortran compiler installed - -# Check for no underscore first since IBM BG ESSL seems to define dgemm with/without underscore -# but dsyev only without underscore ... but AMD ACML also defines both but with different -# interfaces (fortran and c) ... ugh. Hardwire linking for bgp and restore to original order. - - AC_MSG_NOTICE([Checking Fortran-C linking conventions (dgemm -> ?)]) - fsym=no - - if test $host = "powerpc-bgp-linux-gnu"; then - fsym="lc" - AC_MSG_NOTICE([Fortran linking convention is $fsym]) - AC_DEFINE([FORTRAN_LINKAGE_LC],[1],[Fortran-C linking convention lower case (no underscore)]) - fi - if test $host = "powerpc64-bgq-linux-gnu"; then - fsym="lc" - AC_MSG_NOTICE([Fortran linking convention is $fsym]) - AC_DEFINE([FORTRAN_LINKAGE_LC],[1],[Fortran-C linking convention lower case (no underscore)]) - fi - if test $fsym = no; then - AC_CHECK_FUNC([dgemm_],[fsym="lcu"]) - fi - if test $fsym = no; then - AC_CHECK_FUNC([dgemm],[fsym="lc"]) - fi - if test $fsym = no; then - AC_CHECK_FUNC([dgemm__],[fsym="lcuu"]) - fi - if test $fsym = no; then - AC_CHECK_FUNC([DGEMM],[fsym="uc"]) - fi - if test $fsym = no; then - AC_CHECK_FUNC([DGEMM_],[fsym="ucu"]) - fi - -# Well there is nothing in the existing path that gives us what we are -# looking for so try looking for some standard examples so that common -# Linux, Apple and configurations work automatically. We save the -# BLAS library name instead of adding it directly to LIBS since it -# will need to be appened after any LAPACK library that is yet to -# be found. - -# OS X - if test $fsym$ON_A_MAC = noyes; then - LDFLAGS="$LDFLAGS -framework Accelerate" - fsym="lcu" - AC_MSG_NOTICE([Using Accelerate framework for BLAS support]) - fi - -# Linux - BLASLIB="" - if test $fsym = no; then - AC_LANG_SAVE - AC_LANG([C++]) - for blaslib in openblas blas; do - AC_CHECK_LIB([$blaslib], - [dgemm_], - [fsym="lcu"; BLASLIB="-l$blaslib"; AC_MSG_NOTICE([Found dgemm_ in $blaslib]); break], - [AC_MSG_NOTICE([Unable to find dgemm_ in $blaslib])], - [-lpthread]) - done - AC_LANG_RESTORE - fi - -# others ... insert here or extend above for loop if correct symbol is dgemm_ - if test $fsym = no; then - AC_MSG_ERROR([Could not find dgemm with any known linking conventions]) - fi - - AC_MSG_NOTICE([Fortran linking convention is $fsym]) - -# Now verify that we have at least one of the required lapack routines and again attempt to search for candidate libraries if nothing is found - - if test $fsym = lc; then - AC_DEFINE([FORTRAN_LINKAGE_LC],[1],[Fortran-C linking convention lower case (no underscore)]) - lapacksym=dsyev - fi - if test $fsym = lcu; then - AC_DEFINE([FORTRAN_LINKAGE_LCU],[1],[Fortran-C linking convention lower case with single underscore]) - lapacksym=dsyev_ - fi - if test $fsym = lcuu; then - AC_DEFINE([FORTRAN_LINKAGE_LCUU],[1],[Fortran-C linking convention lower case with double underscore]) - lapacksym=dsyev__ - fi - if test $fsym = uc; then - AC_DEFINE([FORTRAN_LINKAGE_UC],[1],[Fortran-C linking convention upper case]) - lapacksym=DSYEV - fi - if test $fsym = ucu; then - AC_DEFINE([FORTRAN_LINKAGE_UCU],[1],[Fortran-C linking convention upper case with single underscore]) - lapacksym=DSYEV_ - fi - - LAPACKLIB="" - foundlapack=no - AC_CHECK_FUNC([$lapacksym],[foundlapack=yes],AC_MSG_NOTICE([Could not find dsyev with selected linking convention in default library path])) - - LAPACKLIB="" - if test $foundlapack = no; then - AC_LANG_SAVE - AC_LANG([C++]) - for lapacklib in lapack; do - AC_CHECK_LIB([$lapacklib], - [$lapacksym], - [foundlapack=yes; LAPACKLIB="-l$lapacklib"; AC_MSG_NOTICE([Found $lapacksym in $lapacklib]); break], - [AC_MSG_NOTICE([Unable to find $lapacksym in $lapackib])], - [$BLASLIB -lpthread]) - done - AC_LANG_RESTORE - fi - - if test $foundlapack = no; then - AC_MSG_NOTICE([Could not find $lapacksym in any known library ... specify LAPACK library via LIBS]) - fi - - LIBS="$LIBS $LAPACKLIB $BLASLIB" -]) - - - - - diff --git a/config/acx_gnu_hashmap.m4 b/config/acx_gnu_hashmap.m4 deleted file mode 100644 index ec8a9486621..00000000000 --- a/config/acx_gnu_hashmap.m4 +++ /dev/null @@ -1,34 +0,0 @@ -AC_DEFUN([ACX_GNU_HASHMAP], [ - AC_LANG_PUSH([C++]) - gotgnuhashmap=no - AC_MSG_CHECKING([for GNU hashmap in '' and namespace __gnu_cxx]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -using __gnu_cxx::hash_map; ]])], - [ AC_DEFINE(GNU_HASHMAP_NAMESPACE, __gnu_cxx, [GNU hashmap namespace]) - AC_DEFINE(INCLUDE_EXT_HASH_MAP,[1],[If defined header is in ext directory]) - AC_MSG_RESULT([yes]) - gotgnuhashmap=yes ], - [AC_MSG_RESULT([no])]) - - if test $gotgnuhashmap = no; then - AC_MSG_CHECKING([for GNU hashmap in '' and namespace _SLTP_STD]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -using _STLP_STD::hash_map; ]])], - [ AC_DEFINE(GNU_HASHMAP_NAMESPACE, _STLP_STD, [GNU hashmap namespace]) - AC_MSG_RESULT([yes]) - gotgnuhashmap=yes ], - [AC_MSG_RESULT([no])]) - fi - AC_LANG_POP([C++]) - if test $gotgnuhashmap = no; then - AC_MSG_ERROR([Could not find GNU hashmap with any known combination of header+namespace]) - fi - - AC_DEFINE(HAVE_GNU_HASHMAP,[1],[Enable if have GNU hashmap]) -]) - - - - diff --git a/config/acx_ibmbgp.m4 b/config/acx_ibmbgp.m4 deleted file mode 100644 index 556f1d26df8..00000000000 --- a/config/acx_ibmbgp.m4 +++ /dev/null @@ -1,40 +0,0 @@ -AC_DEFUN([ACX_IBMBGP],[ - # If on an IBMBGP - # - defines HAVE_IBMBGP=1 in headers - # - defines HAVE_IBMBGP=yes in the script - # - sets thread binding to "1 0 2" - # - enables spinlocks - # - sets the host architecture to powerpc-bgp-linux-gnu - # - #AC_CHECK_FILE([/bgsys], [HAVE_IBMBGP=yes AC_DEFINE([HAVE_IBMBGP],[1],[Defined if we are running on an IBM Blue Gene/P])],[]) - echo "int main()" > __bgp__.cc - echo "{" >> __bgp__.cc - echo "#ifdef __bgp__" >> __bgp__.cc - echo "return 0;" >> __bgp__.cc - echo "#else" >> __bgp__.cc - echo "choke me" >> __bgp__.cc - echo "#endif" >> __bgp__.cc - echo "}" >> __bgp__.cc - mpicxx __bgp__.cc >& /dev/null - if test $? = 0; then - HAVE_IBMBGP=yes - fi - /bin/rm __bgp__.cc - if test "x$HAVE_IBMBGP" = x; then - mpicxx --version -c | grep -q bgp - if test $? = 0; then - HAVE_IBMBGP=yes - fi - fi - if test "x$HAVE_IBMBGP" = xyes; then - AC_MSG_NOTICE([IBM Blue Gene/P detected]) - AC_DEFINE(HAVE_IBMBGP,[1],[Defined if we are running on an IBM Blue Gene/P]) - acx_default_enable_all_static=yes - host="powerpc-bgp-linux" - host_triplet="powerpc-bgp-linux" - - BIND="-1 -1 -1" - AC_DEFINE(USE_SPINLOCKS, [1], [Define if should use spinlocks]) - fi -]) - diff --git a/config/acx_ibmbgq.m4 b/config/acx_ibmbgq.m4 deleted file mode 100644 index 43f8796cf16..00000000000 --- a/config/acx_ibmbgq.m4 +++ /dev/null @@ -1,34 +0,0 @@ -AC_DEFUN([ACX_IBMBGQ],[ - # If on an IBMBGQ - # - defines HAVE_IBMBGQ=1 in headers - # - defines HAVE_IBMBGQ=yes in the script - # - sets thread binding to "1 0 2" - # - enables spinlocks - # - sets the host architecture to powerpc-bgq-linux-gnu - # - #AC_CHECK_FILE([/bgsys], [HAVE_IBMBGQ=yes AC_DEFINE([HAVE_IBMBGQ],[1],[Defined if we are running on an IBM Blue Gene/Q])],[]) - echo "int main()" > __bgq__.cc - echo "{" >> __bgq__.cc - echo "#ifdef __bgq__" >> __bgq__.cc - echo "return 0;" >> __bgq__.cc - echo "#else" >> __bgq__.cc - echo "choke me" >> __bgq__.cc - echo "#endif" >> __bgq__.cc - echo "}" >> __bgq__.cc - mpicxx __bgq__.cc >& /dev/null - if test $? = 0; then - AC_MSG_NOTICE([IBM Blue Gene/Q detected]) - HAVE_IBMBGQ=yes - AC_DEFINE(HAVE_IBMBGQ,[1],[Defined if we are running on an IBM Blue Gene/Q]) - acx_default_enable_all_static=yes - fi - /bin/rm __bgq__.cc - if test "x$HAVE_IBMBGQ" = xyes; then - host="powerpc64-bgq-linux" - host_triplet="powerpc64-bgq-linux" - - BIND="-1 -1 -1" - AC_DEFINE(USE_SPINLOCKS, [1], [Define if should use spinlocks]) - fi -]) - diff --git a/config/acx_mac.m4 b/config/acx_mac.m4 deleted file mode 100644 index 74e0d232bd8..00000000000 --- a/config/acx_mac.m4 +++ /dev/null @@ -1,19 +0,0 @@ -AC_DEFUN([ACX_MAC], [ - # If on a MAC - # - kiss steve jobs' ass - # - get an iphone - # - get another mac - ON_A_MAC="no" - uname -a | grep -iq Darwin - if test $? = 0; then - ITS_A_MAC="yes" - ON_A_MAC="yes" - LDFLAGS="-Wl,-no_pie $LDFLAGS" - AC_MSG_NOTICE([You are building on a mac ... now tell ten of your friends.]) - AC_DEFINE(ON_A_MAC,[1],[Set if building on a mac]) - fi -]) - - - - diff --git a/config/acx_mpi.m4 b/config/acx_mpi.m4 deleted file mode 100644 index ac07c0fa321..00000000000 --- a/config/acx_mpi.m4 +++ /dev/null @@ -1,26 +0,0 @@ -AC_DEFUN([ACX_MPI], [ - # We were using the full macro from ACX but this forced AC_PROG_C or AC_PROG_CXX to - # be run before we had overridden the compilers which meant that some confdef.h - # entries were incorrect (specifically std::exit problem with PGI) - - # Disable MPI C++ bindings. - CPPFLAGS="$CPPFLAGS -DMPICH_SKIP_MPICXX=1 -DOMPI_SKIP_MPICXX=1" - - AC_ARG_VAR(MPICC,[MPI C compiler command]) - AC_CHECK_PROGS(MPICC, mpicc hcc mpcc mpcc_r mpxlc cmpicc, $CC) - acx_mpi_save_CC="$CC" - CC="$MPICC" - AC_SUBST(MPICC) - - AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) - AC_CHECK_PROGS(MPICXX, mpicxx mpic++ mpiCC mpCC hcp mpxlC mpxlC_r cmpic++, $CXX) - acx_mpi_save_CXX="$CXX" - CXX="$MPICXX" - AC_SUBST(MPICXX) - - #AC_ARG_VAR(MPIF77,[MPI Fortran compiler command]) - #AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf mpf77 mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r cmpifc cmpif90c, $F77) - #acx_mpi_save_F77="$F77" - #F77="$MPIF77" - #AC_SUBST(MPIF77) -]) diff --git a/config/acx_posix_memalign.m4 b/config/acx_posix_memalign.m4 deleted file mode 100644 index 11a113cd808..00000000000 --- a/config/acx_posix_memalign.m4 +++ /dev/null @@ -1,43 +0,0 @@ -AC_DEFUN([ACX_POSIX_MEMALIGN], [ - AC_CHECK_FUNC([posix_memalign],[gotpm=1], [gotpm=0]) - if test $gotpm = 1; then - AC_DEFINE([HAVE_POSIX_MEMALIGN], [1], [Set if have posix_memalign]) - elif test "$ON_A_MAC" = "yes"; then - AC_DEFINE([HAVE_POSIX_MEMALIGN], [0], [Set if have posix_memalign]) - else - AC_MSG_WARN([[ posix_memalign NOT FOUND ... enabling override of new/delete ... THIS WILL BE SLOW ]]) - AC_DEFINE([WORLD_GATHER_MEM_STATS], [1], [Set if MADNESS gathers memory statistics]) - fi - - # look for both version of posix_memalign, with and without throw() - gotpmh=0 - if test $gotpm = 1; then - AC_MSG_CHECKING([if missing declaration of posix_memalign in stdlib.h]) - AC_LANG_SAVE - AC_LANG([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -extern "C" int posix_memalign(void **memptr, size_t alignment, size_t size) throw();]], -[[void *m; posix_memalign(&m, 16, 1024);]])], - [AC_MSG_RESULT([no]) - gotpmh=1 - ] - ) - if test $gotpmh = 0; then - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -extern "C" int posix_memalign(void **memptr, size_t alignment, size_t size);]], -[[void *m; posix_memalign(&m, 16, 1024);]])], - [AC_MSG_RESULT([no]) - gotpmh=1 - ], - [ AC_DEFINE(MISSING_POSIX_MEMALIGN_PROTO, [1], [Set if the posix_memalign prototype is missing]) - AC_MSG_RESULT([yes]) - ] - ) - fi - AC_LANG_RESTORE - fi -]) diff --git a/config/acx_std_abs.m4 b/config/acx_std_abs.m4 deleted file mode 100644 index ac5deef7884..00000000000 --- a/config/acx_std_abs.m4 +++ /dev/null @@ -1,27 +0,0 @@ -AC_DEFUN([ACX_STD_ABS], [ - AC_MSG_CHECKING([std::abs(long)]) - AC_LANG_PUSH([C++]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -long (*absptr)(long) = &std::abs; -long a = -1; -long b = std::abs(a); -]])], - [AC_DEFINE(HAVE_STD_ABS_LONG,[1],[Define if have std::abs(long)]) have_abs_long=yes], - [have_abs_long=no]) - AC_MSG_RESULT([$have_abs_long]) - if test X"$have_abs_long" = Xno; then - AC_MSG_CHECKING([std::labs(long)]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -long (*labsptr)(long) = &std::labs; -long a = -1l; -long b = labs(a); -]])], - [AC_DEFINE(HAVE_LABS,[1],[Define if have std::labs(long)]) have_std_labs=yes], - [have_std_labs=no]) - AC_MSG_RESULT([$have_std_labs]) - fi -]) diff --git a/config/acx_unqal_stat_decl.m4 b/config/acx_unqal_stat_decl.m4 deleted file mode 100644 index 95e25748255..00000000000 --- a/config/acx_unqal_stat_decl.m4 +++ /dev/null @@ -1,14 +0,0 @@ -AC_DEFUN([ACX_UNQUALIFIED_STATIC_DECL], [ - AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([if unqualified static declarations are considered]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[template - static inline void f(T* a) {}; - template void g(T* a) { f(a); } - template void g(int* a);]], - [[]])], - [AC_DEFINE(HAVE_UNQUALIFIED_STATIC_DECL, [1], [Set if compiler will instantiate static templates]) AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) - AC_LANG_POP([C++]) -]) diff --git a/config/acx_with_elemental.m4 b/config/acx_with_elemental.m4 deleted file mode 100644 index 945faceb7d1..00000000000 --- a/config/acx_with_elemental.m4 +++ /dev/null @@ -1,37 +0,0 @@ -AC_DEFUN([ACX_WITH_ELEMENTAL], -[ - acx_with_elemental=no - AC_ARG_WITH([elemental], - [AS_HELP_STRING([--with-elemental@<:@=DIR@:>@], [Build with Elemental headers.])], - [ - case $withval in - yes) - acx_with_elemental=yes - ;; - no) - acx_with_elemental=no - ;; - *) - acx_with_elemental=yes - CPPFLAGS="-I$withval/include $CPPFLAGS" - #ELEMENTAL_LIBS="-L$withval/lib -lelemental -lpmrrr -lelem-dummy-lib" - #for 0.81 - ELEMENTAL_LIBS="-L$withval/lib -lelemental -lpmrrr " - if test -f "$withval/lib/liblapack-addons.a"; then - ELEMENTAL_LIBS="$ELEMENTAL_LIBS -llapack-addons" - fi - LIBS="$ELEMENTAL_LIBS $LIBS" - ;; - esac - ] - ) - - if test "$acx_with_elemental" != no; then - # Check for the pressence of Elemental header files. - AC_CHECK_HEADER([elemental.hpp], [], - [AC_MSG_ERROR([Unable to find the elemental.hpp header file.])]) - AC_DEFINE([MADNESS_HAS_ELEMENTAL], [1], - [Madness will use Elemental for parallel linear algebra operations]) - MADNESS_HAS_ELEMENTAL=1 - fi -]) diff --git a/config/acx_with_google_perf.m4 b/config/acx_with_google_perf.m4 deleted file mode 100644 index cedb1734978..00000000000 --- a/config/acx_with_google_perf.m4 +++ /dev/null @@ -1,45 +0,0 @@ -AC_DEFUN([ACX_WITH_GOOGLE_PERF], [ - acx_with_google_perf="" - AC_ARG_WITH([google-perf], - [AS_HELP_STRING([--without-google-perf], - [Disables use of Google fast malloc.profiler/heapchecker; --with-google-perf=directory overrides install path])], - [ - case $withval in - yes) - acx_with_google_perf="yes" - ;; - no) - acx_with_google_perf="no" - ;; - *) - LIBS="$LIBS -L$withval/lib" - CPPFLAGS="-I$withval/include $CPPFLAGS" - acx_with_google_perf="$withval" - esac - ], - [acx_with_google_perf="yes"] - ) - - if test $acx_with_google_perf != "no"; then - AC_LANG_SAVE - AC_LANG([C++]) - - AC_CHECK_LIB([tcmalloc_and_profiler], [ProfilerStart], - [LIBS="-lprofiler -ltcmalloc $LIBS" - have_profiler=yes - AC_MSG_NOTICE([Google profiler and fast malloc found]) - AC_DEFINE([MADNESS_HAS_GOOGLE_PERF], [1], [Define if using Google PerformanceTools])], - [have_profiler=no - AC_MSG_NOTICE(["Unable to link with libprofiler+libtcmalloc])]) - - if test $have_profiler = "no" ; then - AC_CHECK_LIB([tcmalloc_minimal], [malloc], - [LIBS="-ltcmalloc_minimal $LIBS" - AC_MSG_NOTICE([Google minimal fast malloc found]) - AC_DEFINE([MADNESS_HAS_GOOGLE_PERF_MINIMAL], [1], [Define if using Google PerformanceTools without libunwind])], - [AC_MSG_NOTICE(["Unable to link with libtcmalloc_minimal])]) - fi - - AC_LANG_RESTORE - fi -]) diff --git a/config/acx_with_google_test.m4 b/config/acx_with_google_test.m4 deleted file mode 100644 index 7d588850f02..00000000000 --- a/config/acx_with_google_test.m4 +++ /dev/null @@ -1,41 +0,0 @@ -AC_DEFUN([ACX_WITH_GOOGLE_TEST], [ - acx_with_google_test="" - AC_ARG_WITH([google-test], - [AS_HELP_STRING([--with-google-test@<:@=yes|no@:>@], - [Enables use of Google unit test @<:@default=no@:>@])], - [ - case $withval in - yes) - acx_with_google_test="yes" - ;; - *) - acx_with_google_test="no" - esac - ], - [ - acx_with_google_test="no" - ] - ) - - AC_ARG_VAR([GTEST_CPPFLAGS], [C-like preprocessor flags for Google Test.]) - AC_ARG_VAR([GTEST_CXXFLAGS], [C++ compile flags for Google Test.]) - AC_ARG_VAR([GTEST_LDFLAGS], [Linker path and option flags for Google Test.]) - AC_ARG_VAR([GTEST_LIBS], [Library linking flags for Google Test.]) - - - if test $acx_with_google_test == "no"; then - AC_MSG_NOTICE([Configuring with Google Unit Test --- no]) - else - AC_MSG_NOTICE([Configuring with Google Unit Test --- yes]) - - # Set preprocessor and build variables - AC_DEFINE([MADNESS_HAS_GOOGLE_TEST], [1], [Define if should use Google unit testing]) - AC_SUBST([GTEST_CPPFLAGS]) - AC_SUBST([GTEST_CXXFLAGS]) - AC_SUBST([GTEST_LDFLAGS]) - AC_SUBST([GTEST_LIBS]) - - fi - - AM_CONDITIONAL([MADNESS_HAS_GOOGLE_TEST], [test $acx_with_google_test != no]) -]) diff --git a/config/acx_with_libunwind.m4 b/config/acx_with_libunwind.m4 deleted file mode 100644 index 11d3b4a9c8c..00000000000 --- a/config/acx_with_libunwind.m4 +++ /dev/null @@ -1,30 +0,0 @@ -AC_DEFUN([ACX_WITH_LIBUNWIND], [ - acx_with_libunwind="" - AC_ARG_WITH([libunwind], - [AS_HELP_STRING([--with-libunwind@<:@=Install DIR@:>@], - [Enables use of libunwind, required for Google profiler and heap checker])], - [ - case $withval in - yes) - acx_with_libunwind="yes" - ;; - no) - acx_with_libunwind="no" - ;; - *) - CPPFLAGS="$CPPFLAGS -I$with_libunwind/include" - LIBS="$LIBS -L$with_libunwind/lib" - acx_with_libunwind="$withval" - esac - ], - [acx_with_libunwind="no"] - ) - if test $acx_with_libunwind != "no"; then - AC_LANG_SAVE - AC_LANG_C - AC_CHECK_HEADER([libunwind.h], [], [AC_MSG_ERROR([Unable to compile with the libunwind.])]) - AC_CHECK_LIB([unwind], [_Unwind_GetRegionStart], [LIBS="$LIBS -lunwind"], [AC_MSG_ERROR(["Unable to link with libunwind])]) - AC_DEFINE(MADNESS_HAS_LIBUNWIND, [1], [Define if should use libunwind for Google performance tools]) - AC_LANG_RESTORE - fi -]) diff --git a/config/acx_with_libxc.m4 b/config/acx_with_libxc.m4 deleted file mode 100644 index 22f4a902800..00000000000 --- a/config/acx_with_libxc.m4 +++ /dev/null @@ -1,42 +0,0 @@ -AC_DEFUN([ACX_WITH_LIBXC], [ - acx_with_libxc="" - AC_ARG_WITH([libxc], - [AS_HELP_STRING([--with-libxc@<:@=Install DIR@:>@], - [Enables use of the libxc library of density functionals])], - [ - case $withval in - yes) - acx_with_libxc="yes" - ;; - no) - acx_with_libxc="no" - ;; - *) - CPPFLAGS="-I$withval/include $CPPFLAGS" - LIBS="$LIBS -L$withval/lib" - acx_with_libxc="$withval" - esac - ], - [acx_with_libxc="yes"] - ) - - if test $acx_with_libxc != "no"; then - AC_LANG_SAVE - AC_LANG([C++]) - AC_CHECK_HEADERS([xc.h xc_funcs.h], [], - [acx_with_libxc=no - AC_MSG_NOTICE([Unable to include with xc.h or xc_func.h])]) - AC_CHECK_LIB([xc], [xc_func_end], [], - [acx_with_libxc=no - AC_MSG_NOTICE([Unable to link with libxc])]) - - - AC_LANG_RESTORE - fi - - if test $acx_with_libxc != "no"; then - AC_DEFINE([MADNESS_HAS_LIBXC], [1], [Define if using libxc]) - fi - - AM_CONDITIONAL([MADNESS_HAS_LIBXC], [test $acx_with_libxc != "no"]) -]) diff --git a/config/acx_with_mkl.m4 b/config/acx_with_mkl.m4 deleted file mode 100644 index 36e378ff4cd..00000000000 --- a/config/acx_with_mkl.m4 +++ /dev/null @@ -1,75 +0,0 @@ -AC_DEFUN([ACX_WITH_MKL], [ - - AC_ARG_VAR([MKLROOT], [Intel MKL install directory.]) - - AC_ARG_WITH([mkl], - [AS_HELP_STRING([--with-mkl@<:@=yes|no|check|DIR@:>@], - [Enables use of Intel MKL @<:@default=check@:>@])], - [ - case $withval in - yes) - acx_with_mkl="yes" - ;; - no) - acx_with_mkl="no" - ;; - *) - acx_with_mkl="$withval" - ;; - esac - ], - [ - acx_with_mkl="check" - ] - ) - - if test $acx_with_mkl != "no"; then - AC_MSG_CHECKING([Intel MKL]) - - case $acx_with_mkl in - yes|check) - if test -d "$MKLROOT"; then - acx_mkl_root="$MKLROOT" - elif test -d "/opt/intel/mkl"; then - acx_mkl_root="/opt/intel/mkl" - else - acx_mkl_root="no" - fi - ;; - *) - if test -d "$acx_with_mkl"; then - acx_mkl_root="$acx_with_mkl" - else - acx_mkl_root="no" - fi - ;; - esac - - # Show results - AC_MSG_RESULT([$acx_mkl_root]) - - if test $acx_mkl_root != "no"; then - # Set the MKL library name based on the integer type - if test $acx_fortran_int_size == "4"; then - acx_mkl_int_type="lp64" - else - acx_mkl_int_type="ilp64" - fi - - AC_DEFINE([HAVE_INTEL_MKL], [1], [Define if using Intel MKL math library]) - - # Add MKL libraries to the LIBS variable - if test $ON_A_MAC = "no"; then - LIBS="$LIBS -L$acx_mkl_root/lib/intel64 -Wl,--start-group -lmkl_intel_$acx_mkl_int_type -lmkl_core -lmkl_sequential -Wl,--end-group -lpthread -lm -ldl" - else - LIBS="$LIBS -L$acx_mkl_root/lib -lmkl_intel_$acx_mkl_int_type -lmkl_core -lmkl_sequential -lpthread -lm" - fi - else - # Return an error if not checking - if test $acx_with_mkl != "check"; then - AC_MSG_ERROR([Intel MKL install directory not found or invalid.]) - fi - fi - fi - -]) diff --git a/config/acx_with_pcm.m4 b/config/acx_with_pcm.m4 deleted file mode 100644 index 3dca7a6d555..00000000000 --- a/config/acx_with_pcm.m4 +++ /dev/null @@ -1,42 +0,0 @@ -AC_DEFUN([ACX_WITH_PCM], [ - acx_with_pcm="" - AC_ARG_WITH([pcm], - [AS_HELP_STRING([--with-pcm@<:@=Install DIR@:>@], - [Enables use of the polarizable contiuum model library PCM])], - [ - case $withval in - yes) - acx_with_pcm="yes" - ;; - no) - acx_with_pcm="no" - ;; - *) - CPPFLAGS="-I$withval/include $CPPFLAGS" - LIBS="$LIBS -L$withval/lib" - acx_with_pcm="$withval" - esac - ], - [acx_with_pcm="yes"] - ) - - if test $acx_with_pcm != "no"; then - AC_LANG_SAVE - AC_LANG([C++]) - AC_CHECK_HEADERS([PCMSolver/pcmsolver.h PCMSolver/PCMInput.h], [], - [acx_with_pcm=no - AC_MSG_NOTICE([Unable to include with pcmsolver.h or PCMInput.h])]) - AC_CHECK_LIB([pcm],[pcmsolver_is_compatible_library], [], - [acx_with_pcm=no - AC_MSG_NOTICE([Unable to link with pcm])]) - - - AC_LANG_RESTORE - fi - - if test $acx_with_pcm != "no"; then - AC_DEFINE([MADNESS_HAS_PCM], [1], [Define if using pcm]) - fi - - AM_CONDITIONAL([MADNESS_HAS_PCM], [test $acx_with_pcm != "no"]) -]) diff --git a/config/acx_with_stubmpi.m4 b/config/acx_with_stubmpi.m4 deleted file mode 100644 index 334947e0b2b..00000000000 --- a/config/acx_with_stubmpi.m4 +++ /dev/null @@ -1,31 +0,0 @@ -AC_DEFUN([ACX_WITH_STUBMPI], -[ - acx_with_stubmpi=no - AC_ARG_WITH([stubmpi], - [AS_HELP_STRING([--with-stubmpi], [Build without MPI ... i.e., stubbing it out.])], - [ - case $withval in - yes) - acx_with_stubmpi=yes - ;; - no) - acx_with_stubmpi=no - ;; - *) - acx_with_stubmpi=yes - ;; - esac - ]) - if test $acx_with_stubmpi = yes; then - AC_DEFINE(STUBOUTMPI,[1],[If defined header disable MPI by including stubmpi.h]) - MPICC="$CC" - MPICXX="$CXX" - if test "x$CC" = x; then - MPICC=gcc; - fi - if test "x$CXX" = x; then - MPICXX=g++; - fi - AC_MSG_NOTICE([Stubbing out MPI with MPICXX=$MPICXX MPICC=$MPICC]) - fi -]) diff --git a/config/acx_with_tbb.m4 b/config/acx_with_tbb.m4 deleted file mode 100644 index 136b6ff016b..00000000000 --- a/config/acx_with_tbb.m4 +++ /dev/null @@ -1,128 +0,0 @@ -AC_DEFUN([ACX_WITH_TBB], [ - acx_with_tbb_include="no" - acx_with_tbb_lib="no" - acx_with_tbb="no" - - # Configure madness to use Intel TBB and specify the include path. - AC_ARG_WITH([tbb-include], - [AS_HELP_STRING([--with-tbb-include@<:@=DIR@:>@], - [Enables use of Intel TBB as the task scheduler.])], - [ - case $withval in - yes) - AC_MSG_ERROR([You must specify a directory for --with-tbb-include.]) - ;; - no) - ;; - *) - CPPFLAGS="$CPPFLAGS -I$withval" - acx_with_tbb_include="yes" - acx_with_tbb="yes" - esac - ] - ) - - - # Configure madness to use Intel TBB and specify the library path. - AC_ARG_WITH([tbb-lib], - [AS_HELP_STRING([--with-tbb-lib@<:@=DIR@:>@], - [Enables use of Intel TBB as the task scheduler.])], - [ - case $withval in - yes) - AC_MSG_ERROR([You must specify a directory for --with-tbb-lib.]) - ;; - no) - ;; - *) - LIBS="$LIBS -L$withval" - acx_with_tbb_lib="yes" - acx_with_tbb="yes" - esac - ] - ) - - # Configure madness to use Intel TBB - AC_ARG_WITH([tbb], - [AS_HELP_STRING([--with-tbb@<:@=Install DIR@:>@], - [Enables use of Intel TBB as the task scheduler.])], - [ - case $withval in - yes) - acx_with_tbb="yes" - ;; - no) - ;; - *) - if test "$acx_with_tbb_include" == no; then - CPPFLAGS="$CPPFLAGS -I$withval/include" - fi - if test "$acx_with_tbb_lib" == no; then - LIBS="$LIBS -L$withval/lib/intel64/gcc4.4 -L$withval/lib" - fi - acx_with_tbb="yes" - esac - ], - [acx_with_tbb="yes"] - ) - - # Check that we can compile with Intel TBB - if test $acx_with_tbb != "no"; then - AC_LANG_SAVE - AC_LANG([C++]) - - # Check for Intel TBB header. - AC_CHECK_HEADER([tbb/tbb.h], [], - [acx_with_tbb=no - AC_MSG_NOTICE([Unable to compile with Intel TBB.])]) - AC_LANG_RESTORE - fi - - if test $acx_with_tbb != "no"; then - AC_LANG_SAVE - AC_LANG([C++]) - # Check for Intel TBB library. - if test "x$acx_enable_debugging" == xno; then - AC_CHECK_LIB([tbb], [TBB_runtime_interface_version], [LIBS="-ltbb $LIBS"], - [acx_with_tbb=no - AC_MSG_NOTICE(["Unable to link with Intel TBB])]) - else - AC_CHECK_LIB([tbb_debug], [TBB_runtime_interface_version], - [ - LIBS="-ltbb_debug $LIBS" - CPPFLAGS="$CPPFLAGS -DTBB_USE_DEBUG=1" - AC_MSG_WARN([Linking with the debug variant of Intel TBB.]) - ], [ - AC_CHECK_LIB([tbb], [TBB_runtime_interface_version], [LIBS="-ltbb $LIBS"], - [acx_with_tbb=no - AC_MSG_NOTICE(["Unable to link with Intel TBB])]) - ]) - - fi - AC_LANG_RESTORE - fi - - if test $acx_with_tbb != "no"; then - AC_MSG_CHECKING([if TBB is sufficiently recent (> 4.3.5)]) - AC_LANG_SAVE - AC_LANG([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], - [[tbb::task* empty_root; empty_root->add_ref_count(0);]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - acx_with_tbb=no - ] - ) - AC_LANG_RESTORE - fi - - if test $acx_with_tbb != "no"; then - AC_DEFINE(HAVE_INTEL_TBB, [1], [Define if Intel TBB is available.]) - - AC_CHECK_LIB([tbbmalloc_proxy], [__TBB_malloc_proxy], [LIBS="$LIBS -ltbbmalloc_proxy"], - [AC_MSG_NOTICE(["Unable to link with Intel TBB malloc proxy])]) - - fi -]) diff --git a/config/am_prog_ar.m4 b/config/am_prog_ar.m4 deleted file mode 100644 index feab150c702..00000000000 --- a/config/am_prog_ar.m4 +++ /dev/null @@ -1 +0,0 @@ -AC_DEFUN([AM_PROG_AR],[]) \ No newline at end of file diff --git a/config/ax_cxx_compile_stdcxx.m4 b/config/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 036e8b42802..00000000000 --- a/config/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,982 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016 Krzesimir Nowak -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 7 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AX_REQUIRE_DEFINED([AC_MSG_WARN]) -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) - m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])]) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 -) - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) - - -dnl Tests for new features in C++17 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ - -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus <= 201402L - -#error "This is not a C++17 compiler" - -#else - -#if defined(__clang__) - #define REALLY_CLANG -#else - #if defined(__GNUC__) - #define REALLY_GCC - #endif -#endif - -#include -#include -#include - -namespace cxx17 -{ - -#if !defined(REALLY_CLANG) - namespace test_constexpr_lambdas - { - - // TODO: test it with clang++ from git - - constexpr int foo = [](){return 42;}(); - - } -#endif // !defined(REALLY_CLANG) - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template - int multiply(Args... args) - { - return (args * ... * 1); - } - - template - bool all(Args... args) - { - return (args && ...); - } - - } - - namespace test_extended_static_assert - { - - static_assert (true); - - } - - namespace test_auto_brace_init_list - { - - auto foo = {5}; - auto bar {5}; - - static_assert(std::is_same, decltype(foo)>::value); - static_assert(std::is_same::value); - } - - namespace test_typename_in_template_template_parameter - { - - template typename X> struct D; - - } - - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { - - int f1() - { - return 42; - } - - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } - - } - - namespace test_extended_aggregate_initialization - { - - struct base1 - { - int b1, b2 = 42; - }; - - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - - struct derived : base1, base2 - { - int d; - }; - - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - - } - - namespace test_general_range_based_for_loop - { - - struct iter - { - int i; - - int& operator* () - { - return i; - } - - const int& operator* () const - { - return i; - } - - iter& operator++() - { - ++i; - return *this; - } - }; - - struct sentinel - { - int i; - }; - - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } - - struct range - { - iter begin() const - { - return {0}; - } - - sentinel end() const - { - return {5}; - } - }; - - void f() - { - range r {}; - - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } - - } - - namespace test_lambda_capture_asterisk_this_by_value - { - - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - - } - - namespace test_enum_class_construction - { - - enum class byte : unsigned char - {}; - - byte foo {42}; - - } - - namespace test_constexpr_if - { - - template - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - - } - - namespace test_selection_statement_with_initializer - { - - int f() - { - return 13; - } - - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } - - switch (auto i = f(); i + 4) - { - case 17: - return 2; - - default: - return 1; - } - } - - } - -#if !defined(REALLY_CLANG) - namespace test_template_argument_deduction_for_class_templates - { - - // TODO: test it with clang++ from git - - template - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } -#endif // !defined(REALLY_CLANG) - - namespace test_non_type_auto_template_parameters - { - - template - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - -#if !defined(REALLY_CLANG) - namespace test_structured_bindings - { - - // TODO: test it with clang++ from git - - int arr[2] = { 1, 2 }; - std::pair pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair& - { - return pr; - } - - struct S - { - int x1 : 2; - volatile double y1; - }; - - S f3() - { - return {}; - } - - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); - - } -#endif // !defined(REALLY_CLANG) - -#if !defined(REALLY_CLANG) - namespace test_exception_spec_type_system - { - - // TODO: test it with clang++ from git - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template - Bad - f(T*, T*); - - template - Good - f(T1*, T2*); - - static_assert (std::is_same_v); - - } -#endif // !defined(REALLY_CLANG) - - namespace test_inline_variables - { - - template void f(T) - {} - - template inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus <= 201402L - -]]) \ No newline at end of file diff --git a/config/copyright_header b/config/copyright_header deleted file mode 100644 index 5480f32f1af..00000000000 --- a/config/copyright_header +++ /dev/null @@ -1,32 +0,0 @@ -/* - This file is part of MADNESS. - - Copyright (C) 2007,2010 Oak Ridge National Laboratory - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - For more information please contact: - - Robert J. Harrison - Oak Ridge National Laboratory - One Bethel Valley Road - P.O. Box 2008, MS-6367 - - email: harrisonrj@ornl.gov - tel: 865-241-3937 - fax: 865-572-0680 - - $Id$ -*/ diff --git a/config/insert_headers b/config/insert_headers deleted file mode 100755 index 1f13d40ce70..00000000000 --- a/config/insert_headers +++ /dev/null @@ -1,20 +0,0 @@ - - -# This script goes thru all source files (*.h and *.cc only) in the -# MADNESS tree nominally owned by the project and ensures that the -# copyright header is installed - -# It must be run from the top of the madness tree (trunk directory) - -for file in `find . \( -name "*.h" -o -name "*.cc" \) -exec grep -L "This file is part of MADNESS" {} ";" | grep -v muParser | grep -v tinyxml | grep -v cfft | grep -v madness_config.h | grep -v mainpage.h` -do - echo "Processing $file" - cp $file $file.bak - cat config/copyright_header > fredfred - cat $file >> fredfred - mv fredfred $file -done - - - - diff --git a/config/madness-config-version.cmake.in b/config/madness-config-version.cmake.in deleted file mode 100644 index cdac2fd1a94..00000000000 --- a/config/madness-config-version.cmake.in +++ /dev/null @@ -1,29 +0,0 @@ -# based on Modules/BasicConfigVersion-AnyNewerVersion.cmake.in file provided by CMake version 3.7.1 -# -# The created file sets PACKAGE_VERSION_EXACT if the current version string and -# the requested version string are exactly the same and it sets -# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. -# The variable CVF_VERSION must be set before calling configure_file(). - -set(PACKAGE_VERSION "@PACKAGE_VERSION@") - -if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) - set(PACKAGE_VERSION_EXACT TRUE) - endif() -endif() - -# if the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") - return() -endif() - -# check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@AUTOCONF_SIZEOF_VOID_P@") - math(EXPR installedBits "@AUTOCONF_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif() \ No newline at end of file diff --git a/config/madness-config.cmake.in b/config/madness-config.cmake.in deleted file mode 100644 index 4f6067d26b9..00000000000 --- a/config/madness-config.cmake.in +++ /dev/null @@ -1,101 +0,0 @@ -# - CMAKE Config file for the MADNESS package -# The following variables are defined: -# MADNESS_INCLUDE_DIRS - The MADNESS include directory -# MADNESS_LIBRARIES - The MADNESS libraries and their dependencies -# MADNESS__FOUND - System has the specified MADNESS COMPONENT -# MADNESS__LIBRARY - The MADNESS COMPONENT library -# MADNESS_COMPILE_FLAGS - Compile flags required to build with MADNESS -# MADNESS_LINKER_FLAGS - Linker flags required to link with MADNESS -# MADNESS_VERSION - MADNESS version number -# MADNESS_F77_INTEGER_SIZE - The default F77 integer size used for BLAS calls - -# Compute paths -get_filename_component(MADNESS_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -set(prefix "@prefix@") -set(exec_prefix "@exec_prefix@") -set(MADNESS_DIR "@prefix@") -set(MADNESS_INCLUDE_DIRS "@includedir@") -set(MADNESS_LIBRARY "@libdir@") - -# Set package version -set(MADNESS_VERSION "@PACKAGE_VERSION@") - -# Set compile and link flags, and remove optimization and debug flags -string(REGEX REPLACE "-(O[0-9s]|g[0-9]?)([ ]+|$)" "" MADNESS_COMPILE_FLAGS "@CPPFLAGS@ @CXXFLAGS@") -string(REGEX REPLACE "-(O[0-9s]|g[0-9]?)([ ]+|$)" "" MADNESS_LINKER_FLAGS "@CXXFLAGS@ @LDFLAGS@") - -# Set MADNESS component variables -set(MADNESS_DEFAULT_COMPONENT_LIST MADchem MADmra MADtinyxml MADmuparser MADlinalg MADtensor MADmisc MADworld) -set(MADNESS_MADchem_DEP_LIST MADmra) -set(MADNESS_MADmra_DEP_LIST MADtinyxml MADmuparser MADlinalg) -set(MADNESS_MADlinalg_DEP_LIST MADtensor) -set(MADNESS_MADtensor_DEP_LIST MADmisc) -set(MADNESS_MADmisc_DEP_LIST MADworld) -set(MADNESS_MADworld_DEP_LIST) - -# Check for valid component list -foreach(_comp ${MADNESS_FIND_COMPONENTS}) - if(NOT "${MADNESS_DEFAULT_COMPONENT_LIST}" MATCHES "${_comp}") - message(FATAL_ERROR "Invalid MADNESS component: ${_comp}") - endif() -endforeach() - - -# Set MADNESS libraries variable -foreach(_comp ${MADNESS_DEFAULT_COMPONENT_LIST}) - - # Search for MADNESS library - find_library(MADNESS_${_comp}_LIBRARY ${_comp} - PATHS ${MADNESS_LIBRARY} - NO_DEFAULT_PATH) - - # Check that the library component was found - if(MADNESS_${_comp}_LIBRARY) - set(MADNESS_${_comp}_FOUND TRUE) - - # Set MADNESS libraries variable - if("${MADNESS_FIND_COMPONENTS}" MATCHES "${_comp}" OR NOT MADNESS_FIND_COMPONENTS) - list(APPEND MADNESS_LIBRARIES ${MADNESS_${_comp}_LIBRARY}) - endif() - else() - if(MADNESS_FIND_REQUIRED_${_comp} OR (NOT MADNESS_FIND_COMPONENTS AND MADNESS_FIND_REQUIRED)) - # Fail due to missing required component. - MESSAGE(FATAL_ERROR "!!ERROR: MADNESS ${_comp} library is not available.") - endif() - set(MADNESS_${_comp}_FOUND FALSE) - endif() - - # Check for dependencies in the component list - if("${MADNESS_FIND_COMPONENTS}" MATCHES "${_comp}") - foreach(_comp_dep ${MADNESS_${_comp}_DEP_LIST}) - # Add dependency to the component list if missing - if(NOT "${MADNESS_FIND_COMPONENTS}" MATCHES "${_comp_dep}") - list(APPEND MADNESS_FIND_COMPONENTS ${_comp_dep}) - endif() - - # Set required flag for component dependencies - if(MADNESS_FIND_REQUIRED_${_comp}) - set(MADNESS_FIND_REQUIRED_${_comp_dep} TRUE) - else() - set(MADNESS_FIND_REQUIRED_${_comp_dep} FALSE) - endif() - endforeach() - endif() - -endforeach() - -list(APPEND MADNESS_LIBRARIES "@LIBS@") - -# Set Fortran 77 integer size used by MADNESS -set(MADNESS_F77_INTEGER_SIZE @MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE@) - -# Clear local variables -unset(MADNESS_DEFAULT_COMPONENT_LIST) -unset(MADNESS_MADchem_DEP_LIST) -unset(MADNESS_MADmra_DEP_LIST) -unset(MADNESS_MADlinalg_DEP_LIST) -unset(MADNESS_MADtensor_DEP_LIST) -unset(MADNESS_MADmisc_DEP_LIST) -unset(MADNESS_MADworld_DEP_LIST) -unset(prefix) -unset(exec_prefix) diff --git a/config/madness-project.cmake.in b/config/madness-project.cmake.in deleted file mode 100644 index a2ea5c71a3b..00000000000 --- a/config/madness-project.cmake.in +++ /dev/null @@ -1,85 +0,0 @@ -# - CMAKE Project file for the MADNESS package -# The following variables are defined: -# MADNESS_INCLUDE_DIRS - The MADNESS include directory -# MADNESS_LIBRARIES - The MADNESS libraries and their dependencies -# MADNESS__LIBRARY - The MADNESS COMPONENT library -# MADNESS_COMPILE_FLAGS - Compile flags required to build with MADNESS -# MADNESS_LINKER_FLAGS - Linker flags required to link with MADNESS -# MADNESS_VERSION - MADNESS version number -# MADNESS_F77_INTEGER_SIZE - The default F77 integer size used for BLAS calls - -# Compute paths -set(MADNESS_SOURCE_DIR @abs_top_srcdir@) -set(MADNESS_BUILD_DIR @abs_top_builddir@) -set(MADNESS_INCLUDE_DIRS ${MADNESS_SOURCE_DIR}/src ${MADNESS_BUILD_DIR}/src) - -# Set package version -set(MADNESS_VERSION "@PACKAGE_VERSION@") - -# Set compile and link flags, and remove optimization and debug flags -string(REGEX REPLACE "-(O[0-9s]|g[0-9]?)([ ]+|$)" "" MADNESS_COMPILE_FLAGS "@CPPFLAGS@ @CXXFLAGS@") -string(STRIP "${MADNESS_COMPILE_FLAGS}" MADNESS_COMPILE_FLAGS) -string(REGEX REPLACE "-(O[0-9s]|g[0-9]?)([ ]+|$)" "" MADNESS_LINKER_FLAGS "@CXXFLAGS@ @LDFLAGS@") -string(STRIP "${MADNESS_LINKER_FLAGS}" MADNESS_LINKER_FLAGS) - -set(MADNESS_BUILD_SHARED @enable_shared@) -set(MADNESS_BUILD_STATIC @enable_static@) - -# Set variables for shared library paths -if(MADNESS_BUILD_SHARED) - set(MADNESS_MADworld_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/world/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADworld${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADmisc_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/misc/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADmisc${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADtensor_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/tensor/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADtensor${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADlinalg_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/tensor/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADlinalg${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADmra_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/mra/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADmra${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADmuparser_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/external/muparser/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADmuparser${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADtinyxml_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/external/tinyxml/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADtinyxml${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(MADNESS_MADchem_SHARED_LIBRARY - ${MADNESS_BUILD_DIR}/src/apps/chem/.libs/${CMAKE_SHARED_LIBRARY_PREFIX}MADchem${CMAKE_SHARED_LIBRARY_SUFFIX}) -endif() - -# Set variables for static library paths -if(MADNESS_BUILD_STATIC) - set(MADNESS_MADworld_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/world/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADworld${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADmisc_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/misc/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADmisc${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADtensor_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/tensor/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADtensor${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADlinalg_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/tensor/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADlinalg${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADmra_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/mra/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADmra${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADmuparser_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/external/muparser/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADmuparser${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADtinyxml_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/madness/external/tinyxml/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADtinyxml${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(MADNESS_MADchem_STATIC_LIBRARY - ${MADNESS_BUILD_DIR}/src/apps/chem/.libs/${CMAKE_STATIC_LIBRARY_PREFIX}MADchem${CMAKE_STATIC_LIBRARY_SUFFIX}) -endif() - -# Set default libraries -foreach(_lib MADchem MADmra MADtinyxml MADmuparser MADlinalg MADtensor MADmisc MADworld) - if(MADNESS_BUILD_SHARED) - set(MADNESS_${_lib}_LIBRARY ${MADNESS_${_lib}_SHARED_LIBRARY}) - else() - set(MADNESS_${_lib}_LIBRARY ${MADNESS_${_lib}_STATIC_LIBRARY}) - endif() - - list(APPEND MADNESS_LIBRARIES ${MADNESS_${_lib}_LIBRARY}) -endforeach() - -list(APPEND MADNESS_LIBRARIES "@LIBS@") - -# Set Fortran 77 integer size used by MADNESS -set(MADNESS_F77_INTEGER_SIZE @MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE@) - -unset(MAD_LIBRARY_PREFIX) -unset(MAD_LIBRARY_SUFFIX) \ No newline at end of file diff --git a/doc/INSTALL.md b/doc/INSTALL.md new file mode 100644 index 00000000000..c03c6f1cc51 --- /dev/null +++ b/doc/INSTALL.md @@ -0,0 +1,3 @@ +# Installation + +```{include} ../INSTALL.md \ No newline at end of file diff --git a/doc/Latex/implementation.pdf b/doc/Latex/implementation.pdf new file mode 100644 index 00000000000..83770a7c189 Binary files /dev/null and b/doc/Latex/implementation.pdf differ diff --git a/doc/Latex/parallel-runtime.pdf b/doc/Latex/parallel-runtime.pdf new file mode 100644 index 00000000000..f695eeffc1d Binary files /dev/null and b/doc/Latex/parallel-runtime.pdf differ diff --git a/doc/MADNESSeverything4.odp b/doc/MADNESSeverything4.odp new file mode 100644 index 00000000000..0cbf524d054 Binary files /dev/null and b/doc/MADNESSeverything4.odp differ diff --git a/doc/MADNESSeverything4.pdf b/doc/MADNESSeverything4.pdf new file mode 100644 index 00000000000..e246cd38833 Binary files /dev/null and b/doc/MADNESSeverything4.pdf differ diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 00000000000..18fd53ecd53 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build-3.9 +SOURCEDIR = . +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 00000000000..f567413bba4 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,73 @@ +# Configuration file for the Sphinx documentation builder. +# +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# import myst_parser + +# -- Project information ----------------------------------------------------- + +project = 'MADNESS' +copyright = '2022, Florian Bischoff' +author = 'Florian Bischoff' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ["myst_parser", + + ] + +source_suffix = [".rst", ".md"] +myst_enable_extensions = [ + "amsmath", + "colon_fence", + "deflist", + "dollarmath", + "fieldlist", + "html_admonition", + "html_image", + "replacements", + "smartquotes", + "strikethrough", + "substitution", + "tasklist", +] + + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] diff --git a/doc/configuration.dox b/doc/configuration.dox index a6c431f758c..5fe5844bcc3 100644 --- a/doc/configuration.dox +++ b/doc/configuration.dox @@ -34,7 +34,6 @@ \brief Notes on installing and configuring MADNESS. \addtogroup configuration - \todo Write this section. + This section is superseded by the MADNESS readthedocs. - In the mean time, instructions on installing and configuring MADNESS can be found in the wiki at the MADNESS repository. */ diff --git a/doc/contribution.dox b/doc/contribution.dox index ad3b1aa08f9..a23284588a4 100644 --- a/doc/contribution.dox +++ b/doc/contribution.dox @@ -34,5 +34,7 @@ \brief Notes on how to contribute to MADNESS. \addtogroup contribution - \todo Write this section. + Join the MADNESS GitHub repository. + + */ diff --git a/doc/devsamp/CMakeLists.txt.sample.in b/doc/devsamp/CMakeLists.txt.sample.in index 8a2e95705e0..0af24443f88 100644 --- a/doc/devsamp/CMakeLists.txt.sample.in +++ b/doc/devsamp/CMakeLists.txt.sample.in @@ -1,14 +1,20 @@ -cmake_minimum_required(VERSION 3.0) -set(madness_root_dir "@CMAKE_INSTALL_PREFIX@") +cmake_minimum_required(VERSION 3.16) + +project("your_project_name") + +set(CMAKE_CXX_STANDARD 17) +# find MADNESS +set(madness_root_dir "@CMAKE_INSTALL_PREFIX@") find_package(madness @MADNESS_VERSION@ CONFIG QUIET COMPONENTS madness HINTS ${madness_root_dir}) # replace your_program_name_here with the name of the program you are creating set(program "your_program_name_here") + # may need to edit this to list all source files for this test program set(sources ${program}.cpp) -add_executable(${program} EXCLUDE_FROM_ALL ${sources}) +add_executable(${program} ${sources}) # ${program} depends on the MADNESS composite library ... target_link_libraries(${program} madness) diff --git a/doc/devsamp/simple_hf.cpp b/doc/devsamp/simple_hf.cpp new file mode 100644 index 00000000000..02647cec23a --- /dev/null +++ b/doc/devsamp/simple_hf.cpp @@ -0,0 +1,92 @@ +#include +#include + +using namespace madness; + +int main(int argc, char* argv[]) { + World& world=initialize(argc,argv); + startup(world,argc,argv,true); + FunctionDefaults<3>::set_cubic_cell(-10,10); + FunctionDefaults<3>::set_k(8); + FunctionDefaults<3>::set_truncate_mode(1); + FunctionDefaults<3>::set_thresh(1.e-5); + double lo=1.e-4; + + try { + // set up molecule + Atom O( 0.0, 0.0, 0.2, 8, 8); + Atom H1(0.0, 1.4,-0.8, 1, 1); + Atom H2(0.0,-1.4,-0.8, 1, 1); + Molecule molecule({O,H1,H2},1.e-6); + molecule.print(); + long nocc=long(molecule.total_nuclear_charge())/2; + + // define Fock operator + auto T=Kinetic(world); + auto J=Coulomb(world,lo,FunctionDefaults<3>::get_thresh()); + auto K=Exchange(world,lo,FunctionDefaults<3>::get_thresh()); + auto V=Nuclear(world,molecule); + + // compute hcore guess + AtomicBasisSet aobasis("sto-3g"); + auto aos=SCF::project_ao_basis_only(world,aobasis,molecule); + auto hcoremat=T(aos,aos) + V(aos,aos); + auto smat=matrix_inner(world,aos,aos); + Tensor U,e; + sygv(hcoremat,smat,1,U,e); // solves gen. eigenvalue problem: A x = e B x + auto orbitals=transform(world,aos,U(_,Slice(0,nocc-1))); // orbitals are lowest nocc AOs after diagonalization + + // set up KAIN solver + auto solver=nonlinear_vector_solver(world, orbitals.size()); + + // solves F |i> = f_{ij} |j> <=> (T-f_{ii} ) |i> = -(J - K + V) |i> + \sum_{j/neq i> f_{ij} |j> + BSHApply bsh_apply(world); + + int maxiter=30; + for (int iter=0; iter