Skip to content

Commit

Permalink
WIP: dummay tags for action debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jul 13, 2023
1 parent dcd6464 commit 129dc3c
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 148 deletions.
94 changes: 63 additions & 31 deletions .github/workflows/docker-bases.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build base compilers docker images

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

on:
push:
paths:
Expand All @@ -16,11 +20,11 @@ on:

jobs:
#######################################################
################### CPU ###############################
############## Basic gcc CPU ##########################
#######################################################
deploy-cpu-bases:
name: ${{ matrix.tag }}
runs-on: ${{ matrix.runner }}
name: "cpu-base"
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"

Expand All @@ -46,34 +50,65 @@ jobs:
- name: cleanup
run: docker system prune -a -f

- name: Docker image
- name: GCC image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
push: true
build-args: |
'arch=gcc'
target: 'gcc'
build-args: 'arch=gcc'
tags: 'devitocodes/bases:cpu-gcc'

- name: Docker image
#######################################################
############## Intel OneApi CPU #######################
#######################################################
deploy-oneapi-bases:
name: "oneapi-base"
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"

steps:
- name: Checkout devito
uses: actions/checkout@v3

- name: Check event name
run: echo ${{ github.event_name }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: cleanup
run: docker system prune -a -f

- name: ICX image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
push: true
build-args: |
'arch=icx'
target: 'icx'
build-args: 'arch=icx'
tags: 'devitocodes/bases:cpu-icx'

- name: Docker image
- name: ICC image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.cpu'
push: true
build-args: |
'arch=icc'
target: 'icc'
build-args: 'arch=icc'
tags: 'devitocodes/bases:cpu-icc'

#######################################################
Expand Down Expand Up @@ -107,42 +142,38 @@ jobs:
- name: cleanup
run: docker system prune -a -f

- name: Docker image
- name: NVC image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.nvidia'
push: true
build-args: |
'arch=nvc'
target: 'nvc'
build-args: 'arch=nvc'
tags: 'devitocodes/bases:nvidia-nvc'

- name: Docker image
- name: NVCC image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.nvidia'
push: true
build-args: |
'arch=nvcc'
target: 'nvcc'
build-args: 'arch=nvcc'
tags: 'devitocodes/bases:nvidia-nvcc'

- name: Docker image
- name: NVC host image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.nvidia'
push: true
build-args: |
'arch=nvc-host'
target: 'nvc-host'
build-args: 'arch=nvc-host'
tags: 'devitocodes/bases:cpu-nvc'

#######################################################
################### Nvidia clang ######################
# # clang is only officialy supporting cuda<11.5. The latest nvidia sdk with cuda 11.5 is 21.11 (last of 2021)
# # We cannot use newer ones such as 22-1 because the package manager automatically installs the latest 2022
# # that re-install the latest (11.7) version on top of it.
# # For more info check https://llvm.org/docs/CompileCudaWithLLVM.html and the Prerequisites
#######################################################
deploy-nvidia-clang-base:
name: "nvidia-clang-base"
Expand Down Expand Up @@ -172,15 +203,14 @@ jobs:
- name: cleanup
run: docker system prune -a -f

- name: Docker image
- name: Nvidia clang image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.nvidia'
push: true
build-args: |
'arch=clang'
'ver=nvhpc-21-11'
target: 'clang'
build-args: 'arch=clang'
tags: 'devitocodes/bases:nvidia-clang'

#######################################################
Expand Down Expand Up @@ -214,20 +244,22 @@ jobs:
- name: cleanup
run: docker system prune -a -f

- name: Docker image
- name: AMD image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.amd'
push: true
target: 'aomp'
tags: devitocodes/bases:amd

- name: Docker image
- name: AMD HIP image
uses: docker/build-push-action@v3
with:
context: .
file: './docker/Dockerfile.amd'
push: true
target: 'hip'
build-args: |
arch=hip
tags: devitocodes/bases:amd-hip
26 changes: 13 additions & 13 deletions .github/workflows/docker-devito.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ jobs:
fail-fast: false
matrix:
include:
- base: 'bases:nvidia-nvc'
- base: 'test-bases:nvidia-nvc'
tag: 'nvidia-nvc'
flag: '--gpus all'
test: 'tests/test_gpu_openacc.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]

- base: 'bases:nvidia-clang'
- base: 'test-bases:nvidia-clang'
tag: 'nvidia-clang'
flag: '--gpus all'
test: 'tests/test_gpu_openmp.py tests/test_gpu_common.py'
runner: ["self-hosted", "nvidiagpu"]

# Runtime gpu flags from https://hub.docker.com/r/rocm/tensorflow/
- base: 'bases:amd'
- base: 'test-bases:amd'
tag: 'amd'
flag: '--network=host --device=/dev/kfd --device=/dev/dri --ipc=host --group-add video --group-add 109 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined'
test: 'tests/test_gpu_openmp.py'
runner: ["self-hosted", "amdgpu"]

- base: 'bases:cpu-gcc'
- base: 'test-bases:cpu-gcc'
tag: "gcc"
flag: ''
test: 'tests/test_operator.py'
runner: ubuntu-latest

- base: 'bases:cpu-icc'
- base: 'test-bases:cpu-icc'
tag: "icc"
flag: ''
test: 'tests/test_operator.py'
runner: ubuntu-latest

- base: 'bases:cpu-icx'
- base: 'test-bases:cpu-icx'
tag: "icx"
flag: ''
test: 'tests/test_operator.py'
Expand Down Expand Up @@ -90,16 +90,16 @@ jobs:
tags: |
type=raw,value=${{ matrix.tag }}-dev
type=raw,value=${{ matrix.tag }}-latest,enable=${{ github.event_name == 'release' }}
type=raw,value=latest,enable=${{ matrix.base == 'bases:cpu-gcc' }}
type=raw,value=latest,enable=${{ matrix.base == 'test-bases:cpu-gcc' }}
type=semver,pattern={{raw}},prefix=${{ matrix.tag }}-,enable=${{ github.event_name == 'release' }}
# Legacy "gpu" tag
type=raw,value=gpu-dev,enable=${{ matrix.base == 'bases:nvidia-nvc' }}
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:nvidia-nvc' }}
type=raw,value=gpu-dev,enable=${{ matrix.base == 'test-bases:nvidia-nvc' }}
type=semver,pattern={{raw}},prefix=gpu-,enable=${{ github.event_name == 'release' && matrix.base == 'test-bases:nvidia-nvc' }}
type=semver,pattern={{raw}},value=gpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'test-bases:nvidia-nvc' }}
# Legacy "cpu" tag
type=raw,value=cpu-dev,enable=${{ matrix.base == 'bases:cpu-gcc' }}
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'bases:cpu-gcc' }}
type=raw,value=cpu-dev,enable=${{ matrix.base == 'test-bases:cpu-gcc' }}
type=semver,pattern={{raw}},prefix=cpu-,enable=${{ github.event_name == 'release' && matrix.base == 'test-bases:cpu-gcc' }}
type=semver,pattern={{raw}},value=cpu-latest,enable=${{ github.event_name == 'release' && matrix.base == 'test-bases:cpu-gcc' }}
- name: Check tags
run: echo "${{ steps.meta.outputs.tags }}"
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/pytest-core-mpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- master

jobs:
build:
test-mpi-basic:
name: pytest-mpi
runs-on: ubuntu-20.04
strategy:
Expand All @@ -25,6 +25,7 @@ jobs:
env:
DEVITO_LANGUAGE: "openmp"
DEVITO_ARCH: "gcc-9"
OMP_NUM_THREADS: "1"
CC: "gcc-9"
CXX: "g++-9"

Expand Down Expand Up @@ -52,3 +53,22 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: pytest-mpi

test-mpi-docker:
name: pytest-mpi
runs-on: ubuntu-latest
strategy:
matrix:
arch: [gcc, icc, icx]

steps:
- name: Checkout devito
uses: actions/checkout@v3

- name: Build docker image
run: |
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-${{ matrix.arch }}
- name: Test with pytest
run: |
docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e OMP_NUM_THREADS=1 --name testrun devito_img pytest tests/test_mpi.py
2 changes: 1 addition & 1 deletion .github/workflows/pytest-core-nompi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
- name: Set run prefix
run: |
if [[ "${{ matrix.name }}" =~ "docker" ]]; then
echo "RUN_CMD=docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e DEVITO_ARCH=${{ matrix.arch }} --name testrun devito_img" >> $GITHUB_ENV
echo "RUN_CMD=docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV
else
echo "RUN_CMD=" >> $GITHUB_ENV
fi
Expand Down
24 changes: 18 additions & 6 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import numpy.ctypeslib as npct
from codepy.jit import compile_from_string
from codepy.toolchain import GCCToolchain
from codepy.toolchain import GCCToolchain, call_capture_output

from devito.arch import (AMDGPUX, Cpu64, M1, NVIDIAX, POWER8, POWER9, GRAVITON,
INTELGPUX, IntelSkylake, get_nvidia_cc, check_cuda_runtime,
Expand Down Expand Up @@ -54,6 +54,8 @@ def sniff_compiler_version(cc):
compiler = "clang"
elif ver.startswith("icc"):
compiler = "icc"
elif ver.startswith("icx"):
compiler = "icx"
elif ver.startswith("pgcc"):
compiler = "pgcc"
elif ver.startswith("cray"):
Expand All @@ -62,7 +64,7 @@ def sniff_compiler_version(cc):
compiler = "unknown"

ver = Version("0")
if compiler in ["gcc", "icc"]:
if compiler in ["gcc", "icc", "icx"]:
try:
# gcc-7 series only spits out patch level on dumpfullversion.
res = run([cc, "-dumpfullversion"], stdout=PIPE, stderr=DEVNULL)
Expand Down Expand Up @@ -707,7 +709,17 @@ def __init__(self, *args, **kwargs):
if mpi_distro != 'IntelMPI':
warning("Expected Intel MPI distribution with `%s`, but found `%s`"
% (self.__class__.__name__, mpi_distro))
self.cflags.append("-cc=%s" % self.CC)
self.cflags.insert(0, '-cc=%s' % self.CC)

def get_version(self):
if configuration['mpi']:
cmd = [self.cc, "-cc=%s" % self.CC, "--version"]
else:
cmd = [self.cc, "--version"]
result, stdout, stderr = call_capture_output(cmd)
if result != 0:
raise RuntimeError(f"version query failed: {stderr}")
return stdout

def __lookup_cmds__(self):
self.CC = 'icc'
Expand All @@ -720,9 +732,9 @@ def __lookup_cmds__(self):
# we try to use `mpiicc` first, while `mpicc` is our fallback, which may
# or may not be an Intel distribution
try:
check_output(["mpiicc", "--version"]).decode("utf-8")
check_output(["mpiicc", "-cc=%s" % self.CC, "--version"]).decode("utf-8")
self.MPICC = 'mpiicc'
self.MPICXX = 'mpiicpc'
self.MPICXX = 'mpicxx'
except FileNotFoundError:
self.MPICC = 'mpicc'
self.MPICXX = 'mpicxx'
Expand Down Expand Up @@ -777,7 +789,7 @@ def __lookup_cmds__(self):
self.CC = 'icx'
self.CXX = 'icpx'
self.MPICC = 'mpicc'
self.MPICX = 'mpicx'
self.MPICXX = 'mpicxx'


class CustomCompiler(Compiler):
Expand Down
3 changes: 2 additions & 1 deletion devito/core/autotuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def autotune(operator, args, level, mode):
at_args.update(dict(run))

# Drop run if not at least one block per thread
if not configuration['develop-mode'] and nblocks_per_thread.subs(at_args) < 1:
if not configuration['develop-mode'] and \
nblocks_per_thread.subs(normalize_args(at_args)) < 1:
continue

# Run the Operator
Expand Down
Loading

0 comments on commit 129dc3c

Please sign in to comment.