Skip to content

Commit

Permalink
Investigate test failures -- part 3
Browse files Browse the repository at this point in the history
Inspect seed choice during tests.
  • Loading branch information
jmachado-amd committed May 31, 2024
1 parent 5dd0faa commit af0a7e7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions clients/common/misc/rocblas_random.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ inline rocblas_rng_t get_seed()
auto tid = std::this_thread::get_id();
/* return tid == main_thread_id ? rocblas_seed : rocblas_rng_t(std::hash<std::thread::id>{}(tid)); */

constexpr std::size_t rocblas_default_seed = 69069;

This comment has been minimized.

Copy link
@EdDAzevedo

EdDAzevedo Jun 3, 2024

Contributor

Would you prefer a prime number say 69073 instead of 69069 as default seed? Just a suggestion.

auto tid_hash = static_cast<std::size_t>(std::hash<std::thread::id>{}(tid));
std::cout << "\u001b[32m[ ] \u001b[33m" << "Random seed hash: " << tid_hash << "\u001b[0m" << std::endl << std::flush;

auto seed = static_cast<rocblas_rng_t>(tid_hash);
return seed;
bool use_default_seed = (tid == main_thread_id);
auto seed = static_cast<std::size_t>(use_default_seed ? rocblas_default_seed : tid_hash);
std::cout << "\u001b[32m[ ] \u001b[33m" << "Random seed: type " << (use_default_seed ? "default" : "thread id hash")
<< ", value: " << seed << "\u001b[0m" << std::endl << std::flush;

rocblas_rng_t generator;
generator.seed(seed);
return generator;
}

// Reset the seed (mainly to ensure repeatability of failures in a given suite)
Expand Down

0 comments on commit af0a7e7

Please sign in to comment.