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

Use probability sampling over periodic sampling #213

Merged
merged 95 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
6bfca81
kp_sampler_skip: putting in probabilistic sampling
vlkale Oct 13, 2023
fab829a
CMakeLists.txt in kokkos-sampler: fix add_library to kp_add_library
vlkale Oct 13, 2023
eeccd10
sampler's README.md: reflects sampler probability env var
vlkale Oct 13, 2023
d0a24ba
kp_sampler_skip.cpp: tool_prob_num default to -1.0 not 0.1
vlkale Oct 13, 2023
9df6748
Update kp_sampler_skip.cpp: put erase back
vlkale Oct 23, 2023
b629300
Update kp_sampler_skip.cpp: putting in seed
vlkale Oct 23, 2023
df84895
kp_sampler: set default seed to -1, tool fence verbosity
Oct 23, 2023
624a14d
kp_sampler_skip.cpp: applied clang format
vlkale Oct 23, 2023
bd237ac
Sampler: reduce text in prints; revise README
vlkale Oct 24, 2023
27ea88d
fix readme indent
vlkale Oct 24, 2023
ad08a5e
kp_sampler: fix name of seed environment varable and else condition f…
vlkale Oct 26, 2023
5c1a272
Update kp_sampler_skip.cpp: fix msg Kokkos_tools_libs
vlkale Jan 23, 2024
9dbd16b
Merge branch 'kokkos:develop' into use-probability-sampling
vlkale Jan 28, 2024
a6dd9dc
intitialized pointer
vlkale Jan 29, 2024
52e3349
kp_sampler_skip.cpp: revert fix of initialize pointer
vlkale Jan 29, 2024
dae1f2c
Update kp_sampler_skip.cpp: fix func pointer - tools
vlkale Feb 8, 2024
68c1093
kp_sampler_skip.cpp: provide_tpi parameter changed
vlkale Feb 15, 2024
8c56daf
kp_core.hpp: provide_tpi takes struct
vlkale Feb 15, 2024
a2b8577
Update kp_sampler_skip.cpp: fix paren in invoke_ktools_fence
vlkale Feb 15, 2024
43bd1a2
kp_sampler_skip.cpp: applied clang-format-8
vlkale Feb 16, 2024
8021f36
kp_core.hpp: applied clang-format-8
vlkale Feb 16, 2024
e4e2121
Merge branch 'kokkos:develop' into use-probability-sampling
vlkale Feb 29, 2024
5b66f90
Create test_randomized_sampling.cpp
vlkale Feb 29, 2024
d89291e
Create CMakeLists.txt
vlkale Feb 29, 2024
e1f7c22
Update test_randomized_sampling.cpp
vlkale Feb 29, 2024
d020036
test_randomized_sampling.cpp: fix matcher text for 4 samples
vlkale Feb 29, 2024
d2b0a69
Update CMakeLists.txt: add sampler subdirectory
vlkale Mar 7, 2024
cc9118d
Update CMakeLists.txt: fix to be kp_kokkos_sampler
vlkale Mar 7, 2024
fc3cc11
Update test_randomized_sampling.cpp: fix to test with RE2
vlkale Mar 7, 2024
7f519ef
Update test_randomized_sampling.cpp: vector include
vlkale Mar 7, 2024
0df7f5c
Update test_randomized_sampling.cpp: curly fix
vlkale Mar 7, 2024
9ee7600
Update test_randomized_sampling.cpp: RE2 quotation fix
vlkale Mar 7, 2024
4c241a2
CMakeLists.txt: put in test for kernel logger
vlkale Mar 7, 2024
e6e6545
test_randomized_sampling.cpp: sample number to be 100
vlkale Mar 7, 2024
377ffa8
test_randomized_sampling.cpp: fix comment on test
vlkale Mar 7, 2024
74f9196
test_randomized_sampling.cpp: env var default
vlkale Mar 7, 2024
e337319
Update CMakeLists.txt: fix sampler
vlkale Mar 19, 2024
d74eae7
Update CMakeLists.txt: put add'l env variables
vlkale Mar 19, 2024
6049952
test_randomized_sampling.cpp: apply clang format
vlkale Mar 20, 2024
0c9ce3f
CMakeLists.txt: put in sampler verbose
vlkale Mar 20, 2024
64c6a58
test_randomized_sampling: apply clang format
vlkale Mar 20, 2024
486ba9e
test_randomized_sampling.cpp: fixing setting environment variable in …
vlkale Mar 20, 2024
d509a6e
test_randomized_sampling.cpp: apply clang-format
vlkale Mar 20, 2024
2c84bcc
fix test randomized sampling
vlkale Mar 20, 2024
3cb33b4
CMakeLists.txt: fix enviornment var for KOKKOS_TOOLS_LIBS2
vlkale Mar 20, 2024
e4c4f6b
CMakeLists.txt: add global fences environment variable
vlkale Mar 20, 2024
fa33166
CMakeLists.txt: fix nesting of if's in ctest
vlkale Mar 20, 2024
3c1fb93
Update CMakeLists.txt: kaeat_args
vlkale Mar 20, 2024
375ebba
Update CMakeLists.txt: kp_kernel_logger fix
vlkale Mar 20, 2024
c19c018
Update CMakeLists.txt: fix target file 2
vlkale Mar 20, 2024
8317118
add cmake
vlkale Mar 20, 2024
5bb8e7d
Merge branch 'use-probability-sampling' of https://github.com/vlkale/…
vlkale Mar 20, 2024
9517af5
random sampling
vlkale Mar 20, 2024
a03955e
test_randomized_sampling.cpp: fix matcher
vlkale Mar 21, 2024
a4285d3
Update CMakeLists.txt: fix sampler skip variable
vlkale Mar 22, 2024
090245b
Update CMakeLists.txt: env var
vlkale Mar 22, 2024
371ae92
Update kp_sampler_skip.cpp: remove else kernelSampleSkip
vlkale Mar 22, 2024
27e112b
Update kp_sampler_skip.cpp: period in sampler fence printf
vlkale Mar 22, 2024
ceb1e2d
kp_sampler_skip.cpp: removed tool verbose str print
vlkale Mar 22, 2024
44f1eb7
test_randomized_sampling.cpp: take out flushes
vlkale Mar 23, 2024
19cbc2c
Convert kp_kernel_logger to std::cout
masterleinad Mar 25, 2024
c309f0e
Working
masterleinad Mar 26, 2024
8cab46a
Almost working
masterleinad Mar 26, 2024
83d17fb
Still working
masterleinad Mar 26, 2024
e683d6f
Use cout in sampler
masterleinad Mar 26, 2024
c93d11c
Revert changes to kp_kernel_logger.cpp
masterleinad Mar 26, 2024
9d98e9e
kp_sampler_skip.cpp: apply clang format
vlkale Mar 27, 2024
828597d
test_randomized_sampling.cpp: apply clang format
vlkale Mar 27, 2024
7f0cd8a
More indentation
masterleinad Mar 26, 2024
d1b2036
Merge pull request #9 from masterleinad/use-probability-sampling
vlkale Mar 28, 2024
2a376ca
kp_sampler_skip.cpp: fix reduce callee null check
vlkale Apr 2, 2024
b052594
Merge branch 'kokkos:develop' into use-probability-sampling
vlkale Apr 4, 2024
ce93309
kp_kernel_logger.cpp: scan typo fix
vlkale Apr 4, 2024
0d8e79a
Rename test_randomized_sampling.cpp to test_parfor.cpp
vlkale Apr 4, 2024
c16004a
Update CMakeLists.txt: fix sampling
vlkale Apr 4, 2024
3178c8b
Prob smplr (#16)
vlkale Apr 11, 2024
d280cbb
Merge branch 'develop' into use-probability-sampling
vlkale Apr 11, 2024
ca54d35
test_par*.cpp: apply clang format
vlkale Apr 11, 2024
75f9057
test_parreduce.cpp: change test tag; apply clang format
vlkale Apr 11, 2024
43868da
Merge branch 'kokkos:develop' into use-probability-sampling
vlkale May 2, 2024
6f9cd82
Delete matchersProb.hpp
vlkale May 2, 2024
39db70d
kp_sampler_skip.cpp: make function pointer correct
vlkale May 2, 2024
8d28cf6
kp_sampler_skip.cpp: invoke kokkos tools fence
vlkale May 2, 2024
e28dccd
kp_sampler_skip.cpp: Remove small changes not relating to this PR
vlkale May 3, 2024
367ca77
kp_sampler_skip.cpp: apply clang format
vlkale May 3, 2024
af97417
README.md: eliminate unintended changes in text to make diff more rea…
vlkale May 3, 2024
4c48eb0
CMakeLists.txt for test tools: comment in sampler prob environment va…
vlkale May 3, 2024
bb538bb
kp_sampler_skip.cpp: apply clang format
vlkale May 3, 2024
b03c2c4
kp_sampler_skip.cpp: make probability sampling the priority (as before)
vlkale May 3, 2024
d571b94
kp_sampler_skip.cpp: fix conditional as per review request
vlkale May 3, 2024
a426547
kp_sampler_skip.cpp: putting back in conditional as requested
vlkale May 3, 2024
1999883
kp_sampler_skip.cpp: apply clang-format
vlkale May 6, 2024
4cdf85d
kp_sampler_skip.cpp: take out returns from input processing
vlkale May 23, 2024
f4627df
Merge branch 'develop' into use-probability-sampling
crtrott May 23, 2024
679ba48
Fix clang-format
crtrott May 23, 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
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.

193 changes: 135 additions & 58 deletions common/kokkos-sampler/kp_sampler_skip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
#include <dlfcn.h>
#include "../../profiling/all/kp_core.hpp"
#include "kp_config.hpp"
#include <ctime>
#include <limits>
#include <iostream>

namespace KokkosTools {
namespace Sampler {
static uint64_t uniqID = 0;
static uint64_t kernelSampleSkip = 101;
static uint64_t kernelSampleSkip = std::numeric_limits<uint64_t>::max();
static double tool_prob_num = -1.0;
static int tool_verbosity = 0;
static int tool_globFence = 0;
static int tool_seed = -1;

// a hash table mapping kID to nestedkID
static std::unordered_map<uint64_t, uint64_t> infokIDSample;
Expand Down Expand Up @@ -77,6 +81,8 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer,
const uint32_t devInfoCount, void* deviceInfo) {
const char* tool_verbose_str = getenv("KOKKOS_TOOLS_SAMPLER_VERBOSE");
const char* tool_globFence_str = getenv("KOKKOS_TOOLS_GLOBALFENCES");
const char* tool_seed_str = getenv("KOKKOS_TOOLS_RANDOM_SEED");

if (NULL != tool_verbose_str) {
tool_verbosity = atoi(tool_verbose_str);
} else {
Expand All @@ -88,11 +94,15 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer,
tool_globFence = 0;
}

if (NULL != tool_seed_str) {
tool_seed = atoi(tool_seed_str);
}

char* profileLibrary = getenv("KOKKOS_TOOLS_LIBS");
if (NULL == profileLibrary) {
printf(
"Checking KOKKOS_PROFILE_LIBRARY. WARNING: This is a depreciated "
"variable. Please use KOKKOS_TOOLS_LIBS\n");
std::cout << "Checking KOKKOS_PROFILE_LIBRARY. WARNING: This is a "
"deprecated variable. Please use KOKKOS_TOOLS_LIBS\n";

profileLibrary = getenv("KOKKOS_PROFILE_LIBRARY");
if (NULL == profileLibrary) {
std::cout << "KokkosP: FATAL: No library to call in " << profileLibrary
Expand All @@ -113,8 +123,7 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer,
nextLibrary = strtok(NULL, ";");

if (NULL == nextLibrary) {
std::cout << "KokkosP: FATAL: No child library of sampler utility library "
"to call in "
std::cout << "KokkosP: FATAL: No child library to call in "
<< profileLibrary << "!\n";
exit(-1);
} else {
Expand Down Expand Up @@ -158,15 +167,15 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer,
std::cout << "KokkosP: Function Status:\n";
std::cout << "KokkosP: begin-parallel-for: "
<< ((beginForCallee == NULL) ? "no" : "yes") << "\n";
std::cout << "KokkosP: begin-parallel-scan: "
std::cout << "KokkosP: begin-parallel-scan: "
<< ((beginScanCallee == NULL) ? "no" : "yes") << "\n";
std::cout << "KokkosP: begin-parallel-reduce: "
std::cout << "KokkosP: begin-parallel-reduce: "
<< ((beginReduceCallee == NULL) ? "no" : "yes") << "\n";
std::cout << "KokkosP: end-parallel-for: "
std::cout << "KokkosP: end-parallel-for: "
<< ((endForCallee == NULL) ? "no" : "yes") << "\n";
std::cout << "KokkosP: end-parallel-scan: "
std::cout << "KokkosP: end-parallel-scan: "
<< ((endScanCallee == NULL) ? "no" : "yes") << "\n";
std::cout << "KokkosP: end-parallel-reduce: "
std::cout << "KokkosP: end-parallel-reduce: "
<< ((endReduceCallee == NULL) ? "no" : "yes") << "\n";
}
}
Expand All @@ -176,15 +185,78 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer,

uniqID = 1;

if (0 > tool_seed) {
srand(time(NULL));
if (tool_verbosity > 0) {
std::cout << "KokkosP: Seeding random number generator using clock for "
"random sampling.\n";
}
} else {
srand(tool_seed);
if (tool_verbosity > 0) {
std::cout << "KokkosP: Seeding random number generator using seed "
<< tool_seed << " for random sampling.\n";
}
}

const char* tool_probability = getenv("KOKKOS_TOOLS_SAMPLER_PROB");

if (NULL != tool_probability) {
// Read sampling probability as a float between 0 and 100, representing
// a percentage that data should be gathered.
// Utility reasons about probability as a double between 0.0 and 1.0.
tool_prob_num = atof(tool_probability);
if (tool_prob_num > 100.0) {
std::cout << "KokkosP: The sampling probability value is set to be "
"greater than 100.0. The probability for the sampler will "
"be set to 100 percent; all of the invocations of a Kokkos "
"kernel will be profiled.\n";
tool_prob_num = 100.0;
} else if (tool_prob_num < 0.0) {
std::cout
<< "KokkosP: The sampling probability value is set to be a negative "
"number. The sampler's probability will be set to 0 percent; none "
"of the invocations of a Kokkos kernel will be profiled.\n";
tool_prob_num = 0.0;
}
if (tool_verbosity > 0) {
std::cout << "KokkosP: Probability for the sampler set to: "
<< tool_prob_num << "\n";
}
kernelSampleSkip = 1;
}

const char* tool_sample = getenv("KOKKOS_TOOLS_SAMPLER_SKIP");
if (NULL != tool_sample) {
if ((NULL != tool_sample) && (tool_prob_num == -1.0)) {
// If the user touched the sample skip rate variable
// and the tool probability is set to -1 (no probability sampling
// desired), then use only sampler skip rate.
tool_prob_num = 100.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means SamplerSkip is prioritized over random setting, because it overwrites the previous setting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is fixed now.

kernelSampleSkip = atoi(tool_sample) + 1;
if (tool_verbosity > 0) {
std::cout << "KokkosP: Sampling rate set to: " << tool_sample << "\n";
}
}

if (tool_verbosity > 0) {
std::cout << "KokkosP: Sampling rate set to: " << tool_sample << "\n";
if (tool_prob_num == -1.0) {
// If the tool probability is set to -1 (no probability sampling
// desired) and the user also didn't set
// skip rate, then use a default with a probability sampling of 10%.

if (tool_verbosity > 0) {
std::cout << "KokkosP: Neither the probability nor the skip rate for "
"sampling were set...\n";
}
tool_prob_num = 10.0;
kernelSampleSkip = 1;
if (tool_verbosity > 0) {
std::cout << "KokkosP: The probability for the sampler is set to the "
"default of "
<< tool_prob_num
<< " percent. The skip rate for sampler will not be used.\n";
}
}
}
} // end kokkosp_init_library

void kokkosp_finalize_library() {
if (NULL != finalizeProfileLibrary) (*finalizeProfileLibrary)();
Expand All @@ -196,22 +268,23 @@ void kokkosp_begin_parallel_for(const char* name, const uint32_t devID,
static uint64_t invocationNum = 0;
++invocationNum;
if ((invocationNum % kernelSampleSkip) == 0) {
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " calling child-begin function...\n";
}

if (NULL != beginForCallee) {
if (tool_globFence) {
invoke_ktools_fence(0);
}
uint64_t nestedkID = 0;
(*beginForCallee)(name, devID, &nestedkID);
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " finished with child-begin function.\n";
if ((rand() / (1.0 * RAND_MAX)) < (tool_prob_num / 100.0)) {
if (NULL != beginForCallee) {
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " calling child-begin function...\n";
}
if (tool_globFence) {
invoke_ktools_fence(0);
}
uint64_t nestedkID = 0;
(*beginForCallee)(name, devID, &nestedkID);
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " finished with child-begin function.\n";
}
infokIDSample.insert({*kID, nestedkID});
}
infokIDSample.insert({*kID, nestedkID});
}
}
}
Expand Down Expand Up @@ -244,21 +317,23 @@ void kokkosp_begin_parallel_scan(const char* name, const uint32_t devID,
static uint64_t invocationNum = 0;
++invocationNum;
if ((invocationNum % kernelSampleSkip) == 0) {
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " calling child-begin function...\n";
}
if (NULL != beginScanCallee) {
uint64_t nestedkID = 0;
if (tool_globFence) {
invoke_ktools_fence(0);
if ((rand() / (1.0 * RAND_MAX)) < (tool_prob_num / 100.0)) {
if (NULL != beginScanCallee) {
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " calling child-begin function...\n";
}
uint64_t nestedkID = 0;
if (tool_globFence) {
invoke_ktools_fence(0);
}
(*beginScanCallee)(name, devID, &nestedkID);
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " finished with child-begin function.\n";
}
infokIDSample.insert({*kID, nestedkID});
}
(*beginScanCallee)(name, devID, &nestedkID);
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " finished with child-begin function.\n";
}
infokIDSample.insert({*kID, nestedkID});
}
}
}
Expand Down Expand Up @@ -290,21 +365,23 @@ void kokkosp_begin_parallel_reduce(const char* name, const uint32_t devID,
static uint64_t invocationNum = 0;
++invocationNum;
if ((invocationNum % kernelSampleSkip) == 0) {
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " calling child-begin function...\n";
}
if (NULL != beginReduceCallee) {
uint64_t nestedkID = 0;
if (tool_globFence) {
invoke_ktools_fence(0);
}
(*beginReduceCallee)(name, devID, &nestedkID);
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " finished with child-begin function.\n";
if ((rand() / (1.0 * RAND_MAX)) < (tool_prob_num / 100.0)) {
if (NULL != beginReduceCallee) {
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " calling child-begin function...\n";
}
uint64_t nestedkID = 0;
if (tool_globFence) {
invoke_ktools_fence(0);
}
(*beginReduceCallee)(name, devID, &nestedkID);
if (tool_verbosity > 0) {
std::cout << "KokkosP: sample " << *kID
<< " finished with child-begin function.\n";
}
infokIDSample.insert({*kID, nestedkID});
}
infokIDSample.insert({*kID, nestedkID});
}
}
}
Expand Down
23 changes: 21 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
# to the target file of this argument (optional)
# KOKKOS_TOOLS_SAMPLER_VERBOSE : the test environment will receive the variable 'KOKKOS_TOOLS_SAMPLER_VERBOSE' that is set as the value of 1 for printing the sample has been taken
# KOKKOS_TOOLS_GLOBALFENCES : test environment receives the variable 'KOKKOS_TOOLS_GLOBALFENCES' that is set as the value of 1 to turn the tool's auto-fencing on.
# KOKKOS_TOOLS_RANDOM_SEED : test environment receives the variable 'KOKKOS_TOOLS_RANDOM_SEED' that is set as the value for a seed of the random number generator (used for testing repeatability).
# KOKKOS_TOOLS_SAMPLER_SKIP : test environment receives the variable 'KOKKOS_TOOLS_SAMPLER_SKIP' that is set as the value of the number of Kokkos kernel invocations to skip before a tooling activity is invoked.
# KOKKOS_TOOLS_SAMPLER_PROB : test environment receives the variable 'KOKKOS_TOOLS_SAMPLER_PROB' that is set as the probability that a Kokkos kernel invocation has a tooling activity invoked for it.

