Skip to content

Commit

Permalink
Upgrade pyPDAF to be compatible with PDAF V2.2.1 (#4)
Browse files Browse the repository at this point in the history
* adding new interface functions; improved documentation; improved file parser; adding array annotation in Cython; PDAF compilation with CMake in Linux

* fixes bugs in C interface code; fixes issues with installation; add CMake configurations; uses single precision integer in examples for compatibility with Fortran and Cython declaration.

* update the pointer to submodule

update the pointer to submodule

* add missed subroutine interface c__pdafomi_localize_covar_noniso

work out build process and CI for Linux and Mac; cleaned compile pyPDAF on windows; hopefully improved stability using intel-fortran-rt and mpi when new conda version is published; cannot workout a windows build CI as it seems very difficult to set up Intel Fortran with Visual studio in github runner but it is useful to keep the compiler environment variable options.

* separate model ensemble and model integrator

* improved robustness of conda installation; allowing conda packaging from github runner for mac and linux
  • Loading branch information
yumengch committed Oct 10, 2024
1 parent a0edd35 commit 89c610c
Show file tree
Hide file tree
Showing 59 changed files with 3,889 additions and 2,312 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: condaBuild
name: conda_build_linux
on: [workflow_dispatch]
jobs:
check_mac_installation:
runs-on: macos-latest
upload_conda_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
ref: intelMacConda
ref: upgrade2.2.1

- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
auto-update-conda: true
activate-environment: ""

- name: install pyPDAF
shell: bash -el {0}
run: |
cp PDAFBuild/setup_conda_linux.cfg setup.cfg
conda install python anaconda-client conda-build conda-verify
anaconda login --username yumengch --password ${{ secrets.ANACONDA }}
conda config --set anaconda_upload yes
conda-build -c conda-forge -c intel conda.recipe/
conda-build -c conda-forge conda.recipe/
conda install -y -c conda-forge --use-local pypdaf
mpiexec -n 4 python -u example/main.py
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
37 changes: 37 additions & 0 deletions .github/workflows/conda_build_mac_intel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: conda_build_mac_intel
on: [workflow_dispatch]
jobs:
upload_conda_mac_intel:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
ref: upgrade2.2.1

- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
auto-update-conda: true
activate-environment: ""

- name: build pyPDAF
shell: bash -el {0}
run: |
cp PDAFBuild/setup_conda_intel_mac.cfg setup.cfg
conda install python anaconda-client conda-build conda-verify
anaconda login --username yumengch --password ${{ secrets.ANACONDA }}
conda config --set anaconda_upload yes
conda-build -c conda-forge conda.recipe/
- name: install pyPDAF
shell: bash -el {0}
run: |
conda install -y -c conda-forge --use-local pypdaf
mv example/config_mac.py example/config.py
mv example/config_obsA_mac.py example/config_obsA.py
mpiexec -n 4 python -u example/main.py
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
37 changes: 37 additions & 0 deletions .github/workflows/conda_build_mac_m1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: conda_build_mac_m1
on: [workflow_dispatch]
jobs:
upload_conda_mac_m1:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
ref: upgrade2.2.1

- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
auto-update-conda: true
activate-environment: ""

- name: build pyPDAF
shell: bash -el {0}
run: |
cp PDAFBuild/setup_conda_m1_mac.cfg setup.cfg
conda install python anaconda-client conda-build conda-verify
anaconda login --username yumengch --password ${{ secrets.ANACONDA }}
conda config --set anaconda_upload yes
conda-build -c conda-forge conda.recipe/
- name: install pyPDAF
shell: bash -el {0}
run: |
conda install -y -c conda-forge --use-local pypdaf
mv example/config_mac.py example/config.py
mv example/config_obsA_mac.py example/config_obsA.py
mpiexec -n 4 python -u example/main.py
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
52 changes: 0 additions & 52 deletions .github/workflows/test_build.yaml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/test_linux_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: test_linux_build
on: [workflow_dispatch]

jobs:
test_ubuntu_build:
runs-on: ubuntu-latest
steps:
- name: check out code
uses: actions/checkout@v4
with:
submodules: 'true'
ref: main

- name: installing dependent libraries
run: sudo apt install -y liblapack-dev libblas-dev libopenmpi-dev

- name: Set up Python 3.x
uses: actions/setup-python@v5

- name: install pyPDAF
run: pip install -v .

- name: run example
run: mpiexec --oversubscribe -n 4 python -u example/main.py

- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
40 changes: 40 additions & 0 deletions .github/workflows/test_mac_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test_mac_build
on: [workflow_dispatch]

jobs:
test_mac_build:
runs-on: macos-latest
steps:
- name: check out code
uses: actions/checkout@v4
with:
submodules: 'true'
ref: upgrade2.2.1

- name: Setup Fortran compiler
uses: fortran-lang/[email protected]
id: setup-fortran
with:
compiler: gcc
version: 13

- name: install dependent Libaries
run: brew install openblas lapack open-mpi

- name: Set up Python 3.x
uses: actions/setup-python@v5

- name: install pyPDAF
run: |
mv setup_mac.cfg setup.cfg
pip install -v .
- name: run example
run: |
mv example/config_mac.py example/config.py
mv example/config_obsA_mac.py example/config_obsA.py
mpiexec --oversubscribe -n 4 python -u example/main.py
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
81 changes: 81 additions & 0 deletions .github/workflows/test_win_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: test_win_build
on: [workflow_dispatch]

env:
WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/e83a8e64-04fc-45df-85c6-c2208d03bdb5/w_BaseKit_p_2024.2.0.635_offline.exe
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/0d500705-397e-41b3-8b2b-2a3da1753fc2/w_HPCKit_p_2024.2.0.633_offline.exe
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
WINDOWS_DPCPP_COMPONENTS: intel.oneapi.win.mkl.devel:intel.oneapi.win.tbb.devel
CACHE_NUMBER: 5
COMPILER_VERSION: 2024.2.0
TBB_VERSION: 2021.13.0
VS_VER: vs2022

jobs:
test_windows_build:
runs-on: windows-latest
steps:
- name: check out oneAPI code
uses: actions/checkout@v4
with:
repository: oneapi-src/oneapi-ci

- name: cache install fortran
id: cache-install-fortran
uses: actions/cache@v2
with:
path: |
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
C:\Program Files (x86)\Intel\oneAPI\compiler
key: install-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/scripts/cache_exclude_windows.sh') }}

- name: install fortran
if: steps.cache-install.outputs.cache-hit != 'true'
shell: bash
run: scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS

- name: cache install mkl
id: cache-install-mkl
uses: actions/cache@v2
with:
path: |
C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat
C:\Program Files (x86)\Intel\oneAPI\compiler
C:\Program Files (x86)\Intel\oneAPI\tbb
C:\Windows\System32\OpenCL.dll
key: install-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_BASEKIT_URL }}-${{ env.WINDOWS_DPCPP_COMPONENTS }}-compiler-tbb-opencl-${{ hashFiles('**/scripts/cache_exclude_windows.sh') }}

