From a49be33367beda1c5337e34bb98becbab40bcdb0 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Mon, 29 Jul 2024 13:00:01 +0200 Subject: [PATCH 01/83] Consolidate macos version and deployment target. --- .github/workflows/cibuildwheel.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 11de01ea..5613bd91 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -8,7 +8,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macOS-latest] + os: [macOS-12] steps: - uses: actions/checkout@v4 @@ -18,7 +18,7 @@ jobs: - name: Setup macOS if: runner.os == 'macOS' run: | - export FC="/opt/homebrew/bin/gfortran-14" + export FC="/opt/homebrew/bin/gfortran-13" mkdir build cd build cmake .. @@ -38,8 +38,8 @@ jobs: # to supply options, put them in 'env', like: env: CIBW_ARCHS: auto64 - CIBW_ARCHS_MACOS: "arm64" - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0 + CIBW_ARCHS_MACOS: "unversal2" + CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=12.0 CIBW_BUILD_VERBOSITY_WINDOWS: 2 CIBW_SKIP: "*pypy* *pp* *cp36* *cp37* *musl*" with: From 4d164c6cb5538b0e51e6bfddefb6a221cc33da52 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 7 Aug 2024 10:26:44 +0200 Subject: [PATCH 02/83] Set up automated wheel building and unittesting for macOS and (many)linux Modified map_platform_specifics.py such that it can be run on its own (because we don't need makescript.py when using the cmake-based build). The unittests.yml workflow builds and runs the pFUnit-based unittests and the pyTests. Currently, the test "test_critical_suite:test_critical_point_mix" fails on linux. The cibuildwheels.yml workflow builds wheels for macOS x86_64 and arm64, and a manylinux2014 wheel, and runs the pyTests using the wheel for macOS arm64. --- .github/workflows/cibuildwheel.yml | 91 +++++++++------ .github/workflows/unittests.yml | 105 ++++++++++++++++++ CMakeLists.txt | 9 +- addon/pyTests/test_issues.py | 7 +- addon/pycThermopack/makescript.py | 31 +++--- addon/pycThermopack/map_platform_specifics.py | 32 ++++-- addon/pycThermopack/pyproject.toml | 4 +- addon/pycThermopack/thermopack/__init__.py | 40 ------- docs/vCurrent/source_build.md | 27 ++++- src/CMakeLists.txt | 8 ++ unittests/CMakeLists.txt | 12 +- unittests/README.md | 17 +++ 12 files changed, 272 insertions(+), 111 deletions(-) create mode 100644 .github/workflows/unittests.yml diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 5613bd91..c46387df 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -4,44 +4,74 @@ on: [push, pull_request] jobs: build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: Build wheels on ${{ matrix.os }}-${{ matrix.version }} + runs-on: ${{ matrix.os }}-${{ matrix.version }} + timeout-minutes: 30 strategy: + fail-fast: false matrix: - os: [macOS-12] + os: [macOS, ubuntu] + version: [latest] + include: + - version: 12 + os: macOS steps: - uses: actions/checkout@v4 - name: checkout submodules run: git submodule update --init --recursive + + - name: Setup Linux env + if: matrix.os == 'ubuntu' + run: | + echo "gfortran=gfortran" >> $GITHUB_ENV + echo "libinspector=ls ../addon/pycThermopack/thermopack/libthermopack* | xargs ldd" >> $GITHUB_ENV - - name: Setup macOS - if: runner.os == 'macOS' + - name: Setup macOS env + if: matrix.os == 'macOS' run: | - export FC="/opt/homebrew/bin/gfortran-13" - mkdir build - cd build - cmake .. - make install - ls ../addon/pycThermopack - ls ../addon/pycThermopack/thermopack - + echo "gfortran=$(which gfortran-13)" >> $GITHUB_ENV + echo "libinspector=otool -L ../addon/pycThermopack/thermopack/libthermopack*" >> $GITHUB_ENV + echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1)" >> $GITHUB_ENV - # Used to host cibuildwheel + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: binary-${{ matrix.os }}-${{ matrix.version }} + path: ./bin/libthermopack.dylib + - uses: actions/setup-python@v5 - - name: Install cibuildwheel and other dependencies - run: python -m pip install cibuildwheel==2.17.0 build wheel setuptools + - name: Check macOS deployment target + if: matrix.os == 'macOS' + run: echo "Deployment target version is ${{ env.MACOSX_DEPLOYMENT_TARGET }} / ${MACOSX_DEPLOYMENT_TARGET}" - - name: Build wheels - uses: pypa/cibuildwheel@v2.19.1 # run: python -m cibuildwheel --output-dir wheelhouse - # to supply options, put them in 'env', like: + - name: Build wheel + uses: pypa/cibuildwheel@v2.19.2 # run: python -m cibuildwheel --output-dir wheelhouse env: CIBW_ARCHS: auto64 - CIBW_ARCHS_MACOS: "unversal2" - CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=12.0 - CIBW_BUILD_VERBOSITY_WINDOWS: 2 - CIBW_SKIP: "*pypy* *pp* *cp36* *cp37* *musl*" + CIBW_BEFORE_ALL_LINUX: | + yum install -y blas blas-devel + yum install -y lapack lapack-devel + echo $(which gfortran) + + CIBW_BEFORE_BUILD: | + ${{ env.gfortran }} --version + export FC=${{ env.gfortran }} + mkdir build + cd build + cmake .. + make -j4 install + python ../addon/pycThermopack/map_platform_specifics.py + echo "--- pycThermopack contents ---" + ls ../addon/pycThermopack + echo "--- pycThermopack/thermopack contents ---" + ls ../addon/pycThermopack/thermopack + echo "--- Inspecting libthermopack ---" + ${{ env.libinspector }} + CIBW_BUILD: "*cp311*" + CIBW_SKIP: "*musllinux*" + CIBW_TEST_SKIP: "*x86_64*" with: package-dir: "./addon/pycThermopack" output-dir: "./wheelhouse" @@ -49,16 +79,5 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: binary-${{ matrix.os }}-${{ matrix.version }} - path: | - ./wheelhouse/*.whl - ./wheelhouse/*.tar.gz - merge: - runs-on: ubuntu-latest - needs: build_wheels - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@v4 - with: - name: artifact - pattern: binary-* \ No newline at end of file + name: wheel-${{ matrix.os }}-${{ matrix.version }} + path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml new file mode 100644 index 00000000..1733b9b7 --- /dev/null +++ b/.github/workflows/unittests.yml @@ -0,0 +1,105 @@ +name: unittests + +on: [push, pull_request] + +jobs: + run-tests: + name: Run tests on ${{ matrix.os }}-${{ matrix.version }} + runs-on: ${{ matrix.os }}-${{ matrix.version }} + strategy: + fail-fast: false + matrix: + os: [macOS, ubuntu] + version: [latest] + include: + - version: 12 + os: macOS + + outputs: + status: ${{ join('steps.*test.conclusion') }} + steps: + - uses: actions/checkout@v4 + - name: checkout submodules + run: git submodule update --init --recursive + + - name: Setup gfortran Linux + if: matrix.os == 'ubuntu' + run: echo "gfortran=$(which gfortran)" >> $GITHUB_ENV + + - name: Setup gfortran macOS + if: matrix.os == 'macOS' + run: echo "gfortran=$(which gfortran-13)" >> $GITHUB_ENV + + - name: Build ThermoPack + run: | + ${{ env.gfortran }} --version + export FC=${{ env.gfortran }} + mkdir build + cd build + cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. + make -j4 install + echo "--- pycThermopack contents ---" + ls ../addon/pycThermopack + echo "--- pycThermopack/thermopack contents ---" + ls ../addon/pycThermopack/thermopack + + - name: Inspect thermopack + if: matrix.os == 'ubuntu' + run: | + echo "--- Inspecting libthermopack ---" + ldd bin/libthermopack.so + echo "--- Inspecting run_unittests ---" + ldd bin/unittests + + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: binary-${{ matrix.os }}-${{ matrix.version }} + path: ./bin/* + + - id: fortran_test + name: Run unittests + continue-on-error: true + run: | + result=$(./bin/unittests) + if echo "$result" | grep -q "OK"; then + statuscode=0 + else + statuscode=1 + fi + echo "$result" + echo "statuscode=$statuscode" >> $GITHUB_OUTPUT + exit $statuscode + + - uses: actions/setup-python@v5 + - id: python_test + name: Run python tests + continue-on-error: true + run: | + python addon/pycThermopack/map_platform_specifics.py + pip install addon/pycThermopack/[test] + pytest addon/pyTests + result=$(pytest addon/pyTests) + if echo "$result" | grep -q "FAILED"; then + statuscode=1 + else + statuscode=0 + fi + echo "$result" + echo "statuscode=$statuscode" >> $GITHUB_OUTPUT + exit $statuscode + + - name: Check success + run: | + echo "Fortran test result : ${{ steps.fortran_test.outputs.statuscode }}" + echo "Python test result : ${{ steps.python_test.outputs.statuscode }}" + if [[ ${{ steps.fortran_test.outputs.statuscode }} -eq 0 ]] && [[ ${{ steps.python_test.outputs.statuscode }} -eq 0 ]]; then + exit 0 + else + exit 1 + fi + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 52923d5d..73756270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ +cmake_minimum_required(VERSION 3.5) +project(ThermoPack LANGUAGES Fortran) + string(ASCII 27 Esc) set(ColorRed "${Esc}[31m") set(ColorBlue "${Esc}[34m") -cmake_minimum_required(VERSION 3.5) -project(ThermoPack LANGUAGES Fortran) - if(NOT MSVC) execute_process(COMMAND bash -c "arch" OUTPUT_VARIABLE PROC) - set(tp_flags_common "-cpp -fPIC -fdefault-real-8 -fdefault-double-8 -frecursive -Wno-unused-function -Wno-unused-variable") + set(tp_flags_common "-cpp -fPIC -fdefault-real-8 -fdefault-double-8 -frecursive -fopenmp -Wno-unused-function -Wno-unused-variable") include(CheckCompilerFlag) check_compiler_flag(Fortran "-arch arm64" arm64_supported) @@ -20,7 +20,6 @@ if(NOT MSVC) endif() set(tp_debug_flags "${gf_proc} ${tp_flags_common} -g -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow -Wno-unused-dummy-argument -Wall") - set(tp_optim_flags "${tp_flags_common} -O3 ${gf_march} -funroll-loops") if(APPLE) diff --git a/addon/pyTests/test_issues.py b/addon/pyTests/test_issues.py index 35c0c945..da43d781 100644 --- a/addon/pyTests/test_issues.py +++ b/addon/pyTests/test_issues.py @@ -5,12 +5,17 @@ When an issue is resolved, a test with code that triggered it before resolution should be added here. """ from tools import ALL_CUBIC, check_eq +from thermopack.platform_specifics import DIFFERENTIAL_RETURN_MODE from pytest import mark @mark.parametrize('eos', ALL_CUBIC) def test_pr_114(eos): T = 300 eos = eos('ETOH,C2') - h1 = eos.idealenthalpysingle(1, T) + if DIFFERENTIAL_RETURN_MODE == 'v3': + h1 = eos.idealenthalpysingle(1, T) + elif DIFFERENTIAL_RETURN_MODE == 'v2': + h1, = eos.idealenthalpysingle(1, T) + h2, dh = eos.idealenthalpysingle(1, T, dhdt=True) assert check_eq(h1, h2) \ No newline at end of file diff --git a/addon/pycThermopack/makescript.py b/addon/pycThermopack/makescript.py index c3de07b0..35a4444b 100755 --- a/addon/pycThermopack/makescript.py +++ b/addon/pycThermopack/makescript.py @@ -35,26 +35,27 @@ def windows_make(diffs): if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("mode", type=str, help="optim or debug") - parser.add_argument("-diffs", default="v3", type=str, help="Old (v2) or new (> v2) return mode for differentials", ) + parser.add_argument("-diffs", default="v3", type=str, help="Old (v2) or new (> v2) return mode for differentials") + parser.add_argument("--install", action=argparse.BooleanOptionalAction, help="Install thermopack from thermopack/bin/dynamic?") args = parser.parse_args() mode = args.mode - # Glob to handle different OS suffixes - libthermo = list( - Path('../../bin/dynamic').glob(f'libthermopack_{mode}_gfortran*.*'))[0] + if args.install: + # Glob to handle different OS suffixes + libthermo = list( + Path('../../bin/dynamic').glob(f'libthermopack_{mode}_gfortran*.*'))[0] + + if not os.path.exists(libthermo): + print(f'{libthermo}does not exist. Have you compiled thermopack?') + sys.exit(1) - if not os.path.exists(libthermo): - print(f'{libthermo}does not exist. Have you compiled thermopack?') - sys.exit(1) + if os.path.exists("./thermopack/libthermopack"+libthermo.suffix): + os.remove("./thermopack/libthermopack"+libthermo.suffix) - if os.path.exists("./thermopack/libthermopack"+libthermo.suffix): - os.remove("./thermopack/libthermopack"+libthermo.suffix) + shutil.copy2(libthermo, "./thermopack/libthermopack"+libthermo.suffix) - shutil.copy2(libthermo, "./thermopack/libthermopack"+libthermo.suffix) - - pf_specifics_path = os.path.join(os.path.dirname( - __file__), "thermopack", "platform_specifics.py") + pf_specifics_path = os.path.join(os.path.dirname(__file__), "thermopack", "platform_specifics.py") pf_specifics = map_platform_specifics.get_platform_specifics_by_trial_and_error() if args.diffs == 'v2': @@ -83,7 +84,7 @@ def windows_make(diffs): pf_specifics['diff_return_mode'] = args.diffs map_platform_specifics.write_platform_specifics_file(pf_specifics, pf_specifics_path) - map_platform_specifics.write_setup_file(f'v{version}') - map_platform_specifics.write_toml_file(version) + # map_platform_specifics.write_setup_file(f'v{version}') + # map_platform_specifics.write_toml_file(version) print(f'\033[92mSuccessfully configured ThermoPack {version}\033[0m') \ No newline at end of file diff --git a/addon/pycThermopack/map_platform_specifics.py b/addon/pycThermopack/map_platform_specifics.py index cbd4f13f..9b0d074b 100644 --- a/addon/pycThermopack/map_platform_specifics.py +++ b/addon/pycThermopack/map_platform_specifics.py @@ -7,6 +7,7 @@ import sysconfig from datetime import datetime import os +import argparse # GNU FORTRAN G_PREFIX = "__" @@ -74,19 +75,24 @@ def get_platform_specifics_by_trial_and_error(): platform_specifics["dyn_lib"] = "" dynlibs = ["libthermopack.so", "thermopack.dll", "libthermopack.dylib"] + thermopack_dir = path.join(path.dirname(__file__), "thermopack") + errors = [] for lib in dynlibs: - dyn_lib_path = path.join(path.dirname(__file__), "thermopack", lib) + dyn_lib_path = path.join(thermopack_dir, lib) try: tp = cdll.LoadLibrary(dyn_lib_path) - except OSError: - tp = None - #print(dyn_lib_path, tp) - if tp is not None: platform_specifics["dyn_lib"] = lib break + except OSError as err: + errors.append(err) + pass else: - raise FileNotFoundError(f'Could not locate ThermoPack binary! Tried ' - f'{[path.join(path.dirname(__file__), "thermopack", lib) for lib in dynlibs]}') + thermopack_contains = os.listdir(thermopack_dir) + load_errors = '\n\t'.join([str(err) for err in errors]) + raise FileNotFoundError(f'Could not load ThermoPack binary!\n' + f'Tried : {[path.join(thermopack_dir, lib) for lib in dynlibs]}.\n' + f'{thermopack_dir} contains files : {thermopack_contains}\n' + f'Errors when attempting to load :\n\t{load_errors}') prefixes = ["__", ""] moduletxt = ["_", "_MOD_", "_mp_"] postfixes = ["", "_"] @@ -240,7 +246,15 @@ def get_platform_specifics_windows_ifort_whl(): return pf_specifics if __name__ == "__main__": - pf_specifics_path = os.path.join(os.path.dirname( - __file__), "thermopack", "platform_specifics.py") + VERSION_2 = '2.2.3' + VERSION_3 = '3.b0' + + parser = argparse.ArgumentParser() + parser.add_argument('--diffs', default='v3', help="Old (v2) or new (> v2) return mode for differentials") + args = parser.parse_args() + + pf_specifics_path = os.path.join(os.path.dirname( __file__), "thermopack", "platform_specifics.py") pf_specifics_ = get_platform_specifics_by_trial_and_error() + pf_specifics_['diff_return_mode'] = args.diffs + pf_specifics_['version'] = VERSION_2 if (args.diffs == 'v2') else VERSION_3 write_platform_specifics_file(pf_specifics_, pf_specifics_path) diff --git a/addon/pycThermopack/pyproject.toml b/addon/pycThermopack/pyproject.toml index 8bb46ac7..9281c1a3 100644 --- a/addon/pycThermopack/pyproject.toml +++ b/addon/pycThermopack/pyproject.toml @@ -3,7 +3,7 @@ requires = ["scikit-build-core"] build-backend = "scikit_build_core.build" [tool.scikit-build] -sdist.include = ["libthermopack*"] +sdist.include = ["libthermopack*", "platform_specifics.py"] wheel.expand-macos-universal-tags = true [project] @@ -35,6 +35,6 @@ dependencies = ["numpy~=1.20"] test = ["pytest"] [tool.cibuildwheel] -test-command = "pytest {project}/../pyTests" +test-command = "pytest {package}/../pyTests" test-requires = ["pytest"] build-verbosity = 2 \ No newline at end of file diff --git a/addon/pycThermopack/thermopack/__init__.py b/addon/pycThermopack/thermopack/__init__.py index afeb489d..e69de29b 100644 --- a/addon/pycThermopack/thermopack/__init__.py +++ b/addon/pycThermopack/thermopack/__init__.py @@ -1,40 +0,0 @@ -"""Initialization code for the thermopack package""" -from . import platform_specifics -from . import thermo -from . import cubic -from . import tcPR -from . import quantum_cubic -from . import cpa -from . import extended_csp -from . import saft -from . import pcsaft -from . import saftvrmie -from . import saftvrqmie -from . import plotutils -from . import utils -from . import multiparameter -from . import pets -from . import thermopack_state -from . import lee_kesler -from . import ljs_bh -from . import ljs_wca - -__all__ = ["platform_specifics", - "thermo", - "cubic", - "tcPR", - "quantum_cubic", - "cpa", - "saft", - "pcsaft", - "extended_csp", - "saftvrmie", - "saftvrqmie", - "plotutils", - "utils", - "multiparameter" - "pets", - "lee_kesler", - "thermopack_state", - "ljs_bh", - "ljs_wca"] diff --git a/docs/vCurrent/source_build.md b/docs/vCurrent/source_build.md index a7452a92..bbed37a5 100644 --- a/docs/vCurrent/source_build.md +++ b/docs/vCurrent/source_build.md @@ -134,4 +134,29 @@ See [addon/docker/README.md](https://github.com/thermotools/thermopack/tree/main available Dockerfiles to run Thermopack with docker. ### CMake setup -See [thermopack_cmake](https://github.com/morteham/thermopack_cmake) for prototype CMake scripts to compile Thermopack. \ No newline at end of file + +The CMake setup has been tested on macOS and Linux, and is the system currently used for CI. The system assumes that you have +Lapack and gfortran installed, see above instructions for more on that. + +Build and install thermopack by running +```bash +mkdir build +cd build +cmake .. +make install +``` + +To set up the python wrapper, +```bash +python addon/pycThermopack/map_platform_specifics.py +pip install addon/pycThermopack/ +``` +this will generate the file `addon/pycThermopack/thermopack/platform_specifics.py` and install thermopack to your activated virtual environment. + +ThermoPack can be configured to return computed properties as either tuples (`v2`) or using the `Property` struct (`v3`), this is toggled with +the `-diffs` flag when running `makescript.py` as +```bash +python map_platform_specifics.py -diffs=v2 # Use tuples +python map_platform_specifics.py -diffs=v3 # use Property +``` +the default value is `-diffs=v3`. \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb6e2a1e..3498e873 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,9 +10,17 @@ find_package(LAPACK REQUIRED) add_library(thermopack SHARED ${SOURCES}) set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + +# if (NOT MSVC AND NOT APPLE) +# set_target_properties(thermopack PROPERTIES +# INSTALL_RPATH ${CMAKE_INSTALL_RPATH} +# INSTALL_RPATH_USE_LINK_PATH TRUE) +# endif() + target_include_directories(thermopack PUBLIC ${TREND_DIR}) target_link_libraries(thermopack ${LAPACK_LIBRARIES}) +install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../bin) install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../addon/pycThermopack/thermopack) install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../addon/cppThermopack) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 51480bf7..e6e0dfa3 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -4,5 +4,13 @@ set(CMAKE_Fortran_FLAGS ${tp_fortran_flags}) enable_testing() file(GLOB UNITTEST_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.pf) list(REMOVE_ITEM UNITTEST_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_trend.pf) -add_pfunit_ctest(run_unittests TEST_SOURCES ${UNITTEST_SRC} LINK_LIBRARIES thermopack) -target_include_directories(run_unittests PRIVATE ${CMAKE_BINARY_DIR}/thermopack) \ No newline at end of file +add_pfunit_ctest(unittests TEST_SOURCES ${UNITTEST_SRC} LINK_LIBRARIES thermopack) +target_include_directories(unittests PRIVATE ${CMAKE_BINARY_DIR}/thermopack) + +if (NOT MSVC AND NOT APPLE) + set_target_properties(unittests PROPERTIES + INSTALL_RPATH ${CMAKE_CURRENT_SOURCE_DIR}/../bin + INSTALL_RPATH_USE_LINK_PATH TRUE) +endif() + +install(TARGETS unittests DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../bin) \ No newline at end of file diff --git a/unittests/README.md b/unittests/README.md index 51df9e94..658e8058 100644 --- a/unittests/README.md +++ b/unittests/README.md @@ -2,6 +2,23 @@ ## Compiling and Running tests +### With `cmake` + +The project is set up to search for `pFUnit` and use your installation if you have it installed. Set the environment variable `PFUNIT_DIR` before building if you have already installed `pFUnit`. If `pFUnit` is not found, the version of `pFUnit` under `external/pFUnit` will be built and used. + +Build and run unittests by executing + +```bash +mkdir build +cd build +cmake -Dtest=ON .. +make +./unittests/run_unittests +``` + +from the ThermoPack root directory (`..`). Note that the value of the `test` option is cached, so if you have previously built ThermoPack, you may need to clear the `CMakeCache.txt` in the build directory. + +### With only `make` The test-suite is set up and maintained to be compatible with the [`pFUnit` fork under the ThermoTools project](https://github.com/thermotools/pFUnit). To build the test suite you must first clone and build `pFUnit`. To compile the test-suite the environment variable `PFUNIT_DIR` must be set to the path of the directory containing the directories `PFUNIT-4.x` and `FARGPARSE-1.x`, where `x` is some subversion number. This corresponds to running From f6cad6af240f037d829e3b184563871308f374ea Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 7 Aug 2024 11:52:42 +0200 Subject: [PATCH 03/83] Only run workflows on pull requests. --- .github/workflows/cibuildwheel.yml | 2 +- .github/workflows/unittests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c46387df..07b2ec8a 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,6 +1,6 @@ name: cibuildwheel -on: [push, pull_request] +on: [pull_request] jobs: build_wheels: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 1733b9b7..aca3e4a3 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,6 +1,6 @@ name: unittests -on: [push, pull_request] +on: [pull_request] jobs: run-tests: From cf5f80bd41c8a7b327f7ba466fa2898a048355d7 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 9 Aug 2024 12:34:53 +0200 Subject: [PATCH 04/83] Using setup-fortran action for windows unittests. --- .github/workflows/unittests.yml | 42 +++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index aca3e4a3..41926be8 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -4,36 +4,42 @@ on: [pull_request] jobs: run-tests: - name: Run tests on ${{ matrix.os }}-${{ matrix.version }} - runs-on: ${{ matrix.os }}-${{ matrix.version }} + name: Run tests on ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [macOS, ubuntu] - version: [latest] + os: [ubuntu-latest, macos-latest, windows-latest, macos-12] + toolchain: + - {compiler: gcc, version: 13} + - {compiler: intel, version: '2023.2'} + - {compiler: intel-classic, version: '2021.10'} + - {compiler: nvidia-hpc, version: '23.11'} include: - - version: 12 - os: macOS + - os: ubuntu-latest + toolchain: {compiler: gcc, version: 12} + exclude: + - os: macos-latest + toolchain: {compiler: intel, version: '2023.2'} + - os: macos-latest + toolchain: {compiler: nvidia-hpc, version: '23.11'} + - os: windows-latest + toolchain: {compiler: nvidia-hpc, version: '23.11'} - outputs: - status: ${{ join('steps.*test.conclusion') }} steps: - uses: actions/checkout@v4 - name: checkout submodules run: git submodule update --init --recursive - - name: Setup gfortran Linux - if: matrix.os == 'ubuntu' - run: echo "gfortran=$(which gfortran)" >> $GITHUB_ENV - - - name: Setup gfortran macOS - if: matrix.os == 'macOS' - run: echo "gfortran=$(which gfortran-13)" >> $GITHUB_ENV + - uses: fortran-lang/setup-fortran@v1 + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} - name: Build ThermoPack run: | - ${{ env.gfortran }} --version - export FC=${{ env.gfortran }} + ${{ env.FC }} --version + export FC=${{ env.FC }} mkdir build cd build cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. @@ -54,7 +60,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: binary-${{ matrix.os }}-${{ matrix.version }} + name: binary-${{ matrix.os }} path: ./bin/* - id: fortran_test From 8ad17d0e8cca682761f770ef0659e57729e7c330 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 9 Aug 2024 12:35:51 +0200 Subject: [PATCH 05/83] Testing unittests on windows. --- .github/workflows/cibuildwheel.yml | 2 +- .github/workflows/unittests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 07b2ec8a..c46387df 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,6 +1,6 @@ name: cibuildwheel -on: [pull_request] +on: [push, pull_request] jobs: build_wheels: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 41926be8..21f03fa0 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,6 +1,6 @@ name: unittests -on: [pull_request] +on: [push, pull_request] jobs: run-tests: From 150e7a30e4826074d26d3375b17fcf009fb5869d Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Mon, 26 Aug 2024 13:53:08 +0200 Subject: [PATCH 06/83] CI unittests... --- .github/workflows/unittests.yml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 21f03fa0..091693a1 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -10,36 +10,43 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest, macos-12] - toolchain: - - {compiler: gcc, version: 13} - - {compiler: intel, version: '2023.2'} - - {compiler: intel-classic, version: '2021.10'} - - {compiler: nvidia-hpc, version: '23.11'} + toolchain: [] include: - os: ubuntu-latest - toolchain: {compiler: gcc, version: 12} - exclude: + toolchain: {compiler: gcc, version: 13} + - os: ubuntu-latest + toolchain: {nvidia-hpc, version: '23.11'} - os: macos-latest + toolchain: {compiler: gcc, version: 13} + - os: macos-12 + toolchain: {compiler: gcc, version: 13} + - os: windows-latest toolchain: {compiler: intel, version: '2023.2'} - - os: macos-latest - toolchain: {compiler: nvidia-hpc, version: '23.11'} - os: windows-latest - toolchain: {compiler: nvidia-hpc, version: '23.11'} + toolchain: {compiler: intel-classic, version: '2021.10'} steps: - uses: actions/checkout@v4 - name: checkout submodules run: git submodule update --init --recursive + - name: Environment status + run: | + echo ${FC} + + - uses: actions/setup-python@v5 - uses: fortran-lang/setup-fortran@v1 with: compiler: ${{ matrix.toolchain.compiler }} version: ${{ matrix.toolchain.version }} - + - name: Build ThermoPack run: | - ${{ env.FC }} --version - export FC=${{ env.FC }} + # ${{ env.FC }} --version + # export FC=${{ env.FC }} + echo ${FC} + which gfortran + gfortran --version mkdir build cd build cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. From b261b0a1c1965ebd39340bf41ed1e866f7e0e8c6 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Mon, 26 Aug 2024 13:55:53 +0200 Subject: [PATCH 07/83] CI unittests... --- .github/workflows/unittests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 091693a1..18a90cc1 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -10,20 +10,18 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest, macos-12] - toolchain: [] + toolchain: + - {compiler: gcc, version: 13} include: - - os: ubuntu-latest - toolchain: {compiler: gcc, version: 13} - os: ubuntu-latest toolchain: {nvidia-hpc, version: '23.11'} - - os: macos-latest - toolchain: {compiler: gcc, version: 13} - - os: macos-12 - toolchain: {compiler: gcc, version: 13} - os: windows-latest toolchain: {compiler: intel, version: '2023.2'} - os: windows-latest toolchain: {compiler: intel-classic, version: '2021.10'} + exclude: + - os: windows-latest + toolchain: {compiler: gcc, version: 13} steps: - uses: actions/checkout@v4 From 4d02aba81289f9eafa9ff1fd5b9cd70aac3f8e6f Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Mon, 26 Aug 2024 15:52:08 +0200 Subject: [PATCH 08/83] Fixing unittest build, thermopack fortran flags should not be used for pFUnit... --- .github/workflows/unittests.yml | 10 +++++----- .gitignore | 1 + CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 15 ++++++++++++--- thermopack-config.cmake | 4 +++- unittests/CMakeLists.txt | 2 +- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 18a90cc1..6927f0a3 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -48,7 +48,7 @@ jobs: mkdir build cd build cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. - make -j4 install + make install echo "--- pycThermopack contents ---" ls ../addon/pycThermopack echo "--- pycThermopack/thermopack contents ---" @@ -58,21 +58,21 @@ jobs: if: matrix.os == 'ubuntu' run: | echo "--- Inspecting libthermopack ---" - ldd bin/libthermopack.so + ldd installed/libthermopack.so echo "--- Inspecting run_unittests ---" - ldd bin/unittests + ldd installed/unittests - name: Upload uses: actions/upload-artifact@v4 with: name: binary-${{ matrix.os }} - path: ./bin/* + path: ./installed/* - id: fortran_test name: Run unittests continue-on-error: true run: | - result=$(./bin/unittests) + result=$(./installed/unittests) if echo "$result" | grep -q "OK"; then statuscode=0 else diff --git a/.gitignore b/.gitignore index ae4e19d5..041b7487 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ syntax: glob objects bin +installed/ build/ run* doc/dox.out diff --git a/CMakeLists.txt b/CMakeLists.txt index f79f3bc1..d6f62f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,10 +48,10 @@ else() endif() # Set FORTRAN compile flags for thermopack and lapack -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${tp_fortran_flags}") + if(MSVC) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/lapack) + endif(MSVC) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src "thermopack") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a88bd1d..90e99566 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,5 @@ +set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${tp_fortran_flags}") + file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.f90) list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/thermopack.f90) set(TREND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../addon/trend_interface/include) @@ -5,6 +7,8 @@ set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) find_package(LAPACK REQUIRED) +else() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/lapack) endif() add_library(libthermopack STATIC ${SOURCES}) @@ -21,14 +25,17 @@ else(MSVC) add_library(thermopack SHARED $) endif(MSVC) -set_target_properties(libthermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties(libthermopack PROPERTIES + Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT_NAME thermopack) target_include_directories(libthermopack PUBLIC ${TREND_DIR}) + set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(thermopack PUBLIC ${TREND_DIR}) -install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../bin) +install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) +install(TARGETS libthermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../addon/pycThermopack/thermopack) -install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../addon/cppThermopack) add_executable(run_thermopack ${CMAKE_CURRENT_SOURCE_DIR}/thermopack.f90) target_include_directories(run_thermopack PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) @@ -40,3 +47,5 @@ else() target_link_libraries(thermopack PRIVATE lapack blas) target_link_libraries(run_thermopack libthermopack lapack blas) endif() + +install(TARGETS run_thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) \ No newline at end of file diff --git a/thermopack-config.cmake b/thermopack-config.cmake index 11b3a081..e778b434 100644 --- a/thermopack-config.cmake +++ b/thermopack-config.cmake @@ -8,7 +8,7 @@ message(STATUS "ThermoPack found at: ${CMAKE_CURRENT_LIST_DIR}") -set(THERMOPACK_LIB ${CMAKE_CURRENT_LIST_DIR}/addon/cppThermopack/libthermopack${CMAKE_SHARED_LIBRARY_SUFFIX}) +set(THERMOPACK_LIB ${CMAKE_CURRENT_LIST_DIR}/installed/libthermopack${CMAKE_SHARED_LIBRARY_SUFFIX}) set(THERMOPACK_ROOT ${CMAKE_CURRENT_LIST_DIR}) if(NOT EXISTS ${THERMOPACK_LIB}) @@ -18,6 +18,8 @@ if(NOT EXISTS ${THERMOPACK_LIB}) return() endif() +set(THERMOPACK_STATIC_LIB ${CMAKE_CURRENT_LIST_DIR}/installed/libthermopack${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(THERMOPACK_FOUND TRUE) set(THERMOPACK_INSTALLED TRUE) set(THERMOPACK_INCLUDE ${CMAKE_CURRENT_LIST_DIR}/addon/cppThermopack) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index e6e0dfa3..2dcfa86d 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -13,4 +13,4 @@ if (NOT MSVC AND NOT APPLE) INSTALL_RPATH_USE_LINK_PATH TRUE) endif() -install(TARGETS unittests DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../bin) \ No newline at end of file +install(TARGETS unittests DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) \ No newline at end of file From 3fea1b843906bf0fa7f01c2925e75f113f2fb7f6 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Mon, 26 Aug 2024 16:21:46 +0200 Subject: [PATCH 09/83] CI unittests ... --- .github/workflows/unittests.yml | 20 +++++++------------- CMakeLists.txt | 13 ------------- unittests/CMakeLists.txt | 2 +- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 6927f0a3..ca8e0f73 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: run-tests: - name: Run tests on ${{ matrix.os }} + name: Run tests on ${{ matrix.os }} with ${{ matrix.toolchain.compiler }} ${{ matrix.toolchain.version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -13,8 +13,8 @@ jobs: toolchain: - {compiler: gcc, version: 13} include: - - os: ubuntu-latest - toolchain: {nvidia-hpc, version: '23.11'} + # - os: ubuntu-latest + # toolchain: {nvidia-hpc, version: '23.11'} - os: windows-latest toolchain: {compiler: intel, version: '2023.2'} - os: windows-latest @@ -27,10 +27,6 @@ jobs: - uses: actions/checkout@v4 - name: checkout submodules run: git submodule update --init --recursive - - - name: Environment status - run: | - echo ${FC} - uses: actions/setup-python@v5 - uses: fortran-lang/setup-fortran@v1 @@ -40,15 +36,13 @@ jobs: - name: Build ThermoPack run: | - # ${{ env.FC }} --version - # export FC=${{ env.FC }} - echo ${FC} - which gfortran - gfortran --version + if [[ "RUNNER_OS" == "Windows" ]]; then + FC=${{ env.FC }} + fi mkdir build cd build cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. - make install + make -j4 install echo "--- pycThermopack contents ---" ls ../addon/pycThermopack echo "--- pycThermopack/thermopack contents ---" diff --git a/CMakeLists.txt b/CMakeLists.txt index d6f62f6a..82447117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,12 +28,6 @@ if(NOT MSVC) set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "The OSX architecture") endif() else() - message(${ColorRed}"cmake not configured for windows!") - return() - # Need to set up external link to lapack (preferrably a tagged relase, ex. v3.12.0): - # git clone https://github.com/Reference-LAPACK/lapack.git - # git checkout v3.12.0 - # Build using: cmake --build . --config Release set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /real-size:64 /fp:precise /extend-source:132 /iface:cref") set(tp_optim_flags "${tp_flags_common}") set(tp_debug_flags "${tp_flags_common} /check:bounds /warn:all,noexternal /traceback /check:all,noarg_temp_created,nopointers") @@ -47,13 +41,6 @@ else() set(tp_fortran_flags ${tp_optim_flags}) endif() -# Set FORTRAN compile flags for thermopack and lapack - - -if(MSVC) - -endif(MSVC) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src "thermopack") option(test "Build test suite" OFF) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 2dcfa86d..bfe06163 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -9,7 +9,7 @@ target_include_directories(unittests PRIVATE ${CMAKE_BINARY_DIR}/thermopack) if (NOT MSVC AND NOT APPLE) set_target_properties(unittests PROPERTIES - INSTALL_RPATH ${CMAKE_CURRENT_SOURCE_DIR}/../bin + INSTALL_RPATH ${CMAKE_CURRENT_SOURCE_DIR}/../installed INSTALL_RPATH_USE_LINK_PATH TRUE) endif() From 969353d9f8cb91c152337490ff0a936cb0b037dc Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Mon, 26 Aug 2024 16:50:28 +0200 Subject: [PATCH 10/83] CI unittests ... --- .github/workflows/unittests.yml | 3 --- src/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index ca8e0f73..b660106e 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -36,9 +36,6 @@ jobs: - name: Build ThermoPack run: | - if [[ "RUNNER_OS" == "Windows" ]]; then - FC=${{ env.FC }} - fi mkdir build cd build cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90e99566..b32b644d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,7 +20,7 @@ else(MSVC) if(APPLE) # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_SOURCE_DIR}/libthermopack_export.symbols") else(APPLE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/libthermopack_export.version") + # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/libthermopack_export.version") endif(APPLE) add_library(thermopack SHARED $) endif(MSVC) From 1f48b55bb800091a261b8e1244a294f5d210b9e9 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 00:46:23 +0200 Subject: [PATCH 11/83] CI unittests ... --- .github/workflows/unittests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index b660106e..74460f7b 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -12,16 +12,16 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest, macos-12] toolchain: - {compiler: gcc, version: 13} - include: + # include: # - os: ubuntu-latest # toolchain: {nvidia-hpc, version: '23.11'} - - os: windows-latest - toolchain: {compiler: intel, version: '2023.2'} - - os: windows-latest - toolchain: {compiler: intel-classic, version: '2021.10'} - exclude: - - os: windows-latest - toolchain: {compiler: gcc, version: 13} + # - os: windows-latest + # toolchain: {compiler: intel, version: '2023.2'} + # - os: windows-latest + # toolchain: {compiler: intel-classic, version: '2021.10'} + # exclude: + # - os: windows-latest + # toolchain: {compiler: gcc, version: 13} steps: - uses: actions/checkout@v4 From e2ef58237f919d8072e5593fa4f3c191a6e19a31 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 16:47:29 +0200 Subject: [PATCH 12/83] CI unittests ... --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 74460f7b..dbdbcacd 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -38,7 +38,7 @@ jobs: run: | mkdir build cd build - cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. + cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_Compiler=${FC} .. make -j4 install echo "--- pycThermopack contents ---" ls ../addon/pycThermopack From 3757e044a2e5581bd86eafa3f6d25e674b829cec Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 17:03:55 +0200 Subject: [PATCH 13/83] CI unittests ... --- .github/workflows/unittests.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index dbdbcacd..8e676aea 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -28,22 +28,24 @@ jobs: - name: checkout submodules run: git submodule update --init --recursive - - uses: actions/setup-python@v5 - uses: fortran-lang/setup-fortran@v1 with: compiler: ${{ matrix.toolchain.compiler }} version: ${{ matrix.toolchain.version }} + + - name: Config ThermoPack build + run: | + mkdir build + cd build + cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. - name: Build ThermoPack - run: | - mkdir build - cd build - cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_Compiler=${FC} .. - make -j4 install - echo "--- pycThermopack contents ---" - ls ../addon/pycThermopack - echo "--- pycThermopack/thermopack contents ---" - ls ../addon/pycThermopack/thermopack + if: ${{ matrix.os }} != 'Windows' + run: make -j4 install + + - name: Build ThermoPack Windows + if: ${{ matrix.os }} == 'Windows' + run: cmake --build . --target INSTALL - name: Inspect thermopack if: matrix.os == 'ubuntu' From 0aa5d929987c947ad3075eed42302ddb1fd63969 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 17:05:25 +0200 Subject: [PATCH 14/83] CI unittests ... --- .github/workflows/unittests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 8e676aea..6502f65c 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -41,11 +41,13 @@ jobs: - name: Build ThermoPack if: ${{ matrix.os }} != 'Windows' - run: make -j4 install + run: cd build && make -j4 install - name: Build ThermoPack Windows if: ${{ matrix.os }} == 'Windows' - run: cmake --build . --target INSTALL + run: | + cd build + cmake --build . --target INSTALL - name: Inspect thermopack if: matrix.os == 'ubuntu' From 7f8b23c8efdef24d9d2e127d5b17e98770bea8fc Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 17:10:05 +0200 Subject: [PATCH 15/83] CI unittests ... --- .github/workflows/unittests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 6502f65c..fd8a211d 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -40,12 +40,13 @@ jobs: cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. - name: Build ThermoPack - if: ${{ matrix.os }} != 'Windows' + if: ${{ matrix.os }} != 'windows-latest' run: cd build && make -j4 install - name: Build ThermoPack Windows - if: ${{ matrix.os }} == 'Windows' + if: ${{ matrix.os }} == 'windows-latest' run: | + echo "Building on ${{ matrix.os }}" cd build cmake --build . --target INSTALL From 2ecdc4cf3f76f8ab7ba67f17ece879802bf68a04 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 17:13:10 +0200 Subject: [PATCH 16/83] CI unittests ... --- .github/workflows/unittests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index fd8a211d..e045c7ba 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -40,11 +40,11 @@ jobs: cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. - name: Build ThermoPack - if: ${{ matrix.os }} != 'windows-latest' + if: matrix.os != 'windows-latest' run: cd build && make -j4 install - name: Build ThermoPack Windows - if: ${{ matrix.os }} == 'windows-latest' + if: matrix.os == 'windows-latest' run: | echo "Building on ${{ matrix.os }}" cd build From b7bebf3b68340de7a2de35b38abc87ec657f92cd Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 27 Aug 2024 18:21:52 +0200 Subject: [PATCH 17/83] CI unittests ... --- .github/workflows/unittests.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index e045c7ba..f033a315 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -35,19 +35,23 @@ jobs: - name: Config ThermoPack build run: | - mkdir build - cd build - cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. + - name: Build ThermoPack if: matrix.os != 'windows-latest' - run: cd build && make -j4 install + run: | + mkdir build + cd build + cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. + make -j4 install - name: Build ThermoPack Windows if: matrix.os == 'windows-latest' run: | echo "Building on ${{ matrix.os }}" + mkdir build cd build + cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_COMPILER=${FC} .. cmake --build . --target INSTALL - name: Inspect thermopack From 496d49f815e23681c65c05e8484cee73c39c7ae8 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 28 Aug 2024 09:40:02 +0200 Subject: [PATCH 18/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 25 ++++++++++++++++--------- .github/workflows/unittests.yml | 7 +++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c46387df..aa5ef294 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macOS, ubuntu] + os: [macOS, ubuntu, windows] version: [latest] include: - version: 12 @@ -33,13 +33,14 @@ jobs: echo "gfortran=$(which gfortran-13)" >> $GITHUB_ENV echo "libinspector=otool -L ../addon/pycThermopack/thermopack/libthermopack*" >> $GITHUB_ENV echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1)" >> $GITHUB_ENV - - - name: Upload - uses: actions/upload-artifact@v4 + + - name: Setup Windows env + if: matrix.os == 'windows' + uses: fortran-lang/setup-fortran@v1 with: - name: binary-${{ matrix.os }}-${{ matrix.version }} - path: ./bin/libthermopack.dylib - + compiler: gcc + version: 13 + - uses: actions/setup-python@v5 - name: Check macOS deployment target @@ -53,8 +54,14 @@ jobs: CIBW_BEFORE_ALL_LINUX: | yum install -y blas blas-devel yum install -y lapack lapack-devel - echo $(which gfortran) - + + CIBW_BEFORE_BUILD_WINDOWS: | + mkdir build + cd build + cmake .. + cmake --build . --target INSTALL + python ../addon/pycThermopack/map_platform_specifics.py + CIBW_BEFORE_BUILD: | ${{ env.gfortran }} --version export FC=${{ env.gfortran }} diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index f033a315..c9006d94 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -29,13 +29,15 @@ jobs: run: git submodule update --init --recursive - uses: fortran-lang/setup-fortran@v1 + if: matrix.os != 'macos-12' with: compiler: ${{ matrix.toolchain.compiler }} version: ${{ matrix.toolchain.version }} - - name: Config ThermoPack build + - name: Setup gfortran macos-12 + if: matrix.os == 'macos-12' run: | - + export FC=$(which gfortran-13) - name: Build ThermoPack if: matrix.os != 'windows-latest' @@ -49,6 +51,7 @@ jobs: if: matrix.os == 'windows-latest' run: | echo "Building on ${{ matrix.os }}" + echo "Using compiler ${FC}" mkdir build cd build cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_COMPILER=${FC} .. From d8c20e5dedbdabb7904451f99147f492143e14b0 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 28 Aug 2024 09:54:52 +0200 Subject: [PATCH 19/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 5 +++++ .github/workflows/unittests.yml | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index aa5ef294..6ea587bc 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -61,6 +61,11 @@ jobs: cmake .. cmake --build . --target INSTALL python ../addon/pycThermopack/map_platform_specifics.py + echo "--- pycThermopack contents ---" + dir ../addon/pycThermopack + echo "--- pycThermopack/thermopack contents ---" + dir ../addon/pycThermopack/thermopack + echo "--- Inspecting libthermopack ---" CIBW_BEFORE_BUILD: | ${{ env.gfortran }} --version diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index c9006d94..e9da689d 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -38,6 +38,7 @@ jobs: if: matrix.os == 'macos-12' run: | export FC=$(which gfortran-13) + echo FC=$FC >> $GITHUB_ENV - name: Build ThermoPack if: matrix.os != 'windows-latest' @@ -51,10 +52,11 @@ jobs: if: matrix.os == 'windows-latest' run: | echo "Building on ${{ matrix.os }}" + set FC=${{ env.FC }} echo "Using compiler ${FC}" mkdir build cd build - cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_COMPILER=${FC} .. + cmake .. -Dtest=ON cmake --build . --target INSTALL - name: Inspect thermopack From 6f762306c9fa26e4dee2fc181f9cc9ba2afdaf88 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 28 Aug 2024 10:35:36 +0200 Subject: [PATCH 20/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 4 +--- .github/workflows/unittests.yml | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 6ea587bc..c97f940b 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -40,8 +40,6 @@ jobs: with: compiler: gcc version: 13 - - - uses: actions/setup-python@v5 - name: Check macOS deployment target if: matrix.os == 'macOS' @@ -65,7 +63,6 @@ jobs: dir ../addon/pycThermopack echo "--- pycThermopack/thermopack contents ---" dir ../addon/pycThermopack/thermopack - echo "--- Inspecting libthermopack ---" CIBW_BEFORE_BUILD: | ${{ env.gfortran }} --version @@ -81,6 +78,7 @@ jobs: ls ../addon/pycThermopack/thermopack echo "--- Inspecting libthermopack ---" ${{ env.libinspector }} + CIBW_BUILD: "*cp311*" CIBW_SKIP: "*musllinux*" CIBW_TEST_SKIP: "*x86_64*" diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index e9da689d..e4c95b04 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -52,11 +52,11 @@ jobs: if: matrix.os == 'windows-latest' run: | echo "Building on ${{ matrix.os }}" - set FC=${{ env.FC }} - echo "Using compiler ${FC}" + setx FC "${{ env.FC }}" + echo "Using compiler $env:FC / ${{ env.FC }}" mkdir build cd build - cmake .. -Dtest=ON + cmake .. -Dtest=ON -CMAKE_Fortran_COMPILER=${{ env.FC }} cmake --build . --target INSTALL - name: Inspect thermopack From d94fad92e86b747ae0a68ae7008d217aa86f6d1e Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 28 Aug 2024 11:21:01 +0200 Subject: [PATCH 21/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 1 + .github/workflows/unittests.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c97f940b..9cec6d39 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -54,6 +54,7 @@ jobs: yum install -y lapack lapack-devel CIBW_BEFORE_BUILD_WINDOWS: | + echo "Running before_build on windows ..." mkdir build cd build cmake .. diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index e4c95b04..36776772 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -56,7 +56,7 @@ jobs: echo "Using compiler $env:FC / ${{ env.FC }}" mkdir build cd build - cmake .. -Dtest=ON -CMAKE_Fortran_COMPILER=${{ env.FC }} + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=${{ env.FC }} cmake --build . --target INSTALL - name: Inspect thermopack From 0a34dc7ede85cfff3718a4798ea14f3ee73ae7b9 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 28 Aug 2024 12:00:35 +0200 Subject: [PATCH 22/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 4 ++++ .github/workflows/unittests.yml | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 9cec6d39..22300f76 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -56,9 +56,13 @@ jobs: CIBW_BEFORE_BUILD_WINDOWS: | echo "Running before_build on windows ..." mkdir build + echo "Created build dir ..." cd build + echo "Moved into build dir ..." cmake .. + echo "cmake finished ..." cmake --build . --target INSTALL + echo "build finished ..." python ../addon/pycThermopack/map_platform_specifics.py echo "--- pycThermopack contents ---" dir ../addon/pycThermopack diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 36776772..4c4ded14 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -53,10 +53,12 @@ jobs: run: | echo "Building on ${{ matrix.os }}" setx FC "${{ env.FC }}" + setx FC_PATH "$(Get-Command ${{ env.FC }}).Path" echo "Using compiler $env:FC / ${{ env.FC }}" + echo "gfortran at $(Get-Command ${{ env.FC }}).Path / $env:FC_PATH" mkdir build cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=$(Get-Command ${{ env.FC }}).Path cmake --build . --target INSTALL - name: Inspect thermopack From f3d54950f9c664cc067050981d6fa9ba20ab347c Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 28 Aug 2024 15:23:13 +0200 Subject: [PATCH 23/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 28 ++++++++++++++-------------- .github/workflows/unittests.yml | 6 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 22300f76..ea02c498 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -53,20 +53,20 @@ jobs: yum install -y blas blas-devel yum install -y lapack lapack-devel - CIBW_BEFORE_BUILD_WINDOWS: | - echo "Running before_build on windows ..." - mkdir build - echo "Created build dir ..." - cd build - echo "Moved into build dir ..." - cmake .. - echo "cmake finished ..." - cmake --build . --target INSTALL - echo "build finished ..." - python ../addon/pycThermopack/map_platform_specifics.py - echo "--- pycThermopack contents ---" - dir ../addon/pycThermopack - echo "--- pycThermopack/thermopack contents ---" + CIBW_BEFORE_BUILD_WINDOWS: > + echo "Running before_build on windows ..." && + mkdir build && + echo "Created build dir ..." && + cd build && + echo "Moved into build dir ..." && + cmake .. && + echo "cmake finished ..." && + cmake --build . --target INSTALL && + echo "build finished ..." && + python ../addon/pycThermopack/map_platform_specifics.py && + echo "--- pycThermopack contents ---" && + dir ../addon/pycThermopack && + echo "--- pycThermopack/thermopack contents ---" && dir ../addon/pycThermopack/thermopack CIBW_BEFORE_BUILD: | diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 4c4ded14..4766becf 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -53,12 +53,12 @@ jobs: run: | echo "Building on ${{ matrix.os }}" setx FC "${{ env.FC }}" - setx FC_PATH "$(Get-Command ${{ env.FC }}).Path" + setx FC_PATH "$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path)" echo "Using compiler $env:FC / ${{ env.FC }}" - echo "gfortran at $(Get-Command ${{ env.FC }}).Path / $env:FC_PATH" + echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $env:FC_PATH" mkdir build cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=$(Get-Command ${{ env.FC }}).Path + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) cmake --build . --target INSTALL - name: Inspect thermopack From 612179e4b0c0b79b35bd26f46034b248e5e8cd00 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 29 Aug 2024 15:42:04 +0200 Subject: [PATCH 24/83] CI unittests ... --- .github/workflows/unittests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 4766becf..ac3dd39e 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -53,12 +53,12 @@ jobs: run: | echo "Building on ${{ matrix.os }}" setx FC "${{ env.FC }}" - setx FC_PATH "$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path)" + $FC_PATH = "$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path)" echo "Using compiler $env:FC / ${{ env.FC }}" - echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $env:FC_PATH" + echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" mkdir build cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER="$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path)" cmake --build . --target INSTALL - name: Inspect thermopack From 971568fb11a0aa27f6623958627fbe4c8966c770 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 29 Aug 2024 15:56:02 +0200 Subject: [PATCH 25/83] CI unittests ... --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index ac3dd39e..462d9b7f 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -58,7 +58,7 @@ jobs: echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" mkdir build cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER="$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path)" + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER="$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path -replace '\\', '/')" cmake --build . --target INSTALL - name: Inspect thermopack From 59b3eec64234701b04668bc42a06e77b497960eb Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 29 Aug 2024 16:08:16 +0200 Subject: [PATCH 26/83] CI unittests ... --- .github/workflows/unittests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 462d9b7f..73fd1281 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -53,12 +53,12 @@ jobs: run: | echo "Building on ${{ matrix.os }}" setx FC "${{ env.FC }}" - $FC_PATH = "$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path)" + $FC_PATH = "$((Get-Command gfortran | Select-Object -ExpandProperty Path) -replace '\\', '/')" echo "Using compiler $env:FC / ${{ env.FC }}" echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" mkdir build cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER="$(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path -replace '\\', '/')" + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER="$FC_PATH" cmake --build . --target INSTALL - name: Inspect thermopack From a65ba9c4681d409c29057dbdf3a3c2ae634b8bbb Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 29 Aug 2024 16:42:06 +0200 Subject: [PATCH 27/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 7 ++++--- .github/workflows/unittests.yml | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index ea02c498..e1942477 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -38,8 +38,8 @@ jobs: if: matrix.os == 'windows' uses: fortran-lang/setup-fortran@v1 with: - compiler: gcc - version: 13 + compiler: intel + version: '2023.2' - name: Check macOS deployment target if: matrix.os == 'macOS' @@ -59,7 +59,8 @@ jobs: echo "Created build dir ..." && cd build && echo "Moved into build dir ..." && - cmake .. && + $FC_PATH = "$((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/')" && + cmake .. -DCMAKE_Fortran_COMPILER="$FC_PATH" && echo "cmake finished ..." && cmake --build . --target INSTALL && echo "build finished ..." && diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 73fd1281..17063ef6 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -12,13 +12,13 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest, macos-12] toolchain: - {compiler: gcc, version: 13} - # include: + include: # - os: ubuntu-latest # toolchain: {nvidia-hpc, version: '23.11'} - # - os: windows-latest - # toolchain: {compiler: intel, version: '2023.2'} - # - os: windows-latest - # toolchain: {compiler: intel-classic, version: '2021.10'} + - os: windows-latest + toolchain: {compiler: intel, version: '2023.2'} + - os: windows-latest + toolchain: {compiler: intel-classic, version: '2021.10'} # exclude: # - os: windows-latest # toolchain: {compiler: gcc, version: 13} From dc2377ec6afd941ecb9a5608b109684f9ae97e7e Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 29 Aug 2024 16:42:48 +0200 Subject: [PATCH 28/83] Modify pyproject.toml and CMakeLists to optionally recompile thermopack when pip installing. When only running pip install [-e] addon/pycThermopack thermopack will by default not be recompiled. To force recompilation, either export RECOMPILE_THERMOPACK=ON or pip install addon/pycThermopack -C cmake.define.RECOMPILE_THERMOPACK=ON the default behaviour (not recompiling) may be changed in the future. --- addon/pycThermopack/CMakeLists.txt | 7 +++++++ addon/pycThermopack/pyproject.toml | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/addon/pycThermopack/CMakeLists.txt b/addon/pycThermopack/CMakeLists.txt index e69de29b..2bb6f5c3 100644 --- a/addon/pycThermopack/CMakeLists.txt +++ b/addon/pycThermopack/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.16) +project(pycThermopack) + +option(RECOMPILE_THERMOPACK "Recompile thermopack?" OFF) +if(RECOMPILE_THERMOPACK) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../.. "thermopack") +endif() \ No newline at end of file diff --git a/addon/pycThermopack/pyproject.toml b/addon/pycThermopack/pyproject.toml index 9281c1a3..2a7f341b 100644 --- a/addon/pycThermopack/pyproject.toml +++ b/addon/pycThermopack/pyproject.toml @@ -5,6 +5,10 @@ build-backend = "scikit_build_core.build" [tool.scikit-build] sdist.include = ["libthermopack*", "platform_specifics.py"] wheel.expand-macos-universal-tags = true +wheel.py-api = "py3" + +[tool.scikit-build.cmake.define] +RECOMPILE_THERMOPACK = {env="RECOMPILE_THERMOPACK", default="OFF"} [project] name = "thermopack" From 13a04b24fb1c42715d96c86988b882b82a656655 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 29 Aug 2024 16:55:32 +0200 Subject: [PATCH 29/83] CI unittests ... --- .github/workflows/cibuildwheel.yml | 3 +-- .github/workflows/unittests.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index e1942477..7732ae21 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -59,8 +59,7 @@ jobs: echo "Created build dir ..." && cd build && echo "Moved into build dir ..." && - $FC_PATH = "$((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/')" && - cmake .. -DCMAKE_Fortran_COMPILER="$FC_PATH" && + cmake .. -DCMAKE_Fortran_COMPILER="$((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/')" && echo "cmake finished ..." && cmake --build . --target INSTALL && echo "build finished ..." && diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 17063ef6..2791b160 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -53,7 +53,7 @@ jobs: run: | echo "Building on ${{ matrix.os }}" setx FC "${{ env.FC }}" - $FC_PATH = "$((Get-Command gfortran | Select-Object -ExpandProperty Path) -replace '\\', '/')" + $FC_PATH = "$((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/')" echo "Using compiler $env:FC / ${{ env.FC }}" echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" mkdir build From 982291fa415b2de5e5918ce37bd1462fcc203853 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 30 Aug 2024 10:18:02 +0200 Subject: [PATCH 30/83] CI unittests ... --- .github/workflows/unittests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 2791b160..8937a259 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest, macos-12] + os: [ubuntu-latest, macos-latest, windows-2022, macos-12] toolchain: - {compiler: gcc, version: 13} include: @@ -58,7 +58,7 @@ jobs: echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" mkdir build cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER="$FC_PATH" + cmake .. -G "Visual Studio 17 2022" -Dtest=ON -DCMAKE_Fortran_COMPILER="$FC_PATH" cmake --build . --target INSTALL - name: Inspect thermopack From 91209b33505685c30aea5f7e5e97794f05f97e25 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 30 Aug 2024 10:31:23 +0200 Subject: [PATCH 31/83] CI unittests ... --- .github/workflows/unittests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 8937a259..522c1954 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: run-tests: - name: Run tests on ${{ matrix.os }} with ${{ matrix.toolchain.compiler }} ${{ matrix.toolchain.version }} + name: Test on ${{ matrix.os }} with ${{ matrix.toolchain.compiler }} ${{ matrix.toolchain.version }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -52,13 +52,13 @@ jobs: if: matrix.os == 'windows-latest' run: | echo "Building on ${{ matrix.os }}" - setx FC "${{ env.FC }}" - $FC_PATH = "$((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/')" + $FC = ${{ env.FC }} + $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" - echo "gfortran at $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" + echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" mkdir build cd build - cmake .. -G "Visual Studio 17 2022" -Dtest=ON -DCMAKE_Fortran_COMPILER="$FC_PATH" + cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=${{ env.FC }} cmake --build . --target INSTALL - name: Inspect thermopack @@ -77,6 +77,7 @@ jobs: - id: fortran_test name: Run unittests + if: matrix.os != 'windows-latest' continue-on-error: true run: | result=$(./installed/unittests) From b065f58c304db439186e10fcbbde316c9893afce Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 3 Sep 2024 11:54:46 +0200 Subject: [PATCH 32/83] CI unittessts ... --- .github/workflows/unittests.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 522c1954..d6fbb445 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -15,10 +15,10 @@ jobs: include: # - os: ubuntu-latest # toolchain: {nvidia-hpc, version: '23.11'} - - os: windows-latest - toolchain: {compiler: intel, version: '2023.2'} - - os: windows-latest - toolchain: {compiler: intel-classic, version: '2021.10'} + - os: windows-2022 + toolchain: {compiler: intel, version: '2024.1'} + - os: windows-2022 + toolchain: {compiler: intel-classic, version: '2021.12'} # exclude: # - os: windows-latest # toolchain: {compiler: gcc, version: 13} @@ -28,6 +28,10 @@ jobs: - name: checkout submodules run: git submodule update --init --recursive + - name: Install ninja-build tool + if: matrix.os == 'windows-2022' + uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 + - uses: fortran-lang/setup-fortran@v1 if: matrix.os != 'macos-12' with: @@ -41,7 +45,7 @@ jobs: echo FC=$FC >> $GITHUB_ENV - name: Build ThermoPack - if: matrix.os != 'windows-latest' + if: matrix.os != 'windows-2022' run: | mkdir build cd build @@ -49,17 +53,17 @@ jobs: make -j4 install - name: Build ThermoPack Windows - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2022' run: | echo "Building on ${{ matrix.os }}" $FC = ${{ env.FC }} $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - mkdir build - cd build - cmake .. -Dtest=ON -DCMAKE_Fortran_COMPILER=${{ env.FC }} - cmake --build . --target INSTALL + # mkdir build + # cd build + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake --build build --target INSTALL - name: Inspect thermopack if: matrix.os == 'ubuntu' From f31fe3db1237ae881416ef9602362b248cc30dd9 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 3 Sep 2024 16:34:59 +0200 Subject: [PATCH 33/83] CI Windows ... --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b32b644d..96516feb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,7 @@ set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) find_package(LAPACK REQUIRED) else() - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/lapack) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack) endif() add_library(libthermopack STATIC ${SOURCES}) From 79ff4ed29ee81dbcf6513e54f753ac4e0d44a508 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 3 Sep 2024 17:07:42 +0200 Subject: [PATCH 34/83] CI Windows ... --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96516feb..95c5ab27 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,7 @@ set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) find_package(LAPACK REQUIRED) else() - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") endif() add_library(libthermopack STATIC ${SOURCES}) From 754e9d63ce8a57b920d29e78e10229f1fcb5978c Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 3 Sep 2024 17:14:41 +0200 Subject: [PATCH 35/83] CI Windows ... --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 95c5ab27..b69c7460 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ endif(MSVC) set_target_properties(libthermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - OUTPUT_NAME thermopack) + OUTPUT_NAME thermopack_static) target_include_directories(libthermopack PUBLIC ${TREND_DIR}) set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) From 10f96b9a65ea52b0e105b53634f72435bbbd4f63 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Tue, 3 Sep 2024 17:30:39 +0200 Subject: [PATCH 36/83] CI Windows ... --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index d6fbb445..cdb93e5e 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -63,7 +63,7 @@ jobs: # mkdir build # cd build cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} - cmake --build build --target INSTALL + cmake --build build --target install - name: Inspect thermopack if: matrix.os == 'ubuntu' From 85105fd44b254f9a63be90cfc56cf0d9f6ed1589 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 12 Sep 2024 11:01:13 +0200 Subject: [PATCH 37/83] CI Windows... --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82447117..826422e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.19) project(ThermoPack LANGUAGES Fortran) string(ASCII 27 Esc) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b69c7460..09ad713b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,8 @@ set(TREND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../addon/trend_interface/include) set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) - find_package(LAPACK REQUIRED) + # find_package(LAPACK REQUIRED) + find_package(MKL REQUIRED) else() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") endif() @@ -16,6 +17,7 @@ if(MSVC) add_library(thermopack SHARED ${SOURCES}) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static /threads") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${CMAKE_SOURCE_DIR}/MSVStudio/thermopack.def") + target_link_libraries(thermopack SHARED MKL::MKL) else(MSVC) if(APPLE) # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_SOURCE_DIR}/libthermopack_export.symbols") From 3c63a963ec7826431086b03d152772e1edc7adcb Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 12 Sep 2024 11:02:13 +0200 Subject: [PATCH 38/83] CI Windows... --- src/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09ad713b..16a362fb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,7 +17,6 @@ if(MSVC) add_library(thermopack SHARED ${SOURCES}) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static /threads") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${CMAKE_SOURCE_DIR}/MSVStudio/thermopack.def") - target_link_libraries(thermopack SHARED MKL::MKL) else(MSVC) if(APPLE) # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_SOURCE_DIR}/libthermopack_export.symbols") @@ -46,8 +45,8 @@ if(NOT MSVC) target_link_libraries(thermopack ${LAPACK_LIBRARIES}) target_link_libraries(run_thermopack libthermopack ${LAPACK_LIBRARIES}) else() - target_link_libraries(thermopack PRIVATE lapack blas) - target_link_libraries(run_thermopack libthermopack lapack blas) + target_link_libraries(thermopack PUBLIC MKL::MKL) + target_link_libraries(run_thermopack libthermopack) endif() install(TARGETS run_thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) \ No newline at end of file From 4a189d74e85c3ba6749a6f62c14041632227e3ef Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 12 Sep 2024 11:25:27 +0200 Subject: [PATCH 39/83] CI windows... --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16a362fb..494c85e4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,10 +6,10 @@ set(TREND_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../addon/trend_interface/include) set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) - # find_package(LAPACK REQUIRED) - find_package(MKL REQUIRED) + find_package(LAPACK REQUIRED) else() - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") + # add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") + find_package(MKL REQUIRED) endif() add_library(libthermopack STATIC ${SOURCES}) From dbdbfb8ce35c53b386a0e6561c7485351c2caab3 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 12 Sep 2024 12:09:48 +0200 Subject: [PATCH 40/83] CI Windows ... --- .github/workflows/unittests.yml | 2 +- src/CMakeLists.txt | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index cdb93e5e..de981116 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -62,7 +62,7 @@ jobs: echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" # mkdir build # cd build - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_EXE_LINKER_FLAGS="-Wl,--stack=2097152" -DCMAKE_BUILD_TYPE=Release -DLAPACKE:BOOL=ON -DCBLAS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON cmake --build build --target install - name: Inspect thermopack diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 494c85e4..2eaa7281 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,8 +8,7 @@ set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) find_package(LAPACK REQUIRED) else() - # add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") - find_package(MKL REQUIRED) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") endif() add_library(libthermopack STATIC ${SOURCES}) @@ -45,7 +44,7 @@ if(NOT MSVC) target_link_libraries(thermopack ${LAPACK_LIBRARIES}) target_link_libraries(run_thermopack libthermopack ${LAPACK_LIBRARIES}) else() - target_link_libraries(thermopack PUBLIC MKL::MKL) + target_link_libraries(thermopack PUBLIC blas lapack) target_link_libraries(run_thermopack libthermopack) endif() From 74bec04dc56d2c0234bdad36f429a9a3b7ec0576 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 12 Sep 2024 12:17:38 +0200 Subject: [PATCH 41/83] CI Windows ... --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2eaa7281..cd17742e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,7 +45,7 @@ if(NOT MSVC) target_link_libraries(run_thermopack libthermopack ${LAPACK_LIBRARIES}) else() target_link_libraries(thermopack PUBLIC blas lapack) - target_link_libraries(run_thermopack libthermopack) + target_link_libraries(run_thermopack libthermopack blas lapack) endif() install(TARGETS run_thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) \ No newline at end of file From 1a63edc2144785a437c44fa62992c3163e500a69 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 12 Sep 2024 13:11:51 +0200 Subject: [PATCH 42/83] CI Windows ... --- .github/workflows/unittests.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index de981116..9eeded7a 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -52,6 +52,14 @@ jobs: cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. make -j4 install + - name: Build LAPACK Windows + if: matrix.os == 'windows-2022' + run: | + cd external + cd lapack + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake --build build --target install + - name: Build ThermoPack Windows if: matrix.os == 'windows-2022' run: | @@ -62,7 +70,7 @@ jobs: echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" # mkdir build # cd build - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_EXE_LINKER_FLAGS="-Wl,--stack=2097152" -DCMAKE_BUILD_TYPE=Release -DLAPACKE:BOOL=ON -DCBLAS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} cmake --build build --target install - name: Inspect thermopack From 7c3ce54c05f965248a8251b45b347b49c753215f Mon Sep 17 00:00:00 2001 From: morteham Date: Tue, 1 Oct 2024 22:01:42 +0200 Subject: [PATCH 43/83] Adapted CMakeFiles for MSVS build --- CMakeLists.txt | 14 ++++++-------- src/CMakeLists.txt | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 826422e9..b9c69046 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,17 +28,15 @@ if(NOT MSVC) set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "The OSX architecture") endif() else() - set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /real-size:64 /fp:precise /extend-source:132 /iface:cref") + # Build using: cmake --build . --config Release + set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /fp:precise /extend-source:132 /iface:cref") set(tp_optim_flags "${tp_flags_common}") - set(tp_debug_flags "${tp_flags_common} /check:bounds /warn:all,noexternal /traceback /check:all,noarg_temp_created,nopointers") + set(tp_debug_flags "${tp_flags_common} /check:bounds /traceback") endif() -if(CMAKE_BUILD_TYPE MATCHES Debug) - set(tp_fortran_flags ${tp_debug_flags}) -else() - set(CMAKE_BUILD_TYPE "Release") - message(STATUS "CMAKE_BUILD_TYPE not specified, defaulting to Release.") - set(tp_fortran_flags ${tp_optim_flags}) +# Check if the build type is not set and set it to Release +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) endif() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src "thermopack") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd17742e..dc76acf8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,6 @@ -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${tp_fortran_flags}") +# Set FORTRAN compile flags for thermopack and lapack +set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${tp_optim_flags}") +set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${tp_debug_flags}") file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.f90) list(REMOVE_ITEM SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/thermopack.f90) @@ -8,7 +10,17 @@ set(TREND ${TREND_DIR}/trend_interface.f95) if(NOT MSVC) find_package(LAPACK REQUIRED) else() + if(POLICY CMP0077) + set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + endif() + # Disable single/complex/complex16 as it is not used by thermopack + set(BUILD_SINGLE OFF) + set(BUILD_COMPLEX OFF) + set(BUILD_COMPLEX16 OFF) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../external/lapack "lapack") + # Add flags not comatible with lapack + set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} /real-size:64 ") + set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} /real-size:64 /warn:all,noexternal /check:all,noarg_temp_created,nopointers") endif() add_library(libthermopack STATIC ${SOURCES}) @@ -44,8 +56,8 @@ if(NOT MSVC) target_link_libraries(thermopack ${LAPACK_LIBRARIES}) target_link_libraries(run_thermopack libthermopack ${LAPACK_LIBRARIES}) else() - target_link_libraries(thermopack PUBLIC blas lapack) - target_link_libraries(run_thermopack libthermopack blas lapack) + target_link_libraries(thermopack PUBLIC lapack blas) + target_link_libraries(run_thermopack libthermopack lapack blas) endif() install(TARGETS run_thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) \ No newline at end of file From 3e6c20404393b5fe0953d18686e5272c70f474c8 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Wed, 2 Oct 2024 11:29:58 +0200 Subject: [PATCH 44/83] Fix unittest build. --- unittests/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index bfe06163..a3b8d1fb 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -1,5 +1,6 @@ -set(CMAKE_Fortran_FLAGS ${tp_fortran_flags}) +set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${tp_optim_flags}") +set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${tp_debug_flags}") enable_testing() file(GLOB UNITTEST_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.pf) From e3a7b3539ed75647d633b7fa2b676cf39aa846b2 Mon Sep 17 00:00:00 2001 From: Morten Hammer Date: Fri, 4 Oct 2024 14:06:51 +0200 Subject: [PATCH 45/83] Write duplicate files to new location --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc76acf8..f18a8743 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ set_target_properties(libthermopack PROPERTIES OUTPUT_NAME thermopack_static) target_include_directories(libthermopack PUBLIC ${TREND_DIR}) -set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dynamic) target_include_directories(thermopack PUBLIC ${TREND_DIR}) install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) From 27a107ccd326007ffdc9c7978f2a4af4ec1603f9 Mon Sep 17 00:00:00 2001 From: morteham Date: Fri, 4 Oct 2024 21:04:13 +0200 Subject: [PATCH 46/83] Use makescript instead og map_platform_specifics --- .github/workflows/cibuildwheel.yml | 2 +- src/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 7732ae21..afa9c8f1 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -63,7 +63,7 @@ jobs: echo "cmake finished ..." && cmake --build . --target INSTALL && echo "build finished ..." && - python ../addon/pycThermopack/map_platform_specifics.py && + python -c "import sys; sys.path.insert(0, '../addon/pycThermopack'); import makescript; makescript.windows_make('v3')" && echo "--- pycThermopack contents ---" && dir ../addon/pycThermopack && echo "--- pycThermopack/thermopack contents ---" && diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f18a8743..87a05b84 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,6 +26,7 @@ endif() add_library(libthermopack STATIC ${SOURCES}) if(MSVC) add_library(thermopack SHARED ${SOURCES}) + set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dynamic) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static /threads") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${CMAKE_SOURCE_DIR}/MSVStudio/thermopack.def") else(MSVC) @@ -35,6 +36,7 @@ else(MSVC) # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/libthermopack_export.version") endif(APPLE) add_library(thermopack SHARED $) + set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif(MSVC) set_target_properties(libthermopack PROPERTIES @@ -42,7 +44,6 @@ set_target_properties(libthermopack PROPERTIES OUTPUT_NAME thermopack_static) target_include_directories(libthermopack PUBLIC ${TREND_DIR}) -set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dynamic) target_include_directories(thermopack PUBLIC ${TREND_DIR}) install(TARGETS thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) From 72e52d1d076595b3d70a01b2f99b99463ea33099 Mon Sep 17 00:00:00 2001 From: morteham Date: Fri, 4 Oct 2024 21:56:29 +0200 Subject: [PATCH 47/83] Specific python test for windows --- .github/workflows/unittests.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 9eeded7a..bf6f1480 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -89,7 +89,7 @@ jobs: - id: fortran_test name: Run unittests - if: matrix.os != 'windows-latest' + if: matrix.os != 'windows-2022' continue-on-error: true run: | result=$(./installed/unittests) @@ -105,6 +105,7 @@ jobs: - uses: actions/setup-python@v5 - id: python_test name: Run python tests + if: matrix.os != 'windows-2022' continue-on-error: true run: | python addon/pycThermopack/map_platform_specifics.py @@ -120,6 +121,26 @@ jobs: echo "statuscode=$statuscode" >> $GITHUB_OUTPUT exit $statuscode + - uses: actions/setup-python@v5 + - id: python_test_windows + name: Run python tests + if: matrix.os == 'windows-2022' + continue-on-error: true + run: | + python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" + pip install ./addon/pycThermopack/[test] + pytest ./addon/pyTests + pytest addon\pyTests > result.txt + findstr /C:"FAILED" result.txt > nul + if %ERRORLEVEL% equ 0 ( + set statuscode=1 + ) else ( + set statuscode=0 + ) + type result.txt + echo statuscode=%statuscode% >> %GITHUB_OUTPUT% + exit /b %statuscode% + - name: Check success run: | echo "Fortran test result : ${{ steps.fortran_test.outputs.statuscode }}" From e4dd85b75ce7c8d38557388a3d5ed379b80954b0 Mon Sep 17 00:00:00 2001 From: morteham Date: Fri, 4 Oct 2024 22:17:05 +0200 Subject: [PATCH 48/83] Set up python version --- .github/workflows/unittests.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index bf6f1480..6d840c75 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -28,6 +28,11 @@ jobs: - name: checkout submodules run: git submodule update --init --recursive + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install ninja-build tool if: matrix.os == 'windows-2022' uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 @@ -129,17 +134,15 @@ jobs: run: | python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" pip install ./addon/pycThermopack/[test] - pytest ./addon/pyTests - pytest addon\pyTests > result.txt - findstr /C:"FAILED" result.txt > nul - if %ERRORLEVEL% equ 0 ( - set statuscode=1 - ) else ( - set statuscode=0 - ) - type result.txt - echo statuscode=%statuscode% >> %GITHUB_OUTPUT% - exit /b %statuscode% + $result = pytest ./addon/pyTests + if ($result -match "FAILED") { + $statuscode = 1 + } else { + $statuscode = 0 + } + Write-Output $result + Add-Content -Path $env:GITHUB_OUTPUT -Value "statuscode=$statuscode" + exit $statuscode - name: Check success run: | From c3d5c6ffbad72921e6cba222d87c671f75016f0e Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 13:24:57 +0200 Subject: [PATCH 49/83] Print debug about intel-classic --- .github/workflows/unittests.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 6d840c75..2a62401b 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -28,16 +28,12 @@ jobs: - name: checkout submodules run: git submodule update --init --recursive - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Install ninja-build tool if: matrix.os == 'windows-2022' uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 - uses: fortran-lang/setup-fortran@v1 + id: setup-fortran if: matrix.os != 'macos-12' with: compiler: ${{ matrix.toolchain.compiler }} @@ -60,6 +56,11 @@ jobs: - name: Build LAPACK Windows if: matrix.os == 'windows-2022' run: | + echo "Building on ${{ matrix.os }}" + $FC = ${{ env.FC }} + $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') + echo "Using compiler $env:FC / ${{ env.FC }}" + echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" cd external cd lapack cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} @@ -109,7 +110,7 @@ jobs: - uses: actions/setup-python@v5 - id: python_test - name: Run python tests + name: Run python tests for Linux/MacOS if: matrix.os != 'windows-2022' continue-on-error: true run: | @@ -127,8 +128,10 @@ jobs: exit $statuscode - uses: actions/setup-python@v5 + with: + python-version: '3.11' - id: python_test_windows - name: Run python tests + name: Run python tests for Windows if: matrix.os == 'windows-2022' continue-on-error: true run: | From 17563f8a2cb39634efd17b1c19fa1b90d12b9bf3 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 14:29:07 +0200 Subject: [PATCH 50/83] Set CC/CXX to icx as icl is not avaialble --- .github/workflows/unittests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 2a62401b..a839ab79 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -61,6 +61,8 @@ jobs: $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" + $CC = icx + $CXX = icx cd external cd lapack cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} @@ -156,8 +158,4 @@ jobs: else exit 1 fi - - - - \ No newline at end of file From 5d8932e3c4ecf1a93aa88ae18f9d9490f7b2a2aa Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 14:38:52 +0200 Subject: [PATCH 51/83] Set CC/CXX as input to cmake --- .github/workflows/unittests.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index a839ab79..5e3cc70f 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -56,16 +56,9 @@ jobs: - name: Build LAPACK Windows if: matrix.os == 'windows-2022' run: | - echo "Building on ${{ matrix.os }}" - $FC = ${{ env.FC }} - $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') - echo "Using compiler $env:FC / ${{ env.FC }}" - echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - $CC = icx - $CXX = icx cd external cd lapack - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx cmake --build build --target install - name: Build ThermoPack Windows From 32a7c02167bab295c9bb6fc93e5c983d7d71cc9a Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 14:47:48 +0200 Subject: [PATCH 52/83] Set CC/CXX as input to cmake for Thermopack --- .github/workflows/unittests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 5e3cc70f..74cd1e0c 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -56,6 +56,8 @@ jobs: - name: Build LAPACK Windows if: matrix.os == 'windows-2022' run: | + echo "Using compiler $env:CC / ${{ env.CC }}" + echo "Using compiler $env:CXX / ${{ env.CXX }}" cd external cd lapack cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx @@ -71,7 +73,7 @@ jobs: echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" # mkdir build # cd build - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx cmake --build build --target install - name: Inspect thermopack From e9fff7c735cd59af015489d9c5d5405343758caf Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 15:07:24 +0200 Subject: [PATCH 53/83] Install pytest for Windows test --- .github/workflows/unittests.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 74cd1e0c..f72b1024 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -56,8 +56,6 @@ jobs: - name: Build LAPACK Windows if: matrix.os == 'windows-2022' run: | - echo "Using compiler $env:CC / ${{ env.CC }}" - echo "Using compiler $env:CXX / ${{ env.CXX }}" cd external cd lapack cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx @@ -71,8 +69,6 @@ jobs: $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - # mkdir build - # cd build cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx cmake --build build --target install @@ -132,9 +128,11 @@ jobs: if: matrix.os == 'windows-2022' continue-on-error: true run: | + python -m pip install --upgrade pip + pip install pytest python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" pip install ./addon/pycThermopack/[test] - $result = pytest ./addon/pyTests + $result = python -m pytest ./addon/pyTests if ($result -match "FAILED") { $statuscode = 1 } else { @@ -145,6 +143,7 @@ jobs: exit $statuscode - name: Check success + if: matrix.os != 'windows-2022' run: | echo "Fortran test result : ${{ steps.fortran_test.outputs.statuscode }}" echo "Python test result : ${{ steps.python_test.outputs.statuscode }}" @@ -154,3 +153,13 @@ jobs: exit 1 fi + - name: Check success Windows + if: matrix.os == 'windows-2022' + run: | + $statusCode = ${{ steps.python_test_windows.outputs.statuscode }} + Write-Host "Python test result: $statusCode" + if ($statusCode -eq 0) { + exit 0 + } else { + exit 1 + } \ No newline at end of file From 83d700a5cb42da6b9d36183fd90edd769dbd6134 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 15:26:39 +0200 Subject: [PATCH 54/83] Install numpy for Windows test --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index f72b1024..daf5b033 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -129,7 +129,7 @@ jobs: continue-on-error: true run: | python -m pip install --upgrade pip - pip install pytest + pip install pytest numpy python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" pip install ./addon/pycThermopack/[test] $result = python -m pytest ./addon/pyTests From a69fcc702cd8e97a90f7b5639b3e301aba11150e Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 15:53:24 +0200 Subject: [PATCH 55/83] Make sure Windows uploads have different file names --- .github/workflows/unittests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index daf5b033..e6c2bbd5 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -83,7 +83,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: binary-${{ matrix.os }} + name: binary-${{ matrix.os }}-${{ matrix.toolchain.compiler }} path: ./installed/* - id: fortran_test @@ -131,6 +131,7 @@ jobs: python -m pip install --upgrade pip pip install pytest numpy python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" + type './addon/pycThermopack/thermopack/platform_specifics.py' pip install ./addon/pycThermopack/[test] $result = python -m pytest ./addon/pyTests if ($result -match "FAILED") { From dff5bcb7369eda13a39dbfc2305499f55a294cf8 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 16:06:51 +0200 Subject: [PATCH 56/83] Test print for thermopack.dll --- .github/workflows/unittests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index e6c2bbd5..b65fc18a 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -131,7 +131,11 @@ jobs: python -m pip install --upgrade pip pip install pytest numpy python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" - type './addon/pycThermopack/thermopack/platform_specifics.py' + if (Test-Path ./addon/pycThermopack/thermopack/thermopack.dll) { + Write-Host "The file exists." + } else { + Write-Host "The file does not exist." + } pip install ./addon/pycThermopack/[test] $result = python -m pytest ./addon/pyTests if ($result -match "FAILED") { From 8808888e265e14cef85f93bf2f8bdd49df8eec94 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 20:55:14 +0200 Subject: [PATCH 57/83] Use Multithreaded static libraries --- .github/workflows/unittests.yml | 5 ----- src/CMakeLists.txt | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index b65fc18a..71661311 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -131,11 +131,6 @@ jobs: python -m pip install --upgrade pip pip install pytest numpy python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" - if (Test-Path ./addon/pycThermopack/thermopack/thermopack.dll) { - Write-Host "The file exists." - } else { - Write-Host "The file does not exist." - } pip install ./addon/pycThermopack/[test] $result = python -m pytest ./addon/pyTests if ($result -match "FAILED") { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87a05b84..0242a4bc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,10 +25,11 @@ endif() add_library(libthermopack STATIC ${SOURCES}) if(MSVC) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_library(thermopack SHARED ${SOURCES}) set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dynamic) - set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /libs:static /threads") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${CMAKE_SOURCE_DIR}/MSVStudio/thermopack.def") + target_link_options(thermopack PRIVATE "/NODEFAULTLIB:libmmd" "/NODEFAULTLIB:MSVCRT" "/NODEFAULTLIB:libifcoremd" "/NODEFAULTLIB:svml_dispmd") else(MSVC) if(APPLE) # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -exported_symbols_list ${CMAKE_SOURCE_DIR}/libthermopack_export.symbols") @@ -57,6 +58,7 @@ if(NOT MSVC) target_link_libraries(thermopack ${LAPACK_LIBRARIES}) target_link_libraries(run_thermopack libthermopack ${LAPACK_LIBRARIES}) else() + target_link_options(run_thermopack PRIVATE "/NODEFAULTLIB:MSVCRT") target_link_libraries(thermopack PUBLIC lapack blas) target_link_libraries(run_thermopack libthermopack lapack blas) endif() From 9c77662dd7d54b0dae9f8596cbfeaf86828496b0 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 21:34:43 +0200 Subject: [PATCH 58/83] Print symbols in thermpack.dll --- .github/workflows/unittests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 71661311..c388e2e8 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -131,6 +131,7 @@ jobs: python -m pip install --upgrade pip pip install pytest numpy python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" + dumpbin /EXPORTS ./addon/pycThermopack/thermopack/thermopack.dll pip install ./addon/pycThermopack/[test] $result = python -m pytest ./addon/pyTests if ($result -match "FAILED") { From 92514fd908b121cfd5202d2a4986ea46e64b0182 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 21:56:31 +0200 Subject: [PATCH 59/83] Added more debug information --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index c388e2e8..9404d72e 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -70,7 +70,7 @@ jobs: echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx - cmake --build build --target install + cmake --build build --target install --verbose - name: Inspect thermopack if: matrix.os == 'ubuntu' From 38c7deb89adfa3718f050008cb9d1fb497921982 Mon Sep 17 00:00:00 2001 From: morteham Date: Sat, 5 Oct 2024 22:41:48 +0200 Subject: [PATCH 60/83] Commented lapack build --- .github/workflows/unittests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 9404d72e..dde861e6 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -53,13 +53,13 @@ jobs: cmake -Dtest=ON -DCMAKE_BUILD_TYPE=Debug .. make -j4 install - - name: Build LAPACK Windows - if: matrix.os == 'windows-2022' - run: | - cd external - cd lapack - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx - cmake --build build --target install + # - name: Build LAPACK Windows + # if: matrix.os == 'windows-2022' + # run: | + # cd external + # cd lapack + # cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx + # cmake --build build --target install - name: Build ThermoPack Windows if: matrix.os == 'windows-2022' From 9a247c1ef1827273e5ece9f9947f829b660e653e Mon Sep 17 00:00:00 2001 From: morteham Date: Sun, 6 Oct 2024 10:46:50 +0200 Subject: [PATCH 61/83] Corrected line endings in def file --- MSVStudio/thermopack.def | 462 +++++++++++++++++++-------------------- 1 file changed, 231 insertions(+), 231 deletions(-) diff --git a/MSVStudio/thermopack.def b/MSVStudio/thermopack.def index 0fd55b70..402c2f4b 100644 --- a/MSVStudio/thermopack.def +++ b/MSVStudio/thermopack.def @@ -1,231 +1,231 @@ -; File generated by thermopack/addon/pyUtils/exports/export_list.py -; Time stamp: 2024-06-19T23:37:40.701514 -; @NAME@.def : Declares the module parameters. - -LIBRARY - -EXPORTS - thermopack_init_c - thermopack_pressure_c - thermopack_specific_volume_c - thermopack_tpflash_c - thermopack_uvflash_c - thermopack_hpflash_c - thermopack_spflash_c - thermopack_bubt_c - thermopack_bubp_c - thermopack_dewt_c - thermopack_dewp_c - thermopack_zfac_c - thermopack_enthalpy_c - thermopack_entropy_c - thermopack_wilsonk_c - thermopack_wilsonki_c - thermopack_getcriticalparam_c - thermopack_moleweight_c - thermopack_compmoleweight_c - thermopack_puresat_t_c - thermopack_entropy_tv_c - thermopack_twophase_dhdt_c - thermopack_guess_phase_c - thermopack_thermo_c - get_phase_flags_c - thermopack_getkij_ - thermopack_setkijandji_ - thermopack_getlij_ - thermopack_setlijandji_ - thermopack_gethvparam_ - thermopack_sethvparam_ - thermopack_getwsparam_ - thermopack_setwsparam_ - thermopack_get_volume_shift_parameters_ - thermopack_set_volume_shift_parameters_ - thermopack_set_alpha_corr_ - thermopack_set_beta_corr_ - binaryplot_mp_get_bp_term_ - binaryplot_mp_vllebinaryxy_ - binaryplot_mp_global_binary_plot_ - binaryplot_mp_threephaseline_ - compdata_mp_comp_index_active_ - compdata_mp_comp_name_active_ - compdata_mp_comp_structure_ - compdata_mp_get_ideal_cp_correlation_ - compdata_mp_set_ideal_cp_correlation_ - critical_mp_calccriticaltv_ - cubic_eos_mp_get_energy_constants_ - cubic_eos_mp_get_covolumes_ - eos_mp_specificvolume_ - eos_mp_zfac_ - eos_mp_thermo_ - eos_mp_entropy_ - eos_mp_enthalpy_ - eos_mp_compmoleweight_ - eos_mp_moleweight_ - eos_mp_getcriticalparam_ - eos_mp_ideal_enthalpy_single_ - eos_mp_ideal_entropy_single_ - eoslibinit_mp_init_thermo_ - eoslibinit_mp_init_cubic_ - eoslibinit_mp_init_cubic_pseudo_ - eoslibinit_mp_init_cpa_ - eoslibinit_mp_init_pcsaft_ - eoslibinit_mp_init_saftvrmie_ - eoslibinit_mp_init_quantum_cubic_ - eoslibinit_mp_init_tcpr_ - eoslibinit_mp_init_quantum_saftvrmie_ - eoslibinit_mp_init_extcsp_ - eoslibinit_mp_init_lee_kesler_ - eoslibinit_mp_init_multiparameter_ - eoslibinit_mp_init_pets_ - eoslibinit_mp_init_volume_translation_ - eoslibinit_mp_redefine_critical_parameters_ - eoslibinit_mp_init_lj_ - eoslibinit_mp_init_ljs_ - eoslibinit_mp_init_ideal_eos_ - eostv_mp_internal_energy_tv_ - eostv_mp_entropy_tv_ - eostv_mp_pressure_ - eostv_mp_thermo_tv_ - eostv_mp_enthalpy_tv_ - eostv_mp_free_energy_tv_ - eostv_mp_chemical_potential_tv_ - eostv_mp_virial_coefficients_ - eostv_mp_secondvirialcoeffmatrix_ - eostv_mp_binarythirdvirialcoeffmatrix_ - eostv_mp_entropy_tvp_ - eostv_mp_thermo_tvp_ - eostv_mp_enthalpy_tvp_ - fundamental_measure_theory_mp_fmt_energy_density_ - hardsphere_bmcsl_mp_calc_bmcsl_gij_fmt_ - ideal_mp_set_standard_entropy_ - ideal_mp_get_standard_entropy_ - ideal_mp_set_enthalpy_of_formation_ - ideal_mp_get_enthalpy_of_formation_ - isolines_mp_isobar_ - isolines_mp_isotherm_ - isolines_mp_isenthalp_ - isolines_mp_isentrope_ - joule_thompson_inversion_mp_map_jt_inversion_ - lj_splined_mp_ljs_bh_model_control_ - lj_splined_mp_ljs_bh_get_pure_params_ - lj_splined_mp_ljs_bh_set_pure_params_ - lj_splined_mp_calc_ai_reduced_ljs_ex_ - lj_splined_mp_ljs_bh_get_bh_diameter_div_sigma_ - lj_splined_mp_calc_ljs_wca_ai_tr_ - lj_splined_mp_ljs_uv_model_control_ - lj_splined_mp_ljs_wca_model_control_ - lj_splined_mp_ljs_wca_set_pure_params_ - lj_splined_mp_ljs_wca_get_pure_params_ - mut_solver_mp_solve_mu_t_ - mut_solver_mp_solve_lnf_t_ - mut_solver_mp_map_meta_isotherm_ - multipol_mp_fres_multipol_ - multipol_mp_multipol_model_control_ - pc_saft_nonassoc_mp_lng_ii_pc_saft_tvn_ - ph_solver_mp_setphtolerance_ - ph_solver_mp_twophasephflash_ - ps_solver_mp_twophasepsflash_ - saftvrmie_containers_mp_get_saftvrmie_eps_kij_ - saftvrmie_containers_mp_set_saftvrmie_eps_kij_ - saftvrmie_containers_mp_get_saftvrmie_sigma_lij_ - saftvrmie_containers_mp_set_saftvrmie_sigma_lij_ - saftvrmie_containers_mp_get_saftvrmie_lr_gammaij_ - saftvrmie_containers_mp_set_saftvrmie_lr_gammaij_ - saftvrmie_containers_mp_get_saftvrmie_pure_fluid_param_ - saftvrmie_containers_mp_set_saftvrmie_pure_fluid_param_ - saftvrmie_containers_mp_get_feynman_hibbs_order_ - saftvrmie_containers_mp_set_saftvrmie_mass_ - saftvrmie_containers_mp_set_saftvrmie_pure_fluid_deboer_ - saftvrmie_interface_mp_model_control_hs_ - saftvrmie_interface_mp_model_control_a1_ - saftvrmie_interface_mp_model_control_a2_ - saftvrmie_interface_mp_model_control_a3_ - saftvrmie_interface_mp_model_control_chain_ - saftvrmie_interface_mp_hard_sphere_reference_ - saftvrmie_interface_mp_set_temperature_cache_flag_ - saftvrmie_interface_mp_calc_saftvrmie_term_ - saft_interface_mp_printbinarymixturereportsaft_ - saft_interface_mp_print_cpa_report_ - saft_interface_mp_cpa_get_kij_ - saft_interface_mp_cpa_set_kij_ - saft_interface_mp_cpa_set_pure_params_ - saft_interface_mp_cpa_get_pure_params_ - saft_interface_mp_cpa_set_kij_ - saft_interface_mp_pc_saft_get_kij_ - saft_interface_mp_pc_saft_set_kij_asym_ - saft_interface_mp_calc_saft_dispersion_ - saft_interface_mp_calc_saft_chain_ - saft_interface_mp_calc_hard_sphere_diameter_ - saft_interface_mp_calc_hard_sphere_diameter_ij_ - saft_interface_mp_pc_saft_get_pure_params_ - saft_interface_mp_pc_saft_set_pure_params_ - saft_interface_mp_de_broglie_wavelength_ - saft_interface_mp_potential_ - saft_interface_mp_adjust_mass_to_specified_de_boer_parameter_ - saft_interface_mp_de_boer_parameter_ - saft_interface_mp_calc_soft_repulsion_ - saft_interface_mp_pets_get_pure_params_ - saft_interface_mp_pets_set_pure_params_ - saft_interface_mp_truncation_corrections_ - saft_interface_mp_calc_saft_hard_sphere_ - saft_interface_mp_test_fmt_compatibility_ - saft_interface_mp_setcpaformulation_ - saft_interface_mp_get_n_assoc_sites_ - saft_interface_mp_calc_assoc_phi_ - saft_interface_mp_calc_saft_dispersion_ - saft_interface_mp_calc_hard_sphere_diameter_ - saft_interface_mp_pc_saft_get_pure_params_ - saft_interface_mp_pc_saft_set_pure_params_ - saft_interface_mp_de_broglie_wavelength_ - saft_interface_mp_sigma_ij_ - saft_interface_mp_epsilon_ij_ - saft_interface_mp_sigma_eff_ij_ - saft_interface_mp_epsilon_eff_ij_ - saft_interface_mp_alpha_ - saft_interface_mp_getactiveassocparams_ - saft_interface_mp_setactiveassocparams_ - spinodal_mp_map_stability_limit_ - spinodal_mp_initial_stab_limit_point_ - spinodal_mp_map_meta_isentrope_ - spinodal_mp_tv_meta_ps_ - saturation_mp_safe_bubt_ - saturation_mp_safe_bubp_ - saturation_mp_safe_dewt_ - saturation_mp_safe_dewp_ - saturation_curve_mp_envelopeplot_ - saturation_curve_mp_envelope_isentrope_cross_ - saturation_curve_mp_pure_fluid_saturation_wrapper_ - saturation_point_locators_mp_locate_saturation_property_ - saturation_point_locators_mp_property_index_from_string_ - saturation_point_locators_mp_sat_points_based_on_prop_ - solideos_mp_solid_init_ - solideos_mp_solid_specificvolume_ - solideos_mp_solid_enthalpy_ - solideos_mp_solid_entropy_ - solid_saturation_mp_solidenvelopeplot_ - solid_saturation_mp_melting_pressure_correlation_ - solid_saturation_mp_sublimation_pressure_correlation_ - speed_of_sound_mp_sound_velocity_2ph_ - speed_of_sound_mp_speed_of_sound_tv_ - thermo_utils_mp_guessphase_ - thermopack_constants_mp_get_true_ - thermopack_var_mp_set_numerical_robustness_level_ - thermopack_var_mp_get_numerical_robustness_level_ - thermopack_var_mp_get_rgas_ - thermopack_var_mp_set_tmin_ - thermopack_var_mp_get_tmin_ - thermopack_var_mp_set_tmax_ - thermopack_var_mp_get_tmax_ - thermopack_var_mp_set_pmin_ - thermopack_var_mp_get_pmin_ - thermopack_var_mp_set_pmax_ - thermopack_var_mp_get_pmax_ - thermopack_var_mp_set_pmin_ - thermopack_var_mp_get_pmin_ - thermopack_var_mp_add_eos_ - thermopack_var_mp_delete_eos_ - thermopack_var_mp_activate_model_ - thermopack_var_mp_get_eos_identification_ - tp_solver_mp_twophasetpflash_ - sv_solver_mp_twophasesvflash_ - uv_solver_mp_twophaseuvflash_ +; File generated by thermopack/addon/pyUtils/exports/export_list.py +; Time stamp: 2024-06-19T23:37:40.701514 +; @NAME@.def : Declares the module parameters. + +LIBRARY + +EXPORTS + thermopack_init_c + thermopack_pressure_c + thermopack_specific_volume_c + thermopack_tpflash_c + thermopack_uvflash_c + thermopack_hpflash_c + thermopack_spflash_c + thermopack_bubt_c + thermopack_bubp_c + thermopack_dewt_c + thermopack_dewp_c + thermopack_zfac_c + thermopack_enthalpy_c + thermopack_entropy_c + thermopack_wilsonk_c + thermopack_wilsonki_c + thermopack_getcriticalparam_c + thermopack_moleweight_c + thermopack_compmoleweight_c + thermopack_puresat_t_c + thermopack_entropy_tv_c + thermopack_twophase_dhdt_c + thermopack_guess_phase_c + thermopack_thermo_c + get_phase_flags_c + thermopack_getkij_ + thermopack_setkijandji_ + thermopack_getlij_ + thermopack_setlijandji_ + thermopack_gethvparam_ + thermopack_sethvparam_ + thermopack_getwsparam_ + thermopack_setwsparam_ + thermopack_get_volume_shift_parameters_ + thermopack_set_volume_shift_parameters_ + thermopack_set_alpha_corr_ + thermopack_set_beta_corr_ + binaryplot_mp_get_bp_term_ + binaryplot_mp_vllebinaryxy_ + binaryplot_mp_global_binary_plot_ + binaryplot_mp_threephaseline_ + compdata_mp_comp_index_active_ + compdata_mp_comp_name_active_ + compdata_mp_comp_structure_ + compdata_mp_get_ideal_cp_correlation_ + compdata_mp_set_ideal_cp_correlation_ + critical_mp_calccriticaltv_ + cubic_eos_mp_get_energy_constants_ + cubic_eos_mp_get_covolumes_ + eos_mp_specificvolume_ + eos_mp_zfac_ + eos_mp_thermo_ + eos_mp_entropy_ + eos_mp_enthalpy_ + eos_mp_compmoleweight_ + eos_mp_moleweight_ + eos_mp_getcriticalparam_ + eos_mp_ideal_enthalpy_single_ + eos_mp_ideal_entropy_single_ + eoslibinit_mp_init_thermo_ + eoslibinit_mp_init_cubic_ + eoslibinit_mp_init_cubic_pseudo_ + eoslibinit_mp_init_cpa_ + eoslibinit_mp_init_pcsaft_ + eoslibinit_mp_init_saftvrmie_ + eoslibinit_mp_init_quantum_cubic_ + eoslibinit_mp_init_tcpr_ + eoslibinit_mp_init_quantum_saftvrmie_ + eoslibinit_mp_init_extcsp_ + eoslibinit_mp_init_lee_kesler_ + eoslibinit_mp_init_multiparameter_ + eoslibinit_mp_init_pets_ + eoslibinit_mp_init_volume_translation_ + eoslibinit_mp_redefine_critical_parameters_ + eoslibinit_mp_init_lj_ + eoslibinit_mp_init_ljs_ + eoslibinit_mp_init_ideal_eos_ + eostv_mp_internal_energy_tv_ + eostv_mp_entropy_tv_ + eostv_mp_pressure_ + eostv_mp_thermo_tv_ + eostv_mp_enthalpy_tv_ + eostv_mp_free_energy_tv_ + eostv_mp_chemical_potential_tv_ + eostv_mp_virial_coefficients_ + eostv_mp_secondvirialcoeffmatrix_ + eostv_mp_binarythirdvirialcoeffmatrix_ + eostv_mp_entropy_tvp_ + eostv_mp_thermo_tvp_ + eostv_mp_enthalpy_tvp_ + fundamental_measure_theory_mp_fmt_energy_density_ + hardsphere_bmcsl_mp_calc_bmcsl_gij_fmt_ + ideal_mp_set_standard_entropy_ + ideal_mp_get_standard_entropy_ + ideal_mp_set_enthalpy_of_formation_ + ideal_mp_get_enthalpy_of_formation_ + isolines_mp_isobar_ + isolines_mp_isotherm_ + isolines_mp_isenthalp_ + isolines_mp_isentrope_ + joule_thompson_inversion_mp_map_jt_inversion_ + lj_splined_mp_ljs_bh_model_control_ + lj_splined_mp_ljs_bh_get_pure_params_ + lj_splined_mp_ljs_bh_set_pure_params_ + lj_splined_mp_calc_ai_reduced_ljs_ex_ + lj_splined_mp_ljs_bh_get_bh_diameter_div_sigma_ + lj_splined_mp_calc_ljs_wca_ai_tr_ + lj_splined_mp_ljs_uv_model_control_ + lj_splined_mp_ljs_wca_model_control_ + lj_splined_mp_ljs_wca_set_pure_params_ + lj_splined_mp_ljs_wca_get_pure_params_ + mut_solver_mp_solve_mu_t_ + mut_solver_mp_solve_lnf_t_ + mut_solver_mp_map_meta_isotherm_ + multipol_mp_fres_multipol_ + multipol_mp_multipol_model_control_ + pc_saft_nonassoc_mp_lng_ii_pc_saft_tvn_ + ph_solver_mp_setphtolerance_ + ph_solver_mp_twophasephflash_ + ps_solver_mp_twophasepsflash_ + saftvrmie_containers_mp_get_saftvrmie_eps_kij_ + saftvrmie_containers_mp_set_saftvrmie_eps_kij_ + saftvrmie_containers_mp_get_saftvrmie_sigma_lij_ + saftvrmie_containers_mp_set_saftvrmie_sigma_lij_ + saftvrmie_containers_mp_get_saftvrmie_lr_gammaij_ + saftvrmie_containers_mp_set_saftvrmie_lr_gammaij_ + saftvrmie_containers_mp_get_saftvrmie_pure_fluid_param_ + saftvrmie_containers_mp_set_saftvrmie_pure_fluid_param_ + saftvrmie_containers_mp_get_feynman_hibbs_order_ + saftvrmie_containers_mp_set_saftvrmie_mass_ + saftvrmie_containers_mp_set_saftvrmie_pure_fluid_deboer_ + saftvrmie_interface_mp_model_control_hs_ + saftvrmie_interface_mp_model_control_a1_ + saftvrmie_interface_mp_model_control_a2_ + saftvrmie_interface_mp_model_control_a3_ + saftvrmie_interface_mp_model_control_chain_ + saftvrmie_interface_mp_hard_sphere_reference_ + saftvrmie_interface_mp_set_temperature_cache_flag_ + saftvrmie_interface_mp_calc_saftvrmie_term_ + saft_interface_mp_printbinarymixturereportsaft_ + saft_interface_mp_print_cpa_report_ + saft_interface_mp_cpa_get_kij_ + saft_interface_mp_cpa_set_kij_ + saft_interface_mp_cpa_set_pure_params_ + saft_interface_mp_cpa_get_pure_params_ + saft_interface_mp_cpa_set_kij_ + saft_interface_mp_pc_saft_get_kij_ + saft_interface_mp_pc_saft_set_kij_asym_ + saft_interface_mp_calc_saft_dispersion_ + saft_interface_mp_calc_saft_chain_ + saft_interface_mp_calc_hard_sphere_diameter_ + saft_interface_mp_calc_hard_sphere_diameter_ij_ + saft_interface_mp_pc_saft_get_pure_params_ + saft_interface_mp_pc_saft_set_pure_params_ + saft_interface_mp_de_broglie_wavelength_ + saft_interface_mp_potential_ + saft_interface_mp_adjust_mass_to_specified_de_boer_parameter_ + saft_interface_mp_de_boer_parameter_ + saft_interface_mp_calc_soft_repulsion_ + saft_interface_mp_pets_get_pure_params_ + saft_interface_mp_pets_set_pure_params_ + saft_interface_mp_truncation_corrections_ + saft_interface_mp_calc_saft_hard_sphere_ + saft_interface_mp_test_fmt_compatibility_ + saft_interface_mp_setcpaformulation_ + saft_interface_mp_get_n_assoc_sites_ + saft_interface_mp_calc_assoc_phi_ + saft_interface_mp_calc_saft_dispersion_ + saft_interface_mp_calc_hard_sphere_diameter_ + saft_interface_mp_pc_saft_get_pure_params_ + saft_interface_mp_pc_saft_set_pure_params_ + saft_interface_mp_de_broglie_wavelength_ + saft_interface_mp_sigma_ij_ + saft_interface_mp_epsilon_ij_ + saft_interface_mp_sigma_eff_ij_ + saft_interface_mp_epsilon_eff_ij_ + saft_interface_mp_alpha_ + saft_interface_mp_getactiveassocparams_ + saft_interface_mp_setactiveassocparams_ + spinodal_mp_map_stability_limit_ + spinodal_mp_initial_stab_limit_point_ + spinodal_mp_map_meta_isentrope_ + spinodal_mp_tv_meta_ps_ + saturation_mp_safe_bubt_ + saturation_mp_safe_bubp_ + saturation_mp_safe_dewt_ + saturation_mp_safe_dewp_ + saturation_curve_mp_envelopeplot_ + saturation_curve_mp_envelope_isentrope_cross_ + saturation_curve_mp_pure_fluid_saturation_wrapper_ + saturation_point_locators_mp_locate_saturation_property_ + saturation_point_locators_mp_property_index_from_string_ + saturation_point_locators_mp_sat_points_based_on_prop_ + solideos_mp_solid_init_ + solideos_mp_solid_specificvolume_ + solideos_mp_solid_enthalpy_ + solideos_mp_solid_entropy_ + solid_saturation_mp_solidenvelopeplot_ + solid_saturation_mp_melting_pressure_correlation_ + solid_saturation_mp_sublimation_pressure_correlation_ + speed_of_sound_mp_sound_velocity_2ph_ + speed_of_sound_mp_speed_of_sound_tv_ + thermo_utils_mp_guessphase_ + thermopack_constants_mp_get_true_ + thermopack_var_mp_set_numerical_robustness_level_ + thermopack_var_mp_get_numerical_robustness_level_ + thermopack_var_mp_get_rgas_ + thermopack_var_mp_set_tmin_ + thermopack_var_mp_get_tmin_ + thermopack_var_mp_set_tmax_ + thermopack_var_mp_get_tmax_ + thermopack_var_mp_set_pmin_ + thermopack_var_mp_get_pmin_ + thermopack_var_mp_set_pmax_ + thermopack_var_mp_get_pmax_ + thermopack_var_mp_set_pmin_ + thermopack_var_mp_get_pmin_ + thermopack_var_mp_add_eos_ + thermopack_var_mp_delete_eos_ + thermopack_var_mp_activate_model_ + thermopack_var_mp_get_eos_identification_ + tp_solver_mp_twophasetpflash_ + sv_solver_mp_twophasesvflash_ + uv_solver_mp_twophaseuvflash_ From ca86d2929abe72a51d62314498eddc619132c3bf Mon Sep 17 00:00:00 2001 From: morteham Date: Sun, 6 Oct 2024 11:03:05 +0200 Subject: [PATCH 62/83] Print linker --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0242a4bc..dc121229 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,7 @@ else(MSVC) add_library(thermopack SHARED $) set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif(MSVC) - +message(STATUS "Linker: ${CMAKE_LINKER}") set_target_properties(libthermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} OUTPUT_NAME thermopack_static) From 0e01b2e77c8cad58bfbed48c22da0e254a11346e Mon Sep 17 00:00:00 2001 From: morteham Date: Sun, 6 Oct 2024 11:52:28 +0200 Subject: [PATCH 63/83] Use VS generator --- .github/workflows/unittests.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index dde861e6..3c590181 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -28,9 +28,13 @@ jobs: - name: checkout submodules run: git submodule update --init --recursive - - name: Install ninja-build tool + - name: Setup Visual Studio 2022 if: matrix.os == 'windows-2022' - uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 + uses: microsoft/setup-msbuild@v1.0.2 + + # - name: Install ninja-build tool + # if: matrix.os == 'windows-2022' + # uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 - uses: fortran-lang/setup-fortran@v1 id: setup-fortran @@ -69,9 +73,10 @@ jobs: $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx + cmake -B build -G "Visual Studio 17 2022" -DCMAKE_Fortran_COMPILER=${{ env.FC }} cmake --build build --target install --verbose - + # -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx + - name: Inspect thermopack if: matrix.os == 'ubuntu' run: | From ae8540e477efcf89f96bbcc18dfeb05dc06e52af Mon Sep 17 00:00:00 2001 From: morteham Date: Sun, 6 Oct 2024 12:04:22 +0200 Subject: [PATCH 64/83] Revert to ninja but using cl c compiler --- .github/workflows/unittests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 3c590181..77802164 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -28,13 +28,13 @@ jobs: - name: checkout submodules run: git submodule update --init --recursive - - name: Setup Visual Studio 2022 - if: matrix.os == 'windows-2022' - uses: microsoft/setup-msbuild@v1.0.2 - - # - name: Install ninja-build tool + # - name: Setup Visual Studio 2022 # if: matrix.os == 'windows-2022' - # uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 + # uses: microsoft/setup-msbuild@v1.0.2 + + - name: Install ninja-build tool + if: matrix.os == 'windows-2022' + uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 - uses: fortran-lang/setup-fortran@v1 id: setup-fortran @@ -73,9 +73,9 @@ jobs: $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - cmake -B build -G "Visual Studio 17 2022" -DCMAKE_Fortran_COMPILER=${{ env.FC }} + # cmake -B build -G "Visual Studio 17 2022" -DCMAKE_Fortran_COMPILER=${{ env.FC }} + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl cmake --build build --target install --verbose - # -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx - name: Inspect thermopack if: matrix.os == 'ubuntu' From 6df7bd3181a59ba3a8a8ad4f20647c94f9fa9bdf Mon Sep 17 00:00:00 2001 From: morteham Date: Sun, 6 Oct 2024 12:08:13 +0200 Subject: [PATCH 65/83] Trying to correct yml file --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 77802164..f9566a84 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -73,9 +73,9 @@ jobs: $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - # cmake -B build -G "Visual Studio 17 2022" -DCMAKE_Fortran_COMPILER=${{ env.FC }} cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl cmake --build build --target install --verbose + # cmake -B build -G "Visual Studio 17 2022" -DCMAKE_Fortran_COMPILER=${{ env.FC }} - name: Inspect thermopack if: matrix.os == 'ubuntu' From 04226bd60394ecf7956e190c2e5d0e5c960a14e8 Mon Sep 17 00:00:00 2001 From: Morten Hammer Date: Tue, 8 Oct 2024 19:34:46 +0200 Subject: [PATCH 66/83] Tweaks for github actions --- .github/scripts/before_windows_build.ps1 | 16 +++++++++++ .github/workflows/cibuildwheel.yml | 22 +++------------ .github/workflows/unittests.yml | 36 +++++++++++++++++------- CMakeLists.txt | 2 +- addon/pycThermopack/makescript.py | 4 +-- src/CMakeLists.txt | 4 +-- src/eos.f90 | 6 +--- 7 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 .github/scripts/before_windows_build.ps1 diff --git a/.github/scripts/before_windows_build.ps1 b/.github/scripts/before_windows_build.ps1 new file mode 100644 index 00000000..864e725f --- /dev/null +++ b/.github/scripts/before_windows_build.ps1 @@ -0,0 +1,16 @@ +#Set-PSDebug -Trace 1 +echo "Running before_build on windows ..." +mkdir build +echo "Created build dir ..." +cd build +echo "Moved into build dir ..." +cmake .. -G Ninja -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release +echo "cmake finished ..." +cmake --build . --config=Release --target install +echo "build finished ..." +python -c "import sys; sys.path.insert(0, '../addon/pycThermopack'); import makescript; makescript.windows_make('v3')" +echo "--- pycThermopack contents ---" +dir ../addon/pycThermopack +echo "--- pycThermopack/thermopack contents ---" +dir ../addon/pycThermopack/thermopack +#Set-PSDebug -Off \ No newline at end of file diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index afa9c8f1..bfed3a5c 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -38,8 +38,8 @@ jobs: if: matrix.os == 'windows' uses: fortran-lang/setup-fortran@v1 with: - compiler: intel - version: '2023.2' + compiler: intel-classic + version: '2021.12' - name: Check macOS deployment target if: matrix.os == 'macOS' @@ -53,21 +53,7 @@ jobs: yum install -y blas blas-devel yum install -y lapack lapack-devel - CIBW_BEFORE_BUILD_WINDOWS: > - echo "Running before_build on windows ..." && - mkdir build && - echo "Created build dir ..." && - cd build && - echo "Moved into build dir ..." && - cmake .. -DCMAKE_Fortran_COMPILER="$((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/')" && - echo "cmake finished ..." && - cmake --build . --target INSTALL && - echo "build finished ..." && - python -c "import sys; sys.path.insert(0, '../addon/pycThermopack'); import makescript; makescript.windows_make('v3')" && - echo "--- pycThermopack contents ---" && - dir ../addon/pycThermopack && - echo "--- pycThermopack/thermopack contents ---" && - dir ../addon/pycThermopack/thermopack + CIBW_BEFORE_BUILD_WINDOWS: powershell -ExecutionPolicy Bypass -File .github/scripts/before_windows_build.ps1 CIBW_BEFORE_BUILD: | ${{ env.gfortran }} --version @@ -95,4 +81,4 @@ jobs: - uses: actions/upload-artifact@v4 with: name: wheel-${{ matrix.os }}-${{ matrix.version }} - path: ./wheelhouse/*.whl \ No newline at end of file + path: ./wheelhouse/*.whl diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index f9566a84..20dd4485 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -9,14 +9,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-2022, macos-12] + os: [ubuntu-latest, macos-latest, macos-12] toolchain: - {compiler: gcc, version: 13} include: # - os: ubuntu-latest # toolchain: {nvidia-hpc, version: '23.11'} - - os: windows-2022 - toolchain: {compiler: intel, version: '2024.1'} + # - os: windows-2022 + # toolchain: {compiler: intel, version: '2024.1'} - os: windows-2022 toolchain: {compiler: intel-classic, version: '2021.12'} # exclude: @@ -66,25 +66,42 @@ jobs: # cmake --build build --target install - name: Build ThermoPack Windows - if: matrix.os == 'windows-2022' + if: ${{ runner.os == 'Windows' }} run: | echo "Building on ${{ matrix.os }}" $FC = ${{ env.FC }} $FC_PATH = $((Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) -replace '\\', '/') echo "Using compiler $env:FC / ${{ env.FC }}" echo "Fortran compiler at: $(Get-Command ${{ env.FC }} | Select-Object -ExpandProperty Path) / $FC_PATH" - cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl - cmake --build build --target install --verbose + cmake -B build -G Ninja -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release --target install --verbose # cmake -B build -G "Visual Studio 17 2022" -DCMAKE_Fortran_COMPILER=${{ env.FC }} - - name: Inspect thermopack - if: matrix.os == 'ubuntu' + - name: Inspect thermopack Linux + if: ${{ runner.os == 'Linux' }} run: | echo "--- Inspecting libthermopack ---" ldd installed/libthermopack.so + nm installed/libthermopack.so | grep " T " echo "--- Inspecting run_unittests ---" ldd installed/unittests + - name: Inspect thermopack MacOS + if: ${{ runner.os == 'macOS' }} + run: | + echo "--- Inspecting libthermopack ---" + otool -L installed/libthermopack.dylib + nm installed/libthermopack.dylib | grep " T " + echo "--- Inspecting run_unittests ---" + otool -L installed/unittests + + - name: Inspect thermopack Windows + if: ${{ runner.os == 'Windows' }} + run: | + echo "--- Inspecting libthermopack.dll ---" + dumpbin /DEPENDENTS installed/libthermopack.dll + dumpbin /EXPORTS installed/libthermopack.dll + - name: Upload uses: actions/upload-artifact@v4 with: @@ -136,7 +153,6 @@ jobs: python -m pip install --upgrade pip pip install pytest numpy python -c "import sys; sys.path.insert(0, './addon/pycThermopack'); import makescript; makescript.windows_make('v3')" - dumpbin /EXPORTS ./addon/pycThermopack/thermopack/thermopack.dll pip install ./addon/pycThermopack/[test] $result = python -m pytest ./addon/pyTests if ($result -match "FAILED") { @@ -168,4 +184,4 @@ jobs: exit 0 } else { exit 1 - } \ No newline at end of file + } diff --git a/CMakeLists.txt b/CMakeLists.txt index b9c69046..15ec21ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ if(NOT MSVC) endif() else() # Build using: cmake --build . --config Release - set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /fp:precise /extend-source:132 /iface:cref") + set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /fp:precise /extend-source:132 /iface:cref /Qdiag-disable:10448") set(tp_optim_flags "${tp_flags_common}") set(tp_debug_flags "${tp_flags_common} /check:bounds /traceback") endif() diff --git a/addon/pycThermopack/makescript.py b/addon/pycThermopack/makescript.py index 35a4444b..1a370a06 100755 --- a/addon/pycThermopack/makescript.py +++ b/addon/pycThermopack/makescript.py @@ -24,7 +24,7 @@ def windows_make(diffs): pf_specifics["module"] = "_mp_" pf_specifics["postfix"] = "_" pf_specifics["postfix_no_module"] = "_" - pf_specifics["dyn_lib"] = "thermopack.dll" + pf_specifics["dyn_lib"] = "libthermopack.dll" pf_specifics["diff_return_mode"] = diffs pf_specifics_path = os.path.join(os.path.dirname(__file__), "thermopack", "platform_specifics.py") map_platform_specifics.write_platform_specifics_file(pf_specifics, pf_specifics_path) @@ -87,4 +87,4 @@ def windows_make(diffs): # map_platform_specifics.write_setup_file(f'v{version}') # map_platform_specifics.write_toml_file(version) - print(f'\033[92mSuccessfully configured ThermoPack {version}\033[0m') \ No newline at end of file + print(f'\033[92mSuccessfully configured ThermoPack {version}\033[0m') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc121229..b6b655fb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ add_library(libthermopack STATIC ${SOURCES}) if(MSVC) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_library(thermopack SHARED ${SOURCES}) - set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dynamic) + set_target_properties(thermopack PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dynamic OUTPUT_NAME libthermopack) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${CMAKE_SOURCE_DIR}/MSVStudio/thermopack.def") target_link_options(thermopack PRIVATE "/NODEFAULTLIB:libmmd" "/NODEFAULTLIB:MSVCRT" "/NODEFAULTLIB:libifcoremd" "/NODEFAULTLIB:svml_dispmd") else(MSVC) @@ -63,4 +63,4 @@ else() target_link_libraries(run_thermopack libthermopack lapack blas) endif() -install(TARGETS run_thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) \ No newline at end of file +install(TARGETS run_thermopack DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../installed/) diff --git a/src/eos.f90 b/src/eos.f90 index d0c5e2db..2e5a738e 100644 --- a/src/eos.f90 +++ b/src/eos.f90 @@ -847,7 +847,7 @@ end subroutine ideal_entropy_single !> !> \author MH, 2014-01 !---------------------------------------------------------------------- - subroutine ideal_enthalpy_single(t,j,h,dhdt,dhdp) + subroutine ideal_enthalpy_single(t,j,h,dhdt) use ideal, only: Hideal_apparent, Cpideal_apparent use eos_parameters, only: single_eos implicit none @@ -856,7 +856,6 @@ subroutine ideal_enthalpy_single(t,j,h,dhdt,dhdp) integer, intent(in) :: j !< Component index real, intent(out) :: h !< J/mol - Ideal enthalpy real, optional, intent(out) :: dhdt !< J/mol/K - Temperature differential of ideal enthalpy - real, optional, intent(out) :: dhdp !< J/mol/Pa - Pressure differential of ideal enthalpy ! Locals type(thermo_model), pointer :: act_mod_ptr class(base_eos_param), pointer :: act_eos_ptr @@ -892,9 +891,6 @@ subroutine ideal_enthalpy_single(t,j,h,dhdt,dhdp) write(*,*) 'EoSlib error in eos::idealEnthalpySingle: No such EoS libray:',act_mod_ptr%EosLib call stoperror('') end select - if (present(dhdp)) then - dhdp=0.0 - end if end subroutine ideal_enthalpy_single !---------------------------------------------------------------------- From aca20adf2bd809aba973422013eb41f67f2c236e Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 11:16:35 +0200 Subject: [PATCH 67/83] Delete setup.cfg --- .github/workflows/cibuildwheel.yml | 1 + addon/pycThermopack/setup.cfg | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 addon/pycThermopack/setup.cfg diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index bfed3a5c..80582bc4 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -73,6 +73,7 @@ jobs: CIBW_BUILD: "*cp311*" CIBW_SKIP: "*musllinux*" CIBW_TEST_SKIP: "*x86_64*" + CIBW_BUILD_VERBOSITY: 1 with: package-dir: "./addon/pycThermopack" output-dir: "./wheelhouse" diff --git a/addon/pycThermopack/setup.cfg b/addon/pycThermopack/setup.cfg deleted file mode 100644 index 7cb85c34..00000000 --- a/addon/pycThermopack/setup.cfg +++ /dev/null @@ -1,13 +0,0 @@ - -[options] -packages = thermopack -python_requires = >=3.6 -install_requires = - numpy ~= 1.0 - -[options.package_data] -* = *.py, *thermopack.* - -[metadata] -license_files = - LICENSE* From a5d568de03c3d9b0c09cfb099e8a86d294fd021a Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 13:00:36 +0200 Subject: [PATCH 68/83] Moving everything regarding platform-specifics to map_platform_specifics.py makescript.py is now essentially redundant, but we can keep it around for a while and just add a warning, and make it pass the call to map_platform_specifics.py. pyproject.toml is now handled by having a "skeleton" __pyproject.toml, which is parsed by set_toml_version(), which sets the appropriate version number based on the --diffs flag and writes the actual pyproject.toml. --- .github/scripts/before_windows_build.ps1 | 3 +- .gitignore | 3 +- addon/pycThermopack/.gitignore | 3 +- .../{pyproject.toml => __pyproject.toml} | 2 +- addon/pycThermopack/makescript.py | 16 +-- addon/pycThermopack/map_platform_specifics.py | 109 ++++++------------ 6 files changed, 49 insertions(+), 87 deletions(-) rename addon/pycThermopack/{pyproject.toml => __pyproject.toml} (98%) diff --git a/.github/scripts/before_windows_build.ps1 b/.github/scripts/before_windows_build.ps1 index 864e725f..cf9e496a 100644 --- a/.github/scripts/before_windows_build.ps1 +++ b/.github/scripts/before_windows_build.ps1 @@ -8,7 +8,8 @@ cmake .. -G Ninja -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=cl -DCMAKE_C echo "cmake finished ..." cmake --build . --config=Release --target install echo "build finished ..." -python -c "import sys; sys.path.insert(0, '../addon/pycThermopack'); import makescript; makescript.windows_make('v3')" +# python -c "import sys; sys.path.insert(0, '../addon/pycThermopack'); import makescript; makescript.windows_make('v3')" +python ../addon/pycThermopack/map_platform_specifics.py --diffs=v3 --ifort=True echo "--- pycThermopack contents ---" dir ../addon/pycThermopack echo "--- pycThermopack/thermopack contents ---" diff --git a/.gitignore b/.gitignore index 041b7487..d7e3179f 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,5 @@ venv/ venv* *.idea *.vscode -scripts/ \ No newline at end of file +scripts/ +!.github/scripts/ \ No newline at end of file diff --git a/addon/pycThermopack/.gitignore b/addon/pycThermopack/.gitignore index 69e5c96e..e19f946a 100644 --- a/addon/pycThermopack/.gitignore +++ b/addon/pycThermopack/.gitignore @@ -3,5 +3,4 @@ LICENSE* build/ thermopack/platform_specifics.py pyctp/platform_specifics.py -setup.py -!pyproject.toml \ No newline at end of file +setup.py \ No newline at end of file diff --git a/addon/pycThermopack/pyproject.toml b/addon/pycThermopack/__pyproject.toml similarity index 98% rename from addon/pycThermopack/pyproject.toml rename to addon/pycThermopack/__pyproject.toml index 2a7f341b..3a12935b 100644 --- a/addon/pycThermopack/pyproject.toml +++ b/addon/pycThermopack/__pyproject.toml @@ -12,7 +12,7 @@ RECOMPILE_THERMOPACK = {env="RECOMPILE_THERMOPACK", default="OFF"} [project] name = "thermopack" -version = "2.3b0" +version = "0.0.0" authors = [ { name = "Morten Hammer", email="morten.hammer@ntnu.no" }, ] diff --git a/addon/pycThermopack/makescript.py b/addon/pycThermopack/makescript.py index 1a370a06..f7ac8769 100755 --- a/addon/pycThermopack/makescript.py +++ b/addon/pycThermopack/makescript.py @@ -9,15 +9,10 @@ from pathlib import Path import map_platform_specifics -VERSION_2 = '2.2.3' -VERSION_3 = '3.b0' - def windows_make(diffs): - if diffs == 'v2': - version = VERSION_2 - else: - version = VERSION_3 + if diffs != 'v2': diffs = 'v3' + pf_specifics = {} pf_specifics["os_id"] = "win" pf_specifics["prefix"] = "" @@ -28,8 +23,9 @@ def windows_make(diffs): pf_specifics["diff_return_mode"] = diffs pf_specifics_path = os.path.join(os.path.dirname(__file__), "thermopack", "platform_specifics.py") map_platform_specifics.write_platform_specifics_file(pf_specifics, pf_specifics_path) - map_platform_specifics.write_setup_file(f'v{version}') - map_platform_specifics.write_toml_file(version) + map_platform_specifics.correct_toml_version(diffs) + # map_platform_specifics.write_setup_file(f'v{version}') + # map_platform_specifics.write_toml_file(version) if __name__ == "__main__": @@ -63,7 +59,7 @@ def windows_make(diffs): elif args.diffs == 'v3': version = VERSION_3 else: - warnings.warn(f'-diffs={args.diffs} is not a valid value. Valid values are -diffs=[v2.1/v3], treating as -diffs=v3', + warnings.warn(f'-diffs={args.diffs} is not a valid value. Valid values are -diffs=[v2/v3], treating as -diffs=v3', Warning) version = VERSION_3 args.diffs = 'v3' diff --git a/addon/pycThermopack/map_platform_specifics.py b/addon/pycThermopack/map_platform_specifics.py index 9b0d074b..59bb473d 100644 --- a/addon/pycThermopack/map_platform_specifics.py +++ b/addon/pycThermopack/map_platform_specifics.py @@ -8,6 +8,7 @@ from datetime import datetime import os import argparse +import warnings # GNU FORTRAN G_PREFIX = "__" @@ -165,74 +166,15 @@ def write_platform_specifics_file(pf_specifics, filename): f.write(line) f.write("\n") -def write_setup_file(version): - setup_contents = {'name': "'thermopack'", - 'version': f"'{version}'", - 'description': "'Python interface to thermopack'", - 'long_description': "'readme'", - 'long_description_content_type': "'text/markdown'", - 'author': "'Morten Hammer'", - 'author_email': "'morten.hammer@sintef.no'", - 'url': "'https://github.com/thermotools/thermopack'", - 'packages': "['thermopack']", - 'package_data': "{'thermopack':['*thermopack.*']}", - 'install_requires' : "['numpy~=1.0']"} - - with open(os.path.dirname(__file__) + '/setup.py', 'w') as file: - file.write(f"# This file was automatically generated using the function 'write_setup_file' in \n" - f"# {__file__} \n" - f"# Likely called from {os.path.dirname(__file__)}/makescript.py\n" - f"# Timestamp : {datetime.today().isoformat()}\n\n") - file.write("from distutils.core import setup\n" - "from pathlib import Path\n\n" - "root_dir = Path(__file__).parent # thermopack root directory\n" - "readme = (root_dir / 'README_pypi.md').read_text()\n\n") - file.write('setup(') - - for i, (k, v) in enumerate(setup_contents.items()): - if i > 0: - file.write(',') - file.write(f"{k}={v}\n\t") - - file.write(')\n') - -def write_toml_file(version): - contents = """[build-system] -requires = ["setuptools>=39.0"] -build-backend = "setuptools.build_meta" - -[project] -name = "thermopack" -version = \"""" + version + """\" -authors = [ - { name = "Morten Hammer", email="morten.hammer@ntnu.no" }, -] -maintainers = [ - { name = "Morten Hammer", email="morten.hammer@ntnu.no" }, - { name = "Vegard Gjeldvik Jervell", email="vegard.g.jervell@ntnu.no" }, -] -description = "Python interface to thermopack" -readme = "README_pypi.md" -requires-python = ">=3.6" -classifiers = [ - "Programming Language :: Python :: 3", - "Programming Language :: Fortran", - "Operating System :: MacOS", - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", - "License :: OSI Approved :: MIT License", -] -keywords = ["physics", "thermodynamics", "equations_of_state", "phase_equilibria", "SAFT"] - -[project.urls] -"Homepage" = "https://github.com/thermotools/thermopack" -"Bug Tracker" = "https://github.com/thermotools/thermopack/issues" - -[dependencies] -numpy = "^1.1" -""" - with open(f'{os.path.dirname(__file__)}/pyproject.toml', 'w') as file: - file.write(contents) +def set_toml_version(version): + with open('__pyproject.toml', 'r') as ifile: + with open('pyproject.toml', 'w') as ofile: + line = ifile.readline() + while line: + if line == 'version = "0.0.0"\n': + line = f'version = "{version}"\n' + ofile.write(line) + line = ifile.readline() def get_platform_specifics_windows_ifort_whl(): pf_specifics = dict() @@ -242,19 +184,42 @@ def get_platform_specifics_windows_ifort_whl(): pf_specifics["postfix"] = "_" pf_specifics["postfix_no_module"] = "_" pf_specifics["dyn_lib"] = "thermopack.dll" - pf_specifics["diff_return_mode"] = "v2" + print('Using ifort pfs...') return pf_specifics - + +def warn_diff_version(diffs): + if diffs == 'v2': + warnings.warn('\033[93m\nYou are building ThermoPack to use the deprecated return pattern using tuples.\n' + 'Future versions of ThermoPack will return differentials using the `Differential` struct found in utils.py. ' + 'To build ThermoPack to use the new return pattern, run \n\n\t`python map_platform_specifics.py [--diffs=v3 --ifort=False]`\n' + 'For more information see PR#102 at https://github.com/thermotools/thermopack/pull/102\n\n' + 'For more information on configuration options run \n\n\t`python map_platform_specifics.py --help\n\n\033[0m', DeprecationWarning) + else: + warnings.warn('\033[93m\nYou are building ThermoPack using the "new" return pattern (i.e. the Differential structs found ' + "in utils.py.) \nTHIS IS THE RECOMMENDED BUILD but I'm warning you because it is not backwards compatible.\n" + "The old return pattern will probably be discontinued in the future. To build " + 'ThermoPack with the "old" return pattern (using tuples) run \n\n\t`python map_platform_specifics.py --diffs=v2 [--ifort=False]`\n\n' + 'For information on how to adapt old code to the new return pattern, see ' + 'PR#102 at https://github.com/thermotools/thermopack/pull/102\n\n' + 'For more information on configuration options run \n\n\t`python map_platform_specifics.py --help\n\n\033[0m', Warning) + if __name__ == "__main__": VERSION_2 = '2.2.3' VERSION_3 = '3.b0' parser = argparse.ArgumentParser() - parser.add_argument('--diffs', default='v3', help="Old (v2) or new (> v2) return mode for differentials") + parser.add_argument('--diffs', default='v3', help="Old (v2) or new (v3) return mode for differentials (Default: v3)") + parser.add_argument('--ifort', default=False, help='Set to True if thermopack has been compiled with intel-fortran (Default: False)') args = parser.parse_args() pf_specifics_path = os.path.join(os.path.dirname( __file__), "thermopack", "platform_specifics.py") - pf_specifics_ = get_platform_specifics_by_trial_and_error() + pf_specifics_ = get_platform_specifics_by_trial_and_error() if (args.ifort is False) else get_platform_specifics_windows_ifort_whl() pf_specifics_['diff_return_mode'] = args.diffs pf_specifics_['version'] = VERSION_2 if (args.diffs == 'v2') else VERSION_3 + + warn_diff_version(args.diffs) + write_platform_specifics_file(pf_specifics_, pf_specifics_path) + set_toml_version(pf_specifics_['version']) + + print(f'\033[92mSuccessfully configured ThermoPack {pf_specifics_["version"]}\033[0m') From 34f89be7d73d00f376fb90b2a717d74e58750862 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 13:12:43 +0200 Subject: [PATCH 69/83] Fix pyproject.toml file path. --- addon/pycThermopack/.gitignore | 3 ++- addon/pycThermopack/map_platform_specifics.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addon/pycThermopack/.gitignore b/addon/pycThermopack/.gitignore index e19f946a..35a02010 100644 --- a/addon/pycThermopack/.gitignore +++ b/addon/pycThermopack/.gitignore @@ -3,4 +3,5 @@ LICENSE* build/ thermopack/platform_specifics.py pyctp/platform_specifics.py -setup.py \ No newline at end of file +setup.py +pyproject.toml \ No newline at end of file diff --git a/addon/pycThermopack/map_platform_specifics.py b/addon/pycThermopack/map_platform_specifics.py index 59bb473d..8024622f 100644 --- a/addon/pycThermopack/map_platform_specifics.py +++ b/addon/pycThermopack/map_platform_specifics.py @@ -167,8 +167,8 @@ def write_platform_specifics_file(pf_specifics, filename): f.write("\n") def set_toml_version(version): - with open('__pyproject.toml', 'r') as ifile: - with open('pyproject.toml', 'w') as ofile: + with open(f'{os.path.dirname(__file__)}/__pyproject.toml', 'r') as ifile: + with open(f'{os.path.dirname(__file__)}/pyproject.toml', 'w') as ofile: line = ifile.readline() while line: if line == 'version = "0.0.0"\n': From cabdc472e1b106d28ef8ea8b716d85f0bd46cc69 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 13:22:15 +0200 Subject: [PATCH 70/83] pyproject.toml must exist when cibw is called. --- addon/pycThermopack/.gitignore | 3 +-- addon/pycThermopack/map_platform_specifics.py | 16 +++++++++------- .../{__pyproject.toml => pyproject.toml} | 0 3 files changed, 10 insertions(+), 9 deletions(-) rename addon/pycThermopack/{__pyproject.toml => pyproject.toml} (100%) diff --git a/addon/pycThermopack/.gitignore b/addon/pycThermopack/.gitignore index 35a02010..e19f946a 100644 --- a/addon/pycThermopack/.gitignore +++ b/addon/pycThermopack/.gitignore @@ -3,5 +3,4 @@ LICENSE* build/ thermopack/platform_specifics.py pyctp/platform_specifics.py -setup.py -pyproject.toml \ No newline at end of file +setup.py \ No newline at end of file diff --git a/addon/pycThermopack/map_platform_specifics.py b/addon/pycThermopack/map_platform_specifics.py index 8024622f..c989f1b8 100644 --- a/addon/pycThermopack/map_platform_specifics.py +++ b/addon/pycThermopack/map_platform_specifics.py @@ -167,14 +167,16 @@ def write_platform_specifics_file(pf_specifics, filename): f.write("\n") def set_toml_version(version): - with open(f'{os.path.dirname(__file__)}/__pyproject.toml', 'r') as ifile: - with open(f'{os.path.dirname(__file__)}/pyproject.toml', 'w') as ofile: + contents = '' + with open(f'{os.path.dirname(__file__)}/pyproject.toml', 'r') as ifile: + line = ifile.readline() + while line: + if line == 'version = "0.0.0"\n': + line = f'version = "{version}"\n' + contents += line line = ifile.readline() - while line: - if line == 'version = "0.0.0"\n': - line = f'version = "{version}"\n' - ofile.write(line) - line = ifile.readline() + with open(f'{os.path.dirname(__file__)}/pyproject.toml', 'w') as ofile: + ofile.write(contents) def get_platform_specifics_windows_ifort_whl(): pf_specifics = dict() diff --git a/addon/pycThermopack/__pyproject.toml b/addon/pycThermopack/pyproject.toml similarity index 100% rename from addon/pycThermopack/__pyproject.toml rename to addon/pycThermopack/pyproject.toml From 7ea27f5e749b4ff28939869a17de7157a5b3b725 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 13:41:21 +0200 Subject: [PATCH 71/83] Correct libthermopack.dll name in map_platform_specifics. --- addon/pycThermopack/map_platform_specifics.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addon/pycThermopack/map_platform_specifics.py b/addon/pycThermopack/map_platform_specifics.py index c989f1b8..8f6f576a 100644 --- a/addon/pycThermopack/map_platform_specifics.py +++ b/addon/pycThermopack/map_platform_specifics.py @@ -185,8 +185,7 @@ def get_platform_specifics_windows_ifort_whl(): pf_specifics["module"] = "_mp_" pf_specifics["postfix"] = "_" pf_specifics["postfix_no_module"] = "_" - pf_specifics["dyn_lib"] = "thermopack.dll" - print('Using ifort pfs...') + pf_specifics["dyn_lib"] = "libthermopack.dll" return pf_specifics def warn_diff_version(diffs): From b48191a342c38c4dcc400b554533d9fe9d87614f Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 15:34:01 +0200 Subject: [PATCH 72/83] Cleaning up and automating prerelease --- .github/release_bodyFile.md | 7 ++ .github/workflows/cibuildwheel.yml | 47 +++++++- addon/pycThermopack/.gitignore | 3 +- addon/pycThermopack/install | 27 ----- addon/pycThermopack/makescript.py | 32 +----- .../{ => scripts}/build_whl_linux_x86.sh | 0 .../{ => scripts}/build_whl_macOS_arm64.sh | 0 .../{ => scripts}/build_whl_macOS_x86.sh | 0 .../{ => scripts}/build_whl_windows_amd64.bat | 0 .../{ => scripts}/build_whl_windows_win32.bat | 0 .../{ => scripts}/debug_compile.sh | 0 docs/vCurrent/getting_started_cpp.md | 26 ++++- docs/vCurrent/source_build.md | 102 +++++++++++++----- 13 files changed, 153 insertions(+), 91 deletions(-) create mode 100644 .github/release_bodyFile.md delete mode 100755 addon/pycThermopack/install rename addon/pycThermopack/{ => scripts}/build_whl_linux_x86.sh (100%) rename addon/pycThermopack/{ => scripts}/build_whl_macOS_arm64.sh (100%) rename addon/pycThermopack/{ => scripts}/build_whl_macOS_x86.sh (100%) rename addon/pycThermopack/{ => scripts}/build_whl_windows_amd64.bat (100%) rename addon/pycThermopack/{ => scripts}/build_whl_windows_win32.bat (100%) rename addon/pycThermopack/{ => scripts}/debug_compile.sh (100%) diff --git a/.github/release_bodyFile.md b/.github/release_bodyFile.md new file mode 100644 index 00000000..6197214f --- /dev/null +++ b/.github/release_bodyFile.md @@ -0,0 +1,7 @@ +This release is automatically updated whenever a pull request is merged to `main`, and is built from the branch that was merged to `main` (not `main` itself). + +For stable releases of `KineticGas`, see releases named `vX.Y.Z`. + +To install this release, download and unzip the appropriate zip file, then install with `pip install pykingas -f wheels--latest/`, where `wheels--latest` is the directory created by unzipping the file. + +Documentation and user guides for the latest version are found at [thermotools.github.io/KineticGas](thermotools.github.io/KineticGas), but are likely not as well maintained as the documentation and guides for stable releases. \ No newline at end of file diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 80582bc4..c59016a3 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -4,6 +4,7 @@ on: [push, pull_request] jobs: build_wheels: + # if: github.event_name == 'pull_request' name: Build wheels on ${{ matrix.os }}-${{ matrix.version }} runs-on: ${{ matrix.os }}-${{ matrix.version }} timeout-minutes: 30 @@ -12,6 +13,7 @@ jobs: matrix: os: [macOS, ubuntu, windows] version: [latest] + tp_version: [v2, v3] include: - version: 12 os: macOS @@ -62,7 +64,7 @@ jobs: cd build cmake .. make -j4 install - python ../addon/pycThermopack/map_platform_specifics.py + python ../addon/pycThermopack/map_platform_specifics.py --diffs=${{ matrix.tp_version }} echo "--- pycThermopack contents ---" ls ../addon/pycThermopack echo "--- pycThermopack/thermopack contents ---" @@ -72,7 +74,7 @@ jobs: CIBW_BUILD: "*cp311*" CIBW_SKIP: "*musllinux*" - CIBW_TEST_SKIP: "*x86_64*" + CIBW_TEST_SKIP: "*x86_64* thermopack-2*" CIBW_BUILD_VERBOSITY: 1 with: package-dir: "./addon/pycThermopack" @@ -83,3 +85,44 @@ jobs: with: name: wheel-${{ matrix.os }}-${{ matrix.version }} path: ./wheelhouse/*.whl + + release_wheels: # Create or update the release tagged Latest-beta, and upload wheels to that release. + # if: github.event.pull_request.merged == true + name: Update prerelease + needs: build_wheels + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + + - name: Download created wheels + uses: actions/download-artifact@v4 + with: + pattern: wheel-* + + - name: Display full directory status + run: ls -R . + + - name: zip wheels + run: | + for dir in wheels-*; do + zip -r "${dir}.zip" ${dir} + done + + - name: Display current directory status + run: ls + + - uses: ncipollo/release-action@v1 + with: + allowUpdates: true + prerelease: true + updateOnlyUnreleased: true + removeArtifacts: true + name: "Latest (beta)" + tag: Latest-beta + commit: main + makeLatest: true + bodyFile: ".github/release_bodyFile.md" + artifacts: "wheels-*.zip" diff --git a/addon/pycThermopack/.gitignore b/addon/pycThermopack/.gitignore index e19f946a..f67aaaff 100644 --- a/addon/pycThermopack/.gitignore +++ b/addon/pycThermopack/.gitignore @@ -3,4 +3,5 @@ LICENSE* build/ thermopack/platform_specifics.py pyctp/platform_specifics.py -setup.py \ No newline at end of file +setup.py +!scripts/ \ No newline at end of file diff --git a/addon/pycThermopack/install b/addon/pycThermopack/install deleted file mode 100755 index b12cae95..00000000 --- a/addon/pycThermopack/install +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -# Support for python2 -from __future__ import print_function -import os -import sys -import shutil - - -# Setting some variables -IN_VIRTUALENV = hasattr(sys, 'real_prefix') -IS_ROOT = (os.getuid() == 0) -ROOT_DIR = os.getcwd() - -if IS_ROOT or IN_VIRTUALENV: - os.system('python setup.py install') - - # Cleaning up after installation. - shutil.rmtree(os.path.join(ROOT_DIR,'dist'), ignore_errors = True) - shutil.rmtree(os.path.join(ROOT_DIR,'build'), ignore_errors = True) - manifest_path = os.path.join(ROOT_DIR,'MANIFEST') - if os.path.isfile(manifest_path): - os.remove(manifest_path) - -else: - print("Please run as root or in a virtualenv") - - diff --git a/addon/pycThermopack/makescript.py b/addon/pycThermopack/makescript.py index f7ac8769..6fefddfd 100755 --- a/addon/pycThermopack/makescript.py +++ b/addon/pycThermopack/makescript.py @@ -7,25 +7,17 @@ import sys import warnings from pathlib import Path +from map_platform_specifics import VERSION_2, VERSION_3, pf_specifics_path import map_platform_specifics def windows_make(diffs): if diffs != 'v2': diffs = 'v3' - pf_specifics = {} - pf_specifics["os_id"] = "win" - pf_specifics["prefix"] = "" - pf_specifics["module"] = "_mp_" - pf_specifics["postfix"] = "_" - pf_specifics["postfix_no_module"] = "_" - pf_specifics["dyn_lib"] = "libthermopack.dll" + pf_specifics = map_platform_specifics.get_platform_specifics_windows_ifort_whl() pf_specifics["diff_return_mode"] = diffs - pf_specifics_path = os.path.join(os.path.dirname(__file__), "thermopack", "platform_specifics.py") map_platform_specifics.write_platform_specifics_file(pf_specifics, pf_specifics_path) - map_platform_specifics.correct_toml_version(diffs) - # map_platform_specifics.write_setup_file(f'v{version}') - # map_platform_specifics.write_toml_file(version) + map_platform_specifics.set_toml_version(diffs) if __name__ == "__main__": @@ -51,7 +43,6 @@ def windows_make(diffs): shutil.copy2(libthermo, "./thermopack/libthermopack"+libthermo.suffix) - pf_specifics_path = os.path.join(os.path.dirname(__file__), "thermopack", "platform_specifics.py") pf_specifics = map_platform_specifics.get_platform_specifics_by_trial_and_error() if args.diffs == 'v2': @@ -64,23 +55,10 @@ def windows_make(diffs): version = VERSION_3 args.diffs = 'v3' - if args.diffs == 'v2': - warnings.warn('\033[93mYou are building ThermoPack to use the deprecated return pattern using tuples.\n' - 'Future versions of ThermoPack will return differentials using the `Differential` struct found in utils.py. ' - 'To build ThermoPack to use the new return pattern, run \n`python makescript.py [optim/debug]`\n' - 'For more information see PR#102 at https://github.com/thermotools/thermopack/pull/102\033[0m', DeprecationWarning) - else: - warnings.warn('\033[93mYou are building ThermoPack using the "new" return pattern (i.e. the Differential structs found ' - "in utils.py.) \nTHIS IS THE RECOMMENDED BUILD but I'm warning you because it is not backwards compatible.\n" - "The old return pattern will probably be discontinued in the future. To build " - 'ThermoPack with the "old" return pattern (using tuples) run \n`python makescript.py [optim/debug] -diffs=v2`\n\n' - 'For information on how to adapt old code to the new return pattern, see ' - 'PR#102 at https://github.com/thermotools/thermopack/pull/102\033[0m', Warning) + map_platform_specifics.warn_diff_version(args.diffs) pf_specifics['diff_return_mode'] = args.diffs map_platform_specifics.write_platform_specifics_file(pf_specifics, pf_specifics_path) - - # map_platform_specifics.write_setup_file(f'v{version}') - # map_platform_specifics.write_toml_file(version) + map_platform_specifics.set_toml_version(version) print(f'\033[92mSuccessfully configured ThermoPack {version}\033[0m') diff --git a/addon/pycThermopack/build_whl_linux_x86.sh b/addon/pycThermopack/scripts/build_whl_linux_x86.sh similarity index 100% rename from addon/pycThermopack/build_whl_linux_x86.sh rename to addon/pycThermopack/scripts/build_whl_linux_x86.sh diff --git a/addon/pycThermopack/build_whl_macOS_arm64.sh b/addon/pycThermopack/scripts/build_whl_macOS_arm64.sh similarity index 100% rename from addon/pycThermopack/build_whl_macOS_arm64.sh rename to addon/pycThermopack/scripts/build_whl_macOS_arm64.sh diff --git a/addon/pycThermopack/build_whl_macOS_x86.sh b/addon/pycThermopack/scripts/build_whl_macOS_x86.sh similarity index 100% rename from addon/pycThermopack/build_whl_macOS_x86.sh rename to addon/pycThermopack/scripts/build_whl_macOS_x86.sh diff --git a/addon/pycThermopack/build_whl_windows_amd64.bat b/addon/pycThermopack/scripts/build_whl_windows_amd64.bat similarity index 100% rename from addon/pycThermopack/build_whl_windows_amd64.bat rename to addon/pycThermopack/scripts/build_whl_windows_amd64.bat diff --git a/addon/pycThermopack/build_whl_windows_win32.bat b/addon/pycThermopack/scripts/build_whl_windows_win32.bat similarity index 100% rename from addon/pycThermopack/build_whl_windows_win32.bat rename to addon/pycThermopack/scripts/build_whl_windows_win32.bat diff --git a/addon/pycThermopack/debug_compile.sh b/addon/pycThermopack/scripts/debug_compile.sh similarity index 100% rename from addon/pycThermopack/debug_compile.sh rename to addon/pycThermopack/scripts/debug_compile.sh diff --git a/docs/vCurrent/getting_started_cpp.md b/docs/vCurrent/getting_started_cpp.md index afab70d1..87b604c1 100644 --- a/docs/vCurrent/getting_started_cpp.md +++ b/docs/vCurrent/getting_started_cpp.md @@ -36,17 +36,33 @@ The header files you will need are found in `thermopack/addon/cppThermoPack/cppT # Including and linking ThermoPack +*Note:* Before including ThermoPack in your project, ensure that you have compiled and installed ThermoPack by following the instructions for [building with cmake](source_build.html). + An example `CMakeLists.txt` is found in `thermopack/addon/cppExamples`. In essence, all that is required to include ThermoPack is to add the following to your `CMakeLists.txt`: ```cmake -set(THERMOPACK_HEADERS "path/to/thermopack/addon/cppThermopack") -set(libthermopack_path "path/to/thermopack/addon/cppThermopack/libthermopack.[so/dylib]") +set(THERMOPACK_DIR "/path/to/thermopack") +find_library(THERMOPACK REQUIRED) + +add_executable( ) +add_library( ) +# etc. -target_link_libraries( ${libthermopack_path}) -target_include_directories( ${THERMOPACK_HEADERS}) +target_link_libraries( thermopack) # find_library ensures that the exported target "thermopack" is available +target_link_libraries( thermopack) +# etc. ``` -where `` is some target previously defined by a call to `add_executable`, `add_library`, etc. +The environment variable `THERMOPACK_DIR` can also be set using +```bash +export THERMOPACK_DIR=/path/to/thermopack +``` +and should point to the top-level directory of the thermopack-package (where `thermopack-config.cmake` is found). After the `find_library` command has been run, several convenience variables will have been defined: +* `THERMOPACK_INSTALLED` : `"TRUE"` if thermopack is installed, `"FALSE"` otherwise +* `THERMOPACK_ROOT` : Path to directory where `thermopack-config.cmake` was found +* `THERMOPACK_LIB` : Path to thermopack dynamic library +* `THERMOPACK_INCLUDE` : Path to thermopack C++ headers +* `thermopack` : Imported shared library target with headers (this is what you want to link to using `target_link_libraries`) # Library structure diff --git a/docs/vCurrent/source_build.md b/docs/vCurrent/source_build.md index bbed37a5..c533e27a 100644 --- a/docs/vCurrent/source_build.md +++ b/docs/vCurrent/source_build.md @@ -5,6 +5,19 @@ title: Installing the latest version of ThermoPack permalink: /vcurrent/source_build.html --- +- [Using pip](#using-pip) +- [Installing from wheels](#installing-from-wheels) +- [Building from source](#building-from-source) + - [Prerequisites](#prerequisites) + - [CMake setup (macOS and Linux)](#cmake-setup-macos-and-linux) + - [CMake setup (Windows)](#cmake-setup-windows) +- [Legacy build system (without CMake)](#legacy-build-system-without-cmake) + - [Linux setup](#linux-setup) + - [MacOS setup](#macos-setup) + - [Windows setup](#windows-setup) + - [MSYS2/Mingw-W64 setup](#msys2mingw-w64-setup) + - [Docker setup](#docker-setup) + ## Using pip Thermopack has been compiled for Windows, Linux and macOS and made available on the [Python Package Index](https://pypi.org/project/thermopack/) (pypi), and can be @@ -16,6 +29,9 @@ pip3 install thermopack For documentation on the version available on pypi, refer to the appropriate version number in the sidebar. +## Installing from wheels +Pre-built wheels for the latest version of ThermoPack on GitHub are available for download [here](). Refer to the linked page for instructions on how to install packages directly from a python wheel. Please note that the latest version on GitHub may be less stable, tested, and well documented than the versions distributed on PyPI. + ## Building from source The following sections show how to fetch, compile and install Thermopack and the Python frontend pycThermopack. When things are properly installed, it may @@ -34,6 +50,62 @@ Studio](https://visualstudio.microsoft.com/vs/). A solution file is found in assuming that the Intel Fortran compiler is integrated with Microsoft Visual Studio. +For macOS and Linux, Lapack and Blas can likely be installed using `apt`, `brew`, or similar. For windows, Lapack will need to be built from source. The [CMake setup for Windows](#cmake-setup-windows) is configured to handle this automatically. + +### CMake setup (macOS and Linux) + +The `cmake`-based build system assumes that you have Lapack and gfortran installed, see above instructions for more on that. + +Build and install thermopack by running +```bash +mkdir build +cd build +cmake .. +make install +``` + +This will ensure that the thermopack dynamic library is properly installed to `thermopack/installed` and `thermopack/addon/pycThermopack/thermopack`. + +To set up the python wrapper, +```bash +python addon/pycThermopack/map_platform_specifics.py +pip install addon/pycThermopack/ +``` +this will generate the file `addon/pycThermopack/thermopack/platform_specifics.py` and install thermopack to your activated virtual environment. + +ThermoPack can be configured to return computed properties as either tuples (`v2`) or using the `Property` struct (`v3`), this is toggled with +the `-diffs` flag when running `map_platform_specifics.py` as +```bash +python map_platform_specifics.py -diffs=v2 # Use tuples +python map_platform_specifics.py -diffs=v3 # use Property +``` +the default value is `-diffs=v3`. + +### CMake setup (Windows) + +To compile thermopack (and Lapack) with intel fortran, run +``` +mkdir build +cd build +cmake .. -G Ninja -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release +cmake --build . --config=Release --target install +``` +Compile and install Lapack, and install the thermopack dynamic library to `thermopack/installed` and `thermopack/addon/pycThermopack/thermopack`. + +To configure and install the python-wrapper, run +``` +python addon/pycThermopack/map_platform_specifics.py +pip install addon/pycThermopack/ +``` + +*Note:* If your thermopack dynamic library is called `libthermopack.dll`, and not `thermopack.dll`, you will instead need to run +``` +python addon/pycThermopack/map_platform_specifics.py --ifort=True +pip install addon/pycThermopack/ +``` + +## Legacy build system (without CMake) + ### Linux setup The Thermopack source code is downloaded by cloning the library to your local computer. The following commands assume that you have a local installation of @@ -131,32 +203,4 @@ how to install pycThermopack for the MSYS2 environment. ### Docker setup See [addon/docker/README.md](https://github.com/thermotools/thermopack/tree/main/addon/docker) for -available Dockerfiles to run Thermopack with docker. - -### CMake setup - -The CMake setup has been tested on macOS and Linux, and is the system currently used for CI. The system assumes that you have -Lapack and gfortran installed, see above instructions for more on that. - -Build and install thermopack by running -```bash -mkdir build -cd build -cmake .. -make install -``` - -To set up the python wrapper, -```bash -python addon/pycThermopack/map_platform_specifics.py -pip install addon/pycThermopack/ -``` -this will generate the file `addon/pycThermopack/thermopack/platform_specifics.py` and install thermopack to your activated virtual environment. - -ThermoPack can be configured to return computed properties as either tuples (`v2`) or using the `Property` struct (`v3`), this is toggled with -the `-diffs` flag when running `makescript.py` as -```bash -python map_platform_specifics.py -diffs=v2 # Use tuples -python map_platform_specifics.py -diffs=v3 # use Property -``` -the default value is `-diffs=v3`. \ No newline at end of file +available Dockerfiles to run Thermopack with docker. \ No newline at end of file From b6ac020c1dc71eedd1bb0338a820e245acb1066f Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 15:40:03 +0200 Subject: [PATCH 73/83] Correct artifact names. --- .github/workflows/cibuildwheel.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c59016a3..bebe16c4 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: build_wheels: # if: github.event_name == 'pull_request' - name: Build wheels on ${{ matrix.os }}-${{ matrix.version }} + name: Build ${{ matrix.tp_version }} wheels on ${{ matrix.os }}-${{ matrix.version }} runs-on: ${{ matrix.os }}-${{ matrix.version }} timeout-minutes: 30 strategy: @@ -17,6 +17,7 @@ jobs: include: - version: 12 os: macOS + tp_version: [v2, v3] steps: - uses: actions/checkout@v4 @@ -83,7 +84,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: wheel-${{ matrix.os }}-${{ matrix.version }} + name: wheel-${{ matrix.tp_version }}-${{ matrix.os }}-${{ matrix.version }} path: ./wheelhouse/*.whl release_wheels: # Create or update the release tagged Latest-beta, and upload wheels to that release. @@ -105,12 +106,6 @@ jobs: - name: Display full directory status run: ls -R . - - name: zip wheels - run: | - for dir in wheels-*; do - zip -r "${dir}.zip" ${dir} - done - - name: Display current directory status run: ls @@ -125,4 +120,4 @@ jobs: commit: main makeLatest: true bodyFile: ".github/release_bodyFile.md" - artifacts: "wheels-*.zip" + artifacts: "wheel-*" From 54f0337ffac0e558c018856760da4a1f3c9eda82 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 15:53:34 +0200 Subject: [PATCH 74/83] Properly zip wheels and build both v2 and v3 for macOS x86. --- .github/workflows/cibuildwheel.yml | 12 +++++++++++- addon/pycThermopack/map_platform_specifics.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index bebe16c4..c07cf004 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -17,7 +17,10 @@ jobs: include: - version: 12 os: macOS - tp_version: [v2, v3] + tp_version: v2 + - version: 12 + os: macOS + tp_version: v3 steps: - uses: actions/checkout@v4 @@ -106,6 +109,13 @@ jobs: - name: Display full directory status run: ls -R . + - name: zip wheels + run: | + for dir in wheel-*; do + zip -r "${dir}.zip" ${dir} + done + + - name: Display current directory status run: ls diff --git a/addon/pycThermopack/map_platform_specifics.py b/addon/pycThermopack/map_platform_specifics.py index 8f6f576a..beeb1f6a 100644 --- a/addon/pycThermopack/map_platform_specifics.py +++ b/addon/pycThermopack/map_platform_specifics.py @@ -205,7 +205,7 @@ def warn_diff_version(diffs): 'For more information on configuration options run \n\n\t`python map_platform_specifics.py --help\n\n\033[0m', Warning) if __name__ == "__main__": - VERSION_2 = '2.2.3' + VERSION_2 = '2.2.4b0' VERSION_3 = '3.b0' parser = argparse.ArgumentParser() From 0e12bbe3cab1b4b0e2ba8111aae8239505b43e12 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 16:11:36 +0200 Subject: [PATCH 75/83] Tweaking when workflow is executed. --- .github/prerelease_bodyFile.md | 7 +++++++ .github/release_bodyFile.md | 7 ------- .github/workflows/cibuildwheel.yml | 14 ++++++++------ 3 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 .github/prerelease_bodyFile.md delete mode 100644 .github/release_bodyFile.md diff --git a/.github/prerelease_bodyFile.md b/.github/prerelease_bodyFile.md new file mode 100644 index 00000000..7422b8e2 --- /dev/null +++ b/.github/prerelease_bodyFile.md @@ -0,0 +1,7 @@ +This release is automatically updated whenever a pull request is merged to `main`. + +For stable releases of `ThermoPack`, see releases named `vX.Y.Z`. + +To install this release, download and unzip the appropriate zip file, then install with `pip install thermopack -f wheel--/`, where `wheel--` is the directory created by unzipping the file. + +Documentation and user guides for the latest version are found at [thermotools.github.io/thermopack](thermotools.github.io/thermopack), but are likely not as well maintained as the documentation and guides for stable releases. \ No newline at end of file diff --git a/.github/release_bodyFile.md b/.github/release_bodyFile.md deleted file mode 100644 index 6197214f..00000000 --- a/.github/release_bodyFile.md +++ /dev/null @@ -1,7 +0,0 @@ -This release is automatically updated whenever a pull request is merged to `main`, and is built from the branch that was merged to `main` (not `main` itself). - -For stable releases of `KineticGas`, see releases named `vX.Y.Z`. - -To install this release, download and unzip the appropriate zip file, then install with `pip install pykingas -f wheels--latest/`, where `wheels--latest` is the directory created by unzipping the file. - -Documentation and user guides for the latest version are found at [thermotools.github.io/KineticGas](thermotools.github.io/KineticGas), but are likely not as well maintained as the documentation and guides for stable releases. \ No newline at end of file diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index c07cf004..68117801 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,10 +1,14 @@ name: cibuildwheel -on: [push, pull_request] +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + jobs: build_wheels: - # if: github.event_name == 'pull_request' name: Build ${{ matrix.tp_version }} wheels on ${{ matrix.os }}-${{ matrix.version }} runs-on: ${{ matrix.os }}-${{ matrix.version }} timeout-minutes: 30 @@ -91,7 +95,6 @@ jobs: path: ./wheelhouse/*.whl release_wheels: # Create or update the release tagged Latest-beta, and upload wheels to that release. - # if: github.event.pull_request.merged == true name: Update prerelease needs: build_wheels runs-on: ubuntu-latest @@ -115,7 +118,6 @@ jobs: zip -r "${dir}.zip" ${dir} done - - name: Display current directory status run: ls @@ -129,5 +131,5 @@ jobs: tag: Latest-beta commit: main makeLatest: true - bodyFile: ".github/release_bodyFile.md" - artifacts: "wheel-*" + bodyFile: ".github/prerelease_bodyFile.md" + artifacts: "wheel-*.zip" From e2f86a18ed681b6b1ea6b6596a84b092081d5ce1 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 16:14:38 +0200 Subject: [PATCH 76/83] Only run unittests on pull request pushes. --- .github/workflows/unittests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 20dd4485..ec8fdcd9 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,6 +1,6 @@ name: unittests -on: [push, pull_request] +on: [pull_request] jobs: run-tests: From a7491dcd289871d15036b05fc192cbfe42c180fa Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 16:23:01 +0200 Subject: [PATCH 77/83] Tweaking action execution. --- .github/workflows/cibuildwheel.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 68117801..7c2eb690 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,14 +1,10 @@ name: cibuildwheel -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - +on: [push, pull_request] jobs: build_wheels: + if: github.event_name == 'pull_request' name: Build ${{ matrix.tp_version }} wheels on ${{ matrix.os }}-${{ matrix.version }} runs-on: ${{ matrix.os }}-${{ matrix.version }} timeout-minutes: 30 @@ -96,6 +92,7 @@ jobs: release_wheels: # Create or update the release tagged Latest-beta, and upload wheels to that release. name: Update prerelease + if: github.ref_name == 'main' needs: build_wheels runs-on: ubuntu-latest permissions: From ced5355274f3c5110f39709ab384b5f5a6380238 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 16:31:25 +0200 Subject: [PATCH 78/83] Always run unittest action, only deploy on merge. --- .github/workflows/cibuildwheel.yml | 8 ++++++-- .github/workflows/unittests.yml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 7c2eb690..093dcb97 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,6 +1,10 @@ name: cibuildwheel -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: jobs: build_wheels: @@ -92,7 +96,7 @@ jobs: release_wheels: # Create or update the release tagged Latest-beta, and upload wheels to that release. name: Update prerelease - if: github.ref_name == 'main' + if: github.ref == 'refs/heads/main' needs: build_wheels runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index ec8fdcd9..20dd4485 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,6 +1,6 @@ name: unittests -on: [pull_request] +on: [push, pull_request] jobs: run-tests: From 485e07eb4dac1714bbed010e2a54fc8b48f05a56 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Thu, 10 Oct 2024 16:34:46 +0200 Subject: [PATCH 79/83] Always build wheels, only release on merge. --- .github/workflows/cibuildwheel.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 093dcb97..d9c7fb5a 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,14 +1,10 @@ name: cibuildwheel -on: - push: - branches: - - main - pull_request: +on: [push, pull_request] jobs: build_wheels: - if: github.event_name == 'pull_request' + name: Build ${{ matrix.tp_version }} wheels on ${{ matrix.os }}-${{ matrix.version }} runs-on: ${{ matrix.os }}-${{ matrix.version }} timeout-minutes: 30 From 65602c535afec5e58eedbc3d25b277240252ee0e Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 11 Oct 2024 09:22:24 +0200 Subject: [PATCH 80/83] Tweaking runs 1 --- .github/workflows/cibuildwheel.yml | 3 +-- .github/workflows/dummy_build.yml | 20 ++++++++++++++++++++ .github/workflows/dummy_test.yml | 11 +++++++++++ .github/workflows/unittests.yml | 2 +- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/dummy_build.yml create mode 100644 .github/workflows/dummy_test.yml diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index d9c7fb5a..d0566c7d 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -1,10 +1,9 @@ name: cibuildwheel -on: [push, pull_request] +on: [] jobs: build_wheels: - name: Build ${{ matrix.tp_version }} wheels on ${{ matrix.os }}-${{ matrix.version }} runs-on: ${{ matrix.os }}-${{ matrix.version }} timeout-minutes: 30 diff --git a/.github/workflows/dummy_build.yml b/.github/workflows/dummy_build.yml new file mode 100644 index 00000000..fe5cba72 --- /dev/null +++ b/.github/workflows/dummy_build.yml @@ -0,0 +1,20 @@ +name: Dummy Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Dummy build + runs-on: ubuntu-latest + steps: + - name: Build + run: echo "Building ..." + + release_wheels: + name: Dummy release + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - name: Release + run: echo "Releasing ..." + diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml new file mode 100644 index 00000000..557c5d80 --- /dev/null +++ b/.github/workflows/dummy_test.yml @@ -0,0 +1,11 @@ +name: Dummy Test + +on: [push, pull_request] + +jobs: + run_tests: + name: Dummy test + runs-on: ubuntu-latest + steps: + - name: Test + run: echo "Testing ..." \ No newline at end of file diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index 20dd4485..8beb8f4c 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -1,6 +1,6 @@ name: unittests -on: [push, pull_request] +on: [] jobs: run-tests: From 044223cda57bfcec784060369bff7fca003549d3 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 11 Oct 2024 09:26:37 +0200 Subject: [PATCH 81/83] Tweaking runs 2 --- .github/workflows/dummy_build.yml | 1 + .github/workflows/dummy_test.yml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dummy_build.yml b/.github/workflows/dummy_build.yml index fe5cba72..dfd08043 100644 --- a/.github/workflows/dummy_build.yml +++ b/.github/workflows/dummy_build.yml @@ -4,6 +4,7 @@ on: [push, pull_request] jobs: build_wheels: + if: github.ref == 'refs/heads/main' || github.event_name != 'push' name: Dummy build runs-on: ubuntu-latest steps: diff --git a/.github/workflows/dummy_test.yml b/.github/workflows/dummy_test.yml index 557c5d80..0f0cdfc1 100644 --- a/.github/workflows/dummy_test.yml +++ b/.github/workflows/dummy_test.yml @@ -1,6 +1,10 @@ name: Dummy Test -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: jobs: run_tests: From 27350998c2612dc5db6b6ce8cd90e5c30ab95acc Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 11 Oct 2024 09:29:02 +0200 Subject: [PATCH 82/83] Tweaking runs 3 --- .github/workflows/dummy_build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dummy_build.yml b/.github/workflows/dummy_build.yml index dfd08043..ba68bd26 100644 --- a/.github/workflows/dummy_build.yml +++ b/.github/workflows/dummy_build.yml @@ -1,6 +1,10 @@ name: Dummy Build -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: jobs: build_wheels: From 26fa700dcc30b8f0ecdefd5c403645e9ad6ac231 Mon Sep 17 00:00:00 2001 From: Vegard Gjeldvik Jervell Date: Fri, 11 Oct 2024 09:31:13 +0200 Subject: [PATCH 83/83] Tweaking runs 4 --- .github/workflows/dummy_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dummy_build.yml b/.github/workflows/dummy_build.yml index ba68bd26..dce40870 100644 --- a/.github/workflows/dummy_build.yml +++ b/.github/workflows/dummy_build.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Build - run: echo "Building ..." + run: echo "Building ... but not a PR" release_wheels: name: Dummy release