-
Notifications
You must be signed in to change notification settings - Fork 18
152 lines (134 loc) · 5.87 KB
/
basictest_intel.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: basictest_intel
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-20.04
#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
#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 numpy matplotlib gemmi spglib ase mpmath
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)
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 \
-DNCRYSTAL_ENABLE_TESTING=ON \
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
-DMCTOOLS_REQUIRE_ALL_TEST_DEPS=ON
#Flags that we didn't need:
# -DIntelDPCPP_DIR="/opt/intel/oneapi/compiler/latest/linux/cmake/SYCL"
# -DNCRYSTAL_ENABLE_SETUPSH=ON
# -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
run: ( cd ${{github.workspace}}/build && ctest --output-on-failure --test-output-size-failed 100000 --test-output-truncation middle )
- name: Install
run: source /opt/intel/oneapi/setvars.sh && cmake --install ${{github.workspace}}/build
- name: Test installed
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
ncrystal_cif2ncmat codid::9008460
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 $(ncrystal-config --show datadir)/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)
#FIXME: Why is this next line needed?!?
#export LD_LIBRARY_PATH="$(ncrystal-config --show libdir):${LD_LIBRARY_PATH:-}"
#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