IntelĀ® Compiler Base
Software Included
-
IntelĀ® oneAPI HPC Toolkit 2021.1.1 (https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit.html)
Overview
From the IntelĀ® oneAPI HPC Toolkit Docker Hub,
The Intel oneAPI HPC Toolkit delivers what developers need to build, analyze, optimize, and scale high-performance computing (HPC) applications with the latest techniques in vectorization, multithreading, multi-node parallelization, and memory optimization.
For a complete list of libraries included in the IntelĀ® oneAPI HPC Toolkit, please visit the IntelĀ® oneAPI HPC Toolkit Documentation.
Interactive Command-Line Session
To use the IntelĀ® compilers in an interactive command-line session, follow the steps below.
-
Submit an interactive job.
LSF_DOCKER_VOLUMES="/scratch1/fs1/ris/application/intel/oneapi/:/opt/intel/oneapi" \ bsub -Is -q general-interactive -a 'docker(us.gcr.io/ris-appeng-shared-dev/compiler-base:oneapi2021.1.1_centos7)' \ /bin/bash
-
Set up the IntelĀ® oneAPI environment.
. /opt/intel/oneapi/setvars.sh
-
Compile code.
-
Please refer to the IntelĀ® documentation for more information on how to compile code.
-
Multi-Stage Docker Image Build
Compile, Keep Only Binaries
A multi-stage build leverages the compilers in the IntelĀ® oneAPI HPC Toolkit Docker image and copies the compiled binaries and runtime dependencies to a new base image. This method results in a smaller Docker image, reducing computing time/resources/cost, and allows withholding source code from public consumption.
For more information on Docker multi-stage builds, please see the Docker multi-stage build documentation.
Sample Multi-Stage Dockerfile
# Begin Stage 1 with the base compiler image. FROM us.gcr.io/ris-appeng-shared-dev/compiler-base:oneapi2021.1.1_centos7 as build # Add any additional build dependencies here. # copy source code to a new location inside the container. COPY /path/to/source/code /opt/app_name/src # Change directory to location of source code, # set up the Intel environment, # compile, # copy binary to standard location. RUN cd /opt/app_name/src/ && \ . /opt/intel/oneapi/setvars.sh && \ make && \ cp -f example.binary /usr/local/bin # Begin Stage 2 with a new base image. FROM centos:7 # Copy only the needed parts of Stage 1. COPY --from=build /usr/local/bin/example.binary /usr/local/bin COPY --from=build /usr/local/lib /usr/local/lib COPY --from=build /usr/local/include /usr/local/include # Add any additional runtime dependencies here. # Set up MLNX_OFED driver. ENV MOFED_VERSION 5.4-3.1.0.0 ENV OS_VERSION rhel7.7 ENV PLATFORM x86_64 RUN wget -q http://content.mellanox.com/ofed/MLNX_OFED-${MOFED_VERSION}/MLNX_OFED_LINUX-${MOFED_VERSION}-${OS_VERSION}-${PLATFORM}.tgz && \ tar -xvf MLNX_OFED_LINUX-${MOFED_VERSION}-${OS_VERSION}-${PLATFORM}.tgz && \ MLNX_OFED_LINUX-${MOFED_VERSION}-${OS_VERSION}-${PLATFORM}/mlnxofedinstall --user-space-only --without-fw-update -q --distro ${OS_VERSION} && \ cd .. && \ rm -rf ${MOFED_DIR} && \ rm -rf *.tgz
Single-Stage Docker Image Build
Compile, Compile, Keep Source Code and Binaries
A single-stage build leverages the compilers in the IntelĀ® oneAPI HPC Toolkit Docker image and keeps the compiled binaries, runtime dependencies and source code in the resulting image. This method results in a larger Docker image which may cause increased computing time/resources/cost. This method also caches the source code in build layers resulting in public exposure, which may be unwanted.
Sample Single-Stage Dockerfile
FROM us.gcr.io/ris-appeng-shared-dev/compiler-base:oneapi2021.1.1_centos7 # Add any additional build dependencies here. # copy source code to a new location inside the container COPY /path/to/source/code /opt/app_name/src # Change directory to location of source code, # set up the Intel environment, # compile. RUN cd /opt/app_name/src/ && \ . /opt/intel/oneapi/setvars.sh && \ make
Building and Pushing the Docker image
To build and push a Docker image using one of the above methods, please refer to the our existing documentation for guidance.
IntelĀ® Base Compiler Tutorial
Please see our IntelĀ® Base Compiler Tutorial to learn how to leverage the IntelĀ® Base Compiler Docker image on the RIS Scientific Compute Platform.