Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test netcdf builds with nvidia and intel compilers #2896

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore these
build
33 changes: 33 additions & 0 deletions .github/workflows/run_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker

on: [pull_request,workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
docker-build-and-test:
name: Build and Test - ${{ matrix.dockerfile }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfile:
- Dockerfile.intel
- Dockerfile.nvhpc
steps:
- name: Checkout code
uses: actions/checkout@v3

# Some base images, like nvidia or intel, are very large and cannot be built by github
# This tool cache folder is only necessary if you are building the image in the same runner
# Since we are only building docker images, we don't need it
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

- name: Build Docker image
run: docker build -t netcdf -f docker/${{ matrix.dockerfile }} .

- name: Run tests in container
run: docker run --name test-container -t netcdf bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"'
35 changes: 35 additions & 0 deletions docker/Dockerfile.intel
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# versions and sizes from here: https://hub.docker.com/r/intel/oneapi-hpckit/tags
FROM intel/oneapi-hpckit:latest

# Install necessary dependencies
RUN apt update -y && \
apt install -y \
bzip2 \
cmake \
libcurl4-openssl-dev \
libhdf5-dev \
git \
m4 \
make \
unzip \
wget \
zlib1g-dev \
&& apt clean all

# Set working directory
WORKDIR /usr/local/src

COPY . netcdf-c

# Set environment variables for Intel compilers
ENV CC=icx
ENV CXX=icpx
ENV FC=ifx

# Build and install NetCDF
WORKDIR /usr/local/src/netcdf-c
RUN cmake -S . -B build && \
cd build && make -j && \
make install

WORKDIR /usr/local/src/netcdf-c/build
40 changes: 40 additions & 0 deletions docker/Dockerfile.nvhpc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# nvidia rate limits requests. You can get around this by restarting docker if for
# some reason you have to build this image many times
# https://stackoverflow.com/a/75757516/5217293
#
# Container versions, and sizes, can be found at https://catalog.ngc.nvidia.com/orgs/nvidia/containers/nvhpc/tags
#
FROM nvcr.io/nvidia/nvhpc:23.7-devel-cuda12.2-ubuntu22.04

# Install necessary dependencies
RUN apt update -y && \
apt install -y \
bzip2 \
cmake \
libcurl4-openssl-dev \
libhdf5-dev \
git \
m4 \
make \
unzip \
wget \
zlib1g-dev \
&& apt clean all

# Set working directory
WORKDIR /usr/local/src

COPY . netcdf-c

# Set environment variables for nvidia compilers
ENV CXX=nvc++
ENV CC=nvc
ENV FC=nvfortran

# Build and install NetCDF
WORKDIR /usr/local/src/netcdf-c
RUN cmake -S . -B build && \
cd build && make -j && \
make install

WORKDIR /usr/local/src/netcdf-c/build
Loading