Skip to content

CI: Update plugindb.yml to allow flexible deps in plugins #809

CI: Update plugindb.yml to allow flexible deps in plugins

CI: Update plugindb.yml to allow flexible deps in plugins #809

name: basictest_intel
on:
push:
pull_request:
jobs:
ncdevtool_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src
- name: Pip install packages for ncdevtool
run: pip install -r ./src/devel/reqs/requirements_devel.txt
- name: ncdevtool checks
run: ./src/devel/bin/ncdevtool check -n "fix""me"
build:
needs: [ ncdevtool_check ]
strategy:
matrix:
include:
#We can either run ctest or install+test, but not both in the same job:
- { mode: 'ctest' }
- { mode: 'installtest' }
name: ${{ matrix.mode }}
runs-on: ubuntu-22.04
#Note March 2025: ubuntu-20.04 was retired, so updated to next oldest
# (ubuntu-22.04). This time it seemed to work!
#Old note: August 2024 the intel oneapi compilers did not work on ubuntu-22.04
#or ubuntu-latest. This is most likely because these platforms are using a
#too new c++ library from gcc, for which the intel compilers have not been
#updated. Or something like that.
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src
- name: add oneAPI to apt
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
- name: apt update
run: sudo apt update
- name: install oneAPI dpcpp compiler
run: sudo apt install intel-oneapi-compiler-dpcpp-cpp
- name: install oneAPI runtime libs
run: sudo apt install intel-oneapi-runtime-libs
- name: Enable parallel cmake
run: python ./src/devel/bin/ncdevtool nprocs --enable-github-parallel
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
#NB: We don't test matplotlib import here in the next step, since we want
#to make sure that our CTest infrastructure correctly avoids problems from
#"building font cache" printouts on first imports.
- name: pip install extra deps
run: |
python3 -mpip install -r ./src/devel/reqs/requirements_all_and_devel.txt
python3 -c "import numpy; print('numpy imported ok')"
python3 -c "import gemmi; print('gemmi imported ok')"
python3 -c "import spglib; print('spglib imported ok')"
python3 -c "import ase; print('ase imported ok')"
python3 -c "import mpmath; print('mpmath imported ok')"
- name: Configure CMake
run: |
source /opt/intel/oneapi/setvars.sh
#NB: We could use
# -DCMAKE_CXX_COMPILER=icpx
# -DCMAKE_C_COMPILER=icx
#But just because it seems to be something that might be useful. we do:
export CC=$(which icx)
export CXX=$(which icpx)
export NC_EXTRA_ARGS="-DNCRYSTAL_ENABLE_TESTING=ON -DMCTOOLS_REQUIRE_ALL_TEST_DEPS=ON -DNCRYSTAL_SKIP_INSTALL=ON"
if [ "x${{ matrix.mode }}" != "xctest" ]; then
export NC_EXTRA_ARGS="-DNCRYSTAL_ENABLE_TESTING=OFF"
fi
cmake \
-S ${{github.workspace}}/src \
-B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-DNCRYSTAL_ENABLE_EXAMPLES=ON \
-DNCRYSTAL_BUILD_STRICT=ON \
${NC_EXTRA_ARGS}
#Flags that we didn't need:
# -DIntelDPCPP_DIR="/opt/intel/oneapi/compiler/latest/linux/cmake/SYCL"
# -DMKL_ROOT="/opt/intel/oneapi/mkl/latest"
# -DTBB_ROOT="/opt/intel/oneapi/tbb/latest"
- name: Build
run: >
source /opt/intel/oneapi/setvars.sh &&
cmake
--build ${{github.workspace}}/build
--config Release
- name: CTest
if: matrix.mode == 'ctest'
run: ctest --test-dir ./build --no-tests=error --output-on-failure --test-output-size-failed 100000 --test-output-truncation middle
- name: Install
if: matrix.mode != 'ctest'
run: source /opt/intel/oneapi/setvars.sh && cmake --install ${{github.workspace}}/build
- name: Test installed
if: matrix.mode != 'ctest'
env:
NCRYSTAL_ONLINEDB_FORBID_NETWORK: 1
run: |
source /opt/intel/oneapi/setvars.sh
set -eux
#Expose ncrystal-config and examples:
export PATH="${{github.workspace}}/install/bin:${PATH:-}"
#Add python modules and cmdline scripts:
pip install ${{github.workspace}}/src/ncrystal_python
ncrystal-config --summary
nctool --test
ncrystal-config --help
ncrystal_example_c
ncrystal_example_cpp
python3 ${{github.workspace}}/src/examples/ncrystal_example_py
nctool --help
nctool --dump 'Al_sg225.ncmat;dcutoff=1.5'
python3 -c 'import NCrystal; NCrystal.test()'
ncrystal_vdos2ncmat --help
ncrystal_cif2ncmat --help
ncrystal_ncmat2cpp --help
ncrystal_hfg2ncmat --help
ncrystal_verifyatompos --help
export NCRYSTAL_ONLINEDB_CACHEDIR="$PWD/codidcache"
mkdir -p "${NCRYSTAL_ONLINEDB_CACHEDIR}"
cp ./src/tests/data/fake_cod_9005777.cif "${NCRYSTAL_ONLINEDB_CACHEDIR}/cod_9005777.cif"
ncrystal_cif2ncmat codid::9005777
ncrystal_ncmat2hkl --help
ncrystal_ncmat2hkl --format=laz 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.laz
ncrystal_ncmat2hkl --format=lau 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.lau
nctool -d ./test_Al.laz
nctool -d ./test_Al.lau
ncrystal_ncmat2cpp Al_sg225.ncmat -o test.cpp
cat test.cpp
nctool --pdf Al_sg225.ncmat
#Examples from README:
export CC=$(which icx)
export CXX=$(which icpx)
cp ./src/examples/ncrystal_example_cpp.cc ./my_cpp_code.cpp
cp ./src/examples/ncrystal_example_c.c ./my_c_code.c
test -f $(ncrystal-config --show libpath)
test -d $(ncrystal-config --show libdir)
#NOTE: Important that build flags comes AFTER the code being
#compiled. Otherwise ncrystal symbols will be initially ignored, leading
#to errors later:
$CC -std=c11 my_c_code.c $(ncrystal-config --show buildflags) -o my_c_app
./my_c_app
$CXX -std=c++17 my_cpp_code.cpp $(ncrystal-config --show buildflags) -o my_cpp_app
./my_cpp_app
echo "Custom compilation of downstream C/C++ code succeeded"
# - name: install oneAPI MKL library
# run: |
# sudo apt install intel-oneapi-mkl-devel
#TK - name: Add Intel package sources
#TK run: |
#TK wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
#TK echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
#TK sudo apt update
#TK
#TK - name: Install Intel OneAPI Base Toolkit
#TK run: |
#TK sudo apt install intel-basekit