Skip to end of banner
Go to start of banner

Intel® Compiler Base

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 61 Next »

Compute Resources

Docker Usage

Software Included

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.

  1. 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
  1. Set up the Intel® oneAPI environment.

. /opt/intel/oneapi/setvars.sh
  1. 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.

  • No labels