From 46d0152efd5dd1594b05ee2fe1254d4442b92b6f Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 00:27:58 +0100 Subject: [PATCH 01/43] Dockerfile for development environment (cherry picked from commit 3a80089cc2a9f5d45842c1430938fcd3c9bedb6c) --- devtools/Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 devtools/Dockerfile diff --git a/devtools/Dockerfile b/devtools/Dockerfile new file mode 100644 index 00000000..f616d407 --- /dev/null +++ b/devtools/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:latest +MAINTAINER "Tamas K Stenczel " + +# Time Zone data +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/London + +RUN apt-get -q update && \ + apt-get -qy install --no-install-recommends \ + # general + make \ + gfortran \ + libopenmpi-dev \ + libblas-dev \ + liblapack-dev \ + libfftw3-3 \ + # cmake and tools + cmake vim git wget ca-certificates \ + g++ \ + && rm -rf /var/lib/apt/lists/* + + +# DEV use: oh-my-zsh instead of bash +# Uses "robbyrussell" theme (original Oh My Zsh theme), with no plugins +RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.1/zsh-in-docker.sh)" -- \ + -t robbyrussell +ENTRYPOINT "/usr/bin/zsh" +WORKDIR /work From 5ca5980051a34a610361944e88bfb4f500958c1a Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 12:15:42 +0100 Subject: [PATCH 02/43] initial CMake files, building it up incrementally (cherry picked from commit 7a3872a83ea5b9c56b0f315c00d33cbde1447984) --- CMakeLists.txt | 19 +++++++++++++++++++ src/CMakeLists.txt | 4 ++++ src/polychord/CMakeLists.txt | 11 +++++++++++ 3 files changed, 34 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/polychord/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..553a09c3 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.4) + +project(PolyChordLite Fortran) + +# languages +enable_language(Fortran) +enable_language(CXX) + +# flags for gfortran todo: compiler dependence +set (CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays") + +# this will be module building directory, allows linking +set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/generated/mods) + +# on installation we get this perfix as well +set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) + +# directories where we want to make things +add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..4199272c --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,4 @@ +project(src) + +# only include the tree +add_subdirectory(polychord) \ No newline at end of file diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt new file mode 100644 index 00000000..1396a66c --- /dev/null +++ b/src/polychord/CMakeLists.txt @@ -0,0 +1,11 @@ +project(polychord Fortran) + +# manual add one +add_library(${PROJECT_NAME} STATIC utils.F90 abort.F90) +message("manually added STATIC utils.F90 into `polychord` module in ${CMAKE_CURRENT_SOURCE_DIR}") + +# this seems to be standard stuff +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib/static) From 90036c20b349a7c4f3fcff16e3cdd03ab7239a64 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 14:14:07 +0100 Subject: [PATCH 03/43] libchord with glob + automatic dependency inspection (cherry picked from commit cb81f992e7e365c5bdc15a87d7c32d89c02c9c35) --- src/polychord/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt index 1396a66c..5df44ebf 100644 --- a/src/polychord/CMakeLists.txt +++ b/src/polychord/CMakeLists.txt @@ -1,8 +1,9 @@ -project(polychord Fortran) +project(chord Fortran) -# manual add one -add_library(${PROJECT_NAME} STATIC utils.F90 abort.F90) -message("manually added STATIC utils.F90 into `polychord` module in ${CMAKE_CURRENT_SOURCE_DIR}") +## original: glob -> sources -> static library +file(GLOB ${PROJECT_NAME}_sources "*.f90" "*.F90" "*.cpp") +message(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") +add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) # this seems to be standard stuff install(TARGETS ${PROJECT_NAME} From adb461637d8334677830d16b5668a293dd97d85d Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 14:29:28 +0100 Subject: [PATCH 04/43] shared and static libchord as well (cherry picked from commit f58d9eeb1e8a06953edbe60c7516bf12cfe351c3) --- src/polychord/CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt index 5df44ebf..881db65f 100644 --- a/src/polychord/CMakeLists.txt +++ b/src/polychord/CMakeLists.txt @@ -1,9 +1,21 @@ project(chord Fortran) -## original: glob -> sources -> static library +# file glob -> sources -> object -> static & shared lib as well file(GLOB ${PROJECT_NAME}_sources "*.f90" "*.F90" "*.cpp") message(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") -add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_sources}) + +# this is the "object library" target: compiles the sources only once +add_library(objlib OBJECT ${${PROJECT_NAME}_sources}) + +# shared libraries need PIC +set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) + +# libcoord.a +add_library(${PROJECT_NAME} STATIC $) + +# libcoord.so as well -> needs a different target name, but the same lib name +add_library(${PROJECT_NAME}_shared SHARED $) +set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1) # this seems to be standard stuff install(TARGETS ${PROJECT_NAME} From 1dc47ff8e11e8ca250520467021e8ce4262b0086 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 15:00:21 +0100 Subject: [PATCH 05/43] lib and bin dir centrally (cherry picked from commit e5acda578af8541fa8e6bfd4539431a0e158575b) --- CMakeLists.txt | 7 ++++++- src/polychord/CMakeLists.txt | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 553a09c3..41d6cda0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,8 +12,13 @@ set (CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays") # this will be module building directory, allows linking set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/generated/mods) -# on installation we get this perfix as well +# on installation we get this prefix as well set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) +# target directories -> stuff installed in these directories +set(target_lib_dir ${PROJECT_BINARY_DIR}/lib) +set(target_bin_dir ${PROJECT_BINARY_DIR}/bin) + # directories where we want to make things add_subdirectory(src) +add_subdirectory(likelihoods) diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt index 881db65f..5760d2ac 100644 --- a/src/polychord/CMakeLists.txt +++ b/src/polychord/CMakeLists.txt @@ -19,6 +19,6 @@ set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NA # this seems to be standard stuff install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static) + RUNTIME DESTINATION ${target_bin_dir} + LIBRARY DESTINATION ${target_lib_dir} + ARCHIVE DESTINATION ${target_lib_dir}) From a88bc7c023870f0c4c9ff7e0a90bcca1df9b7afb Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 15:20:36 +0100 Subject: [PATCH 06/43] likelyhood examples, lib for each of them (cherry picked from commit a1250fdf1a19b1a5e79703f923f1a99b02799537) --- likelihoods/CMakeLists.txt | 4 ++++ likelihoods/examples/CMakeLists.txt | 23 +++++++++++++++++++++++ src/polychord/CMakeLists.txt | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 likelihoods/CMakeLists.txt create mode 100644 likelihoods/examples/CMakeLists.txt diff --git a/likelihoods/CMakeLists.txt b/likelihoods/CMakeLists.txt new file mode 100644 index 00000000..0de4fee7 --- /dev/null +++ b/likelihoods/CMakeLists.txt @@ -0,0 +1,4 @@ +project(likelyhoods) + +# only include the tree +add_subdirectory(examples) \ No newline at end of file diff --git a/likelihoods/examples/CMakeLists.txt b/likelihoods/examples/CMakeLists.txt new file mode 100644 index 00000000..760f5abc --- /dev/null +++ b/likelihoods/examples/CMakeLists.txt @@ -0,0 +1,23 @@ +project(examples) + +# parse each example separately +file(GLOB ${PROJECT_NAME}_sources "*.f90" "*.F90") +set(${PROJECT_NAME}_library_list "") # hold all the targets we make +foreach(filename ${${PROJECT_NAME}_sources}) + # strip the file name + get_filename_component(archive_name ${filename} NAME_WE) + add_library(${archive_name} ${filename}) + + # add to target list + list(APPEND ${PROJECT_NAME}_library_list ${archive_name}) + + # tell the user + message("Adding example: ${archive_name} (from ${filename})") +endforeach() + + +# standard: where to put the targets +install(TARGETS ${${PROJECT_NAME}_library_list} + RUNTIME DESTINATION ${target_bin_dir} + LIBRARY DESTINATION ${target_lib_dir} + ARCHIVE DESTINATION ${target_lib_dir}) diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt index 5760d2ac..eaa75f5f 100644 --- a/src/polychord/CMakeLists.txt +++ b/src/polychord/CMakeLists.txt @@ -17,7 +17,7 @@ add_library(${PROJECT_NAME} STATIC $) add_library(${PROJECT_NAME}_shared SHARED $) set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1) -# this seems to be standard stuff +# standard: where to put the targets install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${target_bin_dir} LIBRARY DESTINATION ${target_lib_dir} From c5a2114debf04f3175b71e4b9513c3615152501f Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 16:34:32 +0100 Subject: [PATCH 07/43] cmake for drivers (cherry picked from commit f184d6d26357607462374bec82514003b443e705) --- src/CMakeLists.txt | 3 ++- src/drivers/CMakeLists.txt | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/drivers/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4199272c..bdcecba5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ project(src) # only include the tree -add_subdirectory(polychord) \ No newline at end of file +add_subdirectory(polychord) +add_subdirectory(drivers) \ No newline at end of file diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt new file mode 100644 index 00000000..993585b1 --- /dev/null +++ b/src/drivers/CMakeLists.txt @@ -0,0 +1,11 @@ +project(polychord_examples) + +# build the object file -> use elsewhere, eg. in examples +add_library(${PROJECT_NAME} OBJECT polychord_examples.f90) +target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_Fortran_MODULE_DIRECTORY}) + +# standard: where to put the targets +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION ${target_bin_dir} + LIBRARY DESTINATION ${target_lib_dir} + ARCHIVE DESTINATION ${target_lib_dir}) From 01ee82d32fd7671f94b2560b57dd39572afbabec Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 16:34:48 +0100 Subject: [PATCH 08/43] executables for examples (driver's .o does not compile with this now) (cherry picked from commit f1c48d2597913c4f894d17e09462666d9280f6ca) --- likelihoods/examples/CMakeLists.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/likelihoods/examples/CMakeLists.txt b/likelihoods/examples/CMakeLists.txt index 760f5abc..ad69efa8 100644 --- a/likelihoods/examples/CMakeLists.txt +++ b/likelihoods/examples/CMakeLists.txt @@ -3,17 +3,29 @@ project(examples) # parse each example separately file(GLOB ${PROJECT_NAME}_sources "*.f90" "*.F90") set(${PROJECT_NAME}_library_list "") # hold all the targets we make -foreach(filename ${${PROJECT_NAME}_sources}) +foreach (filename ${${PROJECT_NAME}_sources}) # strip the file name get_filename_component(archive_name ${filename} NAME_WE) - add_library(${archive_name} ${filename}) + + # compile once into object -> use in lib and exec as well + add_library(objlib_${archive_name} OBJECT ${filename}) + set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) + + # static library + add_library(${archive_name} STATIC $) + + # executable + linking + add_executable(${archive_name}_exec $ $) + target_link_libraries(${archive_name}_exec chord) # link libchoord.a to it + set_target_properties(${archive_name}_exec PROPERTIES OUTPUT_NAME ${archive_name} CLEAN_DIRECT_OUTPUT 1) # add to target list list(APPEND ${PROJECT_NAME}_library_list ${archive_name}) + list(APPEND ${PROJECT_NAME}_library_list ${archive_name}_exec) # tell the user message("Adding example: ${archive_name} (from ${filename})") -endforeach() +endforeach () # standard: where to put the targets From e862cc31e654af9566de071c5f966051c12872d0 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 23:11:41 +0100 Subject: [PATCH 09/43] executables for examples: the program is better off being compiled with each of them, from the same directory copied the program source, to not break the Makefile build system (cherry picked from commit aac5552cd65c7ae6af90b508cc9118c947e71285) --- likelihoods/examples/CMakeLists.txt | 9 ++++++-- likelihoods/examples/polychord_examples.f90 | 23 +++++++++++++++++++++ src/drivers/CMakeLists.txt | 10 --------- src/drivers/polychord_examples.f90 | 2 ++ 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 likelihoods/examples/polychord_examples.f90 diff --git a/likelihoods/examples/CMakeLists.txt b/likelihoods/examples/CMakeLists.txt index ad69efa8..4766ce0c 100644 --- a/likelihoods/examples/CMakeLists.txt +++ b/likelihoods/examples/CMakeLists.txt @@ -7,6 +7,11 @@ foreach (filename ${${PROJECT_NAME}_sources}) # strip the file name get_filename_component(archive_name ${filename} NAME_WE) + if (${archive_name} STREQUAL "polychord_examples") + # make sure this is not turned into an object & executable alone + continue() + endif () + # compile once into object -> use in lib and exec as well add_library(objlib_${archive_name} OBJECT ${filename}) set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) @@ -14,8 +19,8 @@ foreach (filename ${${PROJECT_NAME}_sources}) # static library add_library(${archive_name} STATIC $) - # executable + linking - add_executable(${archive_name}_exec $ $) + # executable + linking, uses the program and one of the likelihood implementations + add_executable(${archive_name}_exec $ polychord_examples.f90) target_link_libraries(${archive_name}_exec chord) # link libchoord.a to it set_target_properties(${archive_name}_exec PROPERTIES OUTPUT_NAME ${archive_name} CLEAN_DIRECT_OUTPUT 1) diff --git a/likelihoods/examples/polychord_examples.f90 b/likelihoods/examples/polychord_examples.f90 new file mode 100644 index 00000000..49ad93e1 --- /dev/null +++ b/likelihoods/examples/polychord_examples.f90 @@ -0,0 +1,23 @@ +!> This is the main driving routine of the nested sampling algorithm +! TKS: copied from src/drivers for the CMake build system, only kept there to not break the old build system +program PolyChord + + ! ~~~~~~~ Loaded Modules ~~~~~~~ + use interfaces_module, only: run_polychord + use loglikelihood_module, only: loglikelihood, setup_loglikelihood + use utils_module, only: STR_LENGTH + use abort_module, only: halt_program + + ! ~~~~~~~ Local Variable Declaration ~~~~~~~ + implicit none + character(len=STR_LENGTH) :: input_file ! input file + + if(iargc()==1) then + call getarg(1,input_file) + else + call halt_program('PolyChord should be called with at most one argument, the input file') + end if + + call run_polychord(loglikelihood, setup_loglikelihood, input_file) + +end program PolyChord diff --git a/src/drivers/CMakeLists.txt b/src/drivers/CMakeLists.txt index 993585b1..21b618a8 100644 --- a/src/drivers/CMakeLists.txt +++ b/src/drivers/CMakeLists.txt @@ -1,11 +1 @@ project(polychord_examples) - -# build the object file -> use elsewhere, eg. in examples -add_library(${PROJECT_NAME} OBJECT polychord_examples.f90) -target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_Fortran_MODULE_DIRECTORY}) - -# standard: where to put the targets -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${target_bin_dir} - LIBRARY DESTINATION ${target_lib_dir} - ARCHIVE DESTINATION ${target_lib_dir}) diff --git a/src/drivers/polychord_examples.f90 b/src/drivers/polychord_examples.f90 index 40c6149d..bf88d7c8 100644 --- a/src/drivers/polychord_examples.f90 +++ b/src/drivers/polychord_examples.f90 @@ -1,4 +1,6 @@ !> This is the main driving routine of the nested sampling algorithm +! TKS: this was relocated to likelihoods/examples for the CMake build system. +! delete here when the Makefiles are updated or outdated program PolyChord ! ~~~~~~~ Loaded Modules ~~~~~~~ From 8f15fbae599fd8dcad4deb32e58d137be3c06cb7 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 7 Jul 2021 23:18:29 +0100 Subject: [PATCH 10/43] CI action (seed) for CMake build (cherry picked from commit 268e439a7b5d1ac176df26ba85aa46b88213bcf8) --- .github/workflows/run_cmake.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/run_cmake.yaml diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml new file mode 100644 index 00000000..ac5ee24f --- /dev/null +++ b/.github/workflows/run_cmake.yaml @@ -0,0 +1,23 @@ +# This workflow carries out the build of the package with CMake + +name: CMake build + +on: [ push ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # check out + - uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apt-get install gfortran libopenmpi-dev cmake + + - name: Run CMake builid + run: | + mkdir BUILD + cd BUILD + cmake .. + make install From 6eca9d1248ba1d0cd8739069f5b7afc205bb5203 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Thu, 8 Jul 2021 00:11:41 +0100 Subject: [PATCH 11/43] add MPI and link to everything --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41d6cda0..4fb65f20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,12 @@ enable_language(Fortran) enable_language(CXX) # flags for gfortran todo: compiler dependence -set (CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays") +set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays") + +# find MPI & link to everything from now on +find_package(MPI REQUIRED) +message(STATUS "MPI_Fortran_COMPILER: ${MPI_Fortran_COMPILER}") +link_libraries(MPI::MPI_Fortran) # this will be module building directory, allows linking set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/generated/mods) From 511942827bee002182db31312510ba4a6cb5b5d7 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Sun, 11 Jul 2021 20:05:06 +0100 Subject: [PATCH 12/43] intel dockerfile and reorganisation of docker files --- devtools/{ => docker_gnu}/Dockerfile | 0 devtools/docker_intel/Dockerfile | 97 ++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) rename devtools/{ => docker_gnu}/Dockerfile (100%) create mode 100644 devtools/docker_intel/Dockerfile diff --git a/devtools/Dockerfile b/devtools/docker_gnu/Dockerfile similarity index 100% rename from devtools/Dockerfile rename to devtools/docker_gnu/Dockerfile diff --git a/devtools/docker_intel/Dockerfile b/devtools/docker_intel/Dockerfile new file mode 100644 index 00000000..8ca08fca --- /dev/null +++ b/devtools/docker_intel/Dockerfile @@ -0,0 +1,97 @@ +FROM intel/oneapi:os-tools-ubuntu18.04 +MAINTAINER "Tamas K Stenczel " + +# Time Zone data +ARG DEBIAN_FRONTEND=noninteractive +ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 +ENV TZ=Europe/London + +############################################################# +# Assembled from Intel Base-Kit and HPC-Kit Dockerfiles +# includes my additions of apt packages +############################################################# +# install Intel(R) oneAPI Base Toolkit +RUN apt-get update -y && \ +apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ + # Intel compilers and MPI library + intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic \ + intel-oneapi-mpi-devel \ + intel-oneapi-compiler-fortran \ + # other tools and libraries + libblas-dev \ + liblapack-dev \ + cmake \ + make \ + vim git wget ca-certificates \ +-- + +# from Intel HPC toolkit +# setvars.sh environment variables +ENV ACL_BOARD_VENDOR_PATH='/opt/Intel/OpenCLFPGA/oneAPI/Boards' +ENV ADVISOR_2021_DIR='/opt/intel/oneapi/advisor/2021.3.0' +ENV APM='/opt/intel/oneapi/advisor/2021.3.0/perfmodels' +ENV CCL_CONFIGURATION='cpu_gpu_dpcpp' +ENV CCL_ROOT='/opt/intel/oneapi/ccl/2021.3.0' +ENV CLASSPATH='/opt/intel/oneapi/mpi/2021.3.0//lib/mpi.jar:/opt/intel/oneapi/dal/2021.3.0/lib/onedal.jar' +ENV CLCK_ROOT='/opt/intel/oneapi/clck/2021.3.0' +ENV CMAKE_PREFIX_PATH='/opt/intel/oneapi/vpl/2021.4.0:/opt/intel/oneapi/tbb/2021.3.0/env/..:/opt/intel/oneapi/dal/2021.3.0' +ENV CMPLR_ROOT='/opt/intel/oneapi/compiler/2021.3.0' +ENV CONDA_DEFAULT_ENV='intelpython-python3.7' +ENV CONDA_EXE='/opt/intel/oneapi/intelpython/latest/bin/conda' +ENV CONDA_PREFIX='/opt/intel/oneapi/intelpython/latest' +ENV CONDA_PROMPT_MODIFIER='(intelpython-python3.7) ' +ENV CONDA_PYTHON_EXE='/opt/intel/oneapi/intelpython/latest/bin/python' +ENV CONDA_SHLVL='1' +ENV CPATH='/opt/intel/oneapi/vpl/2021.4.0/include:/opt/intel/oneapi/tbb/2021.3.0/env/../include:/opt/intel/oneapi/mpi/2021.3.0//include:/opt/intel/oneapi/mkl/2021.3.0/include:/opt/intel/oneapi/ippcp/2021.3.0/include:/opt/intel/oneapi/ipp/2021.3.0/include:/opt/intel/oneapi/dpl/2021.4.0/linux/include:/opt/intel/oneapi/dnnl/2021.3.0/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/dev-utilities/2021.3.0/include:/opt/intel/oneapi/dal/2021.3.0/include:/opt/intel/oneapi/compiler/2021.3.0/linux/include:/opt/intel/oneapi/ccl/2021.3.0/include/cpu_gpu_dpcpp' +ENV CPLUS_INCLUDE_PATH='/opt/intel/oneapi/clck/2021.3.0/include' +ENV DAALROOT='/opt/intel/oneapi/dal/2021.3.0' +ENV DALROOT='/opt/intel/oneapi/dal/2021.3.0' +ENV DAL_MAJOR_BINARY='1' +ENV DAL_MINOR_BINARY='1' +ENV DNNLROOT='/opt/intel/oneapi/dnnl/2021.3.0/cpu_dpcpp_gpu_dpcpp' +ENV DPL_ROOT='/opt/intel/oneapi/dpl/2021.4.0' +ENV FI_PROVIDER_PATH='/opt/intel/oneapi/mpi/2021.3.0//libfabric/lib/prov:/usr/lib64/libfabric' +ENV FPGA_VARS_ARGS='' +ENV FPGA_VARS_DIR='/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga' +ENV INFOPATH='/opt/intel/oneapi/debugger/10.1.2/gdb/intel64/lib' +ENV INSPECTOR_2021_DIR='/opt/intel/oneapi/inspector/2021.3.0' +ENV INTELFPGAOCLSDKROOT='/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga' +ENV INTEL_LICENSE_FILE='/opt/intel/licenses:/root/intel/licenses:/opt/intel/oneapi/clck/2021.3.0/licensing:/opt/intel/licenses:/root/intel/licenses:/Users/Shared/Library/Application Support/Intel/Licenses' +ENV INTEL_PYTHONHOME='/opt/intel/oneapi/debugger/10.1.2/dep' +ENV IPPCP_TARGET_ARCH='intel64' +ENV IPPCRYPTOROOT='/opt/intel/oneapi/ippcp/2021.3.0' +ENV IPPROOT='/opt/intel/oneapi/ipp/2021.3.0' +ENV IPP_TARGET_ARCH='intel64' +ENV I_MPI_ROOT='/opt/intel/oneapi/mpi/2021.3.0' +ENV LD_LIBRARY_PATH='/opt/intel/oneapi/vpl/2021.4.0/lib:/opt/intel/oneapi/tbb/2021.3.0/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/2021.3.0//libfabric/lib:/opt/intel/oneapi/mpi/2021.3.0//lib/release:/opt/intel/oneapi/mpi/2021.3.0//lib:/opt/intel/oneapi/mkl/2021.3.0/lib/intel64:/opt/intel/oneapi/itac/2021.3.0/slib:/opt/intel/oneapi/ippcp/2021.3.0/lib/intel64:/opt/intel/oneapi/ipp/2021.3.0/lib/intel64:/opt/intel/oneapi/dnnl/2021.3.0/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/debugger/10.1.2/gdb/intel64/lib:/opt/intel/oneapi/debugger/10.1.2/libipt/intel64/lib:/opt/intel/oneapi/debugger/10.1.2/dep/lib:/opt/intel/oneapi/dal/2021.3.0/lib/intel64:/opt/intel/oneapi/compiler/2021.3.0/linux/lib:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/x64:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/emu:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga/host/linux64/lib:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga/linux64/lib:/opt/intel/oneapi/compiler/2021.3.0/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/ccl/2021.3.0/lib/cpu_gpu_dpcpp' +ENV LIBRARY_PATH='/opt/intel/oneapi/vpl/2021.4.0/lib:/opt/intel/oneapi/tbb/2021.3.0/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/2021.3.0//libfabric/lib:/opt/intel/oneapi/mpi/2021.3.0//lib/release:/opt/intel/oneapi/mpi/2021.3.0//lib:/opt/intel/oneapi/mkl/2021.3.0/lib/intel64:/opt/intel/oneapi/ippcp/2021.3.0/lib/intel64:/opt/intel/oneapi/ipp/2021.3.0/lib/intel64:/opt/intel/oneapi/dnnl/2021.3.0/cpu_dpcpp_gpu_dpcpp/lib:/opt/intel/oneapi/dal/2021.3.0/lib/intel64:/opt/intel/oneapi/compiler/2021.3.0/linux/compiler/lib/intel64_lin:/opt/intel/oneapi/compiler/2021.3.0/linux/lib:/opt/intel/oneapi/clck/2021.3.0/lib/intel64:/opt/intel/oneapi/ccl/2021.3.0/lib/cpu_gpu_dpcpp' +ENV MANPATH='/opt/intel/oneapi/mpi/2021.3.0/man:/opt/intel/oneapi/itac/2021.3.0/man:/opt/intel/oneapi/debugger/10.1.2/documentation/man:/opt/intel/oneapi/compiler/2021.3.0/documentation/en/man/common:/opt/intel/oneapi/clck/2021.3.0/man::' +ENV MKLROOT='/opt/intel/oneapi/mkl/2021.3.0' +ENV NLSPATH='/opt/intel/oneapi/mkl/2021.3.0/lib/intel64/locale/%l_%t/%N' +ENV OCL_ICD_FILENAMES='libintelocl_emu.so:libalteracl.so:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/x64/libintelocl.so' +ENV ONEAPI_ROOT='/opt/intel/oneapi' +ENV PATH='/opt/intel/oneapi/vtune/2021.5.0/bin64:/opt/intel/oneapi/vpl/2021.4.0/bin:/opt/intel/oneapi/mpi/2021.3.0//libfabric/bin:/opt/intel/oneapi/mpi/2021.3.0//bin:/opt/intel/oneapi/mkl/2021.3.0/bin/intel64:/opt/intel/oneapi/itac/2021.3.0/bin:/opt/intel/oneapi/intelpython/latest/bin:/opt/intel/oneapi/intelpython/latest/condabin:/opt/intel/oneapi/inspector/2021.3.0/bin64:/opt/intel/oneapi/dev-utilities/2021.3.0/bin:/opt/intel/oneapi/debugger/10.1.2/gdb/intel64/bin:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga/llvm/aocl-bin:/opt/intel/oneapi/compiler/2021.3.0/linux/lib/oclfpga/bin:/opt/intel/oneapi/compiler/2021.3.0/linux/bin/intel64:/opt/intel/oneapi/compiler/2021.3.0/linux/bin:/opt/intel/oneapi/clck/2021.3.0/bin/intel64:/opt/intel/oneapi/advisor/2021.3.0/bin64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' +ENV PKG_CONFIG_PATH='/opt/intel/oneapi/vtune/2021.5.0/include/pkgconfig/lib64:/opt/intel/oneapi/vpl/2021.4.0/lib/pkgconfig:/opt/intel/oneapi/mkl/2021.3.0/tools/pkgconfig:/opt/intel/oneapi/inspector/2021.3.0/include/pkgconfig/lib64:/opt/intel/oneapi/advisor/2021.3.0/include/pkgconfig/lib64:' +ENV PYTHONPATH='/opt/intel/oneapi/advisor/2021.3.0/pythonapi' +ENV SETVARS_COMPLETED='1' +ENV SETVARS_VARS_PATH='/opt/intel/oneapi/vtune/latest/env/vars.sh' +ENV TBBROOT='/opt/intel/oneapi/tbb/2021.3.0/env/..' +ENV VTUNE_PROFILER_2021_DIR='/opt/intel/oneapi/vtune/2021.5.0' +ENV VT_ADD_LIBS='-ldwarf -lelf -lvtunwind -lm -lpthread' +ENV VT_LIB_DIR='/opt/intel/oneapi/itac/2021.3.0/lib' +ENV VT_MPI='impi4' +ENV VT_ROOT='/opt/intel/oneapi/itac/2021.3.0' +ENV VT_SLIB_DIR='/opt/intel/oneapi/itac/2021.3.0/slib' +ENV _CE_CONDA='' +ENV _CE_M='' + + +############################################################# +# Entrypoint & ZSH +############################################################# +# DEV use: oh-my-zsh instead of bash +RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.1/zsh-in-docker.sh)" -- \ + -t dallas +ENTRYPOINT "/usr/bin/zsh" +WORKDIR /work + From ed5ca649d38088e201ccc9a0dd1444e5c5cc0058 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 12 Jul 2021 09:14:37 +0100 Subject: [PATCH 13/43] newer CMake version in both dockerfiles --- devtools/docker_gnu/Dockerfile | 6 ++++++ devtools/docker_intel/Dockerfile | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/devtools/docker_gnu/Dockerfile b/devtools/docker_gnu/Dockerfile index f616d407..8e4b467d 100644 --- a/devtools/docker_gnu/Dockerfile +++ b/devtools/docker_gnu/Dockerfile @@ -19,6 +19,12 @@ RUN apt-get -q update && \ g++ \ && rm -rf /var/lib/apt/lists/* +# reinstall newer cmake, same as in the Intel image +ARG cmake_url=https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh +ADD $cmake_url / +RUN file=$(basename "$cmake_url") && \ + bash $file --prefix=/usr --skip-license && \ + rm $file # DEV use: oh-my-zsh instead of bash # Uses "robbyrussell" theme (original Oh My Zsh theme), with no plugins diff --git a/devtools/docker_intel/Dockerfile b/devtools/docker_intel/Dockerfile index 8ca08fca..2b77811a 100644 --- a/devtools/docker_intel/Dockerfile +++ b/devtools/docker_intel/Dockerfile @@ -25,6 +25,13 @@ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ vim git wget ca-certificates \ -- +# reinstall newer cmake +ARG cmake_url=https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh +ADD $cmake_url / +RUN file=$(basename "$cmake_url") && \ + bash $file --prefix=/usr --skip-license && \ + rm $file + # from Intel HPC toolkit # setvars.sh environment variables ENV ACL_BOARD_VENDOR_PATH='/opt/Intel/OpenCLFPGA/oneAPI/Boards' From 5d18e48c32efc01ac62a581b356d86b776c8bf74 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 12 Jul 2021 09:30:24 +0100 Subject: [PATCH 14/43] switch for compilers, arguments need looking at --- CMakeLists.txt | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fb65f20..6c39f724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,38 @@ cmake_minimum_required(VERSION 3.4) project(PolyChordLite Fortran) # languages -enable_language(Fortran) enable_language(CXX) +enable_language(Fortran) + +# enforce matching of the CXX and Fortran compilers +if (NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_CXX_COMPILER_ID}") + message(FATAL_ERROR "You need to use the same vendor for your C++ and Fortran compiler") +endif () + +# flags for all three compiler types +# todo: inspect the flags and implement in a nicer way +if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel") + message("Using INTEL compilers") + + set(CMAKE_Fortran_FLAGS "-fpp -fpic -assume noold_maxminloc -heap-arrays -ipo -O3 -no-prec-div -xHost -w -vec-report0 -qopt-report0") + set(CMAKE_CXX_FLAGS "-std=c++11 -fpic -ipo -O3 -no-prec-div -xHost -w -vec-report0 -qopt-report0") + + add_compile_options("-nofor-main") + link_libraries("-nofor-main") + +elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") + message("Using GNU compilers") + + set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays -Ofast") + set(CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Ofast") + +elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Cray") + message("Using Cray compilers") + + set(CMAKE_Fortran_FLAGS "-fpp -fpic -qopenmp -dynamic") + set(CMAKE_CXX_FLAGS "-fpic -qopenmp -dynamic") -# flags for gfortran todo: compiler dependence -set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays") +endif () # find MPI & link to everything from now on find_package(MPI REQUIRED) From 2936de12c1c03b6c4065db40f9fa333b36cdce1d Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 12 Jul 2021 09:32:14 +0100 Subject: [PATCH 15/43] enforce linking with Fortran compiler - CMake uses CXX with preference - this went unnoticed on GNU but failed on Intel --- likelihoods/examples/CMakeLists.txt | 7 ++++--- src/polychord/CMakeLists.txt | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/likelihoods/examples/CMakeLists.txt b/likelihoods/examples/CMakeLists.txt index 4766ce0c..cdbac61d 100644 --- a/likelihoods/examples/CMakeLists.txt +++ b/likelihoods/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -project(examples) +project(examples Fortran) # parse each example separately file(GLOB ${PROJECT_NAME}_sources "*.f90" "*.F90") @@ -14,7 +14,8 @@ foreach (filename ${${PROJECT_NAME}_sources}) # compile once into object -> use in lib and exec as well add_library(objlib_${archive_name} OBJECT ${filename}) - set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) + set_target_properties(objlib_${archive_name} PROPERTIES POSITION_INDEPENDENT_CODE 1 LINKER_LANGUAGE Fortran) + target_link_libraries(objlib_${archive_name} chord) # static library add_library(${archive_name} STATIC $) @@ -22,7 +23,7 @@ foreach (filename ${${PROJECT_NAME}_sources}) # executable + linking, uses the program and one of the likelihood implementations add_executable(${archive_name}_exec $ polychord_examples.f90) target_link_libraries(${archive_name}_exec chord) # link libchoord.a to it - set_target_properties(${archive_name}_exec PROPERTIES OUTPUT_NAME ${archive_name} CLEAN_DIRECT_OUTPUT 1) + set_target_properties(${archive_name}_exec PROPERTIES OUTPUT_NAME ${archive_name} CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE Fortran) # add to target list list(APPEND ${PROJECT_NAME}_library_list ${archive_name}) diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt index eaa75f5f..269d602e 100644 --- a/src/polychord/CMakeLists.txt +++ b/src/polychord/CMakeLists.txt @@ -5,17 +5,18 @@ file(GLOB ${PROJECT_NAME}_sources "*.f90" "*.F90" "*.cpp") message(STATUS "Sources for project ${PROJECT_NAME}: ${${PROJECT_NAME}_sources}") # this is the "object library" target: compiles the sources only once -add_library(objlib OBJECT ${${PROJECT_NAME}_sources}) +add_library(objlib_${PROJECT_NAME} OBJECT ${${PROJECT_NAME}_sources}) # shared libraries need PIC -set_property(TARGET objlib PROPERTY POSITION_INDEPENDENT_CODE 1) +set_property(TARGET objlib_${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE 1) # libcoord.a -add_library(${PROJECT_NAME} STATIC $) +add_library(${PROJECT_NAME} STATIC $) +set_property(TARGET ${PROJECT_NAME} PROPERTY LINKER_LANGUAGE Fortran) # libcoord.so as well -> needs a different target name, but the same lib name -add_library(${PROJECT_NAME}_shared SHARED $) -set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1) +add_library(${PROJECT_NAME}_shared SHARED $) +set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE Fortran) # standard: where to put the targets install(TARGETS ${PROJECT_NAME} From 28552da5c5fcd25c8423aff99531475aa43ab21a Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 12 Jul 2021 09:43:20 +0100 Subject: [PATCH 16/43] action with intel compilers --- .github/workflows/run_cmake.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index ac5ee24f..9d441bdf 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -5,7 +5,7 @@ name: CMake build on: [ push ] jobs: - build: + build-GNU: runs-on: ubuntu-latest steps: @@ -17,7 +17,23 @@ jobs: - name: Run CMake builid run: | - mkdir BUILD - cd BUILD + mkdir BUILD_GNU + cd BUILD_GNU + cmake .. + make install + + build-Intel: + runs-on: ubuntu-latest + container: + image: intel/oneapi-hpckit + + steps: + # check out + - uses: actions/checkout@v2 + + - name: Run CMake builid + run: | + mkdir BUILD_Intel + cd BUILD_Intel cmake .. make install From 2587697b3e52199ed411908f45112b45a380f568 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 12 Jul 2021 10:26:47 +0100 Subject: [PATCH 17/43] explicitly set the CXX compiler in intel build for some reason the default that CMake finds is the GNU --- .github/workflows/run_cmake.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index 9d441bdf..c225d86d 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -35,5 +35,5 @@ jobs: run: | mkdir BUILD_Intel cd BUILD_Intel - cmake .. + cmake -DCMAKE_CXX_COMPILER=icpc .. make install From 0ab564c65d34d109d798af21211501e907a38f4c Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 12 Jul 2021 11:50:11 +0100 Subject: [PATCH 18/43] MacOS build --- .github/workflows/run_cmake.yaml | 23 +++++++++++++++++++++++ CMakeLists.txt | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index c225d86d..287c41ba 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -37,3 +37,26 @@ jobs: cd BUILD_Intel cmake -DCMAKE_CXX_COMPILER=icpc .. make install + + build-MacOS: + runs-on: macos-latest + + steps: + # check out + - uses: actions/checkout@v2 + + - name: Install dependencies + run: brew install cmake gcc openmpi + + - name: Check versions + run: | + cmake --version + gcc-11 --version + gfortran-11 --version + + - name: Run CMake builid + run: | + mkdir BUILD_GNU_MacOS + cd BUILD_GNU_MacOS + cmake -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_CXX_COMPILER=gcc-11 .. + make VERBOSE=1 install diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c39f724..a42c577b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,10 @@ elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") set(CMAKE_Fortran_FLAGS "-ffree-line-length-none -cpp -fPIC -fno-stack-arrays -Ofast") set(CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Ofast") + # for GitHub actions MacOS -- debug only + add_compile_options("-lstdc++") + link_libraries("-lstdc++") + elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Cray") message("Using Cray compilers") From fa7f5e450592a6157b098362a2a4957650a58e60 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Sun, 25 Jul 2021 18:46:53 +0100 Subject: [PATCH 19/43] building of the python extension module --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a42c577b..45b57978 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,38 @@ set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) # target directories -> stuff installed in these directories set(target_lib_dir ${PROJECT_BINARY_DIR}/lib) set(target_bin_dir ${PROJECT_BINARY_DIR}/bin) +set(target_python_dir ${PROJECT_BINARY_DIR}/python) # directories where we want to make things add_subdirectory(src) add_subdirectory(likelihoods) + +# PyPolyChord stuff +message(STATUS "Enabling Python package build") +find_package (Python3 COMPONENTS Interpreter Development NumPy REQUIRED) + +# find out the suffix for the current python version +EXECUTE_PROCESS( + COMMAND ${Python3_EXECUTABLE} "-c" "from importlib.machinery import EXTENSION_SUFFIXES;print(EXTENSION_SUFFIXES[0])" + OUTPUT_VARIABLE python_so_suffix +) +STRING(REPLACE "\n" "" python_so_suffix ${python_so_suffix}) +message(STATUS "Python shared object suffix is: ${python_so_suffix}") + +# the extension module +add_library(_pypolychord SHARED pypolychord/_pypolychord.cpp) +set_target_properties(_pypolychord + PROPERTIES + OUTPUT_NAME _pypolychord + PREFIX "" + SUFFIX "${python_so_suffix}" + ) +# dependencies and includes +target_link_libraries(_pypolychord chord_shared Python3::Python Python3::NumPy) +target_include_directories(_pypolychord PUBLIC src/polychord) # PolyChord headers for python extensions + +# place all outputs in one place +install(TARGETS _pypolychord + RUNTIME DESTINATION ${target_python_dir} + LIBRARY DESTINATION ${target_python_dir} + ARCHIVE DESTINATION ${target_python_dir}) \ No newline at end of file From f7edac3ddca14fe28ea5e25c475a985cc87fbf4a Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Sun, 25 Jul 2021 18:50:35 +0100 Subject: [PATCH 20/43] copy of setup.py for CMake - will modify --- setup_cmake.py | 141 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 setup_cmake.py diff --git a/setup_cmake.py b/setup_cmake.py new file mode 100644 index 00000000..17b939eb --- /dev/null +++ b/setup_cmake.py @@ -0,0 +1,141 @@ +""" +Python interface to PolyChord + +Polychord is a tool to solve high dimensional problems. +""" + +from setuptools import setup, Extension, find_packages, Distribution +from setuptools.command.build_py import build_py as _build_py +from distutils.command.clean import clean as _clean + +import os, sys, subprocess, shutil + +import numpy + +def check_compiler(default_CC="gcc"): + """Checks what compiler is being used (clang, intel, or gcc).""" + + CC = default_CC if "CC" not in os.environ else os.environ["CC"] + CC_version = subprocess.check_output([CC, "-v"], stderr=subprocess.STDOUT).decode("utf-8").lower() + + if "clang" in CC_version: + CC_family = "clang" + elif "icc" in CC_version: + CC_family = "intel" + elif "gcc" in CC_version: + CC_family = "gcc" + else: + print("Warning: unrecognised compiler: {}".format(CC_version)) + CC_family = "" + + return CC_family + + +NAME = 'pypolychord' +DOCLINES = (__doc__ or '').split("\n") + + +# Deal with annoying differences between clang and the other compilers +CC_FAMILY = check_compiler() +CPPRUNTIMELIB_FLAG = [] +RPATH_FLAG = [] + +if CC_FAMILY == "clang": + CPPRUNTIMELIB_FLAG += ["-stdlib=libc++"] + if sys.platform == "darwin": + # macOS idiosyncrasies + CPPRUNTIMELIB_FLAG += ["-mmacosx-version-min=10.9"] + +if sys.platform != "darwin": + # Set RPATH on Linux machines + RPATH_FLAG += ["-Wl,-rpath,$ORIGIN/pypolychord/lib"] + + +def readme(): + with open('pypolychord_README.rst') as f: + return f.read() + + +def get_version(short=False): + with open('src/polychord/feedback.f90') as f: + for line in f: + if 'version' in line: + return line[44:50] + + +class DistributionWithOption(Distribution, object): + def __init__(self, *args, **kwargs): + self.global_options = self.global_options \ + + [("no-mpi", None, "Don't compile with MPI support."), + ("debug-flags", None, "Compile in debug mode.")] + self.no_mpi = None + self.debug_flags = None + super(DistributionWithOption, self).__init__(*args, **kwargs) + +class CustomBuildPy(_build_py, object): + def run(self): + env = {} + env["PATH"] = os.environ["PATH"] + if self.distribution.no_mpi is None: + env["MPI"] = "1" + # These need to be set so that build_ext uses the right compilers + cc_compiler = subprocess.check_output(["make", "print_CC"]).decode('utf-8').strip() + os.environ["CC"] = cc_compiler + + cxx_compiler = subprocess.check_output(["make", "print_CXX"]).decode('utf-8').strip() + os.environ["CXX"] = cxx_compiler + else: + env["MPI"] = "0" + + if self.distribution.debug_flags is not None: + self.distribution.ext_modules[0].extra_compile_args += ["-g", "-O0"] + env["DEBUG"] = "1" + + BASE_PATH = os.path.dirname(os.path.abspath(__file__)) + env["PWD"] = BASE_PATH + env.update({k : os.environ[k] for k in ["CC", "CXX", "FC"] if k in os.environ}) + subprocess.check_call(["make", "-e", "libchord.so"], env=env, cwd=BASE_PATH) + if not os.path.isdir("pypolychord/lib/"): + os.makedirs(os.path.join(BASE_PATH, "pypolychord/lib/")) + shutil.copy(os.path.join(BASE_PATH, "lib/libchord.so"), + os.path.join(BASE_PATH, "pypolychord/lib/")) + self.run_command("build_ext") + return super(CustomBuildPy, self).run() + +class CustomClean(_clean): + def run(self): + subprocess.run(["make", "veryclean"], check=True, env=os.environ) + return super().run() + +if "--no-mpi" in sys.argv: + NAME += '_nompi' + DOCLINES[1] = DOCLINES[1] + ' (cannot be used with MPI)' + +pypolychord_module = Extension( + name='_pypolychord', + library_dirs=['lib'], + include_dirs=['src/polychord', numpy.get_include()], + libraries=['chord',], + extra_link_args=RPATH_FLAG + CPPRUNTIMELIB_FLAG, + extra_compile_args= ["-std=c++11"] + RPATH_FLAG + CPPRUNTIMELIB_FLAG, + runtime_library_dirs=['lib'], + sources=['pypolychord/_pypolychord.cpp'] + ) + +setup(name=NAME, + version=get_version(), + description='Python interface to PolyChord ' + get_version(), + url='https://ccpforge.cse.rl.ac.uk/gf/project/polychord/', + author='Will Handley', + author_email='wh260@cam.ac.uk', + license='PolyChord', + packages=find_packages(), + install_requires=['numpy','scipy'], + extras_require={'plotting': 'getdist'}, + distclass=DistributionWithOption, + ext_modules=[pypolychord_module], + cmdclass={'build_py' : CustomBuildPy, + 'clean' : CustomClean}, + package_data={"" : ["lib/libchord.so"]}, + include_package_data=True, + zip_safe=False) From fa43e073b95cb2357faa5fa43310ebb3da6fc5d3 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Sun, 25 Jul 2021 19:23:30 +0100 Subject: [PATCH 21/43] nicer suffix finding --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45b57978..577c92bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ find_package (Python3 COMPONENTS Interpreter Development NumPy REQUIRED) # find out the suffix for the current python version EXECUTE_PROCESS( - COMMAND ${Python3_EXECUTABLE} "-c" "from importlib.machinery import EXTENSION_SUFFIXES;print(EXTENSION_SUFFIXES[0])" + COMMAND ${Python3_EXECUTABLE} "-c" "import sysconfig;print(sysconfig.get_config_var('EXT_SUFFIX'))" OUTPUT_VARIABLE python_so_suffix ) STRING(REPLACE "\n" "" python_so_suffix ${python_so_suffix}) From a709d00f911fd24ca741d3148fa47bb938ade931 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Sun, 25 Jul 2021 19:29:33 +0100 Subject: [PATCH 22/43] wrap python build into an option --- CMakeLists.txt | 62 +++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 577c92bd..f4c17027 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,32 +60,38 @@ set(target_python_dir ${PROJECT_BINARY_DIR}/python) add_subdirectory(src) add_subdirectory(likelihoods) -# PyPolyChord stuff -message(STATUS "Enabling Python package build") -find_package (Python3 COMPONENTS Interpreter Development NumPy REQUIRED) - -# find out the suffix for the current python version -EXECUTE_PROCESS( - COMMAND ${Python3_EXECUTABLE} "-c" "import sysconfig;print(sysconfig.get_config_var('EXT_SUFFIX'))" - OUTPUT_VARIABLE python_so_suffix -) -STRING(REPLACE "\n" "" python_so_suffix ${python_so_suffix}) -message(STATUS "Python shared object suffix is: ${python_so_suffix}") - -# the extension module -add_library(_pypolychord SHARED pypolychord/_pypolychord.cpp) -set_target_properties(_pypolychord - PROPERTIES - OUTPUT_NAME _pypolychord - PREFIX "" - SUFFIX "${python_so_suffix}" + +option(python "Build PyPolyChord package" ON) + + +if (python) + # PyPolyChord stuff + message(STATUS "Enabling Python package build") + find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED) + + # find out the suffix for the current python version + EXECUTE_PROCESS( + COMMAND ${Python3_EXECUTABLE} "-c" "import sysconfig;print(sysconfig.get_config_var('EXT_SUFFIX'))" + OUTPUT_VARIABLE python_so_suffix ) -# dependencies and includes -target_link_libraries(_pypolychord chord_shared Python3::Python Python3::NumPy) -target_include_directories(_pypolychord PUBLIC src/polychord) # PolyChord headers for python extensions - -# place all outputs in one place -install(TARGETS _pypolychord - RUNTIME DESTINATION ${target_python_dir} - LIBRARY DESTINATION ${target_python_dir} - ARCHIVE DESTINATION ${target_python_dir}) \ No newline at end of file + STRING(REPLACE "\n" "" python_so_suffix ${python_so_suffix}) + message(STATUS "Python shared object suffix is: ${python_so_suffix}") + + # the extension module + add_library(_pypolychord SHARED pypolychord/_pypolychord.cpp) + set_target_properties(_pypolychord + PROPERTIES + OUTPUT_NAME _pypolychord + PREFIX "" + SUFFIX "${python_so_suffix}" + ) + # dependencies and includes + target_link_libraries(_pypolychord chord_shared Python3::Python Python3::NumPy) + target_include_directories(_pypolychord PUBLIC src/polychord) # PolyChord headers for python extensions + + # place all outputs in one place + install(TARGETS _pypolychord + RUNTIME DESTINATION ${target_python_dir} + LIBRARY DESTINATION ${target_python_dir} + ARCHIVE DESTINATION ${target_python_dir}) +endif (python) From 8e9f49032efdad24d19110d9a889005158fa8a4b Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 12:12:51 +0100 Subject: [PATCH 23/43] CMake for the python package - libchord.so is not included correctlyjust yet --- CMakeLists.txt | 34 ++++++++- pypolychord/__init__.py | 2 +- setup_cmake.py | 141 ----------------------------------- setup_cmake_template.py | 46 ++++++++++++ src/polychord/CMakeLists.txt | 12 +-- 5 files changed, 85 insertions(+), 150 deletions(-) delete mode 100644 setup_cmake.py create mode 100644 setup_cmake_template.py diff --git a/CMakeLists.txt b/CMakeLists.txt index f4c17027..640311d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,10 @@ option(python "Build PyPolyChord package" ON) if (python) + ################################################################# + # The Compiled .so file + ################################################################# + # PyPolyChord stuff message(STATUS "Enabling Python package build") find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED) @@ -91,7 +95,31 @@ if (python) # place all outputs in one place install(TARGETS _pypolychord - RUNTIME DESTINATION ${target_python_dir} - LIBRARY DESTINATION ${target_python_dir} - ARCHIVE DESTINATION ${target_python_dir}) + LIBRARY DESTINATION ${target_python_dir}) + + ################################################################# + # The simple python module + ################################################################# + + # hack ofr version + set(PACKAGE_VERSION "1.18.2") + + set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup_cmake_template.py") + set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") + set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/pypolychord/__init__.py") + set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") # dummy target for dependence + + # fill in the variables of the setup.py file + configure_file(${SETUP_PY_IN} ${SETUP_PY}) + + # custom target + add_custom_command(OUTPUT ${OUTPUT} + COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} build + COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} + DEPENDS ${DEPS} _pypolychord) + add_custom_target(target ALL DEPENDS ${OUTPUT}) + + # installation with setup.py + install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install)") + endif (python) diff --git a/pypolychord/__init__.py b/pypolychord/__init__.py index 887fffec..976f746e 100644 --- a/pypolychord/__init__.py +++ b/pypolychord/__init__.py @@ -159,7 +159,7 @@ def run_polychord(loglikelihood, nDims, nDerived, settings, os.makedirs(settings.base_dir) except OSError: pass - + try: if rank == 0: os.makedirs(settings.cluster_dir) diff --git a/setup_cmake.py b/setup_cmake.py deleted file mode 100644 index 17b939eb..00000000 --- a/setup_cmake.py +++ /dev/null @@ -1,141 +0,0 @@ -""" -Python interface to PolyChord - -Polychord is a tool to solve high dimensional problems. -""" - -from setuptools import setup, Extension, find_packages, Distribution -from setuptools.command.build_py import build_py as _build_py -from distutils.command.clean import clean as _clean - -import os, sys, subprocess, shutil - -import numpy - -def check_compiler(default_CC="gcc"): - """Checks what compiler is being used (clang, intel, or gcc).""" - - CC = default_CC if "CC" not in os.environ else os.environ["CC"] - CC_version = subprocess.check_output([CC, "-v"], stderr=subprocess.STDOUT).decode("utf-8").lower() - - if "clang" in CC_version: - CC_family = "clang" - elif "icc" in CC_version: - CC_family = "intel" - elif "gcc" in CC_version: - CC_family = "gcc" - else: - print("Warning: unrecognised compiler: {}".format(CC_version)) - CC_family = "" - - return CC_family - - -NAME = 'pypolychord' -DOCLINES = (__doc__ or '').split("\n") - - -# Deal with annoying differences between clang and the other compilers -CC_FAMILY = check_compiler() -CPPRUNTIMELIB_FLAG = [] -RPATH_FLAG = [] - -if CC_FAMILY == "clang": - CPPRUNTIMELIB_FLAG += ["-stdlib=libc++"] - if sys.platform == "darwin": - # macOS idiosyncrasies - CPPRUNTIMELIB_FLAG += ["-mmacosx-version-min=10.9"] - -if sys.platform != "darwin": - # Set RPATH on Linux machines - RPATH_FLAG += ["-Wl,-rpath,$ORIGIN/pypolychord/lib"] - - -def readme(): - with open('pypolychord_README.rst') as f: - return f.read() - - -def get_version(short=False): - with open('src/polychord/feedback.f90') as f: - for line in f: - if 'version' in line: - return line[44:50] - - -class DistributionWithOption(Distribution, object): - def __init__(self, *args, **kwargs): - self.global_options = self.global_options \ - + [("no-mpi", None, "Don't compile with MPI support."), - ("debug-flags", None, "Compile in debug mode.")] - self.no_mpi = None - self.debug_flags = None - super(DistributionWithOption, self).__init__(*args, **kwargs) - -class CustomBuildPy(_build_py, object): - def run(self): - env = {} - env["PATH"] = os.environ["PATH"] - if self.distribution.no_mpi is None: - env["MPI"] = "1" - # These need to be set so that build_ext uses the right compilers - cc_compiler = subprocess.check_output(["make", "print_CC"]).decode('utf-8').strip() - os.environ["CC"] = cc_compiler - - cxx_compiler = subprocess.check_output(["make", "print_CXX"]).decode('utf-8').strip() - os.environ["CXX"] = cxx_compiler - else: - env["MPI"] = "0" - - if self.distribution.debug_flags is not None: - self.distribution.ext_modules[0].extra_compile_args += ["-g", "-O0"] - env["DEBUG"] = "1" - - BASE_PATH = os.path.dirname(os.path.abspath(__file__)) - env["PWD"] = BASE_PATH - env.update({k : os.environ[k] for k in ["CC", "CXX", "FC"] if k in os.environ}) - subprocess.check_call(["make", "-e", "libchord.so"], env=env, cwd=BASE_PATH) - if not os.path.isdir("pypolychord/lib/"): - os.makedirs(os.path.join(BASE_PATH, "pypolychord/lib/")) - shutil.copy(os.path.join(BASE_PATH, "lib/libchord.so"), - os.path.join(BASE_PATH, "pypolychord/lib/")) - self.run_command("build_ext") - return super(CustomBuildPy, self).run() - -class CustomClean(_clean): - def run(self): - subprocess.run(["make", "veryclean"], check=True, env=os.environ) - return super().run() - -if "--no-mpi" in sys.argv: - NAME += '_nompi' - DOCLINES[1] = DOCLINES[1] + ' (cannot be used with MPI)' - -pypolychord_module = Extension( - name='_pypolychord', - library_dirs=['lib'], - include_dirs=['src/polychord', numpy.get_include()], - libraries=['chord',], - extra_link_args=RPATH_FLAG + CPPRUNTIMELIB_FLAG, - extra_compile_args= ["-std=c++11"] + RPATH_FLAG + CPPRUNTIMELIB_FLAG, - runtime_library_dirs=['lib'], - sources=['pypolychord/_pypolychord.cpp'] - ) - -setup(name=NAME, - version=get_version(), - description='Python interface to PolyChord ' + get_version(), - url='https://ccpforge.cse.rl.ac.uk/gf/project/polychord/', - author='Will Handley', - author_email='wh260@cam.ac.uk', - license='PolyChord', - packages=find_packages(), - install_requires=['numpy','scipy'], - extras_require={'plotting': 'getdist'}, - distclass=DistributionWithOption, - ext_modules=[pypolychord_module], - cmdclass={'build_py' : CustomBuildPy, - 'clean' : CustomClean}, - package_data={"" : ["lib/libchord.so"]}, - include_package_data=True, - zip_safe=False) diff --git a/setup_cmake_template.py b/setup_cmake_template.py new file mode 100644 index 00000000..d1e12940 --- /dev/null +++ b/setup_cmake_template.py @@ -0,0 +1,46 @@ +import os +import shutil +import sys +from distutils.core import setup +from pathlib import Path + +from setuptools import Extension +from setuptools.command.build_ext import build_ext + + +class MyBuildExtension(build_ext): + def build_extension(self, ext): + print("MY current working directory:", os.getcwd()) + print("MY args:", sys.argv) + + # _pypolychord.ARCH.so + if os.path.exists("${target_python_dir}/_pypolychord${python_so_suffix}"): + print("CP: ${target_python_dir}/_pypolychord${python_so_suffix} ----> ", self.get_ext_fullpath(ext.name)) + shutil.copyfile("${target_python_dir}/_pypolychord${python_so_suffix}", self.get_ext_fullpath(ext.name)) + else: + print("NOT FOUND: ${target_python_dir}/_pypolychord${python_so_suffix}") + + # lib dir + if not os.path.isdir("${target_lib_dir}/pypolychord/lib/"): + print("CREATED: ${target_lib_dir}/pypolychord/lib/") + Path("${target_lib_dir}/pypolychord/lib/").mkdir(parents=True) + + # libchord.so + if os.path.exists("${target_lib_dir}/libchord.so"): + print("CP ${target_lib_dir}/libchord.so -->", + os.path.join(os.path.dirname(self.get_ext_fullpath(ext.name)), "pypolychord", "lib", "libchord.so")) + shutil.copyfile("${target_lib_dir}/libchord.so", + os.path.join(os.path.dirname(self.get_ext_fullpath(ext.name)), "pypolychord", "lib", "libchord.so")) + + else: + print("NOT Found: ${target_lib_dir}/libchord.so") + + +setup(name='pypolychord', + version='${PACKAGE_VERSION}', + package_dir={'pypolychord': '${CMAKE_CURRENT_SOURCE_DIR}/pypolychord'}, + packages=['pypolychord'], + package_data={'pypolychord': ["${target_lib_dir}/libchord.so"]}, + cmdclass={'build_ext': MyBuildExtension}, + ext_modules=[Extension('_pypolychord', [])], + ) diff --git a/src/polychord/CMakeLists.txt b/src/polychord/CMakeLists.txt index 269d602e..fc26af5e 100644 --- a/src/polychord/CMakeLists.txt +++ b/src/polychord/CMakeLists.txt @@ -16,10 +16,12 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY LINKER_LANGUAGE Fortran) # libcoord.so as well -> needs a different target name, but the same lib name add_library(${PROJECT_NAME}_shared SHARED $) -set_target_properties(${PROJECT_NAME}_shared PROPERTIES OUTPUT_NAME ${PROJECT_NAME} CLEAN_DIRECT_OUTPUT 1 LINKER_LANGUAGE Fortran) +set_target_properties(${PROJECT_NAME}_shared + PROPERTIES + OUTPUT_NAME ${PROJECT_NAME} + CLEAN_DIRECT_OUTPUT 1 + LINKER_LANGUAGE Fortran) # standard: where to put the targets -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${target_bin_dir} - LIBRARY DESTINATION ${target_lib_dir} - ARCHIVE DESTINATION ${target_lib_dir}) +install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_shared + LIBRARY DESTINATION ${target_lib_dir}) From aa8bff2364dbd9a119b255f216e6fe6419357625 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 14:58:30 +0100 Subject: [PATCH 24/43] install python deps in GNU Dockerfile --- devtools/docker_gnu/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devtools/docker_gnu/Dockerfile b/devtools/docker_gnu/Dockerfile index 8e4b467d..bc50e496 100644 --- a/devtools/docker_gnu/Dockerfile +++ b/devtools/docker_gnu/Dockerfile @@ -17,8 +17,11 @@ RUN apt-get -q update && \ # cmake and tools cmake vim git wget ca-certificates \ g++ \ + python3-dev pip \ && rm -rf /var/lib/apt/lists/* +RUN pip3 install scipy matplotlib getdist anesthetic ipython + # reinstall newer cmake, same as in the Intel image ARG cmake_url=https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh ADD $cmake_url / @@ -32,3 +35,6 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/ -t robbyrussell ENTRYPOINT "/usr/bin/zsh" WORKDIR /work + +# python executable +RUN echo "alias python=python3" >> /root/.zshrc From 6dc3d85b00617d1e1387827882ab53d19e3a80a0 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 15:15:18 +0100 Subject: [PATCH 25/43] directly build the python .so file --- CMakeLists.txt | 10 ++++++---- setup_cmake_template.py | 42 ++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 640311d0..14d789f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,6 @@ set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) # target directories -> stuff installed in these directories set(target_lib_dir ${PROJECT_BINARY_DIR}/lib) set(target_bin_dir ${PROJECT_BINARY_DIR}/bin) -set(target_python_dir ${PROJECT_BINARY_DIR}/python) # directories where we want to make things add_subdirectory(src) @@ -82,7 +81,7 @@ if (python) message(STATUS "Python shared object suffix is: ${python_so_suffix}") # the extension module - add_library(_pypolychord SHARED pypolychord/_pypolychord.cpp) + add_library(_pypolychord SHARED pypolychord/_pypolychord.cpp $) set_target_properties(_pypolychord PROPERTIES OUTPUT_NAME _pypolychord @@ -90,12 +89,15 @@ if (python) SUFFIX "${python_so_suffix}" ) # dependencies and includes - target_link_libraries(_pypolychord chord_shared Python3::Python Python3::NumPy) + target_link_libraries(_pypolychord Python3::Python Python3::NumPy) target_include_directories(_pypolychord PUBLIC src/polychord) # PolyChord headers for python extensions + # remember the place of this + set(target_python_so ${CMAKE_CURRENT_BINARY_DIR}/_pypolychord${python_so_suffix}) + # place all outputs in one place install(TARGETS _pypolychord - LIBRARY DESTINATION ${target_python_dir}) + LIBRARY DESTINATION ${target_lib_dir}) ################################################################# # The simple python module diff --git a/setup_cmake_template.py b/setup_cmake_template.py index d1e12940..de376fa4 100644 --- a/setup_cmake_template.py +++ b/setup_cmake_template.py @@ -1,46 +1,40 @@ +""" +Template for setup.py that should be populated by CMake with: +configure_file(${SETUP_PY_IN} ${SETUP_PY}) + +Used template variables: + - "target_python_so" : place where _pypolychord.ARCH.so is built (NOT install path) + - "PACKAGE_VERSION" : version of the package + - "CMAKE_CURRENT_SOURCE_DIR": root directory, where a standard setup.py would be placed +""" + import os import shutil import sys from distutils.core import setup -from pathlib import Path from setuptools import Extension from setuptools.command.build_ext import build_ext class MyBuildExtension(build_ext): + """This class 'builds' the extension module, by + copying it from the place where CMake placed it. + """ def build_extension(self, ext): - print("MY current working directory:", os.getcwd()) - print("MY args:", sys.argv) # _pypolychord.ARCH.so - if os.path.exists("${target_python_dir}/_pypolychord${python_so_suffix}"): - print("CP: ${target_python_dir}/_pypolychord${python_so_suffix} ----> ", self.get_ext_fullpath(ext.name)) - shutil.copyfile("${target_python_dir}/_pypolychord${python_so_suffix}", self.get_ext_fullpath(ext.name)) - else: - print("NOT FOUND: ${target_python_dir}/_pypolychord${python_so_suffix}") - - # lib dir - if not os.path.isdir("${target_lib_dir}/pypolychord/lib/"): - print("CREATED: ${target_lib_dir}/pypolychord/lib/") - Path("${target_lib_dir}/pypolychord/lib/").mkdir(parents=True) - - # libchord.so - if os.path.exists("${target_lib_dir}/libchord.so"): - print("CP ${target_lib_dir}/libchord.so -->", - os.path.join(os.path.dirname(self.get_ext_fullpath(ext.name)), "pypolychord", "lib", "libchord.so")) - shutil.copyfile("${target_lib_dir}/libchord.so", - os.path.join(os.path.dirname(self.get_ext_fullpath(ext.name)), "pypolychord", "lib", "libchord.so")) - - else: - print("NOT Found: ${target_lib_dir}/libchord.so") + if os.path.exists("${target_python_so}"): + shutil.copyfile("${target_python_so}", self.get_ext_fullpath(ext.name)) + elif sys.argv[2] == "install": + # let's warn here, though this should not happen with the current CMake setup + print("NOT FOUND: ${target_python_so}\nYour installation may be incomplete.") setup(name='pypolychord', version='${PACKAGE_VERSION}', package_dir={'pypolychord': '${CMAKE_CURRENT_SOURCE_DIR}/pypolychord'}, packages=['pypolychord'], - package_data={'pypolychord': ["${target_lib_dir}/libchord.so"]}, cmdclass={'build_ext': MyBuildExtension}, ext_modules=[Extension('_pypolychord', [])], ) From 36c57dac89c87f5d8ec533564665a59a68f81226 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 15:31:16 +0100 Subject: [PATCH 26/43] include the rest of the info in CMake setup.py template as well --- setup_cmake_template.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/setup_cmake_template.py b/setup_cmake_template.py index de376fa4..7245ccf6 100644 --- a/setup_cmake_template.py +++ b/setup_cmake_template.py @@ -17,10 +17,16 @@ from setuptools.command.build_ext import build_ext +def readme(): + with open('README.rst') as f: + return f.read() + + class MyBuildExtension(build_ext): """This class 'builds' the extension module, by copying it from the place where CMake placed it. """ + def build_extension(self, ext): # _pypolychord.ARCH.so @@ -32,6 +38,17 @@ def build_extension(self, ext): setup(name='pypolychord', + description='Python interface to PolyChord ${PACKAGE_VERSION}', + long_description=readme(), + long_description_content_type='text/x-rst', + url='https://ccpforge.cse.rl.ac.uk/gf/project/polychord/', + author='Will Handley', + author_email='wh260@cam.ac.uk', + license='PolyChord', + install_requires=['numpy', 'scipy'], + extras_require={'plotting': 'getdist'}, + + # Don't touch anything below here - CMake fills this in version='${PACKAGE_VERSION}', package_dir={'pypolychord': '${CMAKE_CURRENT_SOURCE_DIR}/pypolychord'}, packages=['pypolychord'], From d04a227e8f86648855490bff217813dfa41c0701 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 15:36:41 +0100 Subject: [PATCH 27/43] add some classifiers for the package --- setup_cmake_template.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/setup_cmake_template.py b/setup_cmake_template.py index 7245ccf6..6758d8a7 100644 --- a/setup_cmake_template.py +++ b/setup_cmake_template.py @@ -48,6 +48,28 @@ def build_extension(self, ext): install_requires=['numpy', 'scipy'], extras_require={'plotting': 'getdist'}, + classifiers=[ + "Development Status :: 5 - Production/Stable", + + "Intended Audience :: Education", + + "Operating System :: MacOS :: MacOS X", + "Operating System :: Unix", + + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Scientific/Engineering :: Physics", + + "Programming Language :: C++", + "Programming Language :: Fortran", + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + "Programming Language :: Python :: 3.10", + + ], + # Don't touch anything below here - CMake fills this in version='${PACKAGE_VERSION}', package_dir={'pypolychord': '${CMAKE_CURRENT_SOURCE_DIR}/pypolychord'}, From d72b992cd189a1e47f726cffe44d34f295bcd5d4 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 16:40:29 +0100 Subject: [PATCH 28/43] readme location --- setup_cmake_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_cmake_template.py b/setup_cmake_template.py index 6758d8a7..6380f289 100644 --- a/setup_cmake_template.py +++ b/setup_cmake_template.py @@ -18,7 +18,7 @@ def readme(): - with open('README.rst') as f: + with open('${CMAKE_CURRENT_SOURCE_DIR}/README.rst') as f: return f.read() From 06064c26b63a4b1818dce6464f81e2772f6958b4 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 16:42:01 +0100 Subject: [PATCH 29/43] CI: dependency installations --- .github/workflows/run_cmake.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index 287c41ba..12b0d34a 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -13,7 +13,10 @@ jobs: - uses: actions/checkout@v2 - name: Install dependencies - run: sudo apt-get install gfortran libopenmpi-dev cmake + run: | + sudo apt-get update + sudo apt-get install gfortran libopenmpi-dev cmake python3-dev pip + pip install scipy matplotlib getdist anesthetic ipython - name: Run CMake builid run: | @@ -35,7 +38,7 @@ jobs: run: | mkdir BUILD_Intel cd BUILD_Intel - cmake -DCMAKE_CXX_COMPILER=icpc .. + cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort .. make install build-MacOS: @@ -46,7 +49,9 @@ jobs: - uses: actions/checkout@v2 - name: Install dependencies - run: brew install cmake gcc openmpi + run: | + brew install cmake gcc openmpi + pip install scipy matplotlib getdist anesthetic ipython - name: Check versions run: | From 3f84c804ce96cbc10cf0f19d79826ed6506bb715 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 16:46:54 +0100 Subject: [PATCH 30/43] CI: python3 in MacOS as well + tests --- .github/workflows/run_cmake.yaml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index 12b0d34a..a8950487 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -16,7 +16,7 @@ jobs: run: | sudo apt-get update sudo apt-get install gfortran libopenmpi-dev cmake python3-dev pip - pip install scipy matplotlib getdist anesthetic ipython + pip install scipy matplotlib getdist anesthetic ipython mpi4py - name: Run CMake builid run: | @@ -25,6 +25,12 @@ jobs: cmake .. make install + - name: Test pypolychord + run: python run_pypolychord.py + + - name: Test pypolychord (MPI) + run: mpirun -np 2 python run_pypolychord.py + build-Intel: runs-on: ubuntu-latest container: @@ -40,6 +46,11 @@ jobs: cd BUILD_Intel cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort .. make install + - name: Test pypolychord + run: python run_pypolychord.py + + - name: Test pypolychord (MPI) + run: mpirun -np 2 python run_pypolychord.py build-MacOS: runs-on: macos-latest @@ -51,7 +62,7 @@ jobs: - name: Install dependencies run: | brew install cmake gcc openmpi - pip install scipy matplotlib getdist anesthetic ipython + pip3 install scipy matplotlib getdist anesthetic ipython mpi4py - name: Check versions run: | @@ -65,3 +76,9 @@ jobs: cd BUILD_GNU_MacOS cmake -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_CXX_COMPILER=gcc-11 .. make VERBOSE=1 install + + - name: Test pypolychord + run: python run_pypolychord.py + + - name: Test pypolychord (MPI) + run: mpirun -np 2 python run_pypolychord.py \ No newline at end of file From 67aec13df82c8c6115e15a668b1eba2c45d71d0b Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 16:52:16 +0100 Subject: [PATCH 31/43] update docker files: - Intel to have python and deps - GNU : install mpi4py --- devtools/docker_gnu/Dockerfile | 2 +- devtools/docker_intel/Dockerfile | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/devtools/docker_gnu/Dockerfile b/devtools/docker_gnu/Dockerfile index bc50e496..3f6881b1 100644 --- a/devtools/docker_gnu/Dockerfile +++ b/devtools/docker_gnu/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get -q update && \ python3-dev pip \ && rm -rf /var/lib/apt/lists/* -RUN pip3 install scipy matplotlib getdist anesthetic ipython +RUN pip3 install scipy matplotlib getdist anesthetic ipython mpi4py # reinstall newer cmake, same as in the Intel image ARG cmake_url=https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh diff --git a/devtools/docker_intel/Dockerfile b/devtools/docker_intel/Dockerfile index 2b77811a..8c9ee817 100644 --- a/devtools/docker_intel/Dockerfile +++ b/devtools/docker_intel/Dockerfile @@ -17,6 +17,7 @@ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic \ intel-oneapi-mpi-devel \ intel-oneapi-compiler-fortran \ + intel-oneapi-python python3-pip \ # other tools and libraries libblas-dev \ liblapack-dev \ @@ -25,6 +26,8 @@ apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \ vim git wget ca-certificates \ -- +RUN pip3 install scipy matplotlib getdist anesthetic ipython mpi4py + # reinstall newer cmake ARG cmake_url=https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh ADD $cmake_url / From b9adafc9cf37eb5da9fc0441482385305574cb7c Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 26 Jul 2021 17:17:55 +0100 Subject: [PATCH 32/43] install for user if needed --- .github/workflows/run_cmake.yaml | 2 +- CMakeLists.txt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index a8950487..65016209 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -62,7 +62,7 @@ jobs: - name: Install dependencies run: | brew install cmake gcc openmpi - pip3 install scipy matplotlib getdist anesthetic ipython mpi4py + pip3 install numpy scipy matplotlib getdist anesthetic ipython mpi4py - name: Check versions run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 14d789f1..cfa91bda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,7 @@ add_subdirectory(likelihoods) option(python "Build PyPolyChord package" ON) +option(python_user_install "Install Python package for user (--user)" ON) if (python) @@ -122,6 +123,10 @@ if (python) add_custom_target(target ALL DEPENDS ${OUTPUT}) # installation with setup.py - install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install)") + if (python_user_install) + install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install)") + else(python_user_install) + install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install --user)") + endif(python_user_install) endif (python) From b9a3d3d9abfefcdf207b73bf830692805d68e922 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Tue, 10 Aug 2021 21:29:49 +0100 Subject: [PATCH 33/43] MPI preprocessing directive same in CXX and Fortran --- CMakeLists.txt | 26 ++++++++++++-------- Makefile | 2 +- likelihoods/examples/random_gaussian.f90 | 4 ++-- src/polychord/abort.F90 | 6 ++--- src/polychord/generate.F90 | 20 ++++++++-------- src/polychord/interfaces.F90 | 18 +++++++------- src/polychord/maximiser.F90 | 4 ++-- src/polychord/mpi_utils.F90 | 12 +++++----- src/polychord/nested_sampling.F90 | 30 ++++++++++++------------ src/polychord/random_utils.F90 | 8 +++---- src/polychord/utils.F90 | 6 ++--- 11 files changed, 71 insertions(+), 65 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfa91bda..6a01dfa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,11 @@ project(PolyChordLite Fortran) enable_language(CXX) enable_language(Fortran) +# options +option(MPI "Build with MPI" ON) +option(python "Build PyPolyChord package" ON) +option(python_user_install "Install Python package for user (--user)" ON) + # enforce matching of the CXX and Fortran compilers if (NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_CXX_COMPILER_ID}") message(FATAL_ERROR "You need to use the same vendor for your C++ and Fortran compiler") @@ -41,9 +46,15 @@ elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Cray") endif () # find MPI & link to everything from now on -find_package(MPI REQUIRED) -message(STATUS "MPI_Fortran_COMPILER: ${MPI_Fortran_COMPILER}") -link_libraries(MPI::MPI_Fortran) +if (MPI) + find_package(MPI REQUIRED) + message(STATUS "MPI_Fortran_COMPILER: ${MPI_Fortran_COMPILER}") + link_libraries(MPI::MPI_Fortran) + link_libraries(MPI::MPI_CXX) + + # definitions + add_compile_definitions(USE_MPI) +endif (MPI) # this will be module building directory, allows linking set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/generated/mods) @@ -59,11 +70,6 @@ set(target_bin_dir ${PROJECT_BINARY_DIR}/bin) add_subdirectory(src) add_subdirectory(likelihoods) - -option(python "Build PyPolyChord package" ON) -option(python_user_install "Install Python package for user (--user)" ON) - - if (python) ################################################################# # The Compiled .so file @@ -125,8 +131,8 @@ if (python) # installation with setup.py if (python_user_install) install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install)") - else(python_user_install) + else (python_user_install) install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install --user)") - endif(python_user_install) + endif (python_user_install) endif (python) diff --git a/Makefile b/Makefile index 8e871ce0..107448bf 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ endif ifeq ($(MPI),1) -FFLAGS += -DMPI +FFLAGS += -DUSE_MPI CXXFLAGS += -DUSE_MPI endif diff --git a/likelihoods/examples/random_gaussian.f90 b/likelihoods/examples/random_gaussian.f90 index c54584ac..6efc0fd5 100644 --- a/likelihoods/examples/random_gaussian.f90 +++ b/likelihoods/examples/random_gaussian.f90 @@ -32,7 +32,7 @@ end function loglikelihood subroutine setup_loglikelihood(settings) -#ifdef MPI +#ifdef USE_MPI use mpi_module #endif use settings_module, only: program_settings @@ -54,7 +54,7 @@ subroutine setup_loglikelihood(settings) ! Generate a random covariance matrix, its inverse and logdet on the root node call random_inverse_covmat(invcovmat,logdetcovmat,sigma,nDims) -#ifdef MPI +#ifdef USE_MPI call initialise_mpi(settings%feedback) ! Broadcast the covariance matrix and normalisation data to the ! rest of the nodes diff --git a/src/polychord/abort.F90 b/src/polychord/abort.F90 index fda69985..7cd49946 100644 --- a/src/polychord/abort.F90 +++ b/src/polychord/abort.F90 @@ -5,13 +5,13 @@ module abort_module subroutine halt_program(message) use utils_module, only: stderr_unit implicit none -#ifdef MPI +#ifdef USE_MPI include 'mpif.h' #endif character(LEN=*), intent(in), optional :: message -#ifdef MPI +#ifdef USE_MPI integer :: errorcode=1 integer :: mpierror #endif @@ -22,7 +22,7 @@ subroutine halt_program(message) write(stderr_unit,'( 20("=") )') end if -#ifdef MPI +#ifdef USE_MPI call MPI_ABORT(MPI_COMM_WORLD,errorcode,mpierror) #else stop 1 diff --git a/src/polychord/generate.F90 b/src/polychord/generate.F90 index 8adf0fb3..23d37f7f 100644 --- a/src/polychord/generate.F90 +++ b/src/polychord/generate.F90 @@ -68,7 +68,7 @@ subroutine GenerateLivePoints(loglikelihood,prior,settings,RTI,mpi_information) use run_time_module, only: run_time_info,initialise_run_time_info, find_min_loglikelihoods use array_module, only: add_point use abort_module -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: mpi_bundle,is_root,linear_mode,throw_point,catch_point,more_points_needed,sum_integers,sum_doubles,request_point,no_more_points #else use mpi_module, only: mpi_bundle,is_root,linear_mode @@ -100,7 +100,7 @@ function prior(cube) result(theta) type(run_time_info) :: RTI type(mpi_bundle),intent(in) :: mpi_information -#ifdef MPI +#ifdef USE_MPI integer :: active_workers ! Number of currently working workers integer :: worker_id ! Worker identifier to signal who to throw back to #endif @@ -181,7 +181,7 @@ function prior(cube) result(theta) end do -#ifdef MPI +#ifdef USE_MPI else !===================== PARALLEL MODE ======================= @@ -246,7 +246,7 @@ function prior(cube) result(theta) #endif end if !(nprocs case) -#ifdef MPI +#ifdef USE_MPI nlike = sum_integers(nlike,mpi_information) ! Gather the likelihood calls onto one node ndiscarded = sum_integers(ndiscarded,mpi_information) ! Gather the likelihood calls onto one node total_time = sum_doubles(total_time,mpi_information) ! Sum up the total time taken @@ -319,7 +319,7 @@ subroutine time_speeds(loglikelihood,prior,settings,RTI,speed,mpi_information) use utils_module, only: normal_fb,stdout_unit,fancy_fb,time use calculate_module, only: calculate_point use abort_module -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: mpi_bundle,is_root,sum_doubles,sum_integers #else use mpi_module, only: mpi_bundle,is_root @@ -419,7 +419,7 @@ function prior(cube) result(theta) end if end do -#ifdef MPI +#ifdef USE_MPI total_time=sum_doubles(total_time,mpi_information) i_live = sum_integers(i_live,mpi_information) nlike = sum_integers(nlike,mpi_information) @@ -450,7 +450,7 @@ subroutine GenerateLivePointsFromSeed(loglikelihood,prior,settings,RTI,mpi_infor use array_module, only: add_point use abort_module use chordal_module, only: slice_sample -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: mpi_bundle,is_root,linear_mode,throw_point,catch_point,more_points_needed,sum_integers,sum_doubles,request_point,no_more_points #else use mpi_module, only: mpi_bundle,is_root,linear_mode @@ -482,7 +482,7 @@ function prior(cube) result(theta) type(run_time_info) :: RTI type(mpi_bundle),intent(in) :: mpi_information -#ifdef MPI +#ifdef USE_MPI integer :: active_workers ! Number of currently working workers integer :: worker_id ! Worker identifier to signal who to throw back to #endif @@ -559,7 +559,7 @@ function prior(cube) result(theta) end do -#ifdef MPI +#ifdef USE_MPI else !===================== PARALLEL MODE ======================= @@ -629,7 +629,7 @@ function prior(cube) result(theta) #endif end if !(nprocs case) -#ifdef MPI +#ifdef USE_MPI do i_grade=1,size(settings%grade_dims) nlikes(i_grade) = sum_integers(nlikes(i_grade),mpi_information) ! Gather the likelihood calls onto one node times(i_grade) = sum_doubles(times(i_grade),mpi_information) ! Sum up the total time taken diff --git a/src/polychord/interfaces.F90 b/src/polychord/interfaces.F90 index ac3fe110..1f654d92 100644 --- a/src/polychord/interfaces.F90 +++ b/src/polychord/interfaces.F90 @@ -2,7 +2,7 @@ module interfaces_module use utils_module, only: dp implicit none -#ifdef MPI +#ifdef USE_MPI include 'mpif.h' #endif interface run_polychord @@ -16,11 +16,11 @@ subroutine run_polychord_full(loglikelihood, prior_transform, dumper, settings_i use settings_module, only: program_settings,initialise_settings use random_module, only: initialise_random use nested_sampling_module, only: NestedSampling -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: initialise_mpi, finalise_mpi #endif implicit none -#ifdef MPI +#ifdef USE_MPI include 'mpif.h' #endif @@ -56,7 +56,7 @@ end subroutine dumper real(dp), dimension(4) :: output_info -#ifdef MPI +#ifdef USE_MPI if (present(mpi_communicator)) then comm = mpi_communicator else @@ -73,7 +73,7 @@ end subroutine dumper end if settings = settings_in call initialise_settings(settings) -#ifdef MPI +#ifdef USE_MPI output_info = NestedSampling(loglikelihood,prior_transform,dumper,settings,comm) call finalise_mpi #else @@ -105,7 +105,7 @@ end subroutine dumper type(program_settings),intent(in) :: settings ! The program settings integer, intent(in), optional :: mpi_communicator integer :: comm -#ifdef MPI +#ifdef USE_MPI if (present(mpi_communicator)) then comm = mpi_communicator else @@ -145,7 +145,7 @@ end function prior_transform type(program_settings),intent(in) :: settings ! The program settings integer, intent(in), optional :: mpi_communicator integer :: comm -#ifdef MPI +#ifdef USE_MPI if (present(mpi_communicator)) then comm = mpi_communicator else @@ -177,7 +177,7 @@ end function loglikelihood !> MPI handle integer, intent(in), optional :: mpi_communicator integer :: comm -#ifdef MPI +#ifdef USE_MPI if (present(mpi_communicator)) then comm = mpi_communicator else @@ -231,7 +231,7 @@ end subroutine setup_loglikelihood end interface integer, intent(in), optional :: mpi_communicator integer :: comm -#ifdef MPI +#ifdef USE_MPI if (present(mpi_communicator)) then comm = mpi_communicator else diff --git a/src/polychord/maximiser.F90 b/src/polychord/maximiser.F90 index 600d4c59..cdf18fa7 100644 --- a/src/polychord/maximiser.F90 +++ b/src/polychord/maximiser.F90 @@ -11,7 +11,7 @@ subroutine maximise(loglikelihood,prior,settings,RTI) use run_time_module, only: run_time_info use read_write_module, only: write_max_file, mean use chordal_module, only: generate_nhats, slice_sample -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: mpi_bundle,is_root, throw_point, catch_point, mpi_synchronise, throw_seed, catch_seed #else use mpi_module, only: mpi_bundle,is_root @@ -70,7 +70,7 @@ function do_maximisation(loglikelihood,prior,settings,RTI, posterior) result(max use read_write_module, only: write_max_file, mean use chordal_module, only: generate_nhats, slice_sample use nelder_mead_module, only: nelder_mead -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: mpi_bundle,is_root, throw_point, catch_point, mpi_synchronise, throw_seed, catch_seed #else use mpi_module, only: mpi_bundle,is_root diff --git a/src/polychord/mpi_utils.F90 b/src/polychord/mpi_utils.F90 index 9a891b2a..813cf89d 100644 --- a/src/polychord/mpi_utils.F90 +++ b/src/polychord/mpi_utils.F90 @@ -2,7 +2,7 @@ module mpi_module use utils_module, only: dp, normal_fb implicit none -#ifdef MPI +#ifdef USE_MPI include 'mpif.h' #endif @@ -83,7 +83,7 @@ function get_nprocs(mpi_communicator) result(nprocs) integer, intent(in) :: mpi_communicator integer :: nprocs -#ifdef MPI +#ifdef USE_MPI call MPI_COMM_SIZE( & mpi_communicator,&!handle nprocs, &!return number of processors @@ -103,7 +103,7 @@ function get_rank(mpi_communicator) result(myrank) integer, intent(in) :: mpi_communicator integer :: myrank -#ifdef MPI +#ifdef USE_MPI call MPI_COMM_RANK( & mpi_communicator,&!handle myrank, &!return rank of calling processor @@ -132,7 +132,7 @@ function get_root(mpi_communicator) result(root) ! Get the rank of the process myrank = get_rank(mpi_communicator) -#ifdef MPI +#ifdef USE_MPI call MPI_ALLREDUCE( & myrank, &!send buffer root, &!recieve buffer @@ -149,7 +149,7 @@ function get_root(mpi_communicator) result(root) end function get_root -#ifdef MPI +#ifdef USE_MPI !> Procedure to initialise mpi subroutine initialise_mpi(feedback) implicit none @@ -217,7 +217,7 @@ subroutine mpi_synchronise(mpi_information) implicit none type(mpi_bundle), intent(in) :: mpi_information -#ifdef MPI +#ifdef USE_MPI call MPI_BARRIER(mpi_information%communicator,mpierror) #endif diff --git a/src/polychord/nested_sampling.F90 b/src/polychord/nested_sampling.F90 index 0db480ae..b2e6600d 100644 --- a/src/polychord/nested_sampling.F90 +++ b/src/polychord/nested_sampling.F90 @@ -1,7 +1,7 @@ module nested_sampling_module use utils_module, only: dp -#ifdef MPI +#ifdef USE_MPI use mpi_module, only: get_mpi_information,mpi_bundle,is_root,linear_mode,catch_babies,throw_babies,throw_seed,catch_seed,broadcast_integers,mpi_synchronise #else use mpi_module, only: get_mpi_information,mpi_bundle,is_root,linear_mode @@ -23,7 +23,7 @@ function NestedSampling(loglikelihood,prior, dumper, settings, mpi_communicator) use cluster_module, only: do_clustering use generate_module, only: GenerateSeed,GenerateLivePoints,GenerateLivePointsFromSeed use maximise_module, only: maximise -#ifdef MPI +#ifdef USE_MPI use utils_module, only: normal_fb,stdout_unit #else use utils_module, only: stdout_unit @@ -114,7 +114,7 @@ end subroutine dumper type(mpi_bundle) :: mpi_information -#ifdef MPI +#ifdef USE_MPI ! MPI specific variables ! ---------------------- integer :: i_worker ! Worker iterator @@ -142,7 +142,7 @@ end subroutine dumper ! MPI initialisation mpi_information = get_mpi_information(mpi_communicator) -#ifdef MPI +#ifdef USE_MPI allocate(worker_cluster(mpi_information%nprocs-1)) ! Allocate the worker arrays worker_cluster = 1 ! initialise with 1 @@ -222,7 +222,7 @@ end subroutine dumper num_repeats = RTI%num_repeats call write_num_repeats(num_repeats,settings%feedback) end if -#ifdef MPI +#ifdef USE_MPI call broadcast_integers(num_repeats,mpi_information) allocate(nursary(settings%nTotal,sum(num_repeats), mpi_information%nprocs-1)) allocate(worker_epochs(mpi_information%nprocs-1), nlikes(size(settings%grade_dims),mpi_information%nprocs-1)) @@ -262,7 +262,7 @@ end subroutine dumper ! Generate a new set of points within the likelihood bound of the late point baby_points = SliceSampling(loglikelihood,prior,settings,logL,seed_point,cholesky,nlike,num_repeats) baby_points(settings%b0,:) = logL ! Note the moment it is born at -#ifdef MPI +#ifdef USE_MPI else if(settings%synchronous) then ! Parallel synchronous mode ! ------------------------- @@ -313,7 +313,7 @@ end subroutine dumper ! See if this point is suitable to be added to the arrays -#ifdef MPI +#ifdef USE_MPI if( linear_mode(mpi_information) .or. administrator_epoch==worker_epoch ) then #endif if(replace_point(settings,RTI,baby_points,cluster_id)) then @@ -341,7 +341,7 @@ end subroutine dumper end if if(delete_cluster(settings,RTI)) then -#ifdef MPI +#ifdef USE_MPI administrator_epoch = administrator_epoch+1 #endif end if! Delete any clusters as necessary @@ -357,21 +357,21 @@ end subroutine dumper ! If we want to cluster on sub dimensions, then do this first if(allocated(settings%sub_clustering_dimensions)) then if( do_clustering(settings,RTI,settings%sub_clustering_dimensions) ) then -#ifdef MPI +#ifdef USE_MPI administrator_epoch = administrator_epoch+1 #endif end if end if if( do_clustering(settings,RTI) ) then -#ifdef MPI +#ifdef USE_MPI administrator_epoch = administrator_epoch+1 #endif end if end if call calculate_covmats(settings,RTI) end if -#ifdef MPI +#ifdef USE_MPI end if #endif @@ -421,7 +421,7 @@ end subroutine dumper ! C) Clean up ! ======== -#ifdef MPI +#ifdef USE_MPI ! MPI cleanup ! ----------- ! Kill off the final workers. @@ -429,7 +429,7 @@ end subroutine dumper ! data from each node (and throw it away) and then send a kill signal back to it if (settings%synchronous) then do worker_id=mpi_information%nprocs-1,1,-1 - call throw_seed(seed_point,cholesky,logL,mpi_information,worker_id,administrator_epoch,.false.) + call throw_seed(seed_point,cholesky,logL,mpi_information,worker_id,administrator_epoch,.false.) end do else do i_worker=mpi_information%nprocs-1,1,-1 @@ -441,7 +441,7 @@ end subroutine dumper RTI%nlike = RTI%nlike + nlike ! Send kill signal to worker worker_id (note that we no longer care about seed_point, so we'll just use the last one - call throw_seed(seed_point,cholesky,logL,mpi_information,worker_id,administrator_epoch,.false.) + call throw_seed(seed_point,cholesky,logL,mpi_information,worker_id,administrator_epoch,.false.) end do end if @@ -504,7 +504,7 @@ end subroutine dumper #endif end if !(myrank==root / myrank/=root) -#ifdef MPI +#ifdef USE_MPI call mpi_synchronise(mpi_information) #endif diff --git a/src/polychord/random_utils.F90 b/src/polychord/random_utils.F90 index 1192606e..d27238eb 100644 --- a/src/polychord/random_utils.F90 +++ b/src/polychord/random_utils.F90 @@ -4,7 +4,7 @@ module random_module use utils_module, only: dp -#ifdef MPI +#ifdef USE_MPI use mpi_module #endif @@ -32,7 +32,7 @@ subroutine initialise_random(mpi_communicator,seed_input) integer, optional, intent(in) :: seed_input integer,allocatable,dimension(:) :: seed ! vector to be passed to random_seed -#ifdef MPI +#ifdef USE_MPI integer :: mpierror #endif @@ -46,7 +46,7 @@ subroutine initialise_random(mpi_communicator,seed_input) ! Get the global ranking -#ifdef MPI +#ifdef USE_MPI call MPI_COMM_RANK(mpi_communicator, myrank, mpierror) #else myrank = 0 @@ -76,7 +76,7 @@ subroutine initialise_random(mpi_communicator,seed_input) end if -#ifdef MPI +#ifdef USE_MPI ! Broadcast the system time to all nodes call MPI_BCAST(t,1,MPI_INTEGER,0,mpi_communicator,mpierror) diff --git a/src/polychord/utils.F90 b/src/polychord/utils.F90 index 105e09a4..e5f406a3 100644 --- a/src/polychord/utils.F90 +++ b/src/polychord/utils.F90 @@ -1,7 +1,7 @@ module utils_module implicit none -#ifdef MPI +#ifdef USE_MPI include 'mpif.h' #endif integer, parameter :: dp = kind(1.d0) @@ -1050,12 +1050,12 @@ end function log_gauss !> This gets the wallclock timer from the mpi library function time() implicit none -#ifdef MPI +#ifdef USE_MPI include 'mpif.h' #endif real(dp) :: time -#ifdef MPI +#ifdef USE_MPI time = MPI_Wtime() #else call cpu_time(time) From 7101e159866438d4acb2eb9887ce987e4ae7bf06 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Tue, 10 Aug 2021 21:40:52 +0100 Subject: [PATCH 34/43] allow manual dispatch of CI as well --- .github/workflows/run_cmake.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index 65016209..cf2c9313 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -3,6 +3,7 @@ name: CMake build on: [ push ] + workflow_dispatch: jobs: build-GNU: From 7f71d6264de17974baf46e4654af7624a1aa61b1 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Fri, 13 Aug 2021 08:13:49 +0100 Subject: [PATCH 35/43] CI no cron job in fork --- .github/workflows/CI.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4284765e..564fe979 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -5,8 +5,9 @@ on: branches: [ master ] pull_request: branches: [ master ] - schedule: - - cron: "0 0 * * *" +# don't run the CRON part in my fork +# schedule: +# - cron: "0 0 * * *" workflow_dispatch: From d79af5ef6e5ef77a201da8a89e35a362a6c9ce32 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Fri, 13 Aug 2021 08:17:06 +0100 Subject: [PATCH 36/43] CI: update cmake steps --- .github/workflows/run_cmake.yaml | 45 +++++++++++++------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index cf2c9313..71d53c50 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -2,7 +2,8 @@ name: CMake build -on: [ push ] +on: + push: workflow_dispatch: jobs: @@ -10,7 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - # check out - uses: actions/checkout@v2 - name: Install dependencies @@ -19,12 +19,11 @@ jobs: sudo apt-get install gfortran libopenmpi-dev cmake python3-dev pip pip install scipy matplotlib getdist anesthetic ipython mpi4py - - name: Run CMake builid - run: | - mkdir BUILD_GNU - cd BUILD_GNU - cmake .. - make install + - name: Run CMake + run: cmake -B build + + - name: Build + run: make -C build install - name: Test pypolychord run: python run_pypolychord.py @@ -38,15 +37,14 @@ jobs: image: intel/oneapi-hpckit steps: - # check out - uses: actions/checkout@v2 - - name: Run CMake builid - run: | - mkdir BUILD_Intel - cd BUILD_Intel - cmake -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort .. - make install + - name: Run CMake + run: cmake -B build -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_CXX_COMPILER=icpc + + - name: Build + run: make -C build install + - name: Test pypolychord run: python run_pypolychord.py @@ -57,7 +55,6 @@ jobs: runs-on: macos-latest steps: - # check out - uses: actions/checkout@v2 - name: Install dependencies @@ -65,18 +62,12 @@ jobs: brew install cmake gcc openmpi pip3 install numpy scipy matplotlib getdist anesthetic ipython mpi4py - - name: Check versions - run: | - cmake --version - gcc-11 --version - gfortran-11 --version + # make sure the compiler is from the same vendor here, this is not the default + - name: Run CMake + run: cmake -B build -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_CXX_COMPILER=gcc-11 - - name: Run CMake builid - run: | - mkdir BUILD_GNU_MacOS - cd BUILD_GNU_MacOS - cmake -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_CXX_COMPILER=gcc-11 .. - make VERBOSE=1 install + - name: Build + run: make -C build install - name: Test pypolychord run: python run_pypolychord.py From f9da08a37d64cb2b842b4adbbb2cb8e90d11c7b1 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Fri, 13 Aug 2021 08:18:03 +0100 Subject: [PATCH 37/43] compile option for GCC 10<= to understand MPI's interfaces --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a01dfa1..69bd21df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,11 @@ elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU") add_compile_options("-lstdc++") link_libraries("-lstdc++") + if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 10.0) + # GCC 10 is complaining about MPI interfaces, turn this to warnings + SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch") + endif () + elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Cray") message("Using Cray compilers") From bdca09a141406e1751d2a8a1c16b5d23340576f6 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 20 Sep 2021 08:08:05 +0100 Subject: [PATCH 38/43] CMake: allowed mixed AppleClang+gfortran build --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69bd21df..29d24212 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,9 @@ option(python "Build PyPolyChord package" ON) option(python_user_install "Install Python package for user (--user)" ON) # enforce matching of the CXX and Fortran compilers -if (NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_CXX_COMPILER_ID}") +if (NOT "${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_CXX_COMPILER_ID}" + AND NOT ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" AND + "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")) message(FATAL_ERROR "You need to use the same vendor for your C++ and Fortran compiler") endif () From 55e16c36f3ef477fd8ebc2a9aa46840801514034 Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 20 Sep 2021 08:12:01 +0100 Subject: [PATCH 39/43] CI: MacOS with GCC & Clang as well --- .github/workflows/run_cmake.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index 71d53c50..051fb4b3 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -53,6 +53,9 @@ jobs: build-MacOS: runs-on: macos-latest + strategy: + matrix: + cc: [ gcc, clang ] steps: - uses: actions/checkout@v2 @@ -62,10 +65,14 @@ jobs: brew install cmake gcc openmpi pip3 install numpy scipy matplotlib getdist anesthetic ipython mpi4py - # make sure the compiler is from the same vendor here, this is not the default - - name: Run CMake + - name: Run CMake - GCC + if: matrix.cc == "gcc" run: cmake -B build -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_CXX_COMPILER=gcc-11 + - name: Run CMake - AppleClang + if: matrix.cc == "clang" + run: cmake -B build -DCMAKE_Fortran_COMPILER=gfortran-11 + - name: Build run: make -C build install From 31b6eec22d9999d342626f1eb38f7d69cfdac88f Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Mon, 20 Sep 2021 08:12:25 +0100 Subject: [PATCH 40/43] CMake: change bin and lib paths --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29d24212..9ef355e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,8 @@ set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/generated/mods) set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}) # target directories -> stuff installed in these directories -set(target_lib_dir ${PROJECT_BINARY_DIR}/lib) -set(target_bin_dir ${PROJECT_BINARY_DIR}/bin) +set(target_lib_dir ${PROJECT_SOURCE_DIR}/lib) +set(target_bin_dir ${PROJECT_SOURCE_DIR}/bin) # directories where we want to make things add_subdirectory(src) From ae03fa59d02c6528f2ad362a55bf580a354dfa8c Mon Sep 17 00:00:00 2001 From: "T. K. Stenczel" Date: Wed, 29 Sep 2021 23:06:10 +0100 Subject: [PATCH 41/43] CI: correct syntax --- .github/workflows/run_cmake.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_cmake.yaml b/.github/workflows/run_cmake.yaml index 051fb4b3..76d7d94f 100644 --- a/.github/workflows/run_cmake.yaml +++ b/.github/workflows/run_cmake.yaml @@ -66,11 +66,11 @@ jobs: pip3 install numpy scipy matplotlib getdist anesthetic ipython mpi4py - name: Run CMake - GCC - if: matrix.cc == "gcc" + if: ${{ env.cc == 'gcc' }} run: cmake -B build -DCMAKE_Fortran_COMPILER=gfortran-11 -DCMAKE_CXX_COMPILER=gcc-11 - name: Run CMake - AppleClang - if: matrix.cc == "clang" + if: ${{ env.cc == 'clang' }} run: cmake -B build -DCMAKE_Fortran_COMPILER=gfortran-11 - name: Build From 93138aeaeda0dcab2fd0daf7e7bda91dc5731053 Mon Sep 17 00:00:00 2001 From: Will Handley Date: Sat, 5 Mar 2022 18:28:55 +0000 Subject: [PATCH 42/43] Bumped version number --- README.rst | 2 +- src/polychord/feedback.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 6cf7d034..363f72da 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ :target: https://arxiv.org/abs/1506.00171 :alt: Open-access paper -PolyChord v 1.20.0 +PolyChord v 1.20.1 Will Handley, Mike Hobson & Anthony Lasenby diff --git a/src/polychord/feedback.f90 b/src/polychord/feedback.f90 index ab529e5e..090d4639 100644 --- a/src/polychord/feedback.f90 +++ b/src/polychord/feedback.f90 @@ -28,7 +28,7 @@ subroutine write_opening_statement(settings) write(stdout_unit,'("")') write(stdout_unit,'("PolyChord: Next Generation Nested Sampling")') write(stdout_unit,'("copyright: Will Handley, Mike Hobson & Anthony Lasenby")') - write(stdout_unit,'(" version: 1.20.0")') + write(stdout_unit,'(" version: 1.20.1")') write(stdout_unit,'(" release: 1st June 2021")') write(stdout_unit,'(" email: wh260@mrao.cam.ac.uk")') write(stdout_unit,'("")') From 71a2798be08ce1f21498924ac40c4f2c046c0c2a Mon Sep 17 00:00:00 2001 From: Will Handley Date: Sat, 5 Mar 2022 18:30:45 +0000 Subject: [PATCH 43/43] Bumped version number --- README.rst | 2 +- pypolychord/__init__.py | 4 ++-- src/polychord/feedback.f90 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 363f72da..156ca1c2 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ :target: https://arxiv.org/abs/1506.00171 :alt: Open-access paper -PolyChord v 1.20.1 +PolyChord v 1.21.0 Will Handley, Mike Hobson & Anthony Lasenby diff --git a/pypolychord/__init__.py b/pypolychord/__init__.py index f7bc9acc..7c6e3ddb 100644 --- a/pypolychord/__init__.py +++ b/pypolychord/__init__.py @@ -1,3 +1,3 @@ -__version__ = "1.20.1" +__version__ = "1.21.0" from pypolychord.settings import PolyChordSettings -from pypolychord.polychord import run_polychord \ No newline at end of file +from pypolychord.polychord import run_polychord diff --git a/src/polychord/feedback.f90 b/src/polychord/feedback.f90 index 090d4639..8c8e4596 100644 --- a/src/polychord/feedback.f90 +++ b/src/polychord/feedback.f90 @@ -28,7 +28,7 @@ subroutine write_opening_statement(settings) write(stdout_unit,'("")') write(stdout_unit,'("PolyChord: Next Generation Nested Sampling")') write(stdout_unit,'("copyright: Will Handley, Mike Hobson & Anthony Lasenby")') - write(stdout_unit,'(" version: 1.20.1")') + write(stdout_unit,'(" version: 1.21.0")') write(stdout_unit,'(" release: 1st June 2021")') write(stdout_unit,'(" email: wh260@mrao.cam.ac.uk")') write(stdout_unit,'("")')