intel / oneapi-containers

BSD 3-Clause "New" or "Revised" License
113 stars 45 forks source link

Compilers are not working correctly in hpckit #20

Closed thomas-robinson closed 1 year ago

thomas-robinson commented 2 years ago

I am building a docker container, and the compilers aren't loading by default. I have to source the setvars.sh to get it to work. Here is a snippet of my dockerfile

FROM intel/oneapi-hpckit:2021.4-devel-ubuntu18.04 as builder
LABEL maintainer "Tom Robinson"

#-------------------------------------------------------------
### Set up packages needed
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y patch
RUN apt-get install -y wget
RUN apt-get install -y curl
RUN apt-get install -y m4
RUN apt-get install -y sudo

## Set compilers
ENV FC=ifort
ENV CC=icc
ENV CX=icx
ENV build=/opt
ENV IO_LIBS=${build}/io_libs
## Build zlib and szip and curl
RUN cd $build \
&& zlib="zlib-1.2.11" \
&& rm -rf zlib* \
&& wget http://www.zlib.net/zlib-1.2.11.tar.gz \
&& tar -zxvf zlib-1.2.11.tar.gz \
&& cd $zlib \
&& sudo ./configure --prefix=${IO_LIBS} \
&& make \
&& make -j 20 install
ENV CC "icc -fPIC"

RUN cd $build \
&& szip="szip-2.1.1" \
&& rm -rf szip* \
&& wget https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz \
&& tar xzf szip-2.1.1.tar.gz \
&& cd $szip \
&& ./configure FC=ifort CC=icc --prefix=${IO_LIBS} CPPDEFS="-fPIC" \
&& make \
&& make -j 20 install

This crashes when I try to build it. If I add . /opt/intel/oneapi/setvars.sh \ to the last run line

RUN  . /opt/intel/oneapi/setvars.sh \
&& cd $build \
&& szip="szip-2.1.1" \
&& rm -rf szip* \
&& wget https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz \
&& tar xzf szip-2.1.1.tar.gz \
&& cd $szip \
&& ./configure FC=ifort CC=icc --prefix=${IO_LIBS} CPPDEFS="-fPIC" \
&& make \
&& make -j 20 install

Then is builds. Is this the expected default behavior? Is there a way to enable the compilers by default?

luisfponce commented 2 years ago

Hello @thomas-robinson ,

Please find the latest OneAPI images (no entrypoint used in any oneapi container image, switch to ENV to avoid the scenario RUN . /opt/intel/oneapi/setvars.sh that you had to do), so please feel free to proceed performing FROM intel/oneapi-hpckit:2022.1.1-devel-ubuntu18.04 as builder

Kind regards

tingleby commented 1 year ago

If you are basing an image of the official oneAPI images, the environment is already setup so sourcing setvars.sh should not be needed. Closing this issue, please reopen if you still have questions!