Skip to content

Commit 443f89e

Browse files
Fix: Resolve the compilation error in the Intel oneAPI 2025.3 container. (#6677)
* Fix: Resolve the compilation error in the Intel oneAPI 2025.3 container. * Fix: Turn off pexsi * Update Dockerfile for abacus-develop configuration * Update Dockerfile.intel * Fix: Update CMakeLists.txt * Fix: Update Dockerfile.intel and FindMKL.cmake * Disable SYCL compiler detection for MKL * Turn of MKL_SYCL_DISTRIBUTED_DFT * Test: Turn off DMKL_SYCL and DMKL_SYCL_DISTRIBUTED_DFT * Update Dockerfile.intel * Remove intel-oneapi-mkl-devel-sycl from Dockerfile Removed intel-oneapi-mkl-devel-sycl from installation. * Update Intel oneAPI MKL installation and cleanup * Remove SYCL distributed DFT option from MKL settings Removed the option to disable SYCL distributed DFT in MKL settings. * Since libmkl_sycl_distributed_dft.so can be correctly found, we try to turn on SYCL * Update Dockerfile.intel to remove MKL_SYCL options Removed MKL_SYCL and MKL_SYCL_DISTRIBUTED_DFT options from cmake command. * Recover devcontainer.yml, and comment out `find_package(MKL NO_MODULE)` in FindMKL.cmake. * Recover devcontainer.yml --------- Co-authored-by: Levi Zhou <[email protected]>
1 parent 7e4e4ff commit 443f89e

File tree

3 files changed

+63
-31
lines changed

3 files changed

+63
-31
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,4 +807,4 @@ install(PROGRAMS ${ABACUS_BIN_PATH}
807807

808808
if(ENABLE_COVERAGE)
809809
coverage_evaluate()
810-
endif()
810+
endif()

Dockerfile.intel

Lines changed: 58 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,44 @@ 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-mkl-sycl-devel \
21+
intel-oneapi-mkl-sycl-distributed-dft-devel \
22+
intel-oneapi-mpi-devel \
2023
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
24+
apt-get clean && \
25+
rm -rf /var/lib/apt/lists/*
26+
27+
RUN ls -la /opt/intel/oneapi/mkl/latest/lib/intel64/*sycl*dft*
28+
RUN ls -la /opt/intel/oneapi/mkl/latest/lib/intel64/*dis*
29+
30+
# Set oneAPI environment variables
31+
ENV ONEAPI_ROOT=/opt/intel/oneapi
32+
ENV I_MPI_ROOT=${ONEAPI_ROOT}/mpi/latest
33+
ENV MKLROOT=${ONEAPI_ROOT}/mkl/latest
34+
ENV CMPLR_ROOT=${ONEAPI_ROOT}/compiler/latest
35+
36+
# Set library paths and include paths
37+
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}
38+
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}
39+
ENV PATH=${ONEAPI_ROOT}/vtune/latest/bin64:${ONEAPI_ROOT}/mpi/latest/bin:${MKLROOT}/bin/intel64:${ONEAPI_ROOT}/compiler/latest/bin:${PATH}
40+
ENV CPATH=${MKLROOT}/include:${ONEAPI_ROOT}/mpi/latest/include:${CPATH}
41+
ENV PKG_CONFIG_PATH=${MKLROOT}/lib/pkgconfig:${ONEAPI_ROOT}/mpi/latest/lib/pkgconfig:${PKG_CONFIG_PATH}
42+
43+
# Set CMAKE related paths
44+
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}
3045

3146
SHELL ["/bin/bash", "-c"]
3247
ENV CC=mpiicx CXX=mpiicpx FC=mpiifx
3348

49+
# Verify oneAPI installation
50+
RUN source ${ONEAPI_ROOT}/setvars.sh && \
51+
echo "=== Verify compiler ===" && \
52+
which mpiicx && mpiicx --version && \
53+
echo "=== Verify MKL ===" && \
54+
ls ${MKLROOT}/lib/intel64/ && \
55+
echo "=== Verify MPI ===" && \
56+
which mpirun && mpirun --version
57+
3458
# https://elpa.mpcdf.mpg.de/software/tarball-archive/ELPA_TARBALL_ARCHIVE.html
3559
RUN source /opt/intel/oneapi/setvars.sh && \
3660
cd /tmp && \
@@ -39,28 +63,34 @@ RUN source /opt/intel/oneapi/setvars.sh && \
3963
tar xzf elpa-$ELPA_VER.tar.gz && rm elpa-$ELPA_VER.tar.gz && \
4064
cd elpa-$ELPA_VER && mkdir build && cd build && \
4165
../configure CFLAGS="-O3 -march=native" FCFLAGS="-O3 -qmkl=cluster" --enable-openmp && \
42-
make -j`nproc` && \
66+
make -j$(nproc) && \
4367
make PREFIX=/usr/local install && \
4468
ln -s /usr/local/include/elpa_openmp-$ELPA_VER/elpa /usr/local/include/ && \
4569
cd /tmp && rm -rf elpa-$ELPA_VER
4670

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
71+
# rapidjson and libtorch
72+
RUN cd /tmp && git clone --depth 1 https://github.com/Tencent/rapidjson.git && cp -r rapidjson/include/rapidjson /usr/include/ && rm -rf rapidjson
73+
RUN wget -q https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.0%2Bcpu.zip -O /tmp/libtorch.zip && \
74+
unzip -q /tmp/libtorch.zip -d /opt && rm -f /tmp/libtorch.zip
75+
ENV CMAKE_PREFIX_PATH=/opt/libtorch/share/cmake:${CMAKE_PREFIX_PATH}
5576

77+
# Clone and build abacus (optional during image build; keep for CI image)
5678
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 && \
79+
RUN export LD_LIBRARY_PATH=${GKLIB_ROOT}/lib:${METIS32_ROOT}/lib:${PARMETIS32_ROOT}/lib:${SUPERLU32_DIST_ROOT}/lib:${PEXSI32_ROOT}/lib:${LD_LIBRARY_PATH} && \
80+
export CPATH=${GKLIB_ROOT}/include:${METIS32_ROOT}/include:${PARMETIS32_ROOT}/include:${SUPERLU32_DIST_ROOT}/include:${PEXSI32_ROOT}/include:${CPATH} && \
81+
cd /tmp && git clone https://github.com/deepmodeling/abacus-develop.git --depth 1 && \
6082
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` && \
83+
cmake -B build \
84+
-DENABLE_MLALGO=ON \
85+
-DENABLE_LIBXC=ON \
86+
-DENABLE_LIBRI=ON \
87+
-DENABLE_RAPIDJSON=ON \
88+
-DCMAKE_BUILD_TYPE=Release && \
89+
cmake --build build -j"$(nproc)" && \
6390
cmake --install build && \
64-
rm -rf build && \
65-
abacus --version
66-
#&& rm -rf abacus-develop
91+
(/usr/local/bin/abacus --version || echo "ABACUS installed but version check failed") && \
92+
rm -rf /tmp/abacus-develop
93+
# -DMKL_SYCL=OFF \
94+
# -DMKL_SYCL_DISTRIBUTED_DFT:BOOL=OFF \
95+
# Default entry
96+
CMD ["/bin/bash"]

cmake/FindMKL.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# MKL_INCLUDE - where to find mkl.h, etc.
55
# MKL_FOUND - True if mkl found.
66

7-
find_package(MKL NO_MODULE) # try using official module first
7+
# find_package(MKL NO_MODULE) # try using official module first
88
if(NOT TARGET MKL::MKL)
99

1010
find_path(MKL_INCLUDE mkl_service.h HINTS ${MKLROOT}/include)
@@ -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)