From d080fb3a1af531895029e819adc17cdaf634cb83 Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Fri, 17 Jun 2022 14:32:51 -0500 Subject: [PATCH] CI for OpenSUSE (#12) * CI for OpenSUSE * OpenSUSE MPI --allow-run-as-root - when testing in OpenSUSE docker container, tests using OpenMPI fail due to running as root - This commit toggles OMNITRACE_CI_MPI_RUN_AS_ROOT to ON and tests whether --allow-run-as-root is supported * Tweak to OMNITRACE_CI_MPI_RUN_AS_ROOT handling [ROCm/rocprofiler-systems commit: 20e7b573d441034ebd0c937f8adee57dad9f1a3a] --- .../.github/workflows/cancelling.yml | 2 +- .../.github/workflows/opensuse.yml | 120 ++++++++++++++++++ .../docker/Dockerfile.opensuse.ci | 3 +- .../rocprofiler-systems/tests/CMakeLists.txt | 25 +++- 4 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 projects/rocprofiler-systems/.github/workflows/opensuse.yml diff --git a/projects/rocprofiler-systems/.github/workflows/cancelling.yml b/projects/rocprofiler-systems/.github/workflows/cancelling.yml index 82f8618da2..e199170613 100644 --- a/projects/rocprofiler-systems/.github/workflows/cancelling.yml +++ b/projects/rocprofiler-systems/.github/workflows/cancelling.yml @@ -1,7 +1,7 @@ name: cancel-builds-on-update on: workflow_run: - workflows: ['formatting', 'ubuntu-bionic', 'ubuntu-focal-external-rocm', 'ubuntu-focal-external', 'ubuntu-focal', 'cpack-ubuntu', 'cpack-opensuse'] + workflows: ['formatting', 'ubuntu-bionic', 'ubuntu-focal-external-rocm', 'ubuntu-focal-external', 'ubuntu-focal', 'opensuse', 'cpack-ubuntu', 'cpack-opensuse'] types: ['requested'] jobs: diff --git a/projects/rocprofiler-systems/.github/workflows/opensuse.yml b/projects/rocprofiler-systems/.github/workflows/opensuse.yml new file mode 100644 index 0000000000..97169f8077 --- /dev/null +++ b/projects/rocprofiler-systems/.github/workflows/opensuse.yml @@ -0,0 +1,120 @@ +name: opensuse + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +env: + BUILD_TYPE: Release + OMNITRACE_VERBOSE: 1 + OMNITRACE_CI: ON + +jobs: + opensuse: + runs-on: ubuntu-20.04 + container: + image: jrmadsen/omnitrace-ci:opensuse-${{ matrix.os-release }} + strategy: + matrix: + compiler: ['g++'] + os-release: [ '15.2', '15.3' ] + + steps: + - uses: actions/checkout@v2 + + - name: Install Packages + timeout-minutes: 5 + run: + for i in 6 7 8 9 10; do /opt/conda/envs/py3.${i}/bin/python -m pip install numpy; done + + - name: Configure Env + run: + echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV && + echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV && + echo "/opt/omnitrace/bin:${HOME}/.local/bin" >> $GITHUB_PATH && + echo "LD_LIBRARY_PATH=/opt/omnitrace/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + + - name: Configure CMake + timeout-minutes: 10 + run: + git config --global --add safe.directory ${PWD} && + cmake --version && + cmake -B build + -DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g') + -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} + -DCMAKE_INSTALL_PREFIX=/opt/omnitrace + -DOMNITRACE_BUILD_TESTING=ON + -DOMNITRACE_USE_MPI=OFF + -DOMNITRACE_USE_HIP=OFF + -DOMNITRACE_USE_OMPT=OFF + -DOMNITRACE_USE_PYTHON=ON + -DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs + -DOMNITRACE_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10" + -DOMNITRACE_CI_MPI_RUN_AS_ROOT=ON + + - name: Build + timeout-minutes: 45 + run: + cmake --build build --target all --parallel 2 -- VERBOSE=1 + + - name: Install + timeout-minutes: 5 + run: + cmake --build build --target install --parallel 2 + + - name: Test + timeout-minutes: 45 + run: + cd build && + ldd ./omnitrace && + ./omnitrace --help && + ctest -V -N -O omnitrace-ctest-${{ github.job }}-commands.log && + ctest -V --output-log omnitrace-ctest-${{ github.job }}.log --stop-on-failure + + - name: Test Install + timeout-minutes: 10 + run: | + set -v + export OMNITRACE_DEBUG=ON + which omnitrace-avail + ldd $(which omnitrace-avail) + omnitrace-avail --help + omnitrace-avail -a + which omnitrace-critical-trace + ldd $(which omnitrace-critical-trace) + which omnitrace + ldd $(which omnitrace) + omnitrace --help + omnitrace -e -v 1 -o ls.inst --simulate -- ls + for i in omnitrace-ls.inst-output/*; do echo -e "\n\n --> ${i} \n\n"; cat ${i}; done + omnitrace -e -v 1 -o ls.inst -- ls + ./ls.inst + omnitrace -e -v 1 --simulate -- ls + for i in omnitrace-ls-output/*; do echo -e "\n\n --> ${i} \n\n"; cat ${i}; done + omnitrace -e -v 1 -- ls + + - name: Test User API + timeout-minutes: 10 + run: | + set -v + ./scripts/test-find-package.sh --install-dir /opt/omnitrace + + - name: CTest Artifacts + if: success() || failure() + uses: actions/upload-artifact@v2 + with: + name: ctest-${{ github.job }}-log + path: | + build/*.log + + - name: Data Artifacts + if: success() || failure() + uses: actions/upload-artifact@v2 + with: + name: data-${{ github.job }}-files + path: | + build/omnitrace-tests-output/**/*.txt + build/omnitrace-tests-output/**/*-instr*.json diff --git a/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci b/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci index 2390072b31..16b90a2b5c 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci +++ b/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci @@ -20,7 +20,8 @@ RUN zypper update -y && \ zypper dist-upgrade -y && \ zypper install -y -t pattern devel_basis && \ zypper install -y python3-pip openmpi3-devel gcc-c++ git libnuma-devel dpkg-devel rpm-build papi-devel curl wget binutils-gold && \ - python3 -m pip install 'cmake==3.18.4' + python3 -m pip install 'cmake==3.18.4' && \ + zypper clean --all COPY ./dyninst-source /tmp/dyninst diff --git a/projects/rocprofiler-systems/tests/CMakeLists.txt b/projects/rocprofiler-systems/tests/CMakeLists.txt index abd88ee9cf..502a336852 100644 --- a/projects/rocprofiler-systems/tests/CMakeLists.txt +++ b/projects/rocprofiler-systems/tests/CMakeLists.txt @@ -100,6 +100,24 @@ set(_python_environment # -------------------------------------------------------------------------------------- # +set(MPIEXEC_EXECUTABLE_ARGS) +option( + OMNITRACE_CI_MPI_RUN_AS_ROOT + "Enabled --allow-run-as-root in MPI tests with OpenMPI. Enable with care! Should only be in docker containers" + OFF) +mark_as_advanced(OMNITRACE_CI_MPI_RUN_AS_ROOT) +if(OMNITRACE_CI_MPI_RUN_AS_ROOT) + execute_process( + COMMAND ${MPIEXEC_EXECUTABLE} --allow-run-as-root --help + RESULT_VARIABLE _mpiexec_allow_run_as_root + OUTPUT_QUIET ERROR_QUIET) + if(_mpiexec_allow_run_as_root EQUAL 0) + list(APPEND MPIEXEC_EXECUTABLE_ARGS --allow-run-as-root) + endif() +endif() + +# -------------------------------------------------------------------------------------- # + function(OMNITRACE_ADD_TEST) foreach(_PREFIX RUNTIME REWRITE REWRITE_RUN) foreach(_TYPE PASS FAIL SKIP) @@ -150,12 +168,13 @@ function(OMNITRACE_ADD_TEST) AND ${TEST_MPI} AND TEST_NUM_PROCS GREATER 0) if(NOT TEST_NUM_PROCS GREATER NUM_PROCS_REAL) - set(COMMAND_PREFIX ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} - ${TEST_NUM_PROCS}) + set(COMMAND_PREFIX ${MPIEXEC_EXECUTABLE} ${MPIEXEC_EXECUTABLE_ARGS} + ${MPIEXEC_NUMPROC_FLAG} ${TEST_NUM_PROCS}) list(APPEND TEST_LABELS mpi parallel-${TEST_NUM_PROCS}) list(APPEND TEST_PROPERTIES PARALLEL_LEVEL ${TEST_NUM_PROCS}) else() - set(COMMAND_PREFIX ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 1) + set(COMMAND_PREFIX ${MPIEXEC_EXECUTABLE} ${MPIEXEC_EXECUTABLE_ARGS} + ${MPIEXEC_NUMPROC_FLAG} 1) endif() else() list(APPEND TEST_ENVIRONMENT "OMNITRACE_USE_PID=OFF")