Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caliper support #1773

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0af63f7
initial commit
artv3 Nov 1, 2024
7bb8662
Merge branch 'develop' into artv3/caliper-support
artv3 Nov 25, 2024
864879e
fix cmake config
artv3 Nov 25, 2024
f399ad6
Initial commit
artv3 Nov 26, 2024
ca7423e
first cut at caliper support in raja
artv3 Nov 27, 2024
a4405e2
revert CMakeLists.txt change
artv3 Nov 27, 2024
0078de6
revert timer plug in changes
artv3 Nov 27, 2024
2306ba4
Merge branch 'develop' into artv3/caliper-support
artv3 Dec 20, 2024
91a62c0
remove old raja-caliper test
artv3 Dec 26, 2024
aa28a3c
add raja timers to example
artv3 Dec 26, 2024
03b43e6
additional annotation for caliper
artv3 Dec 26, 2024
5ec0597
support non-naming of kernels
artv3 Dec 26, 2024
2aaf40e
fix raja_depends
artv3 Dec 26, 2024
1ccd52f
kernel name is expected to be the second to last
artv3 Dec 26, 2024
019bd0c
remove unused header
artv3 Dec 26, 2024
79689e0
improve guards
artv3 Dec 26, 2024
1d57b1a
add missing macro in hpp.in
artv3 Dec 26, 2024
17f3d15
intial commit for raja launch
artv3 Dec 27, 2024
b638b00
basic proof of concept for raja launch
artv3 Dec 27, 2024
ddfcf77
build fixes for raja launch x kernel naming
artv3 Dec 27, 2024
13e0dfe
clean up pass
artv3 Dec 27, 2024
d10141a
use && when getting the kernel name from params
artv3 Dec 27, 2024
dc13531
fix kernel naming in examplle
artv3 Dec 28, 2024
71b7f5e
Trigger Build
artv3 Dec 28, 2024
76886cb
add missing expt
artv3 Dec 28, 2024
f87f850
build fixes
artv3 Dec 28, 2024
ade7a6a
fix sycl example build
artv3 Dec 28, 2024
ffc32ad
fix kernel name getter
artv3 Dec 28, 2024
c8cd16b
Merge branch 'artv3/caliper-support' of github.com:LLNL/RAJA into art…
artv3 Dec 28, 2024
88a0c6d
additional chrono timers
artv3 Dec 29, 2024
adb0349
pass at kernel names
artv3 Dec 29, 2024
09b76db
basic formatting
artv3 Dec 29, 2024
272b8fc
build fix
artv3 Dec 29, 2024
b58b4c9
guard native kernel naming capability
artv3 Dec 29, 2024
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
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,20 @@ endif ()

set (raja_depends)

if (RAJA_ENABLE_CALIPER)
set (raja_depends
${raja_depends}
caliper)
find_package(caliper REQUIRED
NO_DEFAULT_PATH
PATHS ${caliper_DIR}
)
message(STATUS "Using Caliper from location = ${caliper_DIR}")
endif()

