diff --git a/common/kokkos-sampler/README.md b/common/kokkos-sampler/README.md index 2b21d7598..c8455ddeb 100644 --- a/common/kokkos-sampler/README.md +++ b/common/kokkos-sampler/README.md @@ -3,5 +3,7 @@ This is a sampler utility that is intended to complement other tools in the Kokk 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 purely random sampling is againdone, 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 the randomized sampling, the user can ensure reproducibility by setting `KOKKOS_TOOLS_RANDOM_SEED` to any integer. If this environment variable is not set, the seed is based on +the C time function. 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. diff --git a/common/kokkos-sampler/kp_sampler_skip.cpp b/common/kokkos-sampler/kp_sampler_skip.cpp index afa20b735..5956fac0b 100644 --- a/common/kokkos-sampler/kp_sampler_skip.cpp +++ b/common/kokkos-sampler/kp_sampler_skip.cpp @@ -88,7 +88,7 @@ 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_SEED"); + const char* tool_seed_str = getenv("KOKKOS_TOOLS_RANDOM_SEED"); if (NULL != tool_verbose_str) { tool_verbosity = atoi(tool_verbose_str); @@ -102,8 +102,6 @@ void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, } if (NULL != tool_seed_str) { tool_seed = atoi(tool_seed_str); - } else { - tool_seed = 1; } char* profileLibrary = getenv("KOKKOS_TOOLS_LIBS");