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

Rebase cuda-11.0 with kokkos-tools develop #261

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
122b167
Update kp_sampler_skip.cpp
vlkale Sep 13, 2023
a2e73a0
Update kp_sampler_skip.cpp
vlkale Sep 13, 2023
ac8d239
update for prints of sampler
vlkale Sep 14, 2023
8dd9724
sample skip: applied clang format
vlkale Sep 14, 2023
ea5b7ba
sample skip: applied clang format 2
vlkale Sep 14, 2023
0a8db28
kp_sampler_skip.cpp: erase in end_parallel_reduce
vlkale Sep 14, 2023
ada1c71
fixing kp samplere
vlkale Sep 14, 2023
267b6a8
Merge branch 'fenceOnSampleOnly' of https://github.com/vlkale/kokkos-…
vlkale Sep 14, 2023
d1b89e2
fixing kp sampler to have erase when retrieving the sample.
vlkale Sep 14, 2023
f6e81b5
kp sampler applied clang format
vlkale Sep 14, 2023
d42680d
applied clang format to kp_core
vlkale Sep 14, 2023
c3e85a6
Merge pull request #208 from vlkale/efficientUnorderedMap
crtrott Oct 5, 2023
889af6d
kp_sampler_skip.cpp: removing glob fence check
vlkale Oct 5, 2023
0f62536
kp_sampler_skip.cpp: invoke_ktools_fence on devID=0
vlkale Oct 5, 2023
bc2c87d
Update kp_sampler_skip.cpp
vlkale Oct 12, 2023
1f0adb4
applied clang format to kp_sampler_skip
vlkale Oct 12, 2023
2ddedef
Merge pull request #209 from vlkale/fenceOnSampleOnly
crtrott Oct 12, 2023
62f3f02
Use eventset in roctxconnector (as in nvtxconnector) (#219)
maartenarnst Nov 20, 2023
bdc248b
type: renaming Kokkos_Tools_OptimizationGoal
romintomasetti Dec 1, 2023
c430ff7
Merge pull request #221 from uliegecsm/name-type
dalg24 Dec 1, 2023
ce606e8
papi(bug): use `kp_add_library` to ensure it is installed
romintomasetti Dec 4, 2023
6dae155
Merge pull request #222 from uliegecsm/papi-install
dalg24 Dec 4, 2023
951abf4
Don't disable clang-format in kp_json_writer.cpp
masterleinad Dec 27, 2023
872352d
Merge pull request #226 from masterleinad/clang_format_kp_json_writer
dalg24 Dec 27, 2023
f3b401d
Use different GitHub action for indentation check
masterleinad Dec 27, 2023
91d9df2
Merge pull request #228 from masterleinad/different_format_check
dalg24 Dec 27, 2023
8bb7ffc
cleaning(simple-kernel-timer): promote `find_index` to `kp_shared.hpp`
romintomasetti Dec 27, 2023
0becae4
Merge pull request #227 from uliegecsm/cleanup
dalg24 Dec 28, 2023
04fe2cd
Add header/legend line to kp_reader (#223)
brian-kelley Jan 5, 2024
f0d4fab
correct folder names from nvprof* to nvtx* in build-all.sh
zhangchonglin Jan 13, 2024
daa1c9d
Merge pull request #231 from ComputationalGasDynamicsLab/cz/build_all…
dalg24 Jan 14, 2024
de5398b
space-time-stack: allow demangled names
romintomasetti Dec 21, 2023
b3ab0cb
Merge pull request #225 from uliegecsm/demangle
dalg24 Jan 23, 2024
38831c3
merge kp-kernels-timers (#235)
blegouix Feb 15, 2024
fe2c93a
tests: add Google Test
romintomasetti Feb 6, 2024
f67e816
Merge pull request #237 from uliegecsm/add-google-test
dalg24 Feb 15, 2024
bdafe27
Fix Makefile for simple-kernel-timer and space-time-stack
masterleinad Feb 22, 2024
758d979
Merge pull request #241 from masterleinad/fix_makefile_profiling
dalg24 Feb 23, 2024
5df25a4
Disable rocThrust
masterleinad Mar 12, 2024
b9d291b
Merge pull request #244 from masterleinad/github_ci_install_rocthrust
dalg24 Mar 28, 2024
1bafc46
CMakeLists.txt: add_library to kp_add_library
vlkale Apr 1, 2024
25c0d65
kp_core.hpp: remove pointer from ptpi
vlkale Apr 1, 2024
152bf84
kp_sampler_skip.cpp: pass by value kokkosp_p_t_p_i
vlkale Apr 1, 2024
2839954
kp_sampler_skip.cpp: remove dereference assignment for ptpi callback
vlkale Apr 1, 2024
bac317d
kp_core.hpp: apply clang-format
vlkale Apr 1, 2024
8a68323
Merge pull request #246 from vlkale/cmake-kp-add-sampler
crtrott Apr 4, 2024
b41533f
Merge pull request #247 from vlkale/fix-ptpi-ptr
crtrott Apr 4, 2024
efc444d
Update kp_kernel_logger.cpp: kokkospk_end_parallel_scan --> kokkosp_e…
vlkale Apr 4, 2024
70b18b0
Merge pull request #249 from vlkale/kernel-logger-end-scan-typo
dalg24 Apr 5, 2024
c57eaa2
Put in tests for sampler (#248)
vlkale Apr 11, 2024
dd39767
README.md: fix build/run instructions (#250)
vlkale Apr 25, 2024
6652675
Remove KOKKOSTOOLS_LIBRARY_MODE
masterleinad Apr 29, 2024
7452c8c
Don't link against kokkostools in tests unconditionally
masterleinad Apr 29, 2024
44ada1f
Sampler's begin for callee's null check before fence (less overhead i…
vlkale May 23, 2024
dd35082
Fix line endings
crtrott May 23, 2024
baf9ae3
Merge pull request #254 from crtrott/unix-line-endings
crtrott May 23, 2024
81d3f3a
Use probability sampling over periodic sampling (#213)
vlkale May 23, 2024
58258bd
Merge pull request #252 from masterleinad/tests_dont_link_kokkostools
crtrott May 30, 2024
cbaf27e
profiling/all/CMakeLists.txt: delete KOKKOS_TOOLS_LIBRARYMODE
vlkale May 31, 2024
0a5d81d
Merge pull request #251 from masterleinad/remove_kokkostools_library_…
crtrott Jun 6, 2024
1041165
kp_space_time_stack.cpp: do nil check at de/alloc function
vlkale Jun 6, 2024
a8c9ca0
kp_space_time_stack.cpp: apply clang-format
vlkale Jun 6, 2024
3cee564
Merge pull request #257 from vlkale/spc-tm-stk-alloc-null-ret
crtrott Jun 10, 2024
eb30d7a
Fix finding Variorum via environment variable
masterleinad Jun 12, 2024
3f53ec8
Merge pull request #258 from masterleinad/fix_finding_variorum
crtrott Jun 13, 2024
2728669
Update Kokkos_Profiling_[C_]Interface.*
masterleinad Jul 8, 2024
9c317a5
Merge pull request #260 from masterleinad/update_kokkos_profiling_int…
dalg24 Jul 8, 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
6 changes: 4 additions & 2 deletions .github/workflows/build-with-kokkos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ jobs:
exit -1
esac

- name: Install CMake, OpenMPI and dtrace
- name: Install git, CMake, OpenMPI, PAPI and dtrace
run: |
apt --yes --no-install-recommends install \
git ca-certificates \
cmake make \
libopenmpi-dev \
systemtap-sdt-dev
systemtap-sdt-dev \
libpapi-dev
- name: Compile and install Kokkos
working-directory: kokkos
run: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: Clang-Format Check
name: Clang-Format check
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.5.0
- name: Run clang-format style check.
uses: DoozyX/clang-format-lint-action@v0.16.2
with:
clang-format-version: '8'
check-path: './'
clangFormatVersion: 8
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ option(KokkosTools_ENABLE_MPI "Enable MPI support" OFF)
option(KokkosTools_ENABLE_CALIPER "Enable building Caliper library" OFF)
option(KokkosTools_ENABLE_APEX "Enable building Apex library" OFF)
option(KokkosTools_ENABLE_EXAMPLES "Build examples" OFF)
option(KokkosTools_ENABLE_TESTS "Build tests" OFF)

# Advanced settings
option(KokkosTools_REUSE_KOKKOS_COMPILER "Set the compiler and flags based on installed Kokkos settings" OFF)
mark_as_advanced(KokkosTools_REUSE_KOKKOS_COMPILER)
Expand Down Expand Up @@ -95,7 +97,8 @@ endif()
include(cmake/configure_variorum.cmake)

set(KOKKOSTOOLS_HAS_CALIPER ${KokkosTools_ENABLE_CALIPER})
set(KOKKOSTOOLS_HAS_NVTX ${Kokkos_ENABLE_CUDA}) # we assume that enabling CUDA for Kokkos program means nvtx should be available
set(KOKKOSTOOLS_HAS_NVTX ${Kokkos_ENABLE_CUDA}) # we assume that enabling CUDA for Kokkos program means nvtx should be available
set(KOKKOSTOOLS_HAS_ROCTX ${Kokkos_ENABLE_HIP}) # we assume that enabling HIP for Kokkos program means roctx should be available

if(DEFINED ENV{VTUNE_HOME})
set(VTune_ROOT $ENV{VTUNE_HOME})
Expand All @@ -115,6 +118,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/profiling/all)
set(COMMON_HEADERS_PATH ${CMAKE_CURRENT_BINARY_DIR}/common)
include_directories(${COMMON_HEADERS_PATH})

# Allow all tools to include any file.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common)

set(SINGLELIB_PROFILERS "" CACHE STRING "" FORCE)

# Export settings
Expand Down Expand Up @@ -263,6 +269,13 @@ if(KokkosTools_ENABLE_EXAMPLES)
endif()
endif()

# Tests
if(KokkosTools_ENABLE_TESTS)
enable_testing()
include(cmake/BuildGTest.cmake)
add_subdirectory(tests)
endif()

# Install exports
install(TARGETS ${EXPORT_TARGETS} EXPORT ${EXPORT_NAME})
install(EXPORT ${EXPORT_NAME}
Expand Down
4 changes: 3 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"CMAKE_CXX_STANDARD" : "17",
"KokkosTools_ENABLE_EXAMPLES" : "ON",
"KokkosTools_ENABLE_SINGLE" : "ON",
"KokkosTools_ENABLE_MPI" : "ON"
"KokkosTools_ENABLE_MPI" : "ON",
"KokkosTools_ENABLE_PAPI" : "ON",
"KokkosTools_ENABLE_TESTS" : "ON"
}
},
{
Expand Down
65 changes: 35 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,38 @@ Note: `Kokkos` must be configured with `Kokkos_ENABLE_LIBDL=ON` to load profilin

## General Usage

To use one of the tools you have to compile it, which will generate a dynamic library. Before executing the Kokkos application you then have to set the environment variable `KOKKOS_TOOLS_LIBS` to point to the dynamic library e.g. in the `bash` shell:
```
export KOKKOS_TOOLS_LIBS=${HOME}/kokkos-tools/src/tools/memory-events/kp_memory_event.so
```
To use one of the tools you have to compile it, which will generate a dynamic library. Before executing the Kokkos application you then have to set the environment variable `KOKKOS_TOOLS_LIBS` to point to the dynamic library.

CMake and Makefiles are supported for building Kokkos Tools. The following provides instructions for both.

## Using cmake

### Build

1. Create a build directory in Kokkos Tools, e.g., type `mkdir myBuild; cd myBuild`
2. To configure, type `cmake .. -DCMAKE_INSTALL_PREFIX=${YOUR_KOKKOS_TOOLS_INSTALL_DIR}`. There are more options but in most cases the defaults are sufficient.
3. To compile, type `make`
4. To install, type `make install`

### Run

Given your installed tool shared library `lib<name_of_tool_shared_lib>.so` and an application executable called yourApplication.exe, type:

`export KOKKOS_TOOLS_LIBS=${YOUR_KOKKOS_TOOLS_INSTALL_DIR}/lib<name_of_tool_shared_lib>.so; ./yourApplication.exe`


## Using make

### Build

To build some library `<name_of_tool_shared_lib>` with make, simply type `make` within that library's subdirectory `${YOUR_KOKKOS_TOOLS_LIB_SRC_DIR}` of Kokkos Tools. This generates the shared library within that subdirectory.

### Run

Given your installed tool shared library `<name_of_tool_shared_lib>.so` and an application executable called `yourApplication.exe`, type:

`export KOKKOS_TOOLS_LIBS=${YOUR_KOKKOS_TOOLS_LIB_SRC_DIR}/<name_of_tool_shared_lib>.so; ./yourApplication.exe`

Many of the tools will produce an output file that uses the hostname as well as the process id as part of the filename.

## Explicit Instrumentation

Expand All @@ -33,11 +59,14 @@ void foo() {
The following provides an overview of the tools available in the set of Kokkos Tools. Click on each Kokkos Tools name to see more details about the tool via the Kokkos Tools Wiki.

### Utilities

+ [**KernelFilter:**](https://github.com/kokkos/kokkos-tools/wiki/KernelFilter)

A tool which is used in conjunction with analysis tools, to restrict them to a subset of the application.

+ [**KernelSampler:**](https://github.com/kokkos/kokkos-tools/wiki/KernelSampler)

A tool to be used in conjunction with analysis tools to restrict the tooling to samples of Kokkos kernel invocations.

### Memory Analysis
+ [**MemoryHighWater:**](https://github.com/kokkos/kokkos-tools/wiki/MemoryHighWater)

Expand Down Expand Up @@ -85,30 +114,6 @@ The following provides an overview of the tools available in the set of Kokkos T
accumulate statistics, and utilize various portable function calls for common needs w.r.t. timers,
resource usage, etc.

# Building Kokkos Tools

Use either CMake or Makefile to build Kokkos Tools.

## Using cmake

1. create a build directory in Kokkos Tools, e.g., type `mkdir myBuild; cd myBuild`
2. To configure the Type `ccmake ..` for any options you would like to enable/disable.
3. To compile, type `make`
4. To install, type `make install`

## Using make

To build with make, simply type `make` within each subdirectory of Kokkos Tools.


Building using `make` is currently recommended. Eventually, the preferred method of building will be `cmake`.

# Running a Kokkos-based Application with a tool

Given your tool shared library `<name_of_tool_shared_library>.so` (which contains kokkos profiling callback functions) and an application executable called yourApplication.exe, type:

`export KOKKOS_TOOLS_LIBS=${YOUR_KOKKOS_TOOLS_DIR}/<name_of_tool_shared_lib>; ./yourApplication.exe`

# Tutorial

A tutorial on Kokkos Tools can be found here: https://github.com/kokkos/kokkos-tutorials/blob/main/LectureSeries/KokkosTutorial_07_Tools.pdf
Expand Down
5 changes: 2 additions & 3 deletions build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ make -f $ROOT_DIR/profiling/memory-events/Makefile
make -f $ROOT_DIR/profiling/memory-hwm/Makefile
make -f $ROOT_DIR/profiling/memory-hwm-mpi/Makefile
make -f $ROOT_DIR/profiling/memory-usage/Makefile
make -f $ROOT_DIR/profiling/nvprof-connector/Makefile
make -f $ROOT_DIR/profiling/nvprof-focused-connector/Makefile
make -f $ROOT_DIR/profiling/nvtx-connector/Makefile
make -f $ROOT_DIR/profiling/nvtx-focused-connector/Makefile
make -f $ROOT_DIR/profiling/papi-connector/Makefile
make -f $ROOT_DIR/profiling/simple-kernel-timer-json/Makefile
make -f $ROOT_DIR/profiling/simple-kernel-timer/Makefile
make -f $ROOT_DIR/profiling/space-time-stack/Makefile
make -f $ROOT_DIR/profiling/systemtap-connector/Makefile
Expand Down
35 changes: 35 additions & 0 deletions cmake/BuildGTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Look for Google Test and enable it as a target.
#
# The main targets that will be available are:
# * GTest::gtest
# * GTest::gmock
#
# References:
# * https://github.com/google/googletest
# * https://matgomes.com/integrate-google-test-into-cmake/
# * https://google.github.io/googletest/quickstart-cmake.html
# * https://jeremimucha.com/2021/04/cmake-fetchcontent/

include(FetchContent)

# Declare the Google Test dependency
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)

# If not yet populated, add Google Test to the build with the following options:
# * disable installation of Google Test
# * enable GMock
# Note that we could have used FetchContent_MakeAvailable instead, but it would then
# use the default configuration that would install Google Test.
FetchContent_GetProperties(googletest)
if (NOT googletest_POPULATED)
FetchContent_Populate(googletest)

set(BUILD_GMOCK ON)
set(INSTALL_GTEST OFF)

add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
3 changes: 2 additions & 1 deletion cmake/configure_variorum.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ if(NOT DEFINED Variorum_ROOT)
if(DEFINED ENV{VARIORUM_ROOT})
set(Variorum_ROOT $ENV{VARIORUM_ROOT})
set(MSG_NOTFOUND "check VARIORUM_ROOT environment variable ($ENV{VARIORUM_ROOT})")
else()
set(Variorum_ROOT ${VARIORUM_ROOT})
endif()
set(Variorum_ROOT ${VARIORUM_ROOT})
else()
set(MSG_NOTFOUND "check Variorum_ROOT (${Variorum_ROOT})")
endif()
Expand Down
2 changes: 1 addition & 1 deletion common/kernel-filter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
kp_add_library(kp_kernel_filter ${KOKKOSTOOLS_LIBRARY_MODE} kp_kernel_filter.cpp)
kp_add_library(kp_kernel_filter kp_kernel_filter.cpp)
2 changes: 1 addition & 1 deletion common/kokkos-sampler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
add_library(kp_kokkos_sampler ${KOKKOSTOOLS_LIBRARY_MODE} kp_sampler_skip.cpp)
kp_add_library(kp_kokkos_sampler kp_sampler_skip.cpp)
2 changes: 1 addition & 1 deletion common/kokkos-sampler/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CXX = clang++
CXX = g++

CXXFLAGS = -O3 -std=c++17 -g

Expand Down
11 changes: 9 additions & 2 deletions common/kokkos-sampler/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
This is a sampler utility that is intended to complement other tools in the Kokkos Tools set. This utility allows for sampling (rather than collecting) of profiling or debugging data gathered from a particular tool of the Kokkos Tools set. The Kokkos Tools user provides a sampling rate via the environment variable KOKKOS_TOOLS_SAMPLER_SKIP.
This is a sampler utility that is intended to complement other tools in the Kokkos Tools set. This utility allows for sampling (rather than collecting) of profiling or debugging data gathered from a particular tool of the Kokkos Tools set.

To use this utility, a Kokkos Tools user provides a sampling probability by setting the environment variable `KOKKOS_TOOLS_SAMPLER_PROB` to a positive real number between 0.0 and 100.0. The user can alternatively set a sampling skip rate, i.e., the number of Kokkos kernel invocations to skip before the next sample is taken. The user does so by setting the environment variable `KOKKOS_TOOLS_SAMPLER_SKIP` to a non-negative integer.

If both sampling probability and sampling skip rate are set by the user, this sampling utility only uses the sampling probability for sampling; the utility sets the sampling skip rate to 1, incorporating no pre-defined periodicity in sampling. If neither sampling probability nor the sampling skip rate are set by the user, then randomized sampling is done, with the sampler's probability being 10.0 percent. The sampler is periodic only if the sampling probability is not set by the user and the sampling skip rate is set by the user.

For randomized sampling, the user can ensure reproducibility of this tool's output across multiple runs of a Kokkos application by setting `KOKKOS_TOOLS_RANDOM_SEED` to an integer value before all of the runs. If this environment variable is not set, the seed is based on the C time function.

In order for the state of the sampled profiling and logging data in memory to be captured at the time of the utility's callback invocation, it might be important to enforce fences. However, this also means that there are more synchronization points compared with running the program without the tool.
This fencing behavior can be controlled by setting the environment variable `KOKKOS_TOOLS_GLOBALFENCES`. A non-zero value implies global fences on invocation of the tool. The default is not to introduce extra fences.
This fencing behavior can be controlled by setting the environment variable `KOKKOS_TOOLS_GLOBALFENCES`. A non-zero value implies global fences on invocation of the tool. The default is not to introduce extra fences.

Loading
Loading