From f4b409c501d6f2b22a4394cd097faa932d27cff1 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Mon, 3 Apr 2023 21:40:59 +0200 Subject: [PATCH 01/19] [wheel build] Release Python API 1.3.0 --- .github/workflows/actions.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 147d50c..e14c19d 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -20,7 +20,7 @@ jobs: message: ${{ steps.commit_message.outputs.message }} steps: - name: Checkout the repo - uses: actions/checkout@v2 + uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # Gets the correct commit message for pull request with: ref: ${{ github.event.pull_request.head.sha }} @@ -39,7 +39,7 @@ jobs: needs: get_commit_message steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 - name: install dependencies run: | @@ -84,7 +84,7 @@ jobs: if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || github.event_name == 'release' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 with: name: pytrexio-source path: ./trexio-*.tar.gz @@ -119,7 +119,7 @@ jobs: name: x86 MacOS 11 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 - name: install dependencies run: | From 6aa2a9ee2582a0482593076192b826db930d2866 Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 3 Apr 2023 22:44:12 +0200 Subject: [PATCH 02/19] Update Guix manifest with v.2.3.0 --- tools/trexio.scm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/trexio.scm b/tools/trexio.scm index 72c7f7e..676db89 100644 --- a/tools/trexio.scm +++ b/tools/trexio.scm @@ -60,8 +60,22 @@ "1n9n1gbk5hgvg73am991xrv7ap002rz719a3nvh8m8ff9x10qd76" )))))) +(define-public trexio-2.3 + (package/inherit trexio-2.0 + (version "2.3.0") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/TREX-CoE/trexio/releases/download/v" version + "/trexio-" version + ".tar.gz")) + (sha256 + (base32 + ;; the hash below is produced by guix download + "183wljg1avsia2pf2wb59s2i2qw6y19qfw164ffy1g024b6362ii" + )))))) + (define-public trexio ;; Default version of TREXIO. - trexio-2.2) + trexio-2.3) trexio From fbd44013db8986daf410a77a8cd23c86e847aed6 Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 3 Apr 2023 22:45:54 +0200 Subject: [PATCH 03/19] Bumd the minor version after the release --- CMakeLists.txt | 2 +- configure.ac | 2 +- python/pytrexio/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba6f6c6..d680079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) # Initialize the CMake project. project(Trexio - VERSION 2.3.0 + VERSION 2.4.0 DESCRIPTION "TREX I/O library" LANGUAGES C Fortran ) diff --git a/configure.ac b/configure.ac index 015c0da..2bd60d3 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([trexio],[2.3.0],[https://github.com/TREX-CoE/trexio/issues]) +AC_INIT([trexio],[2.4.0],[https://github.com/TREX-CoE/trexio/issues]) AC_CONFIG_SRCDIR([Makefile.in]) AC_CONFIG_HEADERS([include/config.h]) diff --git a/python/pytrexio/_version.py b/python/pytrexio/_version.py index 67bc602..3e8d9f9 100644 --- a/python/pytrexio/_version.py +++ b/python/pytrexio/_version.py @@ -1 +1 @@ -__version__ = "1.3.0" +__version__ = "1.4.0" From 3646825790c225d78ac0c62cc770ec17ecf12e2c Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 3 Apr 2023 22:48:42 +0200 Subject: [PATCH 04/19] Remove HL HDF5 from CMake --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0dc8bd4..78feac9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,7 +66,7 @@ option(ENABLE_HDF5 "Enable HDF5 support" ON) if(ENABLE_HDF5) # Try to detect HDF5 installation using built-in FindHDF5.cmake macro. - find_package(HDF5 REQUIRED COMPONENTS C HL) + find_package(HDF5 REQUIRED COMPONENTS C) if(HDF5_FOUND) message(STATUS "HDF5 version :: ${HDF5_VERSION}") @@ -87,9 +87,7 @@ if(ENABLE_HDF5) # - include directories with HDF5 header files target_include_directories(trexio PRIVATE ${HDF5_C_INCLUDE_DIRS}) # - link to HDF5 C libraries - target_link_libraries(trexio PRIVATE - ${HDF5_C_HL_LIBRARIES} - ${HDF5_C_LIBRARIES}) + target_link_libraries(trexio PRIVATE ${HDF5_C_LIBRARIES}) endif() # Private headers have to be listed as sources, otherwise they are installed From 2f939ee4c4de0391b77e0a6a9273a6e78bf549de Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 3 Apr 2023 22:53:02 +0200 Subject: [PATCH 05/19] Cleaner CI --- .github/workflows/actions.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index e14c19d..4897de0 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -31,11 +31,9 @@ jobs: COMMIT_MSG=$(git log --no-merges -1 --oneline) echo "::set-output name=message::$COMMIT_MSG" - trexio_ubuntu: - - runs-on: ubuntu-20.04 name: x86 Ubuntu 20.04 + runs-on: ubuntu-20.04 needs: get_commit_message steps: @@ -114,9 +112,8 @@ jobs: run: make maintainer-clean trexio_macos: - - runs-on: macos-11 name: x86 MacOS 11 + runs-on: macos-11 steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -133,10 +130,10 @@ jobs: ./configure FC=gfortran-10 --enable-silent-rules - name: compile TREXIO - run: make -j 2 + run: make -j3 - name: check TREXIO - run: make check + run: make -j3 check - name: Archive test log file if: failure() From d4d24ff1021d16483a4e073627ab66965536a9ec Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 3 Apr 2023 23:41:02 +0200 Subject: [PATCH 06/19] Better README [skip ci] --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index fd5e058..a313092 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ TREX library for efficient I/O. 2. `gzip -cd trexio-.tar.gz | tar xvf -` 3. `cd trexio-` 4. `./configure` -5. `make` -6. `make check` +5. ```make -j`getconf _NPROCESSORS_ONLN` ``` +6. ```make -j`getconf _NPROCESSORS_ONLN` check``` 7. `sudo make install` @@ -45,8 +45,8 @@ TREX library for efficient I/O. 2. `cd trexio` 3. `./autogen.sh` 4. `./configure` -5. `make` -6. `make check` +5. ```make -j`getconf _NPROCESSORS_ONLN` ``` +6. ```make -j`getconf _NPROCESSORS_ONLN` check``` 7. `sudo make install` ## Installation procedure for CMake users (from the tarball or GitHub repo clone): @@ -56,8 +56,8 @@ The aforementioned instructions rely on [Autotools](https://www.gnu.org/software 1. `cmake -S. -Bbuild` 2. `cd build` -3. `make` -4. `ctest` (or `make test`) +3. ```make -j`getconf _NPROCESSORS_ONLN` ``` +4. ```ctest -j`getconf _NPROCESSORS_ONLN` ``` 5. `sudo make install` **Note: on systems with no `sudo` access, one can add `-DCMAKE_INSTALL_PREFIX=build` as an argument to the `cmake` command so that `make install/uninstall` can be run without `sudo` privileges.** @@ -73,7 +73,7 @@ The official releases of TREXIO `>2.0.0` are also available via the `conda-forge The pre-compiled stable binaries of `trexio` can be installed as follows: ``` -conda install trexio -c conda-forge +conda install -c conda-forge trexio ``` More details can be found in the corresponding [trexio-feedstock](https://github.com/conda-forge/trexio-feedstock). @@ -88,7 +88,7 @@ Schema file contains the manifest specification for the `trexio` package. It can be installed as follows: ``` -guix package --cores= --install-from-file=trexio.scm +guix package --cores=`getconf _NPROCESSORS_ONLN` --install-from-file=trexio.scm ``` ## Installation procedure for Spack users @@ -100,7 +100,7 @@ file contains the Spack specifications required to build different variants of ` It can be installed as follows ``` -spack install --jobs trexio +spack install --jobs `getconf _NPROCESSORS_ONLN` trexio ``` ## Installation procedure for Debian/Ubuntu users @@ -127,14 +127,14 @@ To build TREXIO without HDF5 back end, append `--without-hdf5` option to `config ## Linking to your program The `make install` command takes care of installing the TREXIO shared library on the user machine. -Once installed, add `-ltrexio` to the list of compiler options. +After installation, append `-ltrexio` to the list of compiler (`$LIBS`) options. -In some cases (e.g. when using custom `prefix` during configuration), the TREXIO library might end up installed in a directory, which is absent in the default `$LIBRARY_PATH`. -In order to link the program against TREXIO, the search paths can be modified as follows: +In some cases (e.g. when using custom installation prefix during configuration), the TREXIO library might end up installed in a directory, which is absent in the default `$LD_LIBRARY_PATH`. +In order to link the program against TREXIO, the search path can be modified as follows: -`export LIBRARY_PATH=$LIBRARY_PATH:/lib` +`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib` -(same holds for `$LD_LIBRARY_PATH`). The `` has to be replaced by the prefix used during the installation. +where the `` has to be replaced by the prefix used during the installation. If your project relies on CMake build system, feel free to use the [FindTREXIO.cmake](https://github.com/TREX-CoE/trexio/blob/master/cmake/FindTREXIO.cmake) From bd58998d044ef3a2db96f0290d26f5879728b8dd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 Apr 2023 13:16:16 +0200 Subject: [PATCH 07/19] Fixed S_ISDIR --- src/templates_text/templator_text.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index 9ed7858..1e7f140 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -145,10 +145,10 @@ trexio_text_inquire (const char* file_name) if (file_exists) { bool is_a_directory = false; -#ifdef S_IFDIR +#if defined(S_IFDIR) is_a_directory = st.st_mode & S_IFDIR; -#elif S_ISDIR - is_a_directory = S_ISDIR(s.st_mode); +#elif defined(S_ISDIR) + is_a_directory = S_ISDIR(st.st_mode); #else printf("Some important macros are missing for directory handling.\n"); return TREXIO_FAILURE; From d9a15c12d36e3db41bc4a06c073123ac5e2f74c9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 Apr 2023 14:59:20 +0200 Subject: [PATCH 08/19] Fixed text back-end in Python --- src/templates_text/templator_text.org | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/templates_text/templator_text.org b/src/templates_text/templator_text.org index 1e7f140..3005aa7 100644 --- a/src/templates_text/templator_text.org +++ b/src/templates_text/templator_text.org @@ -162,6 +162,29 @@ trexio_text_inquire (const char* file_name) } #+end_src +On non-POSIX file systems, the function ~mkdtemp~ might is not defined. +In that case, we define an alternate one, which is not as safe as the original one. + + #+begin_src c :tangle basic_text.c +#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L +#else + +char* mkdtemp(char* template) { + char* dir = NULL; + dir = tmpnam(dir); + if (dir == NULL) return NULL; + + if (mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO) != 0) { + return NULL; + } + + strcpy(template, dir); + return template; +} + +#endif + #+end_src + #+begin_src c :tangle basic_text.c trexio_exit_code trexio_text_init (trexio_t* const file) From 13567fceb89aaafff9e38952bd2bd486611243b8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 26 Apr 2023 10:07:04 +0200 Subject: [PATCH 09/19] [wheel build] Set version number to 2.3.1 for fixing text backend in python --- CMakeLists.txt | 2 +- configure.ac | 2 +- python/pytrexio/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d680079..9bda21c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16) # Initialize the CMake project. project(Trexio - VERSION 2.4.0 + VERSION 2.3.1 DESCRIPTION "TREX I/O library" LANGUAGES C Fortran ) diff --git a/configure.ac b/configure.ac index 2bd60d3..dede482 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([trexio],[2.4.0],[https://github.com/TREX-CoE/trexio/issues]) +AC_INIT([trexio],[2.3.1],[https://github.com/TREX-CoE/trexio/issues]) AC_CONFIG_SRCDIR([Makefile.in]) AC_CONFIG_HEADERS([include/config.h]) diff --git a/python/pytrexio/_version.py b/python/pytrexio/_version.py index 3e8d9f9..9c73af2 100644 --- a/python/pytrexio/_version.py +++ b/python/pytrexio/_version.py @@ -1 +1 @@ -__version__ = "1.4.0" +__version__ = "1.3.1" From 00f179d7f9c44600de56afc07a53765d4d623467 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 5 May 2023 08:30:01 +0200 Subject: [PATCH 10/19] Added Python example --- docs/examples.org | 135 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-) diff --git a/docs/examples.org b/docs/examples.org index f1f2e1e..d21be98 100644 --- a/docs/examples.org +++ b/docs/examples.org @@ -200,7 +200,7 @@ program print_energy #+begin_src f90 call getarg(1, filename) - f = trexio_open (filename, 'r', TREXIO_HDF5, rc) + f = trexio_open (filename, 'r', TREXIO_AUTO, rc) if (rc /= TREXIO_SUCCESS) then call trexio_string_of_error(rc, err_msg) print *, 'Error opening TREXIO file: '//trim(err_msg) @@ -410,6 +410,139 @@ program print_energy end program #+end_src +** Python + :PROPERTIES: + :header-args: :tangle print_energy.py + :END: + + #+begin_src python +import sys +import trexio +import numpy as np + +BUFSIZE = 100000 + #+end_src + + This program computes the energy as: + + \[ + E = E_{\text{NN}} + \sum_{ij} \gamma_{ij}\, \langle j | h | i \rangle\, + +\, \frac{1}{2} \sum_{ijkl} \Gamma_{ijkl}\, \langle k l | i j + \rangle\; \textrm{ with } \; 0 < i,j,k,l \le n + \] + One needs to read from the TREXIO file: + + - $n$ :: The number of molecular orbitals + - $E_{\text{NN}}$ :: The nuclear repulsion energy + - $\gamma_{ij}$ :: The one-body reduced density matrix + - $\langle j |h| i \rangle$ :: The one-electron Hamiltonian integrals + - $\Gamma_{ijkl}$ :: The two-body reduced density matrix + - $\langle k l | i j \rangle$ :: The electron repulsion integrals + +*** Obtain the name of the TREXIO file from the command line, and open it for reading + + #+begin_src python +filename = sys.argv[1] +f = trexio.File(filename, 'r', trexio.TREXIO_AUTO) + #+end_src + +*** Read the nuclear repulsion energy + + #+begin_src python +E_nn = trexio.read_nucleus_repulsion(f) + #+end_src + +*** Read the number of molecular orbitals + + #+begin_src python +n = trexio.read_mo_num(f) + #+end_src + +*** Read one-electron quantities + + #+begin_src python +if not trexio.has_mo_1e_int_core_hamiltonian(f): + print("No core hamiltonian in file") + sys.exit(-1) + +h0 = trexio.read_mo_1e_int_core_hamiltonian(f) + +if not trexio.has_rdm_1e(f): + print("No 1e RDM in file") + sys.exit(-1) + +D = trexio.read_rdm_1e(f) + #+end_src + +*** Read two-electron quantities + +**** Electron repulsion integrals + + #+begin_src python +if not trexio.has_mo_2e_int_eri(f): + print("No electron repulsion integrals in file") + sys.exit(-1) + +size_max = trexio.read_mo_2e_int_eri_size(f) + +offset = 0 +icount = BUFSIZE +feof = False +W = np.zeros( (n,n,n,n) ) +while not feof: + buffer_index, buffer_values, icount, feof = trexio.read_mo_2e_int_eri(f, offset, icount) + for m in range(icount): + i, j, k, l = buffer_index[m] + W[i,j,k,l] = buffer_values[m] + W[k,j,i,l] = buffer_values[m] + W[i,l,k,j] = buffer_values[m] + W[k,l,i,j] = buffer_values[m] + W[j,i,l,k] = buffer_values[m] + W[j,k,l,i] = buffer_values[m] + W[l,i,j,k] = buffer_values[m] + W[l,k,j,i] = buffer_values[m] + #+end_src + +**** Reduced density matrix + + #+begin_src python +if not trexio.has_rdm_2e(f): + print("No two-body density matrix in file") + +offset = 0 +icount = BUFSIZE +feof = False +G = np.zeros( (n,n,n,n) ) +while not feof: + buffer_index, buffer_values, icount, feof = trexio.read_rdm_2e(f, offset, icount) + for m in range(icount): + i, j, k, l = buffer_index[m] + G[i,j,k,l] = buffer_values[m] + + #+end_src + +*** Compute the energy + + When the orbitals are real, we can use + \begin{eqnarray*} + E &=& E_{\text{NN}} + \sum_{ij} \gamma_{ij}\, \langle j | h | i \rangle\, + +\, \frac{1}{2} \sum_{ijkl} \Gamma_{ijkl}\, \langle k l | i j + \rangle \\ + &=& E_{\text{NN}} + \sum_{ij} \gamma_{ij}\, \langle i | h | j \rangle\, + +\, \frac{1}{2} \sum_{ijkl} \Gamma_{ijkl}\, \langle i j | k l + \rangle \\ + \end{eqnarray*} + + #+begin_src python +G = np.reshape(G, (n*n, n*n) ) +W = np.reshape(W, (n*n, n*n) ) +E = E_nn +E += 0.5*sum( [ np.dot(G[:,l], W[:,l]) for l in range(n*n) ] ) +E += sum( [ np.dot(D[:,l], h0[:,l]) for l in range(n) ] ) + +print (f"Energy: {E}") + #+end_src + * Reading determinants ** Fortran From b7577c50129e89858432df18e328734c71b0d326 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 5 May 2023 12:44:08 +0200 Subject: [PATCH 11/19] [wheel build] Fix single-precision in float scalars --- python/pytrexio/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pytrexio/_version.py b/python/pytrexio/_version.py index 9c73af2..f708a9b 100644 --- a/python/pytrexio/_version.py +++ b/python/pytrexio/_version.py @@ -1 +1 @@ -__version__ = "1.3.1" +__version__ = "1.3.2" From c23bc20e4e6c68e5ac1695c2538d0442c87db63f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 5 May 2023 12:30:32 +0200 Subject: [PATCH 12/19] Fixes #116 --- src/pytrexio.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytrexio.i b/src/pytrexio.i index b6e5485..c7eea59 100644 --- a/src/pytrexio.i +++ b/src/pytrexio.i @@ -41,7 +41,7 @@ %apply int *OUTPUT { int64_t* const num_up}; %apply int *OUTPUT { int64_t* const num_dn}; %apply float *OUTPUT { float* const num}; -%apply float *OUTPUT { double* const num}; +%apply double *OUTPUT { double* const num}; /* Return TREXIO exit code from trexio_open as part of the output tuple */ %apply int *OUTPUT { trexio_exit_code* const rc_open}; /* Return number of sparse data points stored in the file as part of the output tuple */ From 8eb1ac75d8ff064014ccea920a22a59b43181ae6 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 5 May 2023 13:37:44 +0200 Subject: [PATCH 13/19] [wheel build] Fix single-precision in float scalars 2nd try --- src/pytrexio.i | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pytrexio.i b/src/pytrexio.i index c7eea59..5f3a4e1 100644 --- a/src/pytrexio.i +++ b/src/pytrexio.i @@ -34,12 +34,12 @@ num variable is modified by address */ /* Return num variables as part of the output tuple */ -%apply int *OUTPUT { int32_t* const num}; -%apply int *OUTPUT { int64_t* const num}; -%apply int *OUTPUT { int32_t* const num_up}; -%apply int *OUTPUT { int32_t* const num_dn}; -%apply int *OUTPUT { int64_t* const num_up}; -%apply int *OUTPUT { int64_t* const num_dn}; +%apply int32_t *OUTPUT { int32_t* const num}; +%apply int64_t *OUTPUT { int64_t* const num}; +%apply int32_t *OUTPUT { int32_t* const num_up}; +%apply int32_t *OUTPUT { int32_t* const num_dn}; +%apply int64_t *OUTPUT { int64_t* const num_up}; +%apply int64_t *OUTPUT { int64_t* const num_dn}; %apply float *OUTPUT { float* const num}; %apply double *OUTPUT { double* const num}; /* Return TREXIO exit code from trexio_open as part of the output tuple */ From 55c1998ba31b79ef3629aa274f38d4aaf0bcb976 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Fri, 5 May 2023 15:25:51 +0200 Subject: [PATCH 14/19] [wheel build] Better MacOS CI and rm manylinux-2010 build (EOL) --- .github/workflows/build-wheels.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 5dbdf19..d49bb7a 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -21,7 +21,7 @@ jobs: message: ${{ steps.commit_message.outputs.message }} steps: - name: Checkout the repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Gets the correct commit message for pull request with: ref: ${{ github.event.pull_request.head.sha }} @@ -42,14 +42,14 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - manylinux_tag: [2010_x86_64, 2014_x86_64, 2_24_x86_64] + manylinux_tag: [2014_x86_64, 2_24_x86_64] steps: - name: Checkout the branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: '3.9' @@ -103,8 +103,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-10.15] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + os: [macos-11, macos-12] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] # TODO: normally, one could include macos-11 and the OS list above but the produced wheels receive an error upon installation: # ERROR: trexio-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl is not a supported wheel on this platform. # This happens even with the MACOSX_DEPLOYMENT_TARGET trick. Perhaps it can be solved by configuring the build system @@ -115,10 +115,10 @@ jobs: H5_LDFLAGS: '-L/usr/local/Cellar/hdf5/1.12.1/lib' H5_CFLAGS: '-I/usr/local/Cellar/hdf5/1.12.1/include' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -126,7 +126,7 @@ jobs: run: python --version - name: Install HDF5 - run: brew install hdf5@1.12 + run: brew install hdf5@1.14 # This step is needed to produce wheels with the correct platform tag for MacOS-11 (Big Sur) #- name: Set MACOSX_DEPLOYMENT_TARGET environment variable @@ -186,10 +186,10 @@ jobs: steps: - name: Checkout the branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: '3.9' From 742f797d1a8629f018128b6db5a087d77059be99 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Fri, 5 May 2023 15:54:12 +0200 Subject: [PATCH 15/19] [wheel build] Fix MacOS CI --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index d49bb7a..ffb1f7b 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -126,7 +126,7 @@ jobs: run: python --version - name: Install HDF5 - run: brew install hdf5@1.14 + run: brew install hdf5@1.10 # This step is needed to produce wheels with the correct platform tag for MacOS-11 (Big Sur) #- name: Set MACOSX_DEPLOYMENT_TARGET environment variable From 59fe3de50518e5391de6f8191864ff77c0f4230e Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Fri, 5 May 2023 16:21:09 +0200 Subject: [PATCH 16/19] [wheel build] Fix MacOS CI, part 2 --- .github/workflows/actions.yml | 16 +++++++++++++--- .github/workflows/build-wheels.yml | 9 +++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 4897de0..4af11b8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -112,8 +112,8 @@ jobs: run: make maintainer-clean trexio_macos: - name: x86 MacOS 11 - runs-on: macos-11 + name: x86 MacOS 12 + runs-on: macos-12 steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -121,8 +121,9 @@ jobs: - name: install dependencies run: | brew install emacs - brew install hdf5 + brew install hdf5@1.12 brew install automake + brew --prefix hdf5 - name: configure with autotools run: | @@ -134,6 +135,15 @@ jobs: - name: check TREXIO run: make -j3 check + + - name: compile Python API + run: | + export H5_CFLAGS="-I$(brew --prefix hdf5)/include" + export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" + make python-install + + - name: test Python API + run: make python-test - name: Archive test log file if: failure() diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index ffb1f7b..4a8a178 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -109,11 +109,6 @@ jobs: # ERROR: trexio-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl is not a supported wheel on this platform. # This happens even with the MACOSX_DEPLOYMENT_TARGET trick. Perhaps it can be solved by configuring the build system # to produce the wheels for MacOS-11 from the very beginning - #exclude: - # - os: macos-11 - env: - H5_LDFLAGS: '-L/usr/local/Cellar/hdf5/1.12.1/lib' - H5_CFLAGS: '-I/usr/local/Cellar/hdf5/1.12.1/include' steps: - uses: actions/checkout@v3 @@ -126,7 +121,7 @@ jobs: run: python --version - name: Install HDF5 - run: brew install hdf5@1.10 + run: brew install hdf5@1.12 # This step is needed to produce wheels with the correct platform tag for MacOS-11 (Big Sur) #- name: Set MACOSX_DEPLOYMENT_TARGET environment variable @@ -158,6 +153,8 @@ jobs: run: | mkdir wheelhouse/ cd trexio-${{ env.PYTREXIO_VERSION }}/ + export H5_CFLAGS="-I$(brew --prefix hdf5)/include" + export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib" python -m build --wheel --outdir=./ delocate-wheel trexio-*.whl mv trexio-*.whl ../wheelhouse/ From e937d6cb1cc07ec70ba5897d76ba9de50abc1407 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Fri, 5 May 2023 16:25:18 +0200 Subject: [PATCH 17/19] [wheel build] Fix gfortran version on macos-12 --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 4af11b8..70f0b28 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -128,7 +128,7 @@ jobs: - name: configure with autotools run: | ./autogen.sh - ./configure FC=gfortran-10 --enable-silent-rules + ./configure FC=gfortran-12 --enable-silent-rules - name: compile TREXIO run: make -j3 From 4d00c44e8e5185f73a16d885d9686758c9252dd7 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Fri, 5 May 2023 16:44:07 +0200 Subject: [PATCH 18/19] [wheel build] MacOS CI fix --- .github/workflows/actions.yml | 4 ++-- python/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 70f0b28..11edc61 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -113,7 +113,7 @@ jobs: trexio_macos: name: x86 MacOS 12 - runs-on: macos-12 + runs-on: macos-11 steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -128,7 +128,7 @@ jobs: - name: configure with autotools run: | ./autogen.sh - ./configure FC=gfortran-12 --enable-silent-rules + ./configure FC=gfortran-11 --enable-silent-rules - name: compile TREXIO run: make -j3 diff --git a/python/requirements.txt b/python/requirements.txt index 123153a..0f6ecce 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,4 +1,4 @@ setuptools>=42 pkgconfig -numpy<1.23.0 +numpy<1.24.0 numpy>=1.17.3 From 0df3a70bbee200b60f735c7284884f8656c708a5 Mon Sep 17 00:00:00 2001 From: Evgeny Posenitskiy <45995097+q-posev@users.noreply.github.com> Date: Fri, 5 May 2023 17:06:15 +0200 Subject: [PATCH 19/19] [wheel build] No need to build from several MacOS runners --- .github/workflows/actions.yml | 4 ++-- .github/workflows/build-wheels.yml | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 11edc61..70f0b28 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -113,7 +113,7 @@ jobs: trexio_macos: name: x86 MacOS 12 - runs-on: macos-11 + runs-on: macos-12 steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 @@ -128,7 +128,7 @@ jobs: - name: configure with autotools run: | ./autogen.sh - ./configure FC=gfortran-11 --enable-silent-rules + ./configure FC=gfortran-12 --enable-silent-rules - name: compile TREXIO run: make -j3 diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4a8a178..adddb7c 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -103,12 +103,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-11, macos-12] + os: [macos-12] python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] -# TODO: normally, one could include macos-11 and the OS list above but the produced wheels receive an error upon installation: -# ERROR: trexio-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl is not a supported wheel on this platform. -# This happens even with the MACOSX_DEPLOYMENT_TARGET trick. Perhaps it can be solved by configuring the build system -# to produce the wheels for MacOS-11 from the very beginning + steps: - uses: actions/checkout@v3 @@ -123,11 +120,6 @@ jobs: - name: Install HDF5 run: brew install hdf5@1.12 - # This step is needed to produce wheels with the correct platform tag for MacOS-11 (Big Sur) - #- name: Set MACOSX_DEPLOYMENT_TARGET environment variable - # if: ${{ matrix.os == 'macos-11' }} - # run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV - - name: Compute the PYTREXIO_VERSION environment variable run: echo "PYTREXIO_VERSION=$(grep __version__ python/pytrexio/_version.py | cut -d\ -f3 | tr -d '"')" >> $GITHUB_ENV