MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / createRunID

Method createRunID

src/solver/solver.cxx:610–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610std::string Solver::createRunID() const {
611
612 std::string result;
613 result.resize(36);
614
615 if (MYPE == 0) {
616 // Generate a unique ID for this run
617#if BOUT_HAS_UUID_SYSTEM_GENERATOR
618 uuids::uuid_system_generator gen{};
619#else
620 std::random_device rd;
621 auto seed_data = std::array<int, std::mt19937::state_size>{};
622 std::generate(std::begin(seed_data), std::end(seed_data), std::ref(rd));
623 std::seed_seq seq(std::begin(seed_data), std::end(seed_data));
624 std::mt19937 generator(seq);
625 uuids::uuid_random_generator gen{generator};
626#endif
627
628 result = uuids::to_string(gen());
629 }
630
631 // All ranks have same run_id
632 // Standard representation of UUID is always 36 characters
633 MPI_Bcast(&result[0], 36, MPI_CHAR, 0, BoutComm::get());
634
635 return result;
636}
637
638std::string Solver::getRunID() const {
639 AUTO_TRACE();

Callers

nothing calls this directly

Calls 2

generateFunction · 0.85
to_stringFunction · 0.85

Tested by

no test coverage detected