Files
intel-obxkit/Dockerfile
2025-09-22 09:50:53 +02:00

171 lines
5.5 KiB
Docker

# docker build --target sdk -t intel-obxkit-sdk:2025.2.1
# docker build --target runtime -t intel-obxkit-runtime:2025.2.1
FROM intel/oneapi-hpckit:latest AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt install -y git wget cmake m4 gcc g++ gfortran autotools-dev autoconf libtool flex \
libevent-dev libhwloc-dev libnuma-dev libibverbs-dev librdmacm-dev \
libmunge-dev linux-headers-generic libpthread-stubs0-dev \
libxml2-dev libcurl4-gnutls-dev
RUN rm -rf /var/cache/apt/*
RUN cd /usr/lib \
&& ln -s ./x86_64-linux-gnu/libmunge.a \
&& ln -s ./x86_64-linux-gnu/libmunge.la \
&& ln -s ./x86_64-linux-gnu/libmunge.so
RUN mkdir -p /build \
&& cd /build \
&& wget https://www.zlib.net/zlib-1.3.1.tar.gz \
&& tar xf zlib-1.3.1.tar.gz \
&& mv zlib-1.3.1 zlib \
# git clone --branch knem-1.1.4 --depth=1 https://gitlab.inria.fr/knem/knem.git \
&& git clone --depth=1 https://gitlab.inria.fr/knem/knem.git \
&& git clone --branch v1.18.1 --depth=1 https://github.com/openucx/ucx.git \
&& git clone --branch v2.3.0 --depth=1 https://github.com/ofiwg/libfabric.git \
&& git clone --branch hdf5-1.14.6 --depth=1 https://github.com/HDFGroup/hdf5.git \
&& git clone --branch v4.9.3 --depth=1 https://github.com/Unidata/netcdf-c.git \
&& git clone --branch v4.6.2 --depth=1 https://github.com/Unidata/netcdf-fortran.git \
&& git clone --branch v5.0.9 --depth=1 https://github.com/openpmix/openpmix.git \
&& git clone --branch v5.0.8 --depth=1 https://github.com/open-mpi/ompi.git \
&& cd /build/openpmix && git submodule update --init --recursive \
&& cd /build/ompi && git submodule update --init --recursive
RUN rm -rf /usr/include/level_zero
RUN cd /build/zlib \
&& ./configure --prefix=/opt/zlib \
&& make -j 16 install
RUN cd /build/knem \
&& ./autogen.sh \
&& ./configure --prefix=/opt/knem --with-linux-release=$(basename /lib/modules/*generic) \
&& make -j 16 install
RUN cd /build/openpmix \
&& ./autogen.pl \
&& ./configure --prefix=/opt/pmix --with-zlib=/opt/zlib --with-munge=/usr \
&& make -j 16 install
RUN cd /build/ucx \
&& ./autogen.sh \
&& ./configure --prefix=/opt/ucx \
&& make -j 16 install
RUN cd /build/libfabric \
&& ./autogen.sh \
&& ./configure --prefix=/opt/ofi --without-cuda --without-ze \
&& make -j 16 install
RUN cd /build/ompi \
&& ./autogen.pl
RUN cd /build/ompi \
&& env CC=gcc CXX=g++ F77=ifx FC=ifx ./configure \
--with-knem=/opt/knem \
--with-ucx=/opt/ucx \
--with-pmix=/opt/pmix \
--with-zlib=/opt/zlib \
--with-ofi=/opt/ofi \
--with-libevent \
--without-verbs \
--without-cuda \
--prefix=/opt/openmpi \
&& make -j 16 install
RUN cd /build/hdf5 \
&& CC=gcc CXX=g++ CFC=ifx ./configure --prefix=/opt/hdf5 \
--enable-fortran --enable-cxx --with-zlib=/opt/zlib \
&& make -j 16 install
RUN cd /build/netcdf-c \
&& export LD_LIBRARY_PATH=/opt/hdf5/lib:/opt/zlib/lib:${LD_LIBRARY_PATH} \
&& export CPPFLAGS="-I/opt/hdf5/include -I/opt/zlib/include" \
&& export LDFLAGS="-L/opt/hdf5/lib -L/opt/zlib/lib" \
&& ./configure --prefix=/opt/netcdf-c \
&& make -j 16 install
RUN cd /build/netcdf-fortran \
&& _dep=/opt/netcdf-c \
&& export LD_LIBRARY_PATH=${_dep}/lib:${LD_LIBRARY_PATH} \
&& export CPPFLAGS=-I${_dep}/include \
&& export LDFLAGS=-L${_dep}/lib \
&& export FC=ifx \
&& ./configure --prefix=/opt/netcdf-fortran \
&& make -j 16 install
RUN rm -rf /build
### SDK ###
FROM ubuntu:24.04 AS sdk
WORKDIR /
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt install -y git wget cmake m4 gcc g++ gfortran autotools-dev autoconf libtool flex \
libevent-dev libhwloc-dev libnuma-dev libibverbs-dev librdmacm-dev \
libmunge-dev linux-headers-generic libpthread-stubs0-dev \
libxml2-dev libcurl4-gnutls-dev
RUN rm -rf /var/cache/apt/*
COPY --from=builder /opt /opt
RUN cd /opt/intel/oneapi \
&& rm -rf dnnl ippcp modulefiles-setup.sh advisor dal dpcpp-ct \
ishmem support.txt vtune ccl debugger dpl licensing \
oneapi-hpc-toolkit tbb dev-utilities ipp pti tcm
RUN cd /opt/intel/oneapi/compiler/latest \
&& rm -rf include share/doc share/ide_support etc lib/libsycl*
RUN cd /opt/intel/oneapi/mpi/latest \
&& rm -rf lib/debug lib/debug_mt lib/mpi share etc
RUN cd /opt/intel/oneapi/mkl/latest \
&& rm -rf share etc lib/*_ilp64.* lib/*_sycl* lib/*_tbb_*
RUN find /opt -xtype l ! -exec test -e {} \; -print | xargs rm
RUN mkdir -p /opt/bin \
&& mkdir -p /opt/include \
&& mkdir -p /opt/lib \
&& cp -rs /opt/openmpi/bin/* /opt/bin \
&& cp -rs /opt/netcdf-c/include/* /opt/include \
&& cp -rs /opt/netcdf-fortran/include/* /opt/include \
&& cp -rs /opt/zlib/lib/* /opt/lib \
&& cp -rs /opt/pmix/lib/* /opt/lib \
&& cp -rs /opt/ucx/lib/* /opt/lib \
&& cp -rs /opt/ofi/lib/* /opt/lib \
&& cp -rs /opt/openmpi/lib/* /opt/lib \
&& cp -rs /opt/netcdf-c/lib/* /opt/lib \
&& cp -rs /opt/netcdf-fortran/lib/* /opt/lib
ENV LC_ALL=C
ENV ONEAPI=/opt/bin:/opt/intel/oneapi/2025.2
ENV PATH=/opt/bin:${ONEAPI}/bin:${PATH}
ENV LD_LIBRARY_PATH=/opt/lib:${ONEAPI}/lib:${ONEAPI}/libfabric:${LD_LIBRARY_PATH}
ENV CPATH=/opt/include:${ONEAPI}/include:${CPATH}
ENV CC=gcc
ENV CXX=g++
ENV FC=ifx
ENV MPICC=mpicc
ENV MPIFC=mpic++
ENV MPIFC=mpifort
ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest
ENV I_MPI_FC=ifx
ENV I_MPI_F77=ifx
ENV I_MPI_F90=ifx
### RUNTIME ###
FROM sdk AS runtime
WORKDIR /
RUN rm -rf /opt/intel/oneapi/compiler/latest/bin
RUN rm -rf /opt/intel/oneapi/mpi/latest/bin
RUN find /opt -name \*.a -exec rm {} \;
RUN find /usr -name \*.a -exec rm {} \;