Skip to content

Commit

Permalink
conda package for Linux done
Browse files Browse the repository at this point in the history
  • Loading branch information
yumengch committed Jan 24, 2024
1 parent dc079cf commit e5f8875
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
6 changes: 1 addition & 5 deletions conda.recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#!/usr/bin/env bash
set -ex

sed -i "s^use_MKL=^use_MKL=True^g" setup.cfg
sed -i "s^MKLROOT=^MKLROOT=${CONDA_PREFIX}/lib^g" setup.cfg


# Install the Python package, but without dependencies,
# because Conda takes care of that
$PYTHON -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
sed -i "s^MKLROOT=${CONDA_PREFIX}/lib^MKLROOT=^g" setup.cfg
$PYTHON -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ CPP_DEFS = -DUSE_PDAF
[pyPDAF]
pwd = /home/runner/work/pyPDAF/pyPDAF/
CC = mpicc
condaBuild =
# if MKL is used, give the path to the static MKL library
use_MKL=
MKLROOT=
# if dynamic/shared liblapack and libblas library is used,
# give the library path and flags
LAPACK_PATH=
LAPACK_Flag=
LAPACK_Flag=lapack,blas
# GIVE MPI information
MPI_INC_PATH=
MPI_MOD_PATH=
Expand Down
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@
# linking BLAS/LAPACK
use_MKL=dist.get_option_dict('pyPDAF')['use_MKL'][1]
if use_MKL == 'True':
MKLROOT=dist.get_option_dict('pyPDAF')['MKLROOT'][1]
condaBuild = dist.get_option_dict('pyPDAF')['condaBuild'][1]
if condaBuild == 'True':
MKLROOT = os.path.join(os.environ['PREFIX'], 'lib')
else:
MKLROOT = dist.get_option_dict('pyPDAF')['MKLROOT'][1]

if os.name == 'nt':
library_dirs+=[MKLROOT,]
libraries = ['mkl_core', 'mkl_sequential', 'mkl_intel_lp64']
else:

extra_objects+=['-Wl,--start-group',
f'{MKLROOT}/libmkl_intel_lp64.a',
f'{MKLROOT}/libmkl_sequential.a',
Expand Down Expand Up @@ -130,8 +136,10 @@
# add fortran library to the linking
if os.name != 'nt':
suffix = 'dylib' if sys.platform == 'darwin' else 'so'
result = subprocess.run(['gfortran', '--print-file', 'libgfortran.'+suffix], stdout=subprocess.PIPE)
result = result.stdout.decode()[:-18] if sys.platform == 'darwin' else result.stdout.decode()[:-15]
result = subprocess.run(['gfortran', '--print-file',
'libgfortran.'+suffix], stdout=subprocess.PIPE)
result = result.stdout.decode()
result = result[:-18] if sys.platform == 'darwin' else result[:-15]
library_dirs+=[result,]
library_dirs+=['/usr/lib', ]
# somehow gfortran is always necessary
Expand Down
2 changes: 1 addition & 1 deletion setup_mac.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ MKLROOT=
# if dynamic/shared liblapack and libblas library is used,
# give the library path and flags
LAPACK_PATH=
LAPACK_Flag=
LAPACK_Flag=lapack,blas
# GIVE MPI information
MPI_INC_PATH=
MPI_MOD_PATH=
Expand Down

0 comments on commit e5f8875

Please sign in to comment.