Caliper icon indicating copy to clipboard operation
Caliper copied to clipboard

Caliper support for builtin Kokkos Tools

Open DavidPoliakoff opened this issue 4 years ago • 0 comments

So far this is just a proposal, but we're looking to support a more ubiquitous tools model at Sandia. This is partially inspired by @ibaned , so I'll ping him here

In order to support that, we're going to essentially build a huge tools bundle, users can include Caliper, Apollo, APEX, TAU, whatever they want. A problem with this is that it means we might have multiple tools linked into the same library, all defining kokkosp_begin_parallel_for. Oops. Easy answer, just declare the symbol weak! Except now Caliper's kokkosp_begin_parallel_for gets replaced with Score-P's, which is, you know, suboptimal.

The solution I've come up with, is that there will be a weak, unnamespaced, kokkosp_begin_parallel_for, which just calls the namespaced cali::kokkosp_begin_parallel_for (we can negotiate on the namespace name). There's also a function to return a Kokkos EventSet (note: this does not incur a dependency on a built Kokkos), which calls the correct cali::kokkosp_begin_parallel_for.

Now, for our existing users, nothing really changes, they dlopen Caliper, it's the only kokkosp_begin_parallel_for in the app, they call it, which calls cali::kokkosp_begin_parallel_for.

Meanwhile in the bundled situation, that bundle calls cali::get_event_set (and apollo::get_event_set, once it exists, and TAU, and, and, and...), and registers all of these tools with Kokkos. Then they can pick out a tool by name. On a user's side, they can write something like


auto tools_handle = BigOlKokkosToolsBundle::gimme_all_your_tools();
Kokkos::Tools::here_are_some_tools(tools_handle);
Kokkos::Tools::activate_tool("caliper", "spot2(profile.kokkos)");
Kokkos::initialize(argc, argv);

And then get the functionality they want. I'm putting this up so you can tell me if the code is just too atrocious for words, but I wouldn't merge it until you get a comment from @crtrott saying "yeah, this is the design we want," which might be after I leave. But let me know if you'd like code fixes

DavidPoliakoff avatar Nov 09 '21 21:11 DavidPoliakoff