Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/rocprofiler-register-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@

name: rocprofiler-register Formatting

on:
workflow_dispatch:
pull_request:
paths:
- 'projects/rocprofiler-register/**'
- '!**/*.md'
- '!**/*.rtf'
- '!**/*.rst'
- '!**/.markdownlint-ci2.yaml'
- '!**/.readthedocs.yaml'
- '!**/.spellcheck.local.yaml'
- '!**/.wordlist.txt'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cmake:
runs-on: ubuntu-22.04
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-register

- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Install dependencies
working-directory: projects/rocprofiler-register
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install -r requirements.txt

- name: Run cmake-format
working-directory: projects/rocprofiler-register
run: |
FORMAT_FILES=$(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
command -v cmake-format
cmake-format --version
set +e
cmake-format -i ${FORMAT_FILES}
if [ $(git diff | wc -l) -ne 0 ]; then
echo -e "\nError! CMake code not formatted. Run cmake-format...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi

source:
runs-on: ubuntu-22.04
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-register

- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Install dependencies
working-directory: projects/rocprofiler-register
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 python3 python3-pip
python3 -m pip install -r requirements.txt

- name: Run clang-format
working-directory: projects/rocprofiler-register
run: |
FORMAT_FILES=$(find samples source tests benchmark -type f | egrep '\.(h|hpp|hh|c|cc|cpp)(|\.in)$')
command -v git
command -v clang-format
git --version
clang-format --version
set +e
FORMAT_OUT=$(clang-format -i ${FORMAT_FILES})
git status
if [ $(git diff | wc -l) -ne 0 ]; then
echo -e "\nError! Code not formatted. Run clang-format (version 11)...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi

python:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.10']
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-register

- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
working-directory: projects/rocprofiler-register
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

- name: black format
working-directory: projects/rocprofiler-register
run: |
black .
if [ $(git diff | wc -l) -ne 0 ]; then
echo -e "\nError! Python code not formatted. Run black...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
git diff
exit 1
fi

missing-new-line:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: projects/rocprofiler-register

- name: Extract branch name
shell: bash
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_HEAD_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Find missing new line
shell: bash
working-directory: projects/rocprofiler-register
run: |
OUTFILE=missing_newline.txt
for i in $(find source tests samples benchmark docker cmake -type f | egrep -v '\.(bin|png|csv)$|source/docs/_(build|doxygen)'); do VAL=$(tail -c 1 ${i}); if [ -n "${VAL}" ]; then echo "- ${i}" >> ${OUTFILE}; fi; done
if [[ -f ${OUTFILE} && $(cat ${OUTFILE} | wc -l) -gt 0 ]]; then
echo -e "\nError! Source code missing new line at end of file...\n"
echo -e "\nFiles:\n"
cat ${OUTFILE}
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include "demo.hpp"

#include <rocprofiler-register/rocprofiler-register.h>
Expand Down
8 changes: 4 additions & 4 deletions projects/rocprofiler-register/scripts/run-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def run(*args, **kwargs):
)
finally:
echo_files = []
if "-VV" not in ctest_args and not args.quiet:
if not args.quiet:
for file in glob.glob(
os.path.join(args.binary_dir, "Testing/Temporary/**"),
recursive=True,
Expand Down Expand Up @@ -472,14 +472,14 @@ def run(*args, **kwargs):
echo_files_sorted.append(file)
echo_files_sorted += [x for x in echo_files if x not in echo_files_sorted]
for file in echo_files_sorted:
print(f"\n\n\n###### Reading {file}... ######\n\n\n")
print(f"###### Reading {file}... ######")
with open(file, "r") as inpf:
fdata = inpf.read()
oname = os.path.basename(file)
if "LastTest" not in oname and "Coverage" not in oname:
print(fdata)
if oname.endswith(".log"):
if not oname.endswith(".log"):
oname += ".log"
with open(os.path.join(args.binary_dir, oname), "w") as outf:
print(f"\n\n###### Writing {oname}... ######\n\n")
print(f"###### Writing {oname}... ######")
outf.write(fdata)
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,6 @@ rocp_reg_scan_for_tools()
<< rocprofiler_lib_register_entrypoint << " not found. Tried to dlopen "
<< _rocp_reg_lib;
}
else if(_found_tool && rocprofiler_set_api_table)
{
rocprofiler_lib_config_fn = &rocprofiler_set_api_table;
rocprofiler_lib_attach_fn = &rocprofiler_attach;
rocprofiler_lib_detach_fn = &rocprofiler_detach;
}

