diff --git a/.github/workflows/aqlprofile-codeql.yml b/.github/workflows/aqlprofile-codeql.yml new file mode 100644 index 0000000000..618aa6ae09 --- /dev/null +++ b/.github/workflows/aqlprofile-codeql.yml @@ -0,0 +1,118 @@ +name: "AqlProfile CodeQL Advanced" + +on: + push: + paths: + - 'projects/aqlprofile/**' + pull_request: + paths: + - 'projects/aqlprofile/**' + schedule: + - cron: '0 0 * * *' + +env: + EXCLUDED_PATHS: "" + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ubuntu-latest + container: rocm/dev-ubuntu-22.04:latest + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: c-cpp + build-mode: manual + - language: python + build-mode: none + - language: actions + build-mode: none + + steps: + - name: Install OS requirements + timeout-minutes: 10 + shell: bash + run: | + sudo apt update + sudo apt install -y software-properties-common + sudo apt-add-repository ppa:git-core/ppa + sudo apt-get update + sudo apt install -y git + + - name: Checkout repository + uses: actions/checkout@v4 + with: + sparse-checkout: | + projects/aqlprofile + .github/workflows/aqlprofile-code-ql.yml + + - name: Configure Git Safe Directory + shell: bash + run: | + cd projects/aqlprofile + git config --global --add safe.directory '*' + git config --global --add safe.directory '/__w/rocm-systems/rocm-systems' + + + - if: matrix.build-mode == 'manual' + name: Install requirements + timeout-minutes: 10 + shell: bash + run: | + cd projects/aqlprofile + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev rocm-llvm-dev libgtest-dev libgmock-dev + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + 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 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + name: Configure and Build + timeout-minutes: 30 + shell: bash + run: | + cd projects/aqlprofile + cmake -B /tmp/build -DGPU_TARGETS='gfx906,gfx90a,gfx942,gfx1101,gfx1201' -DCMAKE_PREFIX_PATH=/opt/rocm + cmake --build /tmp/build --target all --parallel 16 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/aqlprofile-continuous_integration.yml b/.github/workflows/aqlprofile-continuous_integration.yml new file mode 100644 index 0000000000..abe50e9b4d --- /dev/null +++ b/.github/workflows/aqlprofile-continuous_integration.yml @@ -0,0 +1,161 @@ +name: AqlProfile Continuous Integration + +on: + workflow_dispatch: + push: + paths: + - 'projects/aqlprofile/**' + - '!projects/aqlprofile/*.md' + - '!projects/aqlprofile/CODEOWNERS' + - '!projects/aqlprofile/source/docs/**' + pull_request: + paths: + - 'projects/aqlprofile/**' + - '!projects/aqlprofile/*.md' + - '!projects/aqlprofile/CODEOWNERS' + - '!projects/aqlprofile/source/docs/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + # TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake + PATH: "/usr/bin:$PATH" + navi3_EXCLUDE_TESTS_REGEX: "" + vega20_EXCLUDE_TESTS_REGEX: "" + mi200_EXCLUDE_TESTS_REGEX: "" + mi300_EXCLUDE_TESTS_REGEX: "" + mi300a_EXCLUDE_TESTS_REGEX: "" + mi325_EXCLUDE_TESTS_REGEX: "" + navi4_EXCLUDE_TESTS_REGEX: "" + navi3_EXCLUDE_LABEL_REGEX: "" + vega20_EXCLUDE_LABEL_REGEX: "" + mi200_EXCLUDE_LABEL_REGEX: "" + mi300_EXCLUDE_LABEL_REGEX: "" + mi300a_EXCLUDE_LABEL_REGEX: "" + mi325_EXCLUDE_LABEL_REGEX: "" + navi4_EXCLUDE_LABEL_REGEX: "" + +jobs: + 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: ['navi4', 'navi3', 'mi300'] + os: ['ubuntu-22.04'] + build-type: ['RelWithDebInfo'] + + runs-on: rocprofiler-${{ matrix.runner == 'mi300' && 'ubuntu-22' || matrix.runner }} + if: github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile' + + permissions: + contents: read + pull-requests: write + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + CORE_EXT_RUNNER: mi300a + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/aqlprofile + + + - name: Install requirements + timeout-minutes: 10 + shell: bash + run: | + cd projects/aqlprofile + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libgtest-dev libgmock-dev + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + 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 + + - name: List Files + shell: bash + run: | + cd projects/aqlprofile + 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 + cat /opt/rocm/.info/version + ls -la + pwd + + - name: Configure, Build, and Test + timeout-minutes: 30 + shell: bash + working-directory: projects/aqlprofile + run: + LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH ctest --output-on-failure -V -DCTEST_SOURCE_DIRECTORY="$(pwd)" + -DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${RUNNER_HOSTNAME}" + -DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.os }}-${{ matrix.runner }}-core + -DCMAKE_CTEST_ARGUMENTS="" + -DAQLPROFILE_BUILD_TESTS=ON + -DAQLPROFILE_EXTRA_CONFIGURE_ARGS="" + -S ./dashboard.cmake + + core-rpm: + if: github.ref != 'refs/heads/amd-npi' && github.event.pull_request.head.repo.full_name == 'AMD-ROCm-Internal/aqlprofile' + # 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: rocprofiler-${{ matrix.os }} + + permissions: + contents: read + pull-requests: write + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + CORE_EXT_RUNNER: mi300 + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/aqlprofile + + - name: Install requirements + timeout-minutes: 10 + shell: bash + run: | + cd projects/aqlprofile + git config --global --add safe.directory '*' + + - name: List Files + shell: bash + run: | + cd projects/aqlprofile + 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 + cat /opt/rocm/.info/version + ls -la + pwd + + - name: Configure, Build, and Test + timeout-minutes: 30 + shell: bash + working-directory: projects/aqlprofile + run: + LD_LIBRARY_PATH=$(pwd)/build:$LD_LIBRARY_PATH ctest --output-on-failure -V -DCTEST_SOURCE_DIRECTORY="$(pwd)" + -DCTEST_BINARY_DIRECTORY="$(pwd)/build" -DAQLPROFILE_BUILD_NUM_JOBS="16" -DCTEST_SITE="${RUNNER_HOSTNAME}" + -DCTEST_BUILD_NAME=PR_${{ github.ref_name }}_${{ github.repository }}-${{ matrix.os }}-${{ matrix.runner }}-core + -DCMAKE_CTEST_ARGUMENTS="" + -DAQLPROFILE_BUILD_TESTS=ON + -DAQLPROFILE_EXTRA_CONFIGURE_ARGS="" + -S ./dashboard.cmake diff --git a/.github/workflows/aqlprofile-rocm-ci-caller.yml b/.github/workflows/aqlprofile-rocm-ci-caller.yml new file mode 100644 index 0000000000..1dea3328b1 --- /dev/null +++ b/.github/workflows/aqlprofile-rocm-ci-caller.yml @@ -0,0 +1,35 @@ +name: Aql ROCm CI Caller + +on: + push: + paths: + - 'projects/aqlprofile/**' + - 'projects/rdc/**' + - 'projects/rocminfo/**' + - 'projects/rocprofiler/**' + - 'projects/roctracer/**' + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'projects/aqlprofile/**' + - 'projects/rdc/**' + - 'projects/rocminfo/**' + - 'projects/rocprofiler/**' + - 'projects/roctracer/**' + workflow_dispatch: + issue_comment: + types: [created] + +jobs: + call-workflow: + if: ${{ github.event_name != 'issue_comment' || github.event.comment.body == '!verify' }} + uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline + secrets: inherit + with: + input_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + input_pr_num: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || 0 }} + input_pr_url: ${{ github.event_name == 'pull_request' && github.event.pull_request.html_url || '' }} + input_pr_title: ${{ github.event_name == 'pull_request' && github.event.pull_request.title || '' }} + repository_name: ${{ github.repository }} + base_ref: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref }} + trigger_event_type: ${{ github.event_name }} diff --git a/.github/workflows/rocprofiler-compute-docs.yml b/.github/workflows/rocprofiler-compute-docs.yml new file mode 100644 index 0000000000..e711ff3160 --- /dev/null +++ b/.github/workflows/rocprofiler-compute-docs.yml @@ -0,0 +1,65 @@ +name: Documentation + +on: + push: + paths: + - 'projects/rocprofiler-compute/docs/archive/docs-2.x/**' + - 'projects/rocprofiler-compute/docs/archive/docs-1.x/**' + - '.github/workflows/rocprofiler-compute-docs.yml' + + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Build job + build: + runs-on: ubuntu-latest + container: + image: sphinxdoc/sphinx + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-compute + - name: Additional python packages + run: | + cd projects/rocprofiler-compute + pip3 install -r docs/archive/requirements-doc.txt + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Build 1.x docs + run: | + cd docs/archive/docs-1.x + make html + - name: Build 2.x docs + run: | + cd docs/archive/docs-2.x + make html + - name: Relocate 1.x docs + run: | + mv docs/archive/docs-1.x/_build/html docs/archive/_build/html/1.x + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./docs/archive/_build/html + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/rocprofiler-register-continuous-integration.yml b/.github/workflows/rocprofiler-register-continuous-integration.yml new file mode 100644 index 0000000000..fd46ce85fa --- /dev/null +++ b/.github/workflows/rocprofiler-register-continuous-integration.yml @@ -0,0 +1,191 @@ +name: RocProfiler-Register Continuous Integration + +on: + push: + paths: + - 'projects/rocprofiler-register/**' + - '!projects/rocprofiler-register/*.md' + pull_request: + paths: + - 'projects/rocprofiler-register/**' + - '!projects/rocprofiler-register/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + strategy: + fail-fast: false + matrix: + compiler: ['clang-14', 'clang-15', 'gcc-11', 'gcc-12'] + ci-args: [''] + ci-tag: [''] + include: + - compiler: 'gcc-12' + ci-args: '--coverage' + ci-tag: '-codecov' + - compiler: 'clang-15' + ci-args: '--linter clang-tidy' + ci-tag: '-clang-tidy' + - compiler: 'clang-13' + ci-args: '' + ci-tag: '' + - compiler: 'gcc-12' + ci-args: '--memcheck ThreadSanitizer' + ci-tag: '-thread-sanitizer' + - compiler: 'gcc-12' + ci-args: '--memcheck AddressSanitizer' + ci-tag: '-address-sanitizer' + - compiler: 'gcc-12' + ci-args: '--memcheck LeakSanitizer' + ci-tag: '-leak-sanitizer' + # - compiler: 'gcc-12' + # ci-args: '--memcheck UndefinedBehaviorSanitizer' + # ci-tag: '-undefined-behavior-sanitizer' + + runs-on: rocprofiler-ubuntu-22 + + env: + BUILD_TYPE: RelWithDebInfo + INSTALL_PREFIX: /opt/rocprofiler-register + PACKAGING_INSTALL_PREFIX: /opt/rocm + + steps: + - uses: actions/checkout@v3 + with: + sparse-checkout: projects/rocprofiler-register + + - name: Install Packages + timeout-minutes: 25 + run: | + cd projects/rocprofiler-register + CC=${{ matrix.compiler }} && + CXX=$(echo ${{ matrix.compiler }} | sed 's/clang-/clang++-/1' | sed 's/gcc-/g++-/1') && + apt-get update && + apt-get install -y build-essential python3 environment-modules ${{ matrix.compiler }} ${CXX} && + update-alternatives --install /usr/bin/cc cc /usr/bin/${CC} 100 && + update-alternatives --install /usr/bin/c++ c++ /usr/bin/${CXX} 100 && + python3 -m pip install --upgrade pip && + python3 -m pip install 'cmake==3.22.0' && + python3 -m pip install -r requirements.txt + + - name: Setup GCov + timeout-minutes: 25 + if: ${{ matrix.compiler == 'gcc-12' }} + run: | + cd projects/rocprofiler-register + update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 100 + + - name: Setup Clang-Tidy + timeout-minutes: 25 + if: ${{ matrix.compiler == 'clang-15' }} + run: | + cd projects/rocprofiler-register + apt-get install -y clang-tidy-15 + update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 + + - name: Configure, Build, and Test + timeout-minutes: 115 + shell: bash + working-directory: projects/rocprofiler-register + run: + cmake --version && + python3 ./scripts/run-ci.py -B build + --name ${{ github.repository_owner }}-${{ github.ref_name }}-azure-mi300x-${{ matrix.compiler }}${{ matrix.ci-tag }} + --build-jobs 2 + --site GitHub + ${{ matrix.ci-args }} + --disable-cdash + -- + -DCMAKE_C_COMPILER=/usr/bin/cc + -DCMAKE_CXX_COMPILER=/usr/bin/c++ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} + -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} + -DROCPROFILER_REGISTER_BUILD_TESTS=ON + -DROCPROFILER_REGISTER_BUILD_SAMPLES=ON + -- + -VV + + - name: Install + timeout-minutes: 10 + working-directory: projects/rocprofiler-register + run: + cmake --build build --target install --parallel 2 + + - name: CPack and Install + working-directory: projects/rocprofiler-register + run: | + cd build + cpack -G STGZ + mkdir -p ${{ env.PACKAGING_INSTALL_PREFIX }} + ./rocprofiler-register-*-Linux.sh --prefix=${{ env.PACKAGING_INSTALL_PREFIX }} --exclude-subdir --skip-license + + - name: Test Installed Packages + if: ${{ contains(matrix.compiler, 'clang-15') }} + timeout-minutes: 10 + shell: bash + run: | + cd projects/rocprofiler-register + CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb /opt/rocm/share/rocprofiler-register/tests + cmake --build build-tests-deb --target all --parallel 16 + ctest --test-dir build-tests-deb --output-on-failure + + - name: Test Install Modulefile + timeout-minutes: 15 + shell: bash + run: | + cd projects/rocprofiler-register + set -v + source /usr/share/modules/init/$(basename ${SHELL}) + module use ${{ env.INSTALL_PREFIX }}/share/modulefiles + module avail + module load rocprofiler-register + pushd tests + BUILD_DIR=${PWD}/build-rocp-reg-modulefile + cmake -B ${BUILD_DIR} . + cmake --build ${BUILD_DIR} --target all + rm -rf ${BUILD_DIR} + + - name: Test Install Setup Env + timeout-minutes: 15 + shell: bash + run: | + cd projects/rocprofiler-register + set -v + source ${{ env.INSTALL_PREFIX }}/share/rocprofiler-register/setup-env.sh + pushd samples/library-implementation + BUILD_DIR=${PWD}/build-rocp-reg-setup-env + cmake -B ${BUILD_DIR} . + cmake --build ${BUILD_DIR} --target all + rm -rf ${BUILD_DIR} + + - name: Test Install CPack Modulefile + timeout-minutes: 15 + shell: bash + run: | + cd projects/rocprofiler-register + set -v + source /usr/share/modules/init/$(basename ${SHELL}) + module use ${{ env.PACKAGING_INSTALL_PREFIX }}/share/modulefiles + module avail + module load rocprofiler-register + pushd tests + BUILD_DIR=${PWD}/build-rocp-reg-modulefile-cpack + cmake -B ${BUILD_DIR} . + cmake --build ${BUILD_DIR} --target all + rm -rf ${BUILD_DIR} + + - name: Test Install CPack Setup Env + timeout-minutes: 15 + shell: bash + run: | + cd projects/rocprofiler-register + set -v + source ${{ env.PACKAGING_INSTALL_PREFIX }}/share/rocprofiler-register/setup-env.sh + pushd samples/library-implementation + BUILD_DIR=${PWD}/build-rocp-reg-setup-env-cpack + cmake -B ${BUILD_DIR} . + cmake --build ${BUILD_DIR} --target all + rm -rf ${BUILD_DIR} diff --git a/.github/workflows/rocprofiler-sdk-code_coverage.yml b/.github/workflows/rocprofiler-sdk-code_coverage.yml new file mode 100644 index 0000000000..2c76882126 --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-code_coverage.yml @@ -0,0 +1,338 @@ +name: RocProfiler-SDK Code Coverage + +permissions: + contents: read + pull-requests: write + +on: + workflow_dispatch: + push: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + - '!projects/rocprofiler-sdk/*.md' + - '!projects/rocprofiler-sdk/**/README.md' + pull_request: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + - '!projects/rocprofiler-sdk/*.md' + - '!projects/rocprofiler-sdk/**/README.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + # TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake + ROCM_PATH: "/opt/rocm" + GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201" + PATH: "/usr/bin:$PATH" + ## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake + ## A task should be assigned directly to fix the issue + ## Scratch memory tests need to be fixed for ROCm 7.0 release + navi3_EXCLUDE_TESTS_REGEX: "" + vega20_EXCLUDE_TESTS_REGEX: "" + mi200_EXCLUDE_TESTS_REGEX: "" + mi300_EXCLUDE_TESTS_REGEX: "" + mi300a_EXCLUDE_TESTS_REGEX: "" + mi325_EXCLUDE_TESTS_REGEX: "" + mi3xx_EXCLUDE_TESTS_REGEX: "" + navi4_EXCLUDE_TESTS_REGEX: "" + navi3_EXCLUDE_LABEL_REGEX: "" + vega20_EXCLUDE_LABEL_REGEX: "" + mi200_EXCLUDE_LABEL_REGEX: "" + mi300_EXCLUDE_LABEL_REGEX: "" + mi300a_EXCLUDE_LABEL_REGEX: "" + mi325_EXCLUDE_LABEL_REGEX: "" + mi3xx_EXCLUDE_LABEL_REGEX: "" + navi4_EXCLUDE_LABEL_REGEX: "" + GLOBAL_CMAKE_OPTIONS: "" + +jobs: + code-coverage: + if: ${{ contains(github.event_name, 'pull_request') }} + strategy: + # fail-fast: false + matrix: + runner: ['mi300'] + os: ['ubuntu-22.04'] + build-type: ['Release'] + + runs-on: rocprofiler-ubuntu-22 + + # define this for container + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + GCC_COMPILER_VERSION: 11 + ROCPROFILER_PC_SAMPLING_BETA_ENABLED: 1 + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Load Existing XML Code Coverage + if: github.event_name == 'pull_request' + id: load-coverage + uses: actions/cache@v4 + with: + key: ${{ github.event.pull_request.base.sha }}-codecov + path: .codecov/** + + - name: Copy Existing XML Code Coverage + if: github.event_name == 'pull_request' + shell: bash + run: | + if [ -d .codecov ]; then cp -r .codecov .codecov.ref; fi + + - name: Configure Env + shell: bash + run: | + echo "${PATH}:/usr/local/bin:${HOME}/.local/bin" >> $GITHUB_PATH + echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:${HOME}/.local/lib" >> $GITHUB_ENV + + - name: Install requirements + timeout-minutes: 10 + shell: bash + run: | + cd projects/rocprofiler-sdk + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev libsqlite3-dev + python3 -m pip install -U --user -r requirements.txt + rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk* + + - name: Sync gcov with compilers + timeout-minutes: 10 + shell: bash + run: + apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} && + update-alternatives + --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 500 + --slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }} + --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }} + + - name: List Files + shell: bash + working-directory: projects/rocprofiler-sdk + 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 + cat /opt/rocm/.info/version + ls -la + + - name: Enable PC Sampling + if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }} + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV + + - name: Configure, Build, and Test (Total Code Coverage) + timeout-minutes: 30 + shell: bash + run: + python3 projects/rocprofiler-sdk/source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov + --build-jobs 16 + --site ${RUNNER_HOSTNAME} + --gpu-targets ${{ env.GPU_TARGETS }} + --coverage all + --run-attempt ${{ github.run_attempt }} + -- + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + -DPython3_EXECUTABLE=$(which python3) + ${{ env.GLOBAL_CMAKE_OPTIONS }} + -- + -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" + -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" + + - name: Configure, Build, and Test (Tests Code Coverage) + timeout-minutes: 30 + shell: bash + run: + find build -type f | egrep '\.gcda$' | xargs rm && + python3 projects/rocprofiler-sdk/source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-tests + --build-jobs 16 + --site ${RUNNER_HOSTNAME} + --gpu-targets ${{ env.GPU_TARGETS }} + --coverage tests + --run-attempt ${{ github.run_attempt }} + -- + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + -DPython3_EXECUTABLE=$(which python3) + ${{ env.GLOBAL_CMAKE_OPTIONS }} + -- + -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" + -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" + + - name: Configure, Build, and Test (Samples Code Coverage) + timeout-minutes: 30 + shell: bash + run: + find build -type f | egrep '\.gcda$' | xargs rm && + python3 projects/rocprofiler-sdk/source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-codecov-samples + --build-jobs 16 + --site ${RUNNER_HOSTNAME} + --gpu-targets ${{ env.GPU_TARGETS }} + --coverage samples + --run-attempt ${{ github.run_attempt }} + -- + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + -DPython3_EXECUTABLE=$(which python3) + ${{ env.GLOBAL_CMAKE_OPTIONS }} + -- + -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" + -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" + + - name: Save XML Code Coverage + id: save-coverage + uses: actions/cache/save@v4 + with: + key: ${{ github.sha }}-codecov + path: | + .codecov/*.xml + + - id: generatereport + name: Generate Code Coverage Comment + if: github.event_name == 'pull_request' + timeout-minutes: 5 + shell: bash + run: | + cd projects/rocprofiler-sdk + echo "PWD: ${PWD}" + ls -la + + for i in "all" "tests" "samples"; do + wkhtmltoimage --enable-local-file-access --quality 70 .codecov/${i}.html .codecov/${i}.png + done + ls -la .codecov + which -a git + git --version + + ./source/scripts/upload-image-to-github.py --bot --token ${{ secrets.TOKEN }} --files .codecov/{all,tests,samples}.png --output-dir .codecov --name pr-${{ github.event.pull_request.number }} + + echo -e "\n${PWD}:" + ls -la . + + echo -e "\n.codecov:" + ls -la .codecov + + get-base-md-contents() { cat .codecov/${1}.png.md; } + get-full-md-contents() { cat .codecov/${1}.png.md .codecov/${1}.md; } + cat << EOF > .codecov/report.md + # Code Coverage Report + + ## Tests Only + $(get-base-md-contents tests) + + ## Samples Only + $(get-base-md-contents samples) + + ## Tests + Samples + $(get-base-md-contents all) + + + EOF + + echo 'CODECOVERAGE_REPORT< $GITHUB_OUTPUT + cat .codecov/report.md >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Write Code Coverage Comment + if: github.event_name == 'pull_request' + timeout-minutes: 5 + uses: actions/github-script@v6 + env: + COMMENT_BODY: | +
+

