diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 0ec06a9d9f..3d9e5f139f 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -24,12 +24,12 @@ env: PC_SAMPLING_TESTS_REGEX: ".*pc-sampling.*" jobs: - core: + core-deb: # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix strategy: fail-fast: false matrix: - runner: ['navi3', 'vega20', 'mi200', 'mi300', 'rhel', 'sles'] + runner: ['navi3', 'vega20', 'mi200', 'mi300'] os: ['ubuntu-22.04'] build-type: ['RelWithDebInfo'] ci-flags: ['--linter clang-tidy'] @@ -45,7 +45,6 @@ jobs: - uses: actions/checkout@v4 - name: Install requirements - if: ${{ !contains(matrix.runner, 'rhel') && !contains(matrix.runner, 'sles') }} timeout-minutes: 10 shell: bash run: | @@ -56,13 +55,6 @@ jobs: update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12 python3 -m pip install -r requirements.txt - - name: Install requirements For RHEL & SLES - if: ${{ contains(matrix.runner, 'rhel') || contains(matrix.runner, 'sles') }} - timeout-minutes: 10 - shell: bash - run: | - python3 -m pip install -r requirements.txt - - name: List Files shell: bash run: | @@ -83,9 +75,8 @@ jobs: shell: bash run: | echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV - + - name: Configure, Build, and Test - if: ${{ !contains(matrix.runner, 'rhel') && !contains(matrix.runner, 'sles') }} timeout-minutes: 30 shell: bash run: @@ -95,7 +86,6 @@ jobs: --site $(echo $RUNNER_HOSTNAME)-$(/opt/rocm/bin/rocm_agent_enumerator | sed -n '2 p') --gpu-targets ${{ env.GPU_TARGETS }} --run-attempt ${{ github.run_attempt }} - ${{ matrix.ci-flags }} -- -DROCPROFILER_DEP_ROCMCORE=ON -DROCPROFILER_BUILD_DOCS=OFF @@ -107,13 +97,116 @@ jobs: -- -LE "${EXCLUDED_TESTS}" + - name: Install + if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }} + timeout-minutes: 10 + run: + cmake --build build --target install --parallel 16 + + - name: Build Packaging + if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }} + timeout-minutes: 10 + run: + cmake --build build --target package --parallel 16 + + - name: Test Install Build + if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }} + timeout-minutes: 10 + shell: bash + run: | + CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples + CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests tests + export LD_LIBRARY_PATH=/opt/rocprofiler-sdk/lib:${LD_LIBRARY_PATH} + cmake --build build-samples --target all --parallel 16 + cmake --build build-tests --target all --parallel 16 + ctest --test-dir build-samples -LE "${EXCLUDED_TESTS}" --output-on-failure + ctest --test-dir build-tests -LE "${EXCLUDED_TESTS}" --output-on-failure + + - name: Install Packages + if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }} + timeout-minutes: 5 + shell: bash + run: | + export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin + ls -la + ls -la ./build + for i in $(ls -S ./build/rocprofiler-sdk*.deb); do dpkg -i ${i}; done; + + - name: Test Installed Packages + if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }} + timeout-minutes: 20 + shell: bash + run: | + CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-samples-deb /opt/rocm/share/rocprofiler-sdk/samples + CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb /opt/rocm/share/rocprofiler-sdk/tests + cmake --build build-samples-deb --target all --parallel 16 + cmake --build build-tests-deb --target all --parallel 16 + ctest --test-dir build-samples-deb -LE "${EXCLUDED_TESTS}" --output-on-failure + ctest --test-dir build-tests-deb -LE "${EXCLUDED_TESTS}" --output-on-failure + + - name: Archive production artifacts + if: ${{ contains(matrix.runner, env.CORE_EXT_RUNNER) }} + uses: actions/upload-artifact@v4 + with: + name: installers + path: | + ${{github.workspace}}/build/*.deb + ${{github.workspace}}/build/*.rpm + ${{github.workspace}}/build/*.tgz + + core-rpm: + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + strategy: + fail-fast: false + matrix: + runner: ['mi300'] + os: ['rhel', 'sles'] + build-type: ['RelWithDebInfo'] + ci-flags: ['--linter clang-tidy'] + + runs-on: ${{ matrix.os }}-runner-set + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + CORE_EXT_RUNNER: navi3 + + steps: + - uses: actions/checkout@v4 + + - name: Install requirements + timeout-minutes: 10 + shell: bash + run: | + python3 -m pip install -r requirements.txt + + - name: List Files + shell: bash + run: | + echo "PATH: ${PATH}" + echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}" + which-realpath() { echo -e "\n$1 resolves to $(realpath $(which $1))"; echo "$($(which $1) --version &> /dev/stdout | head -n 1)"; } + for i in python3 git cmake ctest gcc g++ gcov; do which-realpath $i; done + ls -la + + - name: Exclude PC Sampling Tests + if: ${{ !contains(matrix.runner, 'mi200') && !contains(matrix.runner, 'mi300') }} + shell: bash + run: | + echo 'EXCLUDED_TESTS=${{ env.PC_SAMPLING_TESTS_REGEX }}' >> $GITHUB_ENV + + - name: Enable PC Sampling + if: ${{ contains(matrix.runner, 'mi200') }} + shell: bash + run: | + echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV + - name: Configure, Build, and Test - if: ${{ contains(matrix.runner, 'rhel') || contains(matrix.runner, 'sles') }} timeout-minutes: 30 shell: bash run: sudo LD_LIBRARY_PATH=./build/lib:$LD_LIBRARY_PATH python3 ./source/scripts/run-ci.py -B build - --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.runner }}-mi300-core + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core --build-jobs 16 --site $(echo $RUNNER_HOSTNAME)-$(/opt/rocm/bin/rocm_agent_enumerator | sed -n '2 p') --gpu-targets ${{ env.GPU_TARGETS }} @@ -121,7 +214,6 @@ jobs: -- -DROCPROFILER_DEP_ROCMCORE=ON -DROCPROFILER_BUILD_DOCS=OFF - -DROCPROFILER_BUILD_CI=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk -DCPACK_GENERATOR='DEB;RPM;TGZ' diff --git a/cmake/rocprofiler_build_settings.cmake b/cmake/rocprofiler_build_settings.cmake index 1189575fae..890bd1bedc 100644 --- a/cmake/rocprofiler_build_settings.cmake +++ b/cmake/rocprofiler_build_settings.cmake @@ -66,6 +66,24 @@ target_link_libraries(rocprofiler-build-flags INTERFACE rocprofiler-sdk::rocprof rocprofiler_target_compile_options(rocprofiler-build-flags INTERFACE "-W" "-Wall" "-Wno-unknown-pragmas") +# compiler version specific flags +function(set_compiler_options compiler_id version) + if(CMAKE_CXX_COMPILER_ID STREQUAL ${compiler_id} AND CMAKE_CXX_COMPILER_VERSION + VERSION_LESS_EQUAL ${version}) + rocprofiler_target_compile_options( + rocprofiler-build-flags + INTERFACE "-Wno-error=extra" "-Wno-unused-variable" + "-Wno-error=unused-but-set-variable" + "-Wno-error=unused-but-set-parameter" "-Wno-error=shadow") + endif() +endfunction() + +# Check GCC version +set_compiler_options("GNU" "8.5") + +# Check Clang version +set_compiler_options("Clang" "13.0") + # ----------------------------------------------------------------------------------------# # extra flags for debug information in debug or optimized binaries #