From ceeea8933350f291130594f72d925f7094e86cce Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Tue, 3 Oct 2023 13:14:20 +0200 Subject: [PATCH 01/14] setting up the macports --- CMakeLists.txt | 1 + macports/CMakeLists.txt | 142 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 macports/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index bcc9fb9b3c..79cd8f6cd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ add_subdirectory(src) add_subdirectory(scripts) add_subdirectory(fortran) add_subdirectory(vim) +add_subdirectory(macports) install(DIRECTORY patches DESTINATION ${DIRS_EXTRA_INSTALL}) diff --git a/macports/CMakeLists.txt b/macports/CMakeLists.txt new file mode 100644 index 0000000000..016dbf2026 --- /dev/null +++ b/macports/CMakeLists.txt @@ -0,0 +1,142 @@ +add_custom_command(OUTPUT + science/plumed/Portfile + python/py-plumed/Portfile + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate-portfile.sh $ ${PLUMEDVIM_BINARY_DIR} + DEPENDS Plumed2::plumed_bin + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating vim syntax files") + +add_custom_target(macports +DEPENDS science/plumed/Portfile +python/py-plumed/Portfile + ) +set (_REVISION_ 0) +set (_VERSION_ ${PLUMED_VERSION_GIT}) +FILE(CONFIGURE OUTPUT science/plumed/Portfile +CONTENT +[=[# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 + +PortSystem 1.0 +PortGroup mpi 1.0 +PortGroup linear_ algebra 1.0 +PortGroup debug 1.0 +PortGroup cmake 1.1 + +version @_VERSION_@ +revision @_REVISION_@ +name plumed +categories science + +# Most of the PLUMED code is L-GPL3. However, PLUMED containts +# molfile plugins from VMD that are released with a BSD-like license +# http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/ +license LGPL-3 BSD +maintainers {gmail.com:giovanni.bussi @GiovanniBussi} openmaintainer +description PLUMED is a plugin for molecular dynamics +long_description PLUMED is a plugin for molecular dynamics that can be used \ + in combination with popular molecular dynamics codes to perform biased simulations. \ + Additionally, it can be used as a standalone tool to analyze trajectories. + +platforms darwin + +homepage http://www.plumed.org/ + +fetch.type git +git.url @GIT_URL@ +git.branch @GIT_VERSION@ + +### This is required so that patch made with "git format-patch" work correctly +# patch.pre_args -p1 +### In case patches from github should be included to fix behavior on macports one should +### - put patch files (as obtained with git format-patch) in files/ directory +### - list their name here: +# patchfiles file1 \ +# file2 +### etc + +# Disable additional features. +# --disable-doc: Do not create documentation, and avoid searching for Doxygen. +# --disable-libsearch: Avoid searching libraries using their default names. +# This forces the libraries names to be explicitly passed (e.g. "-lz"). +# It has the advantage that during compilation from source it does not +# link packages that are not explicitely required. +# --disable-static-patch: Avoid a number of tests that are only required when linking plumed +# statically to an MD code. +# --disable-mpi: Do not search for MPI compiler (replaced when enabling mpi, see below) +# --disable-python: Python wrappers will be installed with a separate python port +configure.args-append \ + --disable-doc \ + --disable-libsearch \ + --disable-static-patch \ + --disable-mpi \ + --disable-python + +# install bash completions +configure.args-append BASH_COMPLETION_DIR=${prefix}/share/bash-completion/completions + +# Hardcode path for libplumedKernel.dylib. +# This allows to patch MD codes using the --runtime option but using as +# default kernel the installed one. In this way, MacPorts users +# can just use patched MD codes with the installed plumed or replace it +# by setting PLUMED_KERNEL at runtime +configure.cppflags-append "-D__PLUMED_DEFAULT_KERNEL=${prefix}/lib/libplumedKernel.dylib" + +compilers.choose cc cxx +compiler.cxx_standard 2011 + +mpi.setup + +# To enable mpi, replace a configure flag +if {[mpi_variant_isset]} { + configure.args-replace --disable-mpi --enable-mpi +# command should be included in a pre-configure block to access properly the mpi.exec variable + pre-configure { +# MPIEXEC is stored so that it can be used to perform tests + configure.args-append MPIEXEC="${mpi.exec}" + } +} + +# Optimization flags. +# Notice that plumed is computationally heavy and that +# this change has a significant impact in plumed performances +configure.cxxflags-replace -Os -O3 + +# Libraries. +# Library names are specified here to make sure that +# only requested packages are linked. +configure.ldflags-append \ + -lz -lgsl -lfftw3 +depends_lib-append port:fftw-3 \ + port:gawk \ + port:gsl \ + port:zlib + +# C++ library +# Required in order to use clang with gcc library on old OSX versions. +# See https://github.com/macports/macports-ports/pull/1254 +if {[string match *clang* ${configure.compiler}]} { + configure.ldflags-append -stdlib=${configure.cxx_stdlib} +} + +# This variant enables optional modules in PLUMED. +# Notice that one of the optional modules (drr) requires boost_serialization +variant allmodules description {Enable all optional modules} { + configure.args-append --enable-modules=all + configure.args-append --enable-boost-serialization + configure.ldflags-append -lboost_serialization-mt + depends_lib-append port:boost +} + +# Link lapack/blas libraries +pre-configure { + # commands should be included in a pre-configure block to access tcl variables + configure.ldflags-append ${linalglib} +} + +# Allow running tests from MacPorts +test.run yes +test.target check + +]=] +@ONLY +) \ No newline at end of file From dae554a9bbd7a26e3001d213e082cb37bb0e8090 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Tue, 3 Oct 2023 14:11:44 +0200 Subject: [PATCH 02/14] starting to set up mac CI and macports --- .github/workflows/localcmakeTests.yml | 3 + .github/workflows/macWF.yml | 130 +++++++++++++++----------- macports/CMakeLists.txt | 24 +++-- 3 files changed, 94 insertions(+), 63 deletions(-) diff --git a/.github/workflows/localcmakeTests.yml b/.github/workflows/localcmakeTests.yml index 23cb8497ea..41ba866d49 100644 --- a/.github/workflows/localcmakeTests.yml +++ b/.github/workflows/localcmakeTests.yml @@ -8,3 +8,6 @@ jobs: runBasicTests: uses: ./.github/workflows/cmakeAndTest.yml secrets: inherit + mac: + uses: ./.github/workflows/macWF.yml + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/macWF.yml b/.github/workflows/macWF.yml index 3ba17ad760..0d67e93329 100644 --- a/.github/workflows/macWF.yml +++ b/.github/workflows/macWF.yml @@ -14,50 +14,53 @@ env: jobs: - macports: - runs-on: macos-11 - strategy: - fail-fast: false - matrix: - variant: [ "" , "+allmodules" ] - # see https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 for possible exclusions - env: - PYVERS: "py37 py38 py39 py310" - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: ~/.macports-ci-ccache - key: ccache-macports-${{ matrix.variant }}-${{ github.sha }} - restore-keys: ccache-macports-${{ matrix.variant }}- - - name: Install MacPorts - run: | - wget https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci - source ./macports-ci install - source ./macports-ci ccache - - name: Build local Portfile - run: | - make macports - source ./macports-ci localports macports - - name: Build PLUMED - run: | - sudo port -N -k install plumed ${{ matrix.variant }} - plumed config show - for p in $PYVERS ; do - sudo port -N install $p-plumed - done - source ./macports-ci ccache --save - - name: Run tests - run: | - sudo port -N -d test plumed ${{ matrix.variant }} - - name: Run python tests - run: | - for p in $PYVERS ; do - sudo port test $p-plumed - done + # macports: + # runs-on: macos-11 + # strategy: + # fail-fast: false + # matrix: + # variant: [ "" , "+allmodules" ] + # # see https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 for possible exclusions + # env: + # PYVERS: "py37 py38 py39 py310" + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/cache@v3 + # with: + # path: ~/.macports-ci-ccache + # key: ccache-macports-${{ matrix.variant }}-${{ github.sha }} + # restore-keys: ccache-macports-${{ matrix.variant }}- + # - name: Install MacPorts + # run: | + # wget https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci + # source ./macports-ci install + # source ./macports-ci ccache + # - name: Build local Portfile + # run: | + # make macports + # source ./macports-ci localports macports + # - name: Build PLUMED + # run: | + # sudo port -N -k install plumed ${{ matrix.variant }} + # plumed config show + # for p in $PYVERS ; do + # sudo port -N install $p-plumed + # done + # source ./macports-ci ccache --save + # - name: Run tests + # run: | + # sudo port -N -d test plumed ${{ matrix.variant }} + # - name: Run python tests + # run: | + # for p in $PYVERS ; do + # sudo port test $p-plumed + # done macsimple: runs-on: macos-11 + env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release steps: - uses: actions/checkout@v3 - name: Set paths @@ -67,15 +70,36 @@ jobs: echo "INCLUDE=$HOME/opt/include:$INCLUDE" >> $GITHUB_ENV echo "LIBRARY_PATH=$HOME/opt/lib:$LIBRARY_PATH" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV - - name: Build PLUMED - run: | - brew update > /dev/null - brew install gawk - ./configure --disable-dependency-tracking --prefix="$HOME/opt" - make -j 4 - make install - - name: Run tests - run: | - make --no-print-directory -C regtest - # these can fail for numerical reasons - make -C regtest checkfail + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + #set up without warnings + run: > + cmake -B ${{github.workspace}}/build + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -Doption_relaxed_dependencies=ON + -Dallmodules_activate=ON + -Denable_boost_serialization=ON + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -Dallmodules_activate=ON + -Denable_boost_serialization=ON + -Denable_warnings_basic=OFF + -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" + + - name: Build + working-directory: ${{github.workspace}}/build + # Build your program with the given configuration + run: cmake --build . --config ${{env.BUILD_TYPE}} --parallel 4 + + - name: Checking the tests + working-directory: ${{github.workspace}}/build + #does only the tests marked with the label "testIntegrity". + #These checks ensure that the test suite works as intended, + #if these do not pass there is something very wrong! + run: ctest --output-on-failure -L testIntegrity + + - name: Test + id: tests + working-directory: ${{github.workspace}}/build + + run: ctest -j4 --output-on-failure diff --git a/macports/CMakeLists.txt b/macports/CMakeLists.txt index 016dbf2026..d2deae7bad 100644 --- a/macports/CMakeLists.txt +++ b/macports/CMakeLists.txt @@ -65,14 +65,18 @@ git.branch @GIT_VERSION@ # --disable-mpi: Do not search for MPI compiler (replaced when enabling mpi, see below) # --disable-python: Python wrappers will be installed with a separate python port configure.args-append \ - --disable-doc \ - --disable-libsearch \ - --disable-static-patch \ - --disable-mpi \ - --disable-python + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -Doption_relaxed_dependencies=ON \ + -Denable_boost_serialization=ON \ + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -Dallmodules_activate=ON \ + -Denable_mpi=OFF \ + -Denable_python=OFF \ + -Denable_static_linking=OFF \ + -Denable_doc=OFF # install bash completions -configure.args-append BASH_COMPLETION_DIR=${prefix}/share/bash-completion/completions +configure.args-append -DBASH_COMPLETION_DIR=${prefix}/share/bash-completion/completions # Hardcode path for libplumedKernel.dylib. # This allows to patch MD codes using the --runtime option but using as @@ -88,7 +92,7 @@ mpi.setup # To enable mpi, replace a configure flag if {[mpi_variant_isset]} { - configure.args-replace --disable-mpi --enable-mpi + configure.args-replace -Denable_mpi=OFF -Denable_mpi=ON # command should be included in a pre-configure block to access properly the mpi.exec variable pre-configure { # MPIEXEC is stored so that it can be used to perform tests @@ -121,9 +125,9 @@ if {[string match *clang* ${configure.compiler}]} { # This variant enables optional modules in PLUMED. # Notice that one of the optional modules (drr) requires boost_serialization variant allmodules description {Enable all optional modules} { - configure.args-append --enable-modules=all - configure.args-append --enable-boost-serialization - configure.ldflags-append -lboost_serialization-mt + configure.args-append -Dallmodules_activate=ON + configure.args-append -Denable_boost_serialization=ON + #configure.ldflags-append -lboost_serialization-mt depends_lib-append port:boost } From 534a2c24aaef99b2bbdff0bc2da3988252ad317f Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Tue, 3 Oct 2023 14:17:35 +0200 Subject: [PATCH 03/14] Corrected the CI file --- .github/workflows/localcmakeTests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/localcmakeTests.yml b/.github/workflows/localcmakeTests.yml index 41ba866d49..3b210941d2 100644 --- a/.github/workflows/localcmakeTests.yml +++ b/.github/workflows/localcmakeTests.yml @@ -5,9 +5,10 @@ on: branches: - 'cmake**' jobs: - runBasicTests: + runBasicTests: uses: ./.github/workflows/cmakeAndTest.yml secrets: inherit + mac: uses: ./.github/workflows/macWF.yml - secrets: inherit \ No newline at end of file + secrets: inherit From 68e07547841f99c2c16d49f0dccc176f67706ea7 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Tue, 3 Oct 2023 16:19:13 +0200 Subject: [PATCH 04/14] bypassing makecmd_cmake --- src/core/CMakeLists.txt | 2 +- src/maketools/makecmd | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 51e9ba9d3e..fc9e59d64a 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -59,7 +59,7 @@ target_include_directories(${module_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) MACRO(CREATEINC cppFile type outputFile) add_custom_command(OUTPUT ${outputFile} DEPENDS ${cppFile} - COMMAND bash ${PLUMED_MAKETOOLS}/makecmd_cmake ${type} "${CMAKE_CURRENT_SOURCE_DIR}/${cppFile}" ${outputFile} + COMMAND bash ${PLUMED_MAKETOOLS}/makecmd ${type} "${CMAKE_CURRENT_SOURCE_DIR}/${cppFile}" ${outputFile} COMMENT "Generating ${outputFile}" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/src/maketools/makecmd b/src/maketools/makecmd index 5b58ab068a..ed59ad8fd4 100755 --- a/src/maketools/makecmd +++ b/src/maketools/makecmd @@ -25,6 +25,4 @@ awk -v opt=$1 ' printf(" {\"%s\",%s}%s\n",string[i],enum[i],comma); } } - }' - - + }' < "$2" > "$3" From 6946233e2baea0926e3a183e5036dc7ee29ec08a Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Thu, 5 Oct 2023 08:50:42 +0200 Subject: [PATCH 05/14] mac does not like the options after the arguments --- regtest/testIntegrity/checkEXTRAFILESdir/plumed_regtest_after | 4 ++-- regtest/testIntegrity/checkNEEDS/plumed_regtest_after | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/regtest/testIntegrity/checkEXTRAFILESdir/plumed_regtest_after b/regtest/testIntegrity/checkEXTRAFILESdir/plumed_regtest_after index 63f0b18f39..bcb2d90ae9 100755 --- a/regtest/testIntegrity/checkEXTRAFILESdir/plumed_regtest_after +++ b/regtest/testIntegrity/checkEXTRAFILESdir/plumed_regtest_after @@ -1,7 +1,7 @@ #!/bin/bash { - ls dirAbs -d - ls dirRel -d + ls -d dirAbs + ls -d dirRel ls dirAbs/fileAbs1 ls dirAbs/fileAbs2 ls dirRel/fileRel1 diff --git a/regtest/testIntegrity/checkNEEDS/plumed_regtest_after b/regtest/testIntegrity/checkNEEDS/plumed_regtest_after index 88d9dd443c..4b76b9ed05 100755 --- a/regtest/testIntegrity/checkNEEDS/plumed_regtest_after +++ b/regtest/testIntegrity/checkNEEDS/plumed_regtest_after @@ -1,5 +1,5 @@ #!/bin/bash -#I expect the following variables to be exported in run_ctest + { echo "I did nothig" } > referenceFile From 438d2e2d3af948e861d9f93e21f588ed057238d3 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Fri, 6 Oct 2023 09:57:59 +0200 Subject: [PATCH 06/14] trying to make the mac CI pass --- .github/workflows/cmakeAndTest.yml | 7 +++---- .github/workflows/localcmakeTests.yml | 6 +++--- .github/workflows/macWF.yml | 13 +++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cmakeAndTest.yml b/.github/workflows/cmakeAndTest.yml index 37c07971de..0e569c5722 100644 --- a/.github/workflows/cmakeAndTest.yml +++ b/.github/workflows/cmakeAndTest.yml @@ -10,6 +10,7 @@ env: jobs: buildAndTest: strategy: + fail-fast: false matrix: compiler: [gcc] mpi: [mpi, nompi] @@ -166,14 +167,12 @@ jobs: run: > cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" -Doption_relaxed_dependencies=ON - -Dallmodules_activate=ON -Denable_boost_serialization=ON - -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dallmodules_activate=ON - -Denable_boost_serialization=ON -Denable_warnings_basic=OFF - -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" + - name: Build working-directory: ${{github.workspace}}/build diff --git a/.github/workflows/localcmakeTests.yml b/.github/workflows/localcmakeTests.yml index 3b210941d2..c29bb63693 100644 --- a/.github/workflows/localcmakeTests.yml +++ b/.github/workflows/localcmakeTests.yml @@ -5,9 +5,9 @@ on: branches: - 'cmake**' jobs: - runBasicTests: - uses: ./.github/workflows/cmakeAndTest.yml - secrets: inherit + # runBasicTests: + # uses: ./.github/workflows/cmakeAndTest.yml + # secrets: inherit mac: uses: ./.github/workflows/macWF.yml diff --git a/.github/workflows/macWF.yml b/.github/workflows/macWF.yml index 0d67e93329..78ecb59c2f 100644 --- a/.github/workflows/macWF.yml +++ b/.github/workflows/macWF.yml @@ -70,6 +70,11 @@ jobs: echo "INCLUDE=$HOME/opt/include:$INCLUDE" >> $GITHUB_ENV echo "LIBRARY_PATH=$HOME/opt/lib:$LIBRARY_PATH" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + - name: Update the environment + run: | + brew update > /dev/null + brew install gawk + - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type @@ -77,14 +82,10 @@ jobs: run: > cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" -Doption_relaxed_dependencies=ON - -Dallmodules_activate=ON - -Denable_boost_serialization=ON - -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - -Dallmodules_activate=ON - -Denable_boost_serialization=ON -Denable_warnings_basic=OFF - -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" + - name: Build working-directory: ${{github.workspace}}/build From 17097003a5ac318c4ecd4f808fd237386211b438 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Fri, 6 Oct 2023 11:30:41 +0200 Subject: [PATCH 07/14] changed the cxx standard in the tests --- regtest/scripts/run_ctest | 1 + 1 file changed, 1 insertion(+) diff --git a/regtest/scripts/run_ctest b/regtest/scripts/run_ctest index 80ee4df5ac..381c0bd89b 100755 --- a/regtest/scripts/run_ctest +++ b/regtest/scripts/run_ctest @@ -286,6 +286,7 @@ EOF cat <CMakeLists.txt cmake_minimum_required(VERSION 3.20) project(exe-test CXX) +set (CMAKE_CXX_STANDARD 11) $(echo -e "$otherLang") find_package(Plumed2 REQUIRED) $(echo -e "$compileLibs") From 34347824df6e686c653a0e50fbd52fd7c7ec8cab Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Fri, 6 Oct 2023 11:54:30 +0200 Subject: [PATCH 08/14] make-8 now is more clear when it fails --- regtest/basic/rt-make-8/main.cpp | 8 ++++---- regtest/basic/rt-make-8/output.reference | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/regtest/basic/rt-make-8/main.cpp b/regtest/basic/rt-make-8/main.cpp index 1512cb66a4..f49cb209ec 100644 --- a/regtest/basic/rt-make-8/main.cpp +++ b/regtest/basic/rt-make-8/main.cpp @@ -24,9 +24,9 @@ int main(){ } int inca=1; int incb=1; - ofs< Date: Fri, 6 Oct 2023 12:01:22 +0200 Subject: [PATCH 09/14] Allowing make-fortran test to be skipped --- regtest/scripts/run_ctest | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/regtest/scripts/run_ctest b/regtest/scripts/run_ctest index 381c0bd89b..eb7d890b7e 100755 --- a/regtest/scripts/run_ctest +++ b/regtest/scripts/run_ctest @@ -196,7 +196,15 @@ run_make() { filesf90=$(ls ./*.f90 2>/dev/null) files=$(ls ./*.cpp ./*.f90 ./*.c 2>/dev/null) if [[ -n ${filesf90} ]]; then - otherLang="${otherLang}enable_language (Fortran)\n" + otherLang=$(cat << EOF +${otherLang} +check_language(Fortran) +if(NOT CMAKE_Fortran_COMPILER) + message (FATAL_ERROR "NOT_APPLICABLE (Fortran compiler not found)") +endif() +enable_language (Fortran) +EOF +) if [[ $compiler_language = "fortran08" ]]; then otherLang=$( cat < Date: Fri, 6 Oct 2023 12:13:00 +0200 Subject: [PATCH 10/14] Allowing make-fortran test to be skipped II --- regtest/scripts/run_ctest | 1 + 1 file changed, 1 insertion(+) diff --git a/regtest/scripts/run_ctest b/regtest/scripts/run_ctest index eb7d890b7e..e0e3407cbf 100755 --- a/regtest/scripts/run_ctest +++ b/regtest/scripts/run_ctest @@ -198,6 +198,7 @@ run_make() { if [[ -n ${filesf90} ]]; then otherLang=$(cat << EOF ${otherLang} +include(CheckLanguage) check_language(Fortran) if(NOT CMAKE_Fortran_COMPILER) message (FATAL_ERROR "NOT_APPLICABLE (Fortran compiler not found)") From d6604f4b1b0aa13f2372d2c4b7785b33e76f10b8 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Fri, 6 Oct 2023 14:07:56 +0200 Subject: [PATCH 11/14] removed the doubled diff in run_ctest --- regtest/scripts/run_ctest | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/regtest/scripts/run_ctest b/regtest/scripts/run_ctest index e0e3407cbf..52b87b1b89 100755 --- a/regtest/scripts/run_ctest +++ b/regtest/scripts/run_ctest @@ -351,7 +351,7 @@ check() { # ASCII and diff will be shown in the log test "$(head -c 10 "$file")" = "#! FIELDS " && DIFFOPT="-a" out="$(diff $DIFFOPT "$file" "$new.zfix")" - diff $DIFFOPT "$file" "$new.zfix" + test -n "$out" && { echo FAILURE echo "Diff for ${file%.reference}:" @@ -370,9 +370,8 @@ check() { return $exitcode } -#this settings make the pipe exit with failure code of any command -#so the program exits with the exit state of the scripta and not the -#one of tee +#this settings make the pipe exit with failure code of any command so the +#program exits with the exit state of the script and not the one of tee set -o pipefail { if test -n "$PLUMED_PREPEND_PATH"; then From 42fc13de7eb9ea2b66f529d192e5b1b3b39176c7 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Fri, 6 Oct 2023 14:44:18 +0200 Subject: [PATCH 12/14] formattation in run output --- macports/CMakeLists.txt | 41 ++++++++++++++++----------------------- regtest/scripts/run_ctest | 13 +++++++------ 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/macports/CMakeLists.txt b/macports/CMakeLists.txt index d2deae7bad..a9b435bec5 100644 --- a/macports/CMakeLists.txt +++ b/macports/CMakeLists.txt @@ -18,7 +18,7 @@ CONTENT PortSystem 1.0 PortGroup mpi 1.0 -PortGroup linear_ algebra 1.0 +PortGroup linear_algebra 1.0 PortGroup debug 1.0 PortGroup cmake 1.1 @@ -65,18 +65,15 @@ git.branch @GIT_VERSION@ # --disable-mpi: Do not search for MPI compiler (replaced when enabling mpi, see below) # --disable-python: Python wrappers will be installed with a separate python port configure.args-append \ - -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DCMAKE_BUILD_TYPE=Release \ -Doption_relaxed_dependencies=ON \ - -Denable_boost_serialization=ON \ - -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -Dallmodules_activate=ON \ -Denable_mpi=OFF \ -Denable_python=OFF \ -Denable_static_linking=OFF \ -Denable_doc=OFF # install bash completions -configure.args-append -DBASH_COMPLETION_DIR=${prefix}/share/bash-completion/completions +#configure.args-append -DBASH_COMPLETION_DIR=${prefix}/share/bash-completion/completions # Hardcode path for libplumedKernel.dylib. # This allows to patch MD codes using the --runtime option but using as @@ -94,22 +91,16 @@ mpi.setup if {[mpi_variant_isset]} { configure.args-replace -Denable_mpi=OFF -Denable_mpi=ON # command should be included in a pre-configure block to access properly the mpi.exec variable - pre-configure { -# MPIEXEC is stored so that it can be used to perform tests - configure.args-append MPIEXEC="${mpi.exec}" - } +# pre-configure { +# # MPIEXEC is stored so that it can be used to perform tests +# configure.args-append MPIEXEC="${mpi.exec}" +# } } -# Optimization flags. -# Notice that plumed is computationally heavy and that -# this change has a significant impact in plumed performances -configure.cxxflags-replace -Os -O3 - # Libraries. # Library names are specified here to make sure that # only requested packages are linked. -configure.ldflags-append \ - -lz -lgsl -lfftw3 + depends_lib-append port:fftw-3 \ port:gawk \ port:gsl \ @@ -125,17 +116,18 @@ if {[string match *clang* ${configure.compiler}]} { # This variant enables optional modules in PLUMED. # Notice that one of the optional modules (drr) requires boost_serialization variant allmodules description {Enable all optional modules} { - configure.args-append -Dallmodules_activate=ON - configure.args-append -Denable_boost_serialization=ON + configure.args-append \ + -Dallmodules_activate=ON \ + -Denable_boost_serialization=ON #configure.ldflags-append -lboost_serialization-mt depends_lib-append port:boost } # Link lapack/blas libraries -pre-configure { - # commands should be included in a pre-configure block to access tcl variables - configure.ldflags-append ${linalglib} -} +# pre-configure { +# # commands should be included in a pre-configure block to access tcl variables +# configure.ldflags-append ${linalglib} +# } # Allow running tests from MacPorts test.run yes @@ -143,4 +135,5 @@ test.target check ]=] @ONLY -) \ No newline at end of file +) +#TODO: Bash completitions diff --git a/regtest/scripts/run_ctest b/regtest/scripts/run_ctest index 52b87b1b89..94d464492f 100755 --- a/regtest/scripts/run_ctest +++ b/regtest/scripts/run_ctest @@ -420,12 +420,13 @@ set -o pipefail # this is the executable used for getting the configuration: plumed_nompi="$plumed --no-mpi" cat < Date: Tue, 7 Nov 2023 15:34:53 +0100 Subject: [PATCH 13/14] Update macWF.yml --- .github/workflows/macWF.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macWF.yml b/.github/workflows/macWF.yml index 78ecb59c2f..a2d9316c03 100644 --- a/.github/workflows/macWF.yml +++ b/.github/workflows/macWF.yml @@ -65,11 +65,11 @@ jobs: - uses: actions/checkout@v3 - name: Set paths run: | - echo "$HOME/opt/bin" >> $GITHUB_PATH - echo "CPATH=$HOME/opt/include:$CPATH" >> $GITHUB_ENV - echo "INCLUDE=$HOME/opt/include:$INCLUDE" >> $GITHUB_ENV - echo "LIBRARY_PATH=$HOME/opt/lib:$LIBRARY_PATH" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "$HOME/opt/bin:${{github.workspace}}/install/bin" >> $GITHUB_PATH + echo "CPATH=$HOME/opt/include:${{github.workspace}}/install/include:$CPATH" >> $GITHUB_ENV + echo "INCLUDE=$HOME/opt/include:${{github.workspace}}/install/include:$INCLUDE" >> $GITHUB_ENV + echo "LIBRARY_PATH=$HOME/opt/lib:${{github.workspace}}/install/lib:$LIBRARY_PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$HOME/opt/lib:${{github.workspace}}/install/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV - name: Update the environment run: | brew update > /dev/null @@ -84,6 +84,7 @@ jobs: -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install" -Doption_relaxed_dependencies=ON + -DCMAKE_INSTALL_LIBDIR=lib -Denable_warnings_basic=OFF From 7aa9b4a72605d25b8ba4ea0b9c12a36a25aab1f5 Mon Sep 17 00:00:00 2001 From: Daniele Date: Tue, 12 Dec 2023 16:10:40 +0100 Subject: [PATCH 14/14] counter for ye old sdot bug (#42) * settin up working on sdot for the mac * set up the workaroud for sdot * small correction in the compiler checks * more correct if --------- Co-authored-by: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> --- .gitignore | 2 ++ src/blas/CMakeLists.txt | 63 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e85ec29741..48a520e718 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ makefile.dep /config.* /autom4* /stamp-h +#the cmake standard build dir +build/ diff --git a/src/blas/CMakeLists.txt b/src/blas/CMakeLists.txt index a39c54ab1d..ae900c9695 100644 --- a/src/blas/CMakeLists.txt +++ b/src/blas/CMakeLists.txt @@ -22,6 +22,7 @@ if (BLAS_FOUND) PUBLIC __PLUMED_HAS_EXTERNAL_BLAS=1) include(CheckCXXSourceCompiles) + include(CheckCXXSourceRuns) #From the manual:The check is only performed once, with the result cached in #the variable named by . Every subsequent CMake run will re-use #this cached value rather than performing the check again, even if the @@ -47,18 +48,72 @@ if (BLAS_FOUND) ]] noUnderscodeBlas ) - unset(CMAKE_REQUIRED_LIBRARIES) - + set(CMAKE_REQUIRED_DEFINITIONS -DSDOTtype=float) if(noUnderscodeBlas) target_compile_definitions(${module_name} PUBLIC F77_NO_UNDERSCORE) + set(CMAKE_REQUIRED_DEFINITIONS -DF77_NO_UNDERSCORE -DSDOTtype=float) elseif(NOT noUnderscodeBlas AND NOT UnderscodeBlas) message(WARNING "both srtog_ and srtog are not linkable") # elseif(noUnderscodeBlas AND UnderscodeBlas) - # message(WARNING "both srtog_ and srtog are linkable") - # if both can be linked, use the underscore version + # message(WARNING "both srtog_ and srtog are linkable") + # if both can be linked, use the underscore version endif(noUnderscodeBlas) + set (sdot_check_source + [[ +#if ! defined(F77_NO_UNDERSCORE) +#define sdot sdot_ +#endif +extern "C"{ + SDOTtype sdot(int *n, float *dx, int *incx, float *dy, int *incy); +} + +int main(){ + int size=5; + float af[5],bf[5]; + for(unsigned i=0;i