Skip to content

Commit 526a3d2

Browse files
committed
Fix: Resolve the compilation error in the Intel oneAPI 2025.3 container.
1 parent ea6dbc7 commit 526a3d2

File tree

3 files changed

+63
-30
lines changed

3 files changed

+63
-30
lines changed

.github/workflows/devcontainer.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Container
22

33
on:
4+
pull_request: # FOR TESTING ONLY
5+
branches:
6+
- develop
47
push:
58
branches:
69
- develop
@@ -41,6 +44,7 @@ jobs:
4144
password: ${{ secrets.GITHUB_TOKEN }}
4245

4346
- name: Login to Aliyun Registry
47+
if: github.event.pull_request.head.repo.full_name == github.repository
4448
uses: docker/login-action@v3
4549
with:
4650
registry: dp-harbor-registry.us-east-1.cr.aliyuncs.com
@@ -54,6 +58,7 @@ jobs:
5458
tags: ${{ steps.meta.outputs.tags }}
5559
labels: ${{ steps.meta.outputs.labels }}
5660
file: Dockerfile.${{ matrix.dockerfile }}
57-
push: true
61+
# push: true
62+
push: ${{ github.event_name != 'pull_request' }}
5863
cache-from: type=registry,ref=ghcr.io/deepmodeling/abacus-${{ matrix.dockerfile }}:latest
5964
cache-to: type=inline

Dockerfile.intel

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ubuntu:22.04
22

33
RUN apt-get update && apt-get install -y \
44
bc cmake git gnupg gcc g++ python3-numpy sudo wget vim unzip \
5-
libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev
5+
libcereal-dev libxc-dev libgtest-dev libgmock-dev libbenchmark-dev \
6+
pkg-config build-essential autoconf automake libtool
67

