diff --git a/conda.recipe/bld.bat b/conda.recipe/bld.bat new file mode 100644 index 00000000..6d121506 --- /dev/null +++ b/conda.recipe/bld.bat @@ -0,0 +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 diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml index 599b3af6..9343590d 100644 --- a/conda.recipe/conda_build_config.yaml +++ b/conda.recipe/conda_build_config.yaml @@ -4,6 +4,9 @@ python: - 3.10 - 3.11 +c_compiler: + - vs2022 # [win] + mpi: - mpich # [not win] - msmpi # [win] \ No newline at end of file diff --git a/setup.py b/setup.py index bc0e3372..b3eb1181 100644 --- a/setup.py +++ b/setup.py @@ -92,20 +92,35 @@ extra_objects+=['-Wl,--whole-archive', f'{PDAFdir}/lib/libpdaf-var.a', f'{pwd}/lib/libPDAFc.a', '-Wl,--no-whole-archive'] +# add mpi library path +if os.name == 'nt': + # always use external msmpi as msmpi from conda cannot be linked + MPI_LIB_PATH=dist.get_option_dict('pyPDAF')['MPI_LIB_PATH'][1] + if MPI_LIB_PATH != '': library_dirs += MPI_LIB_PATH.split(',') + libraries += ['msmpi', 'msmpifec'] +else: + mpifortran = 'mpiifort' if compiler == 'intel' else 'mpifort' + result = subprocess.run([mpifortran, '-show'], stdout=subprocess.PIPE) + result = result.stdout.decode()[:-1].split(' ') + s = [l[2:].replace('"', '') for l in result if l[:2] == '-L'] + if len(s) > 0: library_dirs += s + s = [l[2:] for l in result if l[:2] == '-l'] + if len(s) > 0: libraries += s + # linking BLAS/LAPACK use_MKL=dist.get_option_dict('pyPDAF')['use_MKL'][1] if use_MKL == 'True': condaBuild = dist.get_option_dict('pyPDAF')['condaBuild'][1] if condaBuild == 'True': - MKLROOT = os.path.join(os.environ['PREFIX'], 'lib') + 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,] - libraries = ['mkl_core', 'mkl_sequential', 'mkl_intel_lp64'] + 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', @@ -119,20 +134,6 @@ print ('LAPACK_Flag', LAPACK_Flag) if LAPACK_Flag != '': libraries += LAPACK_Flag.split(',') -# add mpi library path -if os.name == 'nt': - MPI_LIB_PATH=dist.get_option_dict('pyPDAF')['MPI_LIB_PATH'][1] - library_dirs+=[MPI_LIB_PATH,] - libraries += ['msmpi', 'msmpifec'] -else: - mpifortran = 'mpiifort' if compiler == 'intel' else 'mpifort' - result = subprocess.run([mpifortran, '-show'], stdout=subprocess.PIPE) - result = result.stdout.decode()[:-1].split(' ') - s = [l[2:].replace('"', '') for l in result if l[:2] == '-L'] - if len(s) > 0: library_dirs += s - s = [l[2:] for l in result if l[:2] == '-l'] - if len(s) > 0: libraries += s - # add fortran library to the linking if os.name != 'nt': suffix = 'dylib' if sys.platform == 'darwin' else 'so'