function(kp_add_executable_and_test)
cmake_parse_arguments(kaeat_args "" "TARGET_NAME;SOURCE_FILE;KOKKOS_TOOLS_SAMPLER_VERBOSE;KOKKOS_TOOLS_GLOBALFENCES;KOKKOS_TOOLS_SAMPLER_SKIP" "KOKKOS_TOOLS_LIBS" ${ARGN})

function(kp_add_executable_and_test)
cmake_parse_arguments(kaeat_args "" "TARGET_NAME;SOURCE_FILE;KOKKOS_TOOLS_SAMPLER_VERBOSE;KOKKOS_TOOLS_GLOBALFENCES;KOKKOS_TOOLS_SAMPLER_SKIP;KOKKOS_TOOLS_SAMPLER_PROB;KOKKOS_TOOLS_RANDOM_SEED" "KOKKOS_TOOLS_LIBS" ${ARGN})
if(NOT DEFINED kaeat_args_TARGET_NAME)
message(FATAL_ERROR "'TARGET_NAME' is a required argument.")
endif()
Expand Down Expand Up @@ -78,7 +80,24 @@ function(kp_add_executable_and_test)
PROPERTY
ENVIRONMENT "KOKKOS_TOOLS_SAMPLER_SKIP=${kaeat_args_KOKKOS_TOOLS_SAMPLER_SKIP}"
)
endif()

if (DEFINED kaeat_args_KOKKOS_TOOLS_SAMPLER_PROB)
set_property(
TEST ${kaeat_args_TARGET_NAME}
APPEND
PROPERTY
ENVIRONMENT "KOKKOS_TOOLS_SAMPLER_PROB=${kaeat_args_KOKKOS_TOOLS_SAMPLER_PROB}"
)
endif()

if (DEFINED kaeat_args_KOKKOS_TOOLS_RANDOM_SEED)
set_property(
TEST ${kaeat_args_TARGET_NAME}
APPEND
PROPERTY
ENVIRONMENT "KOKKOS_TOOLS_RANDOM_SEED=${kaeat_args_KOKKOS_TOOLS_RANDOM_SEED}"
)
endif()

endfunction(kp_add_executable_and_test)
Expand Down
Loading
Loading