78
# Following steps by https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html .
89
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
@@ -16,21 +17,39 @@ RUN apt-get update && \
1617
intel-oneapi-compiler-dpcpp-cpp \
1718
intel-oneapi-compiler-fortran \
1819
intel-oneapi-mkl-devel \
19-
intel-oneapi-mpi-devel="2021.11.*" \
20+
intel-oneapi-mpi-devel \
2021
intel-oneapi-vtune && \
21-
rm /opt/intel/oneapi/mpi/latest && ln -s /opt/intel/oneapi/mpi/2021.11 /opt/intel/oneapi/mpi/latest
22-
ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest \
23-
LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib/:/opt/intel/oneapi/ippcp/latest/lib/:/opt/intel/oneapi/ipp/latest/lib:/opt/intel/oneapi/dpl/latest/lib:/opt/intel/oneapi/dnnl/latest/lib:/opt/intel/oneapi/dal/latest/lib:/opt/intel/oneapi/compiler/latest/lib:/opt/intel/oneapi/ccl/latest/lib/ \
24-
LD_LIBRARY_PATH=/opt/intel/oneapi/tbb/latest/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/lib:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib:/opt/intel/oneapi/itac/latest/slib:/opt/intel/oneapi/ippcp/latest/lib/:/opt/intel/oneapi/ipp/latest/lib:/opt/intel/oneapi/dpl/latest/lib:/opt/intel/oneapi/dnnl/latest/lib:/opt/intel/oneapi/debugger/latest/opt/debugger/lib:/opt/intel/oneapi/dal/latest/lib:/opt/intel/oneapi/compiler/latest/opt/oclfpga/host/linux64/lib:/opt/intel/oneapi/compiler/latest/opt/compiler/lib:/opt/intel/oneapi/compiler/latest/lib:/opt/intel/oneapi/ccl/latest/lib/ \
25-
PATH=/opt/intel/oneapi/vtune/latest/bin64:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/bin:/opt/intel/oneapi/mpi/latest/bin:/opt/intel/oneapi/mkl/latest/bin/:/opt/intel/oneapi/itac/latest/bin:/opt/intel/oneapi/inspector/latest/bin64:/opt/intel/oneapi/dpcpp-ct/latest/bin:/opt/intel/oneapi/dev-utilities/latest/bin:/opt/intel/oneapi/debugger/latest/opt/debugger/bin:/opt/intel/oneapi/compiler/latest/opt/oclfpga/bin:/opt/intel/oneapi/compiler/latest/bin:/opt/intel/oneapi/advisor/latest/bin64:/opt/mamba/bin:/opt/mamba/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
26-
MKLROOT=/opt/intel/oneapi/mkl/latest \
27-
FI_PROVIDER_PATH=/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/lib/prov:/usr/lib/x86_64-linux-gnu/libfabric \
28-
CMAKE_PREFIX_PATH=/opt/intel/oneapi/tbb/latest/env/..:/opt/intel/oneapi/mkl/latest/lib/cmake:/opt/intel/oneapi/ipp/latest/lib/cmake/ipp:/opt/intel/oneapi/dpl/latest/lib/cmake/oneDPL:/opt/intel/oneapi/dnnl/latest/lib/cmake:/opt/intel/oneapi/dal/latest:/opt/intel/oneapi/compiler/latest \
29-
CMPLR_ROOT=/opt/intel/oneapi/compiler/latest
22+
apt-get clean && \
23+
rm -rf /var/lib/apt/lists/*
24+
25+
# Set oneAPI environment variables
26+
ENV ONEAPI_ROOT=/opt/intel/oneapi
27+
ENV I_MPI_ROOT=${ONEAPI_ROOT}/mpi/latest
28+
ENV MKLROOT=${ONEAPI_ROOT}/mkl/latest
29+
ENV CMPLR_ROOT=${ONEAPI_ROOT}/compiler/latest
30+
31+
# Set library paths and include paths
32+
ENV LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/:${LIBRARY_PATH}
33+
ENV LD_LIBRARY_PATH=${ONEAPI_ROOT}/tbb/latest/lib/intel64/gcc4.8:${ONEAPI_ROOT}/mpi/latest/lib:${MKLROOT}/lib/intel64:${ONEAPI_ROOT}/compiler/latest/lib/:${LD_LIBRARY_PATH}
34+
ENV PATH=${ONEAPI_ROOT}/vtune/latest/bin64:${ONEAPI_ROOT}/mpi/latest/bin:${MKLROOT}/bin/intel64:${ONEAPI_ROOT}/compiler/latest/bin:${PATH}
35+
ENV CPATH=${MKLROOT}/include:${ONEAPI_ROOT}/mpi/latest/include:${CPATH}
36+
ENV PKG_CONFIG_PATH=${MKLROOT}/lib/pkgconfig:${ONEAPI_ROOT}/mpi/latest/lib/pkgconfig:${PKG_CONFIG_PATH}
37+
38+
# Set CMAKE related paths
39+
ENV CMAKE_PREFIX_PATH=${ONEAPI_ROOT}/tbb/latest:${MKLROOT}/lib/cmake:${ONEAPI_ROOT}/dpl/latest/lib/cmake:${ONEAPI_ROOT}/dnnl/latest/lib/cmake:${ONEAPI_ROOT}/dal/latest:${ONEAPI_ROOT}/compiler/latest:${CMAKE_PREFIX_PATH}
3040

3141
SHELL ["/bin/bash", "-c"]
3242
ENV CC=mpiicx CXX=mpiicpx FC=mpiifx
3343

44+
# Verify oneAPI installation
45+
RUN source ${ONEAPI_ROOT}/setvars.sh && \
46+
echo "=== Verify compiler ===" && \
47+
which mpiicx && mpiicx --version && \
48+
echo "=== Verify MKL ===" && \
49+
ls ${MKLROOT}/lib/intel64/ && \
50+
echo "=== Verify MPI ===" && \
51+
which mpirun && mpirun --version
52+
3453
# https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html
3554
RUN source /opt/intel/oneapi/setvars.sh && \
3655
cd /tmp && \
@@ -39,28 +58,35 @@ RUN source /opt/intel/oneapi/setvars.sh && \
3958
tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \
4059
cd elpa-$ELPA_VER && mkdir build && cd build && \
4160
../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \
42-
make -j`nproc` && \
61+
make -j$(nproc) && \
4362
make PREFIX=/usr/local install && \
4463
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
4564
cd /tmp && rm -rf elpa-$ELPA_VER
4665

47-
RUN cd /tmp && git clone https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ \
48-
&& rm -rf rapidjson
49-
50-
RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip \
51-
--no-check-certificate --quiet -O libtorch.zip && \
52-
unzip -q libtorch.zip -d /opt && rm libtorch.zip
53-
54-
ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake
66+
# rapidjson and libtorch
67+
RUN cd /tmp && git clone --depth 1 https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ && rm -rf rapidjson
68+
RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \
69+
unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip
70+
ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH}
5571

72+
# Clone and build abacus (optional during image build; keep for CI image)
5673
ADD https://api.github.com/repos/deepmodeling/abacus-develop/git/refs/heads/develop /dev/null
57-
58-
RUN source /opt/intel/oneapi/setvars.sh && \
59-
git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
74+
RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \
75+
export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \
76+
cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
6077
cd abacus-develop && \
61-
cmake -B build -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_RAPIDJSON=ON && \
62-
cmake --build build -j`nproc` && \
78+
cmake -B build \
79+
-DMKL_SYCL=OFF \
80+
-DENABLE_MLALGO=ON \
81+
-DENABLE_PEXSI=ON \
82+
-DENABLE_LIBXC=ON \
83+
-DENABLE_LIBRI=ON \
84+
-DENABLE_RAPIDJSON=ON \
85+
-DCMAKE_BUILD_TYPE=Release && \
86+
cmake --build build -j"$(nproc)" && \
6387
cmake --install build && \
64-
rm -rf build && \
65-
abacus --version
66-
#&& rm -rf abacus-develop
88+
(/usr/local/bin/abacus --version || echo "ABACUS installed but version check failed") && \
89+
rm -rf /tmp/abacus-develop
90+
91+
# Default entry
92+
CMD ["/bin/bash"]

cmake/FindMKL.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ if(MKL_FOUND)
7070
set_property(TARGET MKL::MKL PROPERTY
7171
INTERFACE_LINK_LIBRARIES
7272
"-Wl,--start-group"
73-
MKL::INTEL MKL::INTEL_THREAD MKL::CORE)
73+
MKL::INTEL MKL::INTEL_THREAD MKL::CORE
74+
"-Wl,--end-group"
75+
)
7476
endif()
7577
endif()
7678

0 commit comments

Comments
 (0)