return rocp_scan_data{ rocprofiler_lib_handle,
rocprofiler_lib_config_fn,
Expand Down
23 changes: 10 additions & 13 deletions projects/rocprofiler-register/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ function(rocp_register_test_executable _NAME)
set(_BASE_PRELOAD "${ROCPROFILER_REGISTER_MEMCHECK_PRELOAD_ENV}")
endif()

rocp_register_add_test(
${_NAME} ${_NAME} "${_BASE_PRELOAD}"
"${RRTE_CORE_PASS_REGEX}" "${RRTE_CORE_FAIL_REGEX}")
rocp_register_add_test(${_NAME} ${_NAME} "${_BASE_PRELOAD}" "${RRTE_CORE_PASS_REGEX}"
"${RRTE_CORE_FAIL_REGEX}")

# Build LD_PRELOAD list for -preload tests
set(_PRELOAD_LIBS "librocprofiler-register.so" "libgeneric-tool.so")
Expand All @@ -181,10 +180,8 @@ function(rocp_register_test_executable _NAME)
endif()
list(JOIN _PRELOAD_LIBS ":" _PRELOAD_STRING)

rocp_register_add_test(
${_NAME}-preload ${_NAME}
"LD_PRELOAD=${_PRELOAD_STRING}"
"${RRTE_PRELOAD_PASS_REGEX}" "${RRTE_PRELOAD_FAIL_REGEX}")
rocp_register_add_test(${_NAME}-preload ${_NAME} "LD_PRELOAD=${_PRELOAD_STRING}"
"${RRTE_PRELOAD_PASS_REGEX}" "${RRTE_PRELOAD_FAIL_REGEX}")

rocp_register_add_test(
${_NAME}-env
Expand All @@ -194,16 +191,16 @@ function(rocp_register_test_executable _NAME)
"${RRTE_PRELOAD_FAIL_REGEX}")

rocp_register_add_test(
${_NAME}-wrap ${_NAME}
${_NAME}-wrap
${_NAME}
"LD_PRELOAD=librocprofiler-register.so;ROCP_REG_TEST_WRAP=1;${ROCPROFILER_REGISTER_MEMCHECK_PRELOAD_ENV}"
"${RRTE_WRAP_PASS_REGEX}" "${RRTE_WRAP_FAIL_REGEX}")
"${RRTE_WRAP_PASS_REGEX}"
"${RRTE_WRAP_FAIL_REGEX}")

rocp_register_add_test(
${_NAME}-preload-wrap
${_NAME}
${_NAME}-preload-wrap ${_NAME}
"LD_PRELOAD=${_PRELOAD_STRING};ROCP_REG_TEST_WRAP=1"
"${RRTE_PRELOAD_WRAP_PASS_REGEX}"
"${RRTE_PRELOAD_WRAP_FAIL_REGEX}")
"${RRTE_PRELOAD_WRAP_PASS_REGEX}" "${RRTE_PRELOAD_WRAP_FAIL_REGEX}")

rocp_register_add_test(
${_NAME}-env-wrap
Expand Down
11 changes: 9 additions & 2 deletions projects/rocprofiler-register/tests/bin/simple-hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <mutex>
Expand Down Expand Up @@ -59,8 +60,8 @@ namespace
{
using auto_lock_t = std::unique_lock<std::mutex>;
auto print_lock = std::mutex{};
size_t xdim = 4960 * 2;
size_t ydim = 4960 * 2;
size_t xdim = 4096 * 2;
size_t ydim = 4096 * 2;
size_t nthreads = 2;
size_t nitr = 1;
} // namespace
Expand Down Expand Up @@ -112,6 +113,12 @@ main(int argc, char** argv)
itr.join();
}

std::ifstream maps_file("/proc/self/maps");
std::string line;
while (std::getline(maps_file, line)) {
std::cout << line << std::endl;
}

return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <pthread.h>
#include <cstdint>
#include <stdexcept>
Expand Down
1 change: 0 additions & 1 deletion projects/rocprofiler-register/tests/rccl/rccl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#pragma once

#define RCCL_API_TRACE_VERSION_MAJOR 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <rocprofiler-register/rocprofiler-register.h>
#include <amdhip/amdhip.hpp>
#include <hsa-runtime/hsa-runtime.hpp>
Expand Down
1 change: 0 additions & 1 deletion projects/rocprofiler-register/tests/roctx/roctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#ifdef NDEBUG
# undef NDEBUG
#endif
Expand Down
1 change: 0 additions & 1 deletion projects/rocprofiler-register/tests/roctx/roctx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#pragma once

#define ROCTX_VERSION_MAJOR 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <dlfcn.h>
#include <pthread.h>
#include <cstdlib>
Expand Down
1 change: 0 additions & 1 deletion projects/rocprofiler-register/tests/test-amdhip-ctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <dlfcn.h>
#include <cstdlib>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <dlfcn.h>
#include <string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <dlfcn.h>
#include <pthread.h>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion projects/rocprofiler-register/tests/test-amdhip-roctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.


#include <dlfcn.h>
#include <string>

Expand Down
Loading