Skip to content

Commit

Permalink
improved robustness of conda installation
Browse files Browse the repository at this point in the history
  • Loading branch information
yumengch committed Jul 24, 2024
1 parent c623623 commit 38379e8
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/conda_build_mac_intel.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: conda_build_mac_intel
on: [workflow_dispatch, pull_request]
on: [workflow_dispatch]
jobs:
upload_conda_mac_intel:
runs-on: macos-13
Expand All @@ -21,7 +21,7 @@ jobs:
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 no
conda config --set anaconda_upload yes
conda-build -c conda-forge conda.recipe/
- name: install pyPDAF
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/conda_build_mac_m1.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: conda_build_mac_m1
on: [workflow_dispatch, pull_request]
on: [workflow_dispatch]
jobs:
upload_conda_mac_m1:
runs-on: macos-latest
Expand All @@ -21,7 +21,7 @@ jobs:
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 no
conda config --set anaconda_upload yes
conda-build -c conda-forge conda.recipe/
- name: install pyPDAF
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_win_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- 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\latest\env\vars.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
Expand Down
20 changes: 20 additions & 0 deletions PDAFBuild/setup_conda_win.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[pyPDAF]
pwd = D:\a\pyPDAF\pyPDAF
PDAF_dir = PDAF_V2.2.1
cmake_config_path = D:\a\pyPDAF\pyPDAF\PDAFBuild\win_intel_msmpi_pypdaf.cmake
condaBuild = True
# compilers used in fortran and C
# c_compiler can be: gcc, msvc, icc, clang
# fortran compiler can be: gfortran, ifort
# fortran compiler should be consistent with the compiler used in cmake configuration file
c_compiler = msvc
fortran_compiler = ifort
# if MKL is used, give the path to the static MKL library
use_MKL= True
MKLROOT=
# if dynamic/shared liblapack and libblas library is used,
# give the library path and flags
LAPACK_PATH=
LAPACK_Flag=lapack,blas
# GIVE MPI information
MPI_LIB_PATH=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64
2 changes: 1 addition & 1 deletion conda.recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2022

%PYTHON -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
"%PYTHON%" -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
2 changes: 1 addition & 1 deletion conda.recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ python:
- 3.9
- 3.10
- 3.11
- 3.12
- 3.12 # [not win]

c_compiler:
- vs2022 # [win]
Expand Down
12 changes: 6 additions & 6 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% set version = "0.02" %}
{% set version = "0.03" %}

package:
name: pypdaf
version: 0.0.2
version: 0.0.3

source:
noarch: python
Expand All @@ -14,6 +14,7 @@ build:
requirements:
host:
- python {{python}}
- setuptools
- pip
- cython
- numpy
Expand All @@ -25,14 +26,13 @@ requirements:
build:
- {{ compiler('c') }}
- {{ compiler('fortran') }} # [not win]
- cmake
- setuptools
- make # [not win]
- cmake # [not win]
- make # [not win]
run:
- python
- {{ pin_compatible('numpy') }}
- mpi4py
- intel-fortran-rt # [win]
- intel-fortran-rt=2024.2.0 # [win]
- {{ mpi }}
- blas-devel=*=*netlib* # [osx]
- liblapack=*=*netlib* # [osx]
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,20 @@
# MKLROOT = os.environ['LIBRARY_LIB'] if os.name == 'nt' else \
# os.path.join(os.environ['PREFIX'], 'lib')
# else:

MKLROOT = dist.get_option_dict('pyPDAF')['MKLROOT'][1]
# assert MKLROOT != '', 'MKLROOT must not be empty, check setup.cfg file'

if os.name == 'nt':
library_dirs+=[MKLROOT,]
if MKLROOT != '': library_dirs+=[MKLROOT,]
libraries += ['mkl_core', 'mkl_sequential', 'mkl_intel_lp64']
elif sys.platform == "linux" or sys.platform == "linux2":
MKLROOT = dist.get_option_dict('pyPDAF')['MKLROOT'][1]
if condaBuild == 'True': MKLROOT = os.path.join(os.environ['PREFIX'], 'lib')
extra_objects+=['-Wl,--start-group',
f'{MKLROOT}/libmkl_intel_lp64.a',
f'{MKLROOT}/libmkl_sequential.a',
f'{MKLROOT}/libmkl_core.a',
'-Wl,--end-group']
else:
MKLROOT = dist.get_option_dict('pyPDAF')['MKLROOT'][1]
if condaBuild == 'True': MKLROOT = os.path.join(os.environ['PREFIX'], 'lib')
extra_objects+=[
f'{MKLROOT}/libmkl_intel_lp64.a',
Expand Down

0 comments on commit 38379e8

Please sign in to comment.