|
18 | 18 | #include "oneapi/tbb/global_control.h" |
19 | 19 | #include "util/include/util.hpp" |
20 | 20 |
|
21 | | -namespace { |
22 | | -[[maybe_unused]] void SyncGTestSeed() { |
23 | | - unsigned int seed = 0; |
24 | | - int rank = -1; |
25 | | - MPI_Comm_rank(MPI_COMM_WORLD, &rank); |
26 | | - if (rank == 0) { |
27 | | - try { |
28 | | - seed = std::random_device{}(); |
29 | | - } catch (...) { |
30 | | - seed = 0; |
31 | | - } |
32 | | - if (seed == 0) { |
33 | | - const auto now = static_cast<std::uint64_t>(std::chrono::steady_clock::now().time_since_epoch().count()); |
34 | | - seed = static_cast<unsigned int>(((now & 0x7fffffffULL) | 1ULL)); |
35 | | - } |
36 | | - } |
37 | | - MPI_Bcast(&seed, 1, MPI_UNSIGNED, 0, MPI_COMM_WORLD); |
38 | | - ::testing::GTEST_FLAG(random_seed) = static_cast<int>(seed); |
39 | | -} |
40 | | - |
41 | | -[[maybe_unused]] void SyncGTestFilter() { |
42 | | - int rank = -1; |
43 | | - MPI_Comm_rank(MPI_COMM_WORLD, &rank); |
44 | | - std::string filter = (rank == 0) ? ::testing::GTEST_FLAG(filter) : std::string{}; |
45 | | - int len = static_cast<int>(filter.size()); |
46 | | - MPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); |
47 | | - if (rank != 0) { |
48 | | - filter.resize(static_cast<std::size_t>(len)); |
49 | | - } |
50 | | - if (len > 0) { |
51 | | - MPI_Bcast(filter.data(), len, MPI_CHAR, 0, MPI_COMM_WORLD); |
52 | | - } |
53 | | - ::testing::GTEST_FLAG(filter) = filter; |
54 | | -} |
55 | | - |
56 | | -[[maybe_unused]] bool HasFlag(int argc, char **argv, std::string_view flag) { |
57 | | - for (int i = 1; i < argc; ++i) { |
58 | | - if (argv[i] != nullptr && std::string_view(argv[i]) == flag) { |
59 | | - return true; |
60 | | - } |
61 | | - } |
62 | | - return false; |
63 | | -} |
64 | | -} // namespace |
65 | | - |
66 | 21 | namespace ppc::runners { |
67 | 22 |
|
68 | 23 | void UnreadMessagesDetector::OnTestEnd(const ::testing::TestInfo & /*test_info*/) { |
|
0 commit comments