Code Coverage Report

+ + + ${{ steps.generatereport.outputs.CODECOVERAGE_REPORT }} +
+ with: + github-token: ${{ secrets.TOKEN }} + script: | + const commentIdentifier = ''; // Used to identify codecov comment + const commentBody = process.env.COMMENT_BODY; + + // Fetch existing comments + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + }); + + // Check for an existing comment + const existingComment = comments.find(comment => comment.body.includes(commentIdentifier)); + + if (existingComment) { + // Update the existing comment + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body: commentBody, + }); + core.info(`Updated comment with ID: ${existingComment.id}`); + } else { + // Create a new comment + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: commentBody, + }); + core.info('Created a new comment.'); + } + + - name: Archive Code Coverage Data + if: ${{ github.event_name == 'workflow_dispatch' }} + uses: actions/upload-artifact@v4 + with: + name: code-coverage-details + path: | + ${{github.workspace}}/.codecov/* + + - name: Verify Test Labels + timeout-minutes: 5 + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + pushd build + # + # if following fails, there is a test that does not have + # a label identifying it as sample or test (unit or integration). + # Recommended labels are: + # - samples + # - unittests + # - integration-tests + # + ctest -N -LE 'samples|tests' -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" -O ctest.mislabeled.log + grep 'Total Tests: 0' ctest.mislabeled.log + # + # if following fails, then there is overlap between the labels. + # A test cannot both be a sample and (unit/integration) test. + # + ctest -N -O ctest.all.log + ctest -N -O ctest.samples.log -L samples + ctest -N -O ctest.tests.log -L tests + NUM_ALL=$(grep 'Total Tests:' ctest.all.log | awk '{print $NF}') + NUM_SAMPLE=$(grep 'Total Tests:' ctest.samples.log | awk '{print $NF}') + NUM_TEST=$(grep 'Total Tests:' ctest.tests.log | awk '{print $NF}') + NUM_SUM=$((${NUM_SAMPLE} + ${NUM_TEST})) + echo "Total tests: ${NUM_ALL}" + echo "Total labeled tests: ${NUM_SUM}" + if [ ${NUM_ALL} != ${NUM_SUM} ]; then + echo "Test label overlap" + exit 1 + fi + popd diff --git a/.github/workflows/rocprofiler-sdk-codeql.yml b/.github/workflows/rocprofiler-sdk-codeql.yml new file mode 100644 index 0000000000..57763ac9ca --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-codeql.yml @@ -0,0 +1,103 @@ +name: "RocProfiler-SDK CodeQL Advanced Analysis" + +on: + workflow_dispatch: + pull_request: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + - '!projects/rocprofiler-sdk/*.md' + + push: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + - '!projects/rocprofiler-sdk/*.md' + +env: + ROCM_PATH: "/opt/rocm" + GPU_TARGETS: "gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1201" + PATH: "/usr/bin:$PATH" + EXCLUDED_PATHS: "external /tmp/build/external" + GLOBAL_CMAKE_OPTIONS: "-DROCPROFILER_INTERNAL_RCCL_API_TRACE=ON" + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ubuntu-latest + + container: rocm/dev-ubuntu-22.04:latest + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: cpp + build-mode: manual + - language: python + build-mode: none + - language : actions + build-mode: none + steps: + - name: Install requirements + timeout-minutes: 10 + shell: bash + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt update + sudo apt install -y software-properties-common + sudo apt-add-repository ppa:git-core/ppa + sudo apt-get update + sudo apt-get install -y git build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rocdecode-dev rocjpeg-dev + git config --global --add safe.directory '*' + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + sudo 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 + + - uses: actions/checkout@v4 + with: + sparse-checkout: | + projects/rocprofiler-sdk + .github/workflows/rocprofiler-sdk-codeql.yml + .github/workflows/rocprofiler-sdk-formatting.yml + submodules: 'true' + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended + + - name: Configure and Build + timeout-minutes: 30 + shell: bash + run: | + cd projects/rocprofiler-sdk + python3 -m pip install -r requirements.txt + cmake -B /tmp/build -DCMAKE_PREFIX_PATH=/opt/rocm ${{ env.GLOBAL_CMAKE_OPTIONS }} -DPython3_EXECUTABLE=$(which python3) . + cmake --build /tmp/build --target all --parallel 16 + rm -rf ${EXCLUDED_PATHS} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/rocprofiler-sdk-continuous_integration.yml b/.github/workflows/rocprofiler-sdk-continuous_integration.yml new file mode 100644 index 0000000000..145519d31c --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-continuous_integration.yml @@ -0,0 +1,338 @@ +name: RocProfiler-SDK Continuous Integration + +on: + workflow_dispatch: + push: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/*.md' + - '!projects/rocprofiler-sdk/**/README.md' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + pull_request: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/*.md' + - '!projects/rocprofiler-sdk/**/README.md' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + # TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_TARGETS, etc. with internal handling in cmake + ROCM_PATH: "/opt/rocm" + GPU_TARGETS: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx950 gfx1030 gfx1100 gfx1101 gfx1102 gfx1201" + PATH: "/usr/bin:$PATH" + ## No tests should be excluded here except for extreme emergencies; tests should only be disabled in CMake + ## A task should be assigned directly to fix the issues + ## Scratch memory tests need to be fixed for ROCm 7.0 release + navi3_EXCLUDE_TESTS_REGEX: "" + vega20_EXCLUDE_TESTS_REGEX: "" + mi200_EXCLUDE_TESTS_REGEX: "" + mi300_EXCLUDE_TESTS_REGEX: "" + mi300a_EXCLUDE_TESTS_REGEX: "" + mi325_EXCLUDE_TESTS_REGEX: "" + mi3xx_EXCLUDE_TESTS_REGEX: "" + navi4_EXCLUDE_TESTS_REGEX: "" + navi3_EXCLUDE_LABEL_REGEX: "" + vega20_EXCLUDE_LABEL_REGEX: "" + mi200_EXCLUDE_LABEL_REGEX: "" + mi300_EXCLUDE_LABEL_REGEX: "" + mi300a_EXCLUDE_LABEL_REGEX: "" + mi325_EXCLUDE_LABEL_REGEX: "" + mi3xx_EXCLUDE_LABEL_REGEX: "" + navi4_EXCLUDE_LABEL_REGEX: "" + GLOBAL_CMAKE_OPTIONS: "" + +jobs: + 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: ['navi4', 'navi3', 'mi300a'] + os: ['ubuntu-22.04'] + build-type: ['RelWithDebInfo'] + + runs-on: rocprofiler-${{ matrix.runner == 'mi3xx' && 'ubuntu-22' || matrix.runner }} + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + CORE_EXT_RUNNER: mi3xx + + steps: + - uses: actions/checkout@v4 + + - name: Install requirements + timeout-minutes: 10 + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + 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 -U --user -r requirements.txt + rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk* /opt/rocm*/lib/python*/site-packages/roctx /opt/rocm*/lib/python*/site-packages/rocpd + + - name: List Files + shell: bash + working-directory: projects/rocprofiler-sdk + 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 + cat /opt/rocm/.info/version + ls -la + + - name: Enable PC Sampling + if: ${{ contains(matrix.system.gpu, 'mi200') || contains(matrix.system.gpu, 'mi300a') }} + shell: bash + working-directory: projects/rocprofiler-sdk + run: + echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV + + - name: Configure, Build, and Test + timeout-minutes: 30 + shell: bash + working-directory: projects/rocprofiler-sdk + run: + python3 ./source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.system.os }}-${{ matrix.system.gpu }}-core + --build-jobs 16 + --site ${RUNNER_HOSTNAME} + --gpu-targets ${{ env.GPU_TARGETS }} + --run-attempt ${{ github.run_attempt }} + ${{ matrix.system.ci-flags }} + -- + -DROCPROFILER_DEP_ROCMCORE=ON + -DROCPROFILER_BUILD_DOCS=OFF + -DCMAKE_BUILD_TYPE=${{ matrix.system.build-type }} + -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk + -DCPACK_GENERATOR='DEB;RPM;TGZ' + -DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)" + -DPython3_EXECUTABLE=$(which python3) + ${{ env.GLOBAL_CMAKE_OPTIONS }} + -- + -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" + -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" + + - name: Install + if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }} + timeout-minutes: 10 + working-directory: projects/rocprofiler-sdk + run: + cmake --build build --target install --parallel 16 + + - name: Build Packaging + if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }} + timeout-minutes: 10 + working-directory: projects/rocprofiler-sdk + run: + cmake --build build --target package --parallel 16 + + - name: Test Install Build + if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }} + timeout-minutes: 20 + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-samples samples + CMAKE_PREFIX_PATH=/opt/rocprofiler-sdk cmake -B build-tests -DGPU_TARGETS="gfx942" 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 "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure + ctest --test-dir build-tests -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure + + - name: Install Packages + if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }} + timeout-minutes: 5 + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin + ls -la + ls -la ./build + dpkg --force-all -i ./build/rocprofiler-sdk-roctx_*.deb + dpkg --force-all -i ./build/rocprofiler-sdk-rocpd_*.deb + for i in $(ls -S ./build/rocprofiler-sdk*.deb | egrep -v 'roctx|rocpd'); do dpkg --force-all -i ${i}; done; + + - name: Test Installed Packages + if: ${{ contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }} + timeout-minutes: 20 + shell: bash + working-directory: projects/rocprofiler-sdk + 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 -DGPU_TARGETS="gfx942" /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 "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure + ctest --test-dir build-tests-deb -LE "${${{ matrix.system.gpu }}_EXCLUDE_LABEL_REGEX}" -E "${${{ matrix.system.gpu }}_EXCLUDE_TESTS_REGEX}" --output-on-failure + + - name: Archive production artifacts + if: ${{ github.event_name == 'workflow_dispatch' && contains(matrix.system.gpu, env.CORE_EXT_RUNNER) }} + uses: actions/upload-artifact@v4 + with: + name: installers-deb + 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-8', 'sles-15'] + build-type: ['RelWithDebInfo'] + ci-flags: [''] + + runs-on: rocprof-${{ matrix.os }} + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + OS_TYPE: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Install requirements + timeout-minutes: 10 + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + git config --global --add safe.directory '*' + if [ "${OS_TYPE}" == "rhel-8" ]; then + dnf makecache + dnf groupinstall -y "Development Tools" + dnf remove -y gcc-c++ + dnf install -y gcc-toolset-11-gcc-c++ llvm14-devel + fi + python3 -m pip install --upgrade pip + python3 -m pip install -U --user -r requirements.txt + rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk* + + - name: List Files + shell: bash + working-directory: projects/rocprofiler-sdk + 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 + cat /opt/rocm/.info/version + ls -la + + - name: Enable PC Sampling + if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }} + shell: bash + working-directory: projects/rocprofiler-sdk + run: + echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV + + - name: Configure, Build, and Test + timeout-minutes: 30 + shell: bash + working-directory: projects/rocprofiler-sdk + run: + if [ "${OS_TYPE}" == "rhel" ]; then source scl_source enable gcc-toolset-11; fi; + /usr/bin/python3 ./source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-core + --build-jobs 16 + --site ${RUNNER_HOSTNAME} + --gpu-targets ${{ env.GPU_TARGETS }} + --run-attempt ${{ github.run_attempt }} + ${{ matrix.ci-flags }} + -- + -DROCPROFILER_DEP_ROCMCORE=ON + -DROCPROFILER_BUILD_DOCS=OFF + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + -DPython3_EXECUTABLE=$(which python3) + ${{ env.GLOBAL_CMAKE_OPTIONS }} + -- + -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" + -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" + + sanitizers: + strategy: + fail-fast: false + matrix: + runner: ['mi3xx'] + sanitizer: ['AddressSanitizer', 'ThreadSanitizer', 'LeakSanitizer', 'UndefinedBehaviorSanitizer'] + os: ['ubuntu-22.04'] + build-type: ['RelWithDebInfo'] + + if: ${{ contains(github.event_name, 'pull_request') }} + runs-on: rocprofiler-${{ matrix.runner == 'mi3xx' && 'ubuntu-22' || matrix.runner }} + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + GCC_COMPILER_VERSION: 13 + + steps: + - uses: actions/checkout@v4 + + - name: Install requirements + timeout-minutes: 10 + shell: bash + working-directory: projects/rocprofiler-sdk + run: + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake python3-pip libasan8 libtsan2 software-properties-common clang-15 libdw-dev libsqlite3-dev + add-apt-repository ppa:ubuntu-toolchain-r/test + apt-get update + apt-get upgrade -y + apt-get install -y gcc-${{ env.GCC_COMPILER_VERSION }} g++-${{ env.GCC_COMPILER_VERSION }} + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_COMPILER_VERSION }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_COMPILER_VERSION }} --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ env.GCC_COMPILER_VERSION }} + python3 -m pip install -U --user -r requirements.txt + rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk* + + - name: List Files + shell: bash + working-directory: projects/rocprofiler-sdk + run: | + 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 + cat /opt/rocm/.info/version + ls -la + + - name: Enable PC Sampling + if: ${{ contains(matrix.runner, 'mi200') || contains(matrix.runner, 'mi300a') }} + shell: bash + working-directory: projects/rocprofiler-sdk + run: + echo 'ROCPROFILER_PC_SAMPLING_BETA_ENABLED=1' >> $GITHUB_ENV + + - name: Configure, Build, and Test + timeout-minutes: 45 + shell: bash + working-directory: projects/rocprofiler-sdk + run: + python3 ./source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.runner }}-${{ matrix.sanitizer }} + --build-jobs 16 + --site ${RUNNER_HOSTNAME} + --gpu-targets ${{ env.GPU_TARGETS }} + --memcheck ${{ matrix.sanitizer }} + --run-attempt ${{ github.run_attempt }} + -- + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + -DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}" + -DPython3_EXECUTABLE=$(which python3) + ${{ env.GLOBAL_CMAKE_OPTIONS }} + -- + -LE "${${{ matrix.runner }}_EXCLUDE_LABEL_REGEX}" + -E "${${{ matrix.runner }}_EXCLUDE_TESTS_REGEX}" \ No newline at end of file diff --git a/.github/workflows/rocprofiler-sdk-docs.yml b/.github/workflows/rocprofiler-sdk-docs.yml new file mode 100644 index 0000000000..7c066307bc --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-docs.yml @@ -0,0 +1,140 @@ +name: RocProfiler-SDK Documentation + +on: + workflow_dispatch: + push: + paths: + - 'projects/rocprofiler-sdk/*.md' + - 'projects/rocprofiler-sdk/VERSION' + - 'projects/rocprofiler-sdk/source/docs/**' + - 'projects/rocprofiler-sdk/source/scripts/update-docs.sh' + - 'projects/rocprofiler-sdk/source/include/rocprofiler-sdk/**' + - 'projects/rocprofiler-sdk/.github/workflows/docs.yml' + pull_request: + paths: + - 'projects/rocprofiler-sdk/*.md' + - 'projects/rocprofiler-sdk/VERSION' + - 'projects/rocprofiler-sdk/source/docs/**' + - 'projects/rocprofiler-sdk/source/scripts/update-docs.sh' + - 'projects/rocprofiler-sdk/source/include/rocprofiler-sdk/**' + - 'projects/rocprofiler-sdk/.github/workflows/docs.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + +jobs: + build-docs: + runs-on: ubuntu-latest + container: continuumio/miniconda3 + permissions: + contents: read + pages: write + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-sdk + submodules: true + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Create Docs Directory + run: | + git config --global --add safe.directory '*' + mkdir -p projects/rocprofiler-sdk/docs/_doxygen/rocprofiler-sdk + mkdir -p projects/rocprofiler-sdk/docs/_doxygen/roctx + - name: Install documentation dependencies + timeout-minutes: 10 + shell: bash + run: | + apt-get update + apt-get install -y doxygen graphviz build-essential cmake + - name: Build Docs + shell: bash -el {0} + working-directory: projects/rocprofiler-sdk/source/docs + run: | + conda init + conda env create -n rocprofiler-docs -f environment.yml + conda activate rocprofiler-docs + python3 -m pip install sphinx + python3 -m pip install doxysphinx rocm-docs-core + git config --global --add safe.directory '*' + ../scripts/update-docs.sh + - name: Upload artifact + if: ${{ github.event_name == 'workflow_dispatch' }} + uses: actions/upload-pages-artifact@v3 + with: + path: projects/rocprofiler-sdk/docs + + deploy-docs: + if: github.ref == 'refs/heads/amd-mainline' + runs-on: ubuntu-latest + needs: build-docs + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + build-docs-from-source: + runs-on: ubuntu-latest + container: rocm/dev-ubuntu-22.04:latest + steps: + - name: Install os essentials + timeout-minutes: 10 + shell: bash + run: | + sudo apt update + sudo apt install -y software-properties-common + sudo apt-add-repository ppa:git-core/ppa + sudo apt-get update + sudo apt-get install -y git + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-sdk + submodules: true + - name: Create Docs Directory + run: | + git config --global --add safe.directory '*' + mkdir -p projects/rocprofiler-sdk/source/docs/_doxygen/rocprofiler-sdk + mkdir -p projects/rocprofiler-sdk/source/docs/_doxygen/roctx + - name: Install requirements + timeout-minutes: 10 + shell: bash + working-directory: projects/rocprofiler-sdk/ + run: | + git config --global --add safe.directory '*' + sudo apt-get update + sudo apt-get install -y cmake gcc g++ libdw-dev libsqlite3-dev rpm + python3 -m pip install -r requirements.txt + + - name: Configure, Build, Install, and Package + timeout-minutes: 60 + shell: bash + working-directory: projects/rocprofiler-sdk/ + run: + git config --global --add safe.directory '*'; + export CMAKE_PREFIX_PATH=/opt/rocm:${CMAKE_PREFIX_PATH}; + cmake -B build + -DROCPROFILER_DEP_ROCMCORE=ON + -DROCPROFILER_BUILD_DOCS=ON + -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler-sdk + -DCPACK_GENERATOR='DEB;RPM;TGZ' + -DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)" + -DPython3_EXECUTABLE=$(which python3) + .; + cmake --build build --target docs --parallel 4; + cmake --build build --target all --parallel 12; + sudo cmake --build build --target install --parallel 12; + cmake --build build --target package --parallel 12 diff --git a/.github/workflows/rocprofiler-sdk-python.yml b/.github/workflows/rocprofiler-sdk-python.yml new file mode 100644 index 0000000000..8f1d23b779 --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-python.yml @@ -0,0 +1,42 @@ +name: RocProfiler-SDK Python Linting + +on: + workflow_dispatch: + push: + paths: + - 'projects/rocprofiler-sdk/**' + pull_request: + paths: + - 'projects/rocprofiler-sdk/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linting: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.10', '3.12'] + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-sdk + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + cd projects/rocprofiler-sdk + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + cd projects/rocprofiler-sdk + # stop the build if there are Python syntax errors or undefined names + flake8 source --count --show-source --statistics --select=E9,F63,F7,F82 + # flake8 options are defined in .flake8 + flake8 source --count --show-source --statistics diff --git a/.github/workflows/rocprofiler-sdk-restrictions.yml b/.github/workflows/rocprofiler-sdk-restrictions.yml new file mode 100644 index 0000000000..b47fc20f31 --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-restrictions.yml @@ -0,0 +1,55 @@ + +name: RocProfiler-SDK Code Restrictions +permissions: + contents: read + +# This workflow ensures that certain code restrictions are applied. +# For examples, rocprofiler-sdk cannot use std::regex because of issues +# when loaded into an application compiled with C++ dual ABI support because +# while std::regex itself (and std::regex_traits) being ABI-tagged, +# std::__detail::_Scanner is not. Applications compiled with dual ABI support +# will either throw an exception or produce a segfault and thus, this workflow +# attempts to catch usage of std::regex during CI. + +on: + workflow_dispatch: + pull_request: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/.github/workflows/pull_*.yml' + - '!projects/rocprofiler-sdk/.github/workflows/linting.yml' + - '!projects/rocprofiler-sdk/.github/workflows/markdown_lint.yml' + - '!projects/rocprofiler-sdk/*.md' + - '!projects/rocprofiler-sdk/**/README.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + regex: + runs-on: ubuntu-latest + env: + FOLDERS: "projects/rocprofiler-sdk/source/lib/common projects/rocprofiler-sdk/source/lib/rocprofiler-sdk projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx" + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3-pip + python3 -m pip install -U cmake-format + + - name: Apply restriction + run: | + cd projects/rocprofiler-sdk + set +e + FILES="$(find ${FOLDERS} -type f)" + GREP="$(grep -E -n 'std::regex|' ${FILES})" + if [ "${GREP}" != "" ]; then + echo -e "\nError! std::regex is not allowed in ${FOLDERS}...\n" + echo -e "\nResults:\n" + echo "${GREP}" + exit 1 + fi diff --git a/.github/workflows/rocprofiler-sdk-rocm_ci_caller.yml b/.github/workflows/rocprofiler-sdk-rocm_ci_caller.yml new file mode 100644 index 0000000000..e89520a732 --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-rocm_ci_caller.yml @@ -0,0 +1,33 @@ +name: RocProfiler-SDK ROCm CI Caller +on: + pull_request: + types: [opened, reopened, synchronize] + paths: + - 'projects/rocm-smi-lib/**' + - 'projects/rocprofiler-register/**' + - 'projects/rocprofiler-sdk/**' + - 'projects/rocr-runtime/**' + push: + paths: + - 'projects/rocm-smi-lib/**' + - 'projects/rocprofiler-register/**' + - 'projects/rocprofiler-sdk/**' + - 'projects/rocr-runtime/**' + workflow_dispatch: + issue_comment: + types: [created] + +jobs: + call-workflow: + if: github.event_name != 'issue_comment' ||(github.event_name == 'issue_comment' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!verify') || startsWith(github.event.comment.body, '!verify release') || startsWith(github.event.comment.body, '!verify retest'))) + uses: AMD-ROCm-Internal/rocm_ci_infra/.github/workflows/rocm_ci.yml@mainline + secrets: inherit + with: + input_sha: ${{github.event_name == 'pull_request' && github.event.pull_request.head.sha || (github.event_name == 'push' && github.sha) || (github.event_name == 'issue_comment' && github.event.issue.pull_request.head.sha) || github.sha}} + input_pr_num: ${{github.event_name == 'pull_request' && github.event.pull_request.number || (github.event_name == 'issue_comment' && github.event.issue.number) || 0}} + input_pr_url: ${{github.event_name == 'pull_request' && github.event.pull_request.html_url || (github.event_name == 'issue_comment' && github.event.issue.pull_request.html_url) || ''}} + input_pr_title: ${{github.event_name == 'pull_request' && github.event.pull_request.title || (github.event_name == 'issue_comment' && github.event.issue.pull_request.title) || ''}} + repository_name: ${{ github.repository }} + base_ref: ${{github.event_name == 'pull_request' && github.event.pull_request.base.ref || (github.event_name == 'issue_comment' && github.event.issue.pull_request.base.ref) || github.ref}} + trigger_event_type: ${{ github.event_name }} + comment_text: ${{ github.event_name == 'issue_comment' && github.event.comment.body || '' }} diff --git a/.github/workflows/rocprofiler-sdk-rocm_release_compatibility.yml b/.github/workflows/rocprofiler-sdk-rocm_release_compatibility.yml new file mode 100644 index 0000000000..44624d57f3 --- /dev/null +++ b/.github/workflows/rocprofiler-sdk-rocm_release_compatibility.yml @@ -0,0 +1,119 @@ +name: RocProfiler-SDK ROCm Release Compatibility + +permissions: + contents: read + +on: + workflow_dispatch: + push: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + - '!projects/rocprofiler-sdk/*.md' + pull_request: + paths: + - 'projects/rocprofiler-sdk/**' + - '!projects/rocprofiler-sdk/CODEOWNERS' + - '!projects/rocprofiler-sdk/source/docs/**' + - '!projects/rocprofiler-sdk/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + ROCM_PATH: "/opt/rocm" + PATH: "/usr/bin:$PATH" + +jobs: + rocm-release-compatibility: + strategy: + fail-fast: false + matrix: + rocm-release: ['6.2', '6.3', '6.4', 'latest'] + os: ['ubuntu-22.04'] + build-type: ['Release'] + + runs-on: ubuntu-latest + container: + image: rocm/dev-${{ matrix.os }}:${{ matrix.rocm-release }} + + # define this for containers + env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + + steps: + - name: Install Git + timeout-minutes: 25 + run: | + apt-get update + apt-get install -y software-properties-common + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git + + - uses: actions/checkout@v4 + + - name: Install requirements + if: ${{ matrix.rocm-release == '6.2' }} + timeout-minutes: 10 + shell: bash + run: | + cd projects/rocprofiler-sdk + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + 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 -U --user -r requirements.txt + + - name: Install requirements + if: ${{ matrix.rocm-release != '6.2' }} + timeout-minutes: 10 + shell: bash + run: | + cd projects/rocprofiler-sdk + git config --global --add safe.directory '*' + apt-get update + apt-get install -y build-essential cmake g++-11 g++-12 python3-pip libdw-dev libsqlite3-dev rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 + 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 -U --user -r requirements.txt + + - name: List Files + shell: bash + run: | + cd projects/rocprofiler-sdk + echo "Number of processors: $(nproc)" + 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 + cat /opt/rocm/.info/version + ls -la + + - name: Configure and Build + timeout-minutes: 30 + shell: bash + working-directory: projects/rocprofiler-sdk + run: + python3 source/scripts/run-ci.py -B build + --name ${{ github.repository }}-${{ github.ref_name }}-${{ matrix.os }}-rocm-${{ matrix.rocm-release }} + --build-jobs 4 + --site "$(hostname)" + --stages Start Update Configure Build Submit + --run-attempt ${{ github.run_attempt }} + --disable-cdash + -- + -DROCPROFILER_DEP_ROCMCORE=ON + -DROCPROFILER_BUILD_{TESTS,SAMPLES,DOCS}=OFF + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + -DCMAKE_INSTALL_PREFIX="$(realpath /opt/rocm)" + -DPython3_EXECUTABLE=$(which python3) + + - name: Install + timeout-minutes: 10 + run: + cd projects/rocprofiler-sdk + cmake --build build --target install diff --git a/.github/workflows/rocprofiler-systems-containers.yml b/.github/workflows/rocprofiler-systems-containers.yml new file mode 100644 index 0000000000..3654b594c0 --- /dev/null +++ b/.github/workflows/rocprofiler-systems-containers.yml @@ -0,0 +1,188 @@ +name: RocProfiler-Systems Continuous Integration Containers +run-name: ci-containers + +# nightly build +on: + workflow_dispatch: + schedule: + - cron: 0 5 * * * + push: + paths: + - '.github/workflows/rocprofiler-systems-containers.yml' + - 'projects/rocprofiler-systems/docker/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + +jobs: + rocprofiler-systems-ci: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - distro: "ubuntu" + version: "20.04" + - distro: "ubuntu" + version: "22.04" + - distro: "ubuntu" + version: "24.04" + - distro: "opensuse" + version: "15.5" + - distro: "opensuse" + version: "15.6" + - distro: "rhel" + version: "8.10" + - distro: "rhel" + version: "9.3" + - distro: "rhel" + version: "9.4" + - distro: "rhel" + version: "9.5" + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-systems + submodules: recursive + + - 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.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build CI Container + timeout-minutes: 45 + uses: nick-fields/retry@v3 + with: + retry_wait_seconds: 60 + timeout_minutes: 45 + max_attempts: 3 + command: | + pushd projects/rocprofiler-systems/docker + ./build-docker-ci.sh --distro ${{ matrix.distro }} --versions ${{ matrix.version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push --jobs 2 --elfutils-version 0.186 --boost-version 1.79.0 + popd + + rocprofiler-systems-release: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + # ubuntu 20.04 + - os-distro: "ubuntu" + os-version: "20.04" + rocm-version: "0.0" + - os-distro: "ubuntu" + os-version: "20.04" + rocm-version: "6.3" + # ubuntu 22.04 + - os-distro: "ubuntu" + os-version: "22.04" + rocm-version: "0.0" + - os-distro: "ubuntu" + os-version: "22.04" + rocm-version: "6.3" + - os-distro: "ubuntu" + os-version: "22.04" + rocm-version: "6.4" + # ubuntu 24.04 + - os-distro: "ubuntu" + os-version: "24.04" + rocm-version: "0.0" + - os-distro: "ubuntu" + os-version: "24.04" + rocm-version: "6.3" + - os-distro: "ubuntu" + os-version: "24.04" + rocm-version: "6.4" + # opensuse 15.5 + - os-distro: "opensuse" + os-version: "15.5" + rocm-version: "0.0" + - os-distro: "opensuse" + os-version: "15.5" + rocm-version: "6.3" + # opensuse 15.6 + - os-distro: "opensuse" + os-version: "15.6" + rocm-version: "0.0" + - os-distro: "opensuse" + os-version: "15.6" + rocm-version: "6.3" + - os-distro: "opensuse" + os-version: "15.6" + rocm-version: "6.4" + # RHEL 8.10 + - os-distro: "rhel" + os-version: "8.10" + rocm-version: "0.0" + - os-distro: "rhel" + os-version: "8.10" + rocm-version: "6.3" + - os-distro: "rhel" + os-version: "8.10" + rocm-version: "6.4" + # RHEL 9.4 + - os-distro: "rhel" + os-version: "9.4" + rocm-version: "0.0" + - os-distro: "rhel" + os-version: "9.4" + rocm-version: "6.3" + - os-distro: "rhel" + os-version: "9.4" + rocm-version: "6.4" + # RHEL 9.5 + - os-distro: "rhel" + os-version: "9.5" + rocm-version: "0.0" + - os-distro: "rhel" + os-version: "9.5" + rocm-version: "6.3" + - os-distro: "rhel" + os-version: "9.5" + rocm-version: "6.4" + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-systems + + - 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.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Base Container + timeout-minutes: 45 + uses: nick-fields/retry@v3 + with: + retry_wait_seconds: 60 + timeout_minutes: 45 + max_attempts: 3 + command: | + pushd projects/rocprofiler-systems/docker + ./build-docker.sh --distro ${{ matrix.os-distro }} --versions ${{ matrix.os-version }} --rocm-versions ${{ matrix.rocm-version }} --user ${{ secrets.DOCKERHUB_USERNAME }} --push + popd diff --git a/.github/workflows/rocprofiler-systems-formatting.yml b/.github/workflows/rocprofiler-systems-formatting.yml new file mode 100644 index 0000000000..562773e8ee --- /dev/null +++ b/.github/workflows/rocprofiler-systems-formatting.yml @@ -0,0 +1,120 @@ + +name: RocProfiler-Systems Formatting +run-name: formatting + +on: + push: + paths: + - 'projects/rocprofiler-systems/**' + pull_request: + paths: + - 'projects/rocprofiler-systems/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + + call-workflow-passing-data: + name: Documentation + uses: ROCm/rocm-docs-core/.github/workflows/linting.yml@develop + + python: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-systems + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: black format + run: | + cd projects/rocprofiler-systems + black --diff --check . + + cmake: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-systems + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3-pip + python3 -m pip install gersemi + - name: gersemi + run: | + set +e + gersemi -i $(find . -type f ! -path '*/external/*' | grep -E 'CMakeLists.txt|\.cmake$') + if [ $(git diff | wc -l) -gt 0 ]; then + echo -e "\nError! CMake code not formatted. Run gersemi ...\n" + echo -e "\nFiles:\n" + git diff --name-only + echo -e "\nFull diff:\n" + git diff + exit 1 + fi + + source: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: projects/rocprofiler-systems + + - name: Install dependencies + run: | + DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}') + sudo apt-get update + sudo apt-get install -y software-properties-common wget curl clang-format-18 + - name: clang-format + run: | + set +e + FILES=$(find source examples tests -type f | egrep '\.(h|hpp|c|cpp)(|\.in)$') + FORMAT_OUT=$(clang-format-18 -output-replacements-xml ${FILES}) + RET=$(echo ${FORMAT_OUT} | grep -c '