diff --git a/.github/workflows/phono3py-pytest-conda-mkl.yml b/.github/workflows/phono3py-pytest-conda-mkl.yml new file mode 100644 index 00000000..fdff9130 --- /dev/null +++ b/.github/workflows/phono3py-pytest-conda-mkl.yml @@ -0,0 +1,51 @@ +name: Python Package using Conda + +on: + push: + branches-ignore: + - master + - rc + +jobs: + build-linux: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + strategy: + matrix: + python-version: ["3.10"] + + steps: + - uses: actions/checkout@v2 + # Use conda-incubator/setup-miniconda for precise control of conda infrastructure + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + channels: conda-forge + channel-priority: strict + python-version: ${{ matrix.python-version }} + - name: Install dependent packages + run: | + conda activate test + conda install --yes python=${{ matrix.python-version }} + #conda install --yes matplotlib-base pyyaml "libblas=*=*openblas" openblas h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler + conda install --yes matplotlib-base pyyaml "libblas=*=*mkl" mkl-include h5py scipy pytest codecov pytest-cov spglib alm cmake c-compiler + - name: Install phonopy + run: | + conda activate test + git clone --depth 1 https://github.com/phonopy/phonopy.git + cd phonopy + pip install -e . -vvv + cd .. + - name: Install phono3py + run: | + conda activate test + pip install -e . -vvv + - name: Run pytest + run: | + pytest --cov=./ --cov-report=xml test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + verbose: true diff --git a/CMakeLists.txt b/CMakeLists.txt index cabb5f1c..238556db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,8 +55,17 @@ endif() if (PHONO3PY OR PHONONMOD) if (BLAS_LIBRARIES MATCHES "libmkl") - message(STATUS "MKL library detected") - add_compile_definitions(MKL_LAPACKE) # phono3py macro + message(STATUS "MKL detected: Set C-macros MKL_LAPACKE MULTITHREADED_BLAS") + add_compile_definitions(MKL_LAPACKE) + add_compile_definitions(MULTITHREADED_BLAS) # phono3py macro + add_compile_definitions(NPY_NO_DEPRECATED_API=0) # phono3py macro + add_compile_definitions(THM_EPSILON=1e-10) # phono3py macro + endif() + if (BLAS_LIBRARIES MATCHES "libopenblas") + message(STATUS "OpenBLAS detected: Set C-macro MULTITHREADED_BLAS") + add_compile_definitions(MULTITHREADED_BLAS) # phono3py macro + add_compile_definitions(NPY_NO_DEPRECATED_API=0) # phono3py macro + add_compile_definitions(THM_EPSILON=1e-10) # phono3py macro endif() endif() diff --git a/c/phonon.c b/c/phonon.c index a388db6c..e27fb8dd 100644 --- a/c/phonon.c +++ b/c/phonon.c @@ -214,8 +214,8 @@ static void get_undone_phonons( } /* To avoid multithreaded BLAS in OpenMP loop */ -#ifdef _OPENMP #ifndef MULTITHREADED_BLAS +#ifdef _OPENMP #pragma omp parallel for private(j, gp, freqs_tmp, info) #endif #endif @@ -274,8 +274,8 @@ static void get_gonze_undone_phonons( } /* To avoid multithreaded BLAS in OpenMP loop */ -#ifdef _OPENMP #ifndef MULTITHREADED_BLAS +#ifdef _OPENMP #pragma omp parallel for private(j, gp, freqs_tmp, info) #endif #endif