rocprofiler library unit tests (#81)

* Update CI and linting workflows

- delete linting workflow
- compile default CI job with clang-tidy
- split out code coverage matrix entry to separate job
- code coverage job runs code coverage 3x
  - once for total code coverage
  - once for unittests code coverage
  - once for samples code coverage

* Update PTL submodule

- improves handling of when thread pool is destroyed in atexit handler

* Update lib/rocprofiler/buffer

- buffer::instance::get_internal_buffer()
- allocate_buffer invokes internal_threading::initialize() on first entry
- update flush routine
 - if wait is false, does not wait for task group to finish syncing
 - checks for callback pointer

* Update lib/rocprofiler/internal_threading

- modifications to handle destruction of statics before atexit handler is invoked

* Update lib/rocprofiler/registration.cpp

- reorder atexit call in initialize()
- protect finalize from executing more than once

* Add unittests for rocprofiler buffer

* Update CI workflow

- disable fail-fast for sanitizers
- move AddressSanitizer job to top of the list

* Update lib/rocprofiler/tests/buffer/CMakeLists.txt

- do not set memcheck LD_PRELOAD for rocprofiler-lib-buffer-tests

* Update lib/rocprofiler/registration.{hpp,cpp}

- only invoke client finalizers if initialized
- remove invoke_client_initializer
- move invoke_client functions to anonymous namespace (no declaration in header)
- set fini status in finalize

* Update scripts/thread-sanitizer-suppr.txt

- suppress false positive for double mutex lock in external/ptl/source/PTL/TaskGroup.hh

* Restructure lib/rocprofiler/tests

* Update lib/common

- add utility.cpp
- move read_command_line to utility.{hpp,cpp}
  - was formerly in config.cpp

* Update lib/rocprofiler

- checks for init status return configuration locked if status is not greater than -1
  - in other words, this prevents calling these functions directly (which was possible when check was for greater than 0

* Update lib/rocprofiler/context/context.{hpp,cpp}

- provide deactivate_client_contexts and deregister_client_contexts
  - these functions are used when the tool fails to configure

* Update lib/rocprofiler/registration.{hpp,cpp}

- internal "public" get_client_offet()
- client ids are offset by a random value to avoid default values behaving correctly

* Update lib/rocprofiler/tests

- fix rocprofiler_lib.registration_lambda_no_result

* Update lib/rocprofiler/tests

- fix rocprofiler_lib.registration_lambda_with_result

* Update lib/rocprofiler/tests

- remove deep bind from rocprofiler_lib.registration_lambda_with_result

* Update lib/rocprofiler/tests

- use RTLD_NOW when dlopen'ing in rocprofiler_lib.registration_lambda_with_result

* Update rocprofiler registration tests

- split registration tests into separate exe that links to shared library

* Formatting

* Update CI workflow

- always checkout submodules via actions/checkout

* Update lib/rocprofiler/buffer.{hpp,cpp}

- fix issue with buffer flushing not working when only called once

* Update rocprofiler lib registration test

- test for buffered callback

* Update include/rocprofiler/rocprofiler.h

- include internal_threading.h header

* Update rocprofiler lib registration test

- add in internal threading for buffered test

[ROCm/rocprofiler-sdk commit: a646c1546c]
This commit is contained in:
Jonathan R. Madsen
2023-09-26 19:21:31 -05:00
کامیت شده توسط GitHub
والد b66bcdd107
کامیت cfcfd280d0
25فایلهای تغییر یافته به همراه1157 افزوده شده و 313 حذف شده
@@ -41,18 +41,12 @@ jobs:
max-parallel: 4
matrix:
include:
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
build-type: 'RelWithDebInfo'
ci-flags: ''
name-tag: ''
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
build-type: 'Release'
ci-flags: '--coverage'
name-tag: '-codecov'
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
build-type: 'RelWithDebInfo'
ci-flags: '--linter clang-tidy'
name-tag: ''
runs-on: ${{ matrix.runner }}
@@ -69,6 +63,19 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install requirements
shell: bash
run: |
git config --global --add safe.directory '*'
apt-get update
apt-get install -y cmake clang-tidy-11 g++-11 g++-12 libgtest-dev python3-pip
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-11 10
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12
python3 -m pip install -r requirements.txt
- name: List Files
shell: bash
@@ -77,13 +84,6 @@ jobs:
for i in python python3 git cmake ctest; do which-realpath $i; done
ls -la
- name: Install requirements
shell: bash
run: |
pip3 install -r requirements.txt
apt install -y cmake libgtest-dev
git config --global --add safe.directory '*'
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
@@ -126,11 +126,108 @@ jobs:
${{github.workspace}}/build/*.rpm
${{github.workspace}}/build/*.tgz
code-coverage:
strategy:
fail-fast: true
max-parallel: 4
matrix:
include:
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
build-type: 'Release'
runs-on: ${{ matrix.runner }}
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
container:
image: compute-artifactory.amd.com:5000/rocm-plus-docker/compute-rocm-dkms-no-npi-hipclang:${{ needs.get_latest_mainline_build_number.outputs.LATEST_BUILD_NUMBER }}-${{ matrix.os }}-stg1
options: --memory=128g --cpus=32 --ipc=host --device=/dev/kfd --device=/dev/dri${{ matrix.device }} --group-add video --cap-add=SYS_PTRACE --cap-add CAP_SYS_PTRACE --cap-add CAP_SYS_ADMIN --security-opt seccomp=unconfined
if: ${{ always() }}
needs: get_latest_mainline_build_number
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: List Files
shell: bash
run: |
which-realpath() { echo "$1 resolves to $(realpath $(which $1))"; }
for i in python python3 git cmake ctest; do which-realpath $i; done
ls -la
- name: Install requirements
shell: bash
run: |
pip3 install -r requirements.txt
apt install -y cmake libgtest-dev
git config --global --add safe.directory '*'
- name: Configure, Build, and Test (Total Code Coverage)
timeout-minutes: 30
shell: bash
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-mi200-${{ matrix.os }}-codecov
--build-jobs 8
--site mi200
--gpu-targets ${{ env.GPU_LIST }}
--coverage
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
- name: Configure, Build, and Test (Unit Tests Code Coverage)
timeout-minutes: 30
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-mi200-${{ matrix.os }}-codecov-unittests
--build-jobs 8
--site mi200
--gpu-targets ${{ env.GPU_LIST }}
--coverage
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
--
-L unittests
- name: Configure, Build, and Test (Samples Code Coverage)
timeout-minutes: 30
shell: bash
run:
find build -type f | egrep '\.gcda$' | xargs rm &&
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-mi200-${{ matrix.os }}-codecov-samples
--build-jobs 8
--site mi200
--gpu-targets ${{ env.GPU_LIST }}
--coverage
--
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DPython3_EXECUTABLE=$(which python3)
--
-L samples
sanitizers:
strategy:
fail-fast: false
matrix:
include:
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
build-type: 'RelWithDebInfo'
ci-flags: ''
sanitizer: 'AddressSanitizer'
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
@@ -143,12 +240,6 @@ jobs:
build-type: 'RelWithDebInfo'
ci-flags: ''
sanitizer: 'LeakSanitizer'
- os: 'ubuntu-22.04'
runner: 'renderD131'
device: '/renderD131'
build-type: 'RelWithDebInfo'
ci-flags: ''
sanitizer: 'AddressSanitizer'
runs-on: ${{ matrix.runner }}
-86
مشاهده پرونده
@@ -1,86 +0,0 @@
name: Linting
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths-ignore:
- '*.md'
- 'source/docs/**'
pull_request:
branches: [ "main" ]
paths-ignore:
- '*.md'
- 'source/docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# TODO(jrmadsen): replace LD_RUNPATH_FLAG, GPU_LIST, etc. with internal handling in cmake
ROCM_PATH: "/opt/rocm"
GPU_LIST: "gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1101 gfx1102"
PATH: "/usr/bin:$PATH"
jobs:
get-latest-mainline-build-number:
runs-on: mi200
outputs:
LATEST_BUILD_NUMBER: ${{ steps.get_build_number.outputs.LATEST_BUILD_NUMBER }}
steps:
- id: get_build_number
run: echo "LATEST_BUILD_NUMBER=$(wget -qO- 'http://rocm-ci.amd.com/job/compute-rocm-dkms-no-npi-hipclang/lastSuccessfulBuild/buildNumber')" >> $GITHUB_OUTPUT
clang-tidy:
strategy:
fail-fast: false
matrix:
os: ['ubuntu-22.04']
runner: ['renderD131']
device: ['/renderD131']
linter: ['clang-tidy']
runs-on: ${{ matrix.runner }}
# define this for containers
env:
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
container:
image: compute-artifactory.amd.com:5000/rocm-plus-docker/compute-rocm-dkms-no-npi-hipclang:${{ needs.get-latest-mainline-build-number.outputs.LATEST_BUILD_NUMBER }}-${{ matrix.os }}-stg1
options: --privileged --ipc=host --device=/dev/kfd --device=/dev/dri${{ matrix.device }} --group-add video --cap-add=SYS_PTRACE --cap-add CAP_SYS_PTRACE --cap-add CAP_SYS_ADMIN --security-opt seccomp=unconfined
if: ${{ always() }}
needs: get-latest-mainline-build-number
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Update container
run: |
apt-get update
apt-get install -y cmake clang-tidy-11 g++-11 g++-12
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-11 10
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 --slave /usr/bin/g++ g++ /usr/bin/g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12
- name: Configure, Build, and Test
timeout-minutes: 30
shell: bash
run:
python3 ./source/scripts/run-ci.py -B build
--name ${{ github.repository }}-${{ github.ref_name }}-mi200-${{ matrix.linter }}
--build-jobs 8
--site mi200
--gpu-targets ${{ env.GPU_LIST }}
--linter ${{ matrix.linter }}
--
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}"
-DPython3_EXECUTABLE=$(which python3)
--
-VV