| 608 | } |
| 609 | |
| 610 | std::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 | |
| 638 | std::string Solver::getRunID() const { |
| 639 | AUTO_TRACE(); |