- name: install mkl
if: steps.cache-install.outputs.cache-hit != 'true'
shell: bash
run: scripts/install_windows.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_COMPONENTS

- name: restore registry on cache hit
if: steps.cache-install.outputs.cache-hit == 'true'
shell: bash
run: scripts/restore_registry.bat $COMPILER_VERSION $TBB_VERSION

- name: check out pyPDAF code
uses: actions/checkout@v4
with:
submodules: 'true'
ref: upgrade2.2.1

- name: install pyPDAF
run: |
cmd.exe /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cmd.exe /k "C:\Program Files (x86)\Intel\oneAPI\compiler\2024.2\env\vars.bat"
cmd.exe /k '"C:\Program Files (x86)\Intel\oneAPI\mkl\latest\env\vars.bat" && powershell'
cd D:\a\pyPDAF\pyPDAF
Move-Item -Path setup_win.cfg -Destination setup.cfg -Force
pip install -v .
- name: run example
run: |
Move-Item -Path example/config_win.py -Destination example/config.py -Force
Move-Item -Path example/config_obsA_win.py -Destination example/config_obsA.py -Force
mpiexec --oversubscribe -n 4 python -u example/main.py
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "PDAF_V2.1"]
path = PDAF_V2.1
url = https://github.com/PDAF/PDAF/
branch = PDAF_V2.1
[submodule "PDAF_V2.2.1"]
path = PDAF_V2.2.1
url = https://github.com/PDAF/PDAF.git
branch = PDAF_V2.2.1
Loading

0 comments on commit 89c610c

Please sign in to comment.