Skip to content
Merged
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
87 changes: 87 additions & 0 deletions .github/workflows/linux_debug_ittnotify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Copyright (c) 2026 The STE||AR Group
# Copyright (c) 2026 Vansh Dobhal
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

name: Linux CI (ITTNotify, Debug)

on: [pull_request]

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

jobs:
build:
runs-on: ubuntu-latest
container: stellargroup/build_env:17

steps:
- uses: actions/checkout@v6
- name: Install ITTNotify (ittapi)
shell: bash
run: |
git clone https://github.com/intel/ittapi.git
cmake -S ittapi -B ittapi/build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PWD/ittapi/install
cmake --build ittapi/build --target install
- name: Build ref-collector
shell: bash
run: |
cd ittapi/src/ittnotify_refcol
make CC=gcc
- name: Configure
shell: bash
env:
AMPLIFIER_ROOT: ${{ github.workspace }}/ittapi/install
run: |
cmake \
. \
-Bbuild \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DHPX_WITH_MALLOC=system \
-DHPX_WITH_FETCH_ASIO=ON \
-DHPX_WITH_ASIO_TAG=asio-1-34-2 \
-DHPX_WITH_EXAMPLES=ON \
-DHPX_WITH_TESTS=ON \
-DHPX_WITH_TESTS_MAX_THREADS_PER_LOCALITY=2 \
-DHPX_WITH_VERIFY_LOCKS=ON \
-DHPX_WITH_VERIFY_LOCKS_BACKTRACE=ON \
-DHPX_WITH_CHECK_MODULE_DEPENDENCIES=On \
-DHPX_WITH_ITTNOTIFY=ON
- name: Build
shell: bash
run: |
cmake --build build --target all
cmake --build build --target examples
- name: Test
shell: bash
run: |
export INTEL_LIBITTNOTIFY64="${GITHUB_WORKSPACE}/ittapi/src/ittnotify_refcol/libittnotify_refcol.so"
export INTEL_LIBITTNOTIFY_LOG_DIR="${GITHUB_WORKSPACE}/itt_logs"
# Enable ITT bindings at runtime so the ref-collector is loaded
export HPX_HAVE_ITTNOTIFY=1
mkdir -p $INTEL_LIBITTNOTIFY_LOG_DIR
cd build
ctest \
--output-on-failure \
--tests-regex tests.examples.itt_notify \
-j1
- name: Verify ITT API usage
shell: bash
run: |
LOG_DIR="${GITHUB_WORKSPACE}/itt_logs"
# Fallback to /tmp if custom dir wasn't picked up
if ! ls ${LOG_DIR}/libittnotify_refcol_*.log 1>/dev/null 2>&1; then
LOG_DIR="/tmp"
fi

echo "=== ITT ref-collector log contents (from ${LOG_DIR}) ==="
cat ${LOG_DIR}/libittnotify_refcol_*.log
grep -q "__itt_domain_create" ${LOG_DIR}/libittnotify_refcol_*.log
grep -q "__itt_task_begin" ${LOG_DIR}/libittnotify_refcol_*.log
echo "ITT API verification passed."
4 changes: 4 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ set(subdirs
transpose
)

if(HPX_WITH_ITTNOTIFY)
set(subdirs ${subdirs} itt_notify)
endif()

if(HPX_WITH_EXAMPLES_HDF5)
set(subdirs ${subdirs} interpolate1d sheneos)
endif()
Expand Down
32 changes: 32 additions & 0 deletions examples/itt_notify/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2026 The STE||AR Group
# Copyright (c) 2026 Vansh Dobhal
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

if(NOT HPX_WITH_ITTNOTIFY)
return()
endif()

set(example_programs itt_notify_smoke)

foreach(example_program ${example_programs})
set(sources ${example_program}.cpp)

source_group("Source Files" FILES ${sources})

add_hpx_executable(
${example_program} INTERNAL_FLAGS
SOURCES ${sources}
FOLDER "Examples/ITTNotify" ${HPX_WITH_CXX_MODULES_OPTION}
)

add_hpx_example_target_dependencies("itt_notify" ${example_program})

if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test(
"itt_notify" ${example_program} ${${example_program}_PARAMETERS}
)
endif()
endforeach()
53 changes: 53 additions & 0 deletions examples/itt_notify/itt_notify_smoke.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (c) 2026 The STE||AR Group
// Copyright (c) 2026 Vansh Dobhal
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// This smoke test verifies that HPX correctly invokes ITT API functions
// when built with HPX_WITH_ITTNOTIFY=ON. It exercises HPX's ITT RAII
// wrappers (domain, task, string_handle, mark_context) and spawns async
// work so the scheduling loop also generates ITT instrumentation.
//
// When run with the ittapi ref-collector (INTEL_LIBITTNOTIFY64), all
// ITT calls are logged to a file that CI can inspect for verification.

#include <hpx/future.hpp>
#include <hpx/init.hpp>
#include <hpx/modules/itt_notify.hpp>

#include <cstddef>

int hpx_main()
{
// Exercise the ITT RAII wrappers directly
hpx::util::itt::domain domain("hpx.itt.smoke");
hpx::util::itt::string_handle task_name("smoke_task");
hpx::util::itt::mark_context mark("smoke_mark");

{
hpx::util::itt::task t(domain, task_name);
}

// Spawn async work so the scheduler exercises its ITT instrumentation
constexpr std::size_t n = 8;
hpx::future<int> futs[n];

for (std::size_t i = 0; i < n; ++i)
{
futs[i] = hpx::async([i]() -> int { return static_cast<int>(i * i); });
}

for (auto& f : futs)
{
f.get();
}

return hpx::local::finalize();
}

int main(int argc, char* argv[])
{
return hpx::local::init(hpx_main, argc, argv);
}
Loading