if (RAJA_ENABLE_OPENMP)
set (raja_depends
${raja_depends}
openmp)
endif()

Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic_mat_transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ int main(int argc, char *argv[])
RAJA::launch<launch_policy>
(res, RAJA::LaunchParams(RAJA::Teams(outer_Dimc, outer_Dimr),
RAJA::Threads(TILE_DIM, TILE_DIM), dynamic_shared_mem_size),
"Matrix tranpose with dynamic shared memory kernel",
RAJA::expt::KernelName("Matrix tranpose with dynamic shared memory kernel"),
[=] RAJA_HOST_DEVICE(RAJA::LaunchContext ctx)
{
RAJA::loop<outer1>(ctx, RAJA::RangeSegment(0, outer_Dimr), [&] (int by){
Expand Down
14 changes: 8 additions & 6 deletions examples/launch-param-reductions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))
RAJA::Index_type seq_maxloc2(-1);

RAJA::launch<LAUNCH_POL1>
(host_res, RAJA::LaunchParams(), "SeqReductionKernel",
(host_res, RAJA::LaunchParams(),
RAJA::expt::Reduce<RAJA::operators::plus >(&seq_sum),
RAJA::expt::Reduce<RAJA::operators::minimum>(&seq_min),
RAJA::expt::Reduce<RAJA::operators::maximum>(&seq_max),
RAJA::expt::Reduce<RAJA::operators::minimum>(&seq_minloc),
RAJA::expt::Reduce<RAJA::operators::maximum>(&seq_maxloc),
RAJA::expt::ReduceLoc<RAJA::operators::minimum>(&seq_min2, &seq_minloc2),
RAJA::expt::ReduceLoc<RAJA::operators::maximum>(&seq_max2, &seq_maxloc2),
RAJA::expt::KernelName("SeqReductionKernel"),
[=] RAJA_HOST_DEVICE ( RAJA::LaunchContext ctx,
VALOP_INT_SUM &_seq_sum,
VALOP_INT_MIN &_seq_min,
Expand Down Expand Up @@ -218,14 +219,15 @@ int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))
RAJA::Index_type omp_maxloc2(-1);

RAJA::launch<LAUNCH_POL2>
(host_res, RAJA::LaunchParams(), "OmpReductionKernel",
(host_res, RAJA::LaunchParams(),
RAJA::expt::Reduce<RAJA::operators::plus >(&omp_sum),
RAJA::expt::Reduce<RAJA::operators::minimum>(&omp_min),
RAJA::expt::Reduce<RAJA::operators::maximum>(&omp_max),
RAJA::expt::Reduce<RAJA::operators::minimum>(&omp_minloc),
RAJA::expt::Reduce<RAJA::operators::maximum>(&omp_maxloc),
RAJA::expt::ReduceLoc<RAJA::operators::minimum>(&omp_min2, &omp_minloc2),
RAJA::expt::ReduceLoc<RAJA::operators::maximum>(&omp_max2, &omp_maxloc2),
RAJA::expt::KernelName("OmpReductionKernel"),
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx,
VALOP_INT_SUM &_omp_sum,
VALOP_INT_MIN &_omp_min,
Expand Down Expand Up @@ -291,14 +293,14 @@ int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))

RAJA::launch<LAUNCH_POL3>
(device_res, RAJA::LaunchParams(RAJA::Teams(NUMBER_OF_TEAMS), RAJA::Threads(CUDA_BLOCK_SIZE)),
"CUDAReductionKernel",
RAJA::expt::Reduce<RAJA::operators::plus >(&cuda_sum),
RAJA::expt::Reduce<RAJA::operators::minimum>(&cuda_min),
RAJA::expt::Reduce<RAJA::operators::maximum>(&cuda_max),
RAJA::expt::Reduce<RAJA::operators::minimum>(&cuda_minloc),
RAJA::expt::Reduce<RAJA::operators::maximum>(&cuda_maxloc),
RAJA::expt::ReduceLoc<RAJA::operators::minimum>(&cuda_min2, &cuda_minloc2),
RAJA::expt::ReduceLoc<RAJA::operators::maximum>(&cuda_max2, &cuda_maxloc2),
RAJA::expt::KernelName( "CUDAReductionKernel"),
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx,
VALOP_INT_SUM &_cuda_sum,
VALOP_INT_MIN &_cuda_min,
Expand Down Expand Up @@ -368,14 +370,14 @@ int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))

RAJA::launch<LAUNCH_POL3>
(device_res, RAJA::LaunchParams(RAJA::Teams(NUMBER_OF_TEAMS), RAJA::Threads(HIP_BLOCK_SIZE)),
"HipReductionKernel",
RAJA::expt::Reduce<RAJA::operators::plus >(&hip_sum),
RAJA::expt::Reduce<RAJA::operators::minimum>(&hip_min),
RAJA::expt::Reduce<RAJA::operators::maximum>(&hip_max),
RAJA::expt::Reduce<RAJA::operators::minimum>(&hip_minloc),
RAJA::expt::Reduce<RAJA::operators::maximum>(&hip_maxloc),
RAJA::expt::ReduceLoc<RAJA::operators::minimum>(&hip_min2, &hip_minloc2),
RAJA::expt::ReduceLoc<RAJA::operators::maximum>(&hip_max2, &hip_maxloc2),
RAJA::expt::KernelName( "HipReductionKernel"),
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx,
VALOP_INT_SUM &_hip_sum,
VALOP_INT_MIN &_hip_min,
Expand Down Expand Up @@ -442,15 +444,15 @@ int main(int RAJA_UNUSED_ARG(argc), char** RAJA_UNUSED_ARG(argv[]))

RAJA::launch<LAUNCH_POL4>
(device_res, RAJA::LaunchParams(RAJA::Teams(NUMBER_OF_TEAMS), RAJA::Threads(SYCL_BLOCK_SIZE)),
"SyclReductionKernel",
RAJA::expt::Reduce<RAJA::operators::plus >(&sycl_sum),
RAJA::expt::Reduce<RAJA::operators::minimum>(&sycl_min),
RAJA::expt::Reduce<RAJA::operators::maximum>(&sycl_max),
RAJA::expt::Reduce<RAJA::operators::minimum>(&sycl_minloc),
RAJA::expt::Reduce<RAJA::operators::maximum>(&sycl_maxloc),
RAJA::expt::ReduceLoc<RAJA::operators::minimum>(&sycl_min2, &sycl_minloc2),
RAJA::expt::ReduceLoc<RAJA::operators::maximum>(&sycl_max2, &sycl_maxloc2),
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx,
RAJA::expt::KernelName( "SyclReductionKernel"),
[=] RAJA_HOST_DEVICE (RAJA::LaunchContext ctx,
VALOP_INT_SUM &_sycl_sum,
VALOP_INT_MIN &_sycl_min,
VALOP_INT_MAX &_sycl_max,
Expand Down
2 changes: 1 addition & 1 deletion examples/launch_reductions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int main(int argc, char *argv[])
(select_cpu_or_gpu,
RAJA::LaunchParams(RAJA::Teams(GRID_SZ),
RAJA::Threads(TEAM_SZ)),
"Launch Reductions",
RAJA::expt::KernelName("Launch Reductions"),
[=] RAJA_HOST_DEVICE(RAJA::LaunchContext ctx)
{

Expand Down
11 changes: 10 additions & 1 deletion examples/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
# SPDX-License-Identifier: (BSD-3-Clause)
################################################################################

if(RAJA_ENABLE_CALIPER)
raja_add_executable(
NAME raja-forall-caliper
SOURCES raja-forall-caliper.cpp caliper-plugin.cpp)
raja_add_executable(
NAME raja-launch-caliper
SOURCES raja-launch-caliper.cpp caliper-plugin.cpp)
endif()

raja_add_executable(
NAME plugin-example
SOURCES test-plugin.cpp counter-plugin.cpp)
Expand All @@ -13,7 +22,7 @@ if (RAJA_ENABLE_RUNTIME_PLUGINS)
raja_add_executable(
NAME plugin-example-dynamic
SOURCES test-plugin-dynamic.cpp)

raja_add_plugin_library(NAME timer_plugin
SHARED TRUE
SOURCES timer-plugin.cpp)
Expand Down
37 changes: 37 additions & 0 deletions examples/plugin/caliper-plugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2016-24, Lawrence Livermore National Security, LLC
// and RAJA project contributors. See the RAJA/LICENSE file for details.
//
// SPDX-License-Identifier: (BSD-3-Clause)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

#include "RAJA/util/PluginStrategy.hpp"

#include <iostream>
#include <caliper/cali.h>

class CaliperPlugin : public RAJA::util::PluginStrategy
{
public:
void preLaunch(const RAJA::util::PluginContext&p) override
{
if(!p.kernel_name->empty()) CALI_MARK_BEGIN(p.kernel_name->c_str());
}

void postLaunch(const RAJA::util::PluginContext& p) override
{
if(!p.kernel_name->empty()) CALI_MARK_END(p.kernel_name->c_str());
}

private:

};

// Dynamically loading plugin.
extern "C" RAJA::util::PluginStrategy *getPlugin()
{
return new CaliperPlugin;
}

// Statically loading plugin.
static RAJA::util::PluginRegistry::add<CaliperPlugin> P("Caliper", "Enables Caliper Profiling");
Loading
Loading