Allow OMPI as root in container #344
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cuda unit tests | |
on: | |
workflow_dispatch: | |
inputs: | |
python_version: | |
required: false | |
type: string | |
ref: | |
required: false | |
type: string | |
check_run_id: | |
required: false | |
type: string | |
pr_repo: | |
required: false | |
type: string | |
push: | |
branches: [devel, main, cuda_nvc_test] | |
env: | |
COMMIT: ${{ inputs.ref || github.event.ref }} | |
PEM: ${{ secrets.BOT_PEM }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
GITHUB_CHECK_RUN_ID: ${{ inputs.check_run_id }} | |
PR_REPO: ${{ inputs.pr_repo || github.repository }} | |
jobs: | |
Cuda: | |
runs-on: ubuntu-24.04 | |
name: Unit tests | |
container: kitware/nvidia-nvhpc:24.9-devel-cuda_multi-ubuntu24.04 | |
steps: | |
- name: Prepare docker | |
run: | | |
echo "OMPI_ALLOW_RUN_AS_ROOT=1" >> $GITHUB_ENV | |
echo "OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1" >> $GITHUB_ENV | |
echo $LD_LIBRARY_PATH | |
which mpicc | |
mpicc -show | |
mpirun --help | |
mpirun | |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nvidia/hpc_sdk/Linux_x86_64/24.9/comm_libs/12.6/hpcx/hpcx-2.20/ompi/lib" >> $GITHUB_ENV | |
apt-get update && apt-get install -y sudo | |
TZ=Europe/France | |
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata | |
sudo apt-get install -y git | |
sudo chown -R $(whoami) /github/home | |
shell: bash | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.COMMIT }} | |
repository: ${{ env.PR_REPO }} | |
submodules: true | |
- name: Install python (setup-python action doesn't work with containers) | |
uses: ./.github/actions/python_install | |
- name: "Setup" | |
id: token | |
run: | | |
pip install jwt requests | |
python ci_tools/setup_check_run.py cuda | |
- name: CUDA Version | |
run: | | |
nvcc --version # cuda install check | |
nvc --version # cuda install check | |
- name: Install dependencies | |
uses: ./.github/actions/linux_install | |
- name: Install Pyccel with tests | |
run: | | |
# Ignore nvc switch errors | |
export CFLAGS=-noswitcherror | |
python -m pip install --upgrade pip | |
python -m pip install .[test] | |
shell: bash | |
- name: Coverage install | |
uses: ./.github/actions/coverage_install | |
- name: Ccuda tests with pytest | |
id: cuda_pytest | |
uses: ./.github/actions/pytest_run_cuda | |
- name: Collect coverage information | |
continue-on-error: True | |
uses: ./.github/actions/coverage_collection | |
- name: Save code coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-artifact | |
path: .coverage | |
retention-days: 1 | |
include-hidden-files: true | |
- name: "Post completed" | |
if: always() | |
run: | |
python ci_tools/complete_check_run.py ${{ steps.cuda_pytest.outcome }} | |