diff --git a/docs/jana1to2/jana1-to-jana2.md b/docs/jana1to2/jana1-to-jana2.md index d58c2a3a1..7c8dc04f4 100644 --- a/docs/jana1to2/jana1-to-jana2.md +++ b/docs/jana1to2/jana1-to-jana2.md @@ -1,10 +1,14 @@ # Transition Guides for JANA1 to JANA2 -Welcome to the transition guides for JANA1 to JANA2! This page provides an overview of the changes and directs you to detailed documentation to help you navigate the updates effectively. +Welcome to the transition guides for JANA1 to JANA2! This page provides an overview of the changes and directs you to detailed documentation to help you navigate the updates effectively. As JANA transitions from version 1 (JANA1) to version 2 (JANA2), several important changes have been made. To assist you in adapting to these changes, we have created two comprehensive guides: -## Overview +## Developers Transition Guide +This guide focuses on key syntax and structural changes between JANA1 and JANA2. It is intended for developers who need to understand and update their codebase according to the new standards. + - [Developers Transition Guide: Key Syntax Changes](jana1to2/developers-transition-guide.md) -As JANA transitions from version 1 (JANA1) to version 2 (JANA2), several important changes have been made. To assist you in adapting to these changes, we have created two comprehensive guides: +## Parameter Changes Guide +This guide details the changes in parameters between JANA1 and JANA2. It provides user-focused information on how these changes impact configurations and usage. + - [Parameter Changes Guide](jana1to2/parameter-changes-guide.md) 1. **Developers Transition Guide:** This guide focuses on key syntax and structural changes between JANA1 and JANA2. It is intended for developers who need to understand and update their codebase according to the new standards. - [Developers Transition Guide: Key Syntax Changes](#developers-transition-guide) diff --git a/src/examples/EventGroupExample/GroupedEventProcessor.h b/src/examples/EventGroupExample/GroupedEventProcessor.h index 795fac81d..5fc94098f 100644 --- a/src/examples/EventGroupExample/GroupedEventProcessor.h +++ b/src/examples/EventGroupExample/GroupedEventProcessor.h @@ -10,14 +10,14 @@ #include #include #include -#include +#include #include "TridasEvent.h" /// GroupedEventProcessor demonstrates basic usage of JEventGroups class GroupedEventProcessor : public JEventProcessor { - + JBenchUtils m_bench_utils = JBenchUtils(); public: GroupedEventProcessor() { SetTypeName(NAME_OF_THIS); @@ -26,8 +26,9 @@ class GroupedEventProcessor : public JEventProcessor { void Process(const std::shared_ptr& event) override { + m_bench_utils.set_seed(event->GetEventNumber(), NAME_OF_THIS); // In parallel, perform a random amount of (slow) computation - consume_cpu_ms(100, 1.0); + m_bench_utils.consume_cpu_ms(100, 1.0); auto tridas_event = event->GetSingle(); tridas_event->should_keep = true; diff --git a/src/examples/InteractiveStreamingExample/ADCSampleFactory.h b/src/examples/InteractiveStreamingExample/ADCSampleFactory.h index ae263f117..2d1a100ad 100644 --- a/src/examples/InteractiveStreamingExample/ADCSampleFactory.h +++ b/src/examples/InteractiveStreamingExample/ADCSampleFactory.h @@ -7,7 +7,6 @@ #define _ADCSampleFactory_h_ #include -#include #include "ADCSample.h" #include "INDRAMessage.h" diff --git a/src/examples/InteractiveStreamingExample/InteractiveStreamingExample.cc b/src/examples/InteractiveStreamingExample/InteractiveStreamingExample.cc index 9708b983a..d9235524b 100644 --- a/src/examples/InteractiveStreamingExample/InteractiveStreamingExample.cc +++ b/src/examples/InteractiveStreamingExample/InteractiveStreamingExample.cc @@ -5,6 +5,8 @@ #include #include +#include + #include "RootProcessor.h" #include "MonitoringProcessor.h" @@ -16,8 +18,10 @@ void dummy_publisher_loop(JApplication* app) { + JBenchUtils bench_utils = JBenchUtils(); size_t delay_ms = 1; auto logger = app->GetService()->get_logger("dummy_publisher_loop"); + bench_utils.set_seed(7, "InteractiveStreamingExample.cc:dummy_publisher_loop"); std::this_thread::yield(); //std::this_thread::sleep_for(std::chrono::milliseconds(10)); // Wait for JANA to fire up so we don't lose data @@ -50,7 +54,7 @@ void dummy_publisher_loop(JApplication* app) { //LOG_DEBUG(logger) << "Send: " << message << " (" << message.get_buffer_size() << " bytes)" << LOG_END; std::cout << "dummy_producer_loop: Sending '" << message << "' (" << message.get_buffer_size() << " bytes)" << std::endl; transport.send(message); - consume_cpu_ms(delay_ms, 0, false); + bench_utils.consume_cpu_ms(delay_ms, 0, false); std::this_thread::yield(); } diff --git a/src/examples/RootDatamodelExample/JTestRootEventSource.cc b/src/examples/RootDatamodelExample/JTestRootEventSource.cc index 02760b6f5..8d8807e5b 100644 --- a/src/examples/RootDatamodelExample/JTestRootEventSource.cc +++ b/src/examples/RootDatamodelExample/JTestRootEventSource.cc @@ -13,7 +13,6 @@ #include #include -#include JTestRootEventSource::JTestRootEventSource() { SetTypeName(NAME_OF_THIS); // Provide JANA with class name @@ -24,13 +23,14 @@ JEventSource::Result JTestRootEventSource::Emit(JEvent& event) { /// Generate an event by inserting objects into "event". /// (n.b. a normal event source would read these from a file or stream) - // Spin the CPU a bit to limit the rate - consume_cpu_ms(5); - // Configure event and run numbers static size_t current_event_number = 1; event.SetEventNumber(current_event_number++); event.SetRunNumber(222); + + m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS); + // Spin the CPU a bit to limit the rate + m_bench_utils.consume_cpu_ms(5); // Generate hit objects. We use random numbers to give some variation // and make things look a little more realistic diff --git a/src/examples/RootDatamodelExample/JTestRootEventSource.h b/src/examples/RootDatamodelExample/JTestRootEventSource.h index fba3dd6a9..b3b2ee913 100644 --- a/src/examples/RootDatamodelExample/JTestRootEventSource.h +++ b/src/examples/RootDatamodelExample/JTestRootEventSource.h @@ -8,9 +8,12 @@ #include #include +#include + class JTestRootEventSource : public JEventSource { + JBenchUtils m_bench_utils = JBenchUtils(); public: JTestRootEventSource(); virtual ~JTestRootEventSource() = default; diff --git a/src/examples/StreamingExample/AHitAnomalyDetector.h b/src/examples/StreamingExample/AHitAnomalyDetector.h index b925f4e9b..582c44d67 100644 --- a/src/examples/StreamingExample/AHitAnomalyDetector.h +++ b/src/examples/StreamingExample/AHitAnomalyDetector.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include "AHit.h" class AHitAnomalyDetector : public JEventProcessor { @@ -33,13 +33,15 @@ class AHitAnomalyDetector : public JEventProcessor { } ss << "}" << std::endl; std::cout << ss.str(); - consume_cpu_ms(m_delay_ms); + m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS); + m_bench_utils.consume_cpu_ms(m_delay_ms); } void Finish() override { std::cout << "Anomaly detection: Done!" << std::endl; } private: size_t m_delay_ms; + JBenchUtils m_bench_utils = JBenchUtils(); }; diff --git a/src/examples/StreamingExample/AHitBHitFuser.h b/src/examples/StreamingExample/AHitBHitFuser.h index 5f3e09951..91b30f014 100644 --- a/src/examples/StreamingExample/AHitBHitFuser.h +++ b/src/examples/StreamingExample/AHitBHitFuser.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include "AHit.h" /// AHitBHitFuser @@ -39,7 +39,9 @@ class AHitBHitFuser : public JEventProcessor { } ss << "}" << std::endl; std::cout << ss.str(); - consume_cpu_ms(m_delay_ms); + + m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS); + m_bench_utils.consume_cpu_ms(m_delay_ms); auto raw_hits = event.Get("raw_hits"); @@ -52,13 +54,14 @@ class AHitBHitFuser : public JEventProcessor { calibrated_hit->V += 7; std::cout << serializer.serialize(*calibrated_hit) << std::endl; } - consume_cpu_ms(m_delay_ms); + m_bench_utils.consume_cpu_ms(m_delay_ms); } void Finish() override { std::cout << "Done!" << std::endl; } private: size_t m_delay_ms; + JBenchUtils m_bench_utils = JBenchUtils(); }; diff --git a/src/examples/StreamingExample/ZmqMain.cc b/src/examples/StreamingExample/ZmqMain.cc index d363e129a..b08d1dfe4 100644 --- a/src/examples/StreamingExample/ZmqMain.cc +++ b/src/examples/StreamingExample/ZmqMain.cc @@ -7,9 +7,11 @@ #include #include #include +#include #include #include + #include "ReadoutMessageAuto.h" #include "ZmqTransport.h" #include "AHitParser.h" @@ -18,7 +20,9 @@ void dummy_publisher_loop() { - consume_cpu_ms(3000, 0, false); + JBenchUtils bench_utils = JBenchUtils(); + bench_utils.set_seed(6, "ZmqMain.cc:dummy_publisher_loop"); + bench_utils.consume_cpu_ms(3000, 0, false); auto transport = ZmqTransport("tcp://127.0.0.1:5555", true); transport.initialize(); @@ -30,14 +34,14 @@ void dummy_publisher_loop() { message.event_number = counter; message.payload_size = 4; - message.payload[0] = randfloat(0,1); - message.payload[1] = randfloat(-100,100); - message.payload[2] = randfloat(-100,100); - message.payload[3] = randfloat(-100,100); + message.payload[0] = bench_utils.randfloat(0,1); + message.payload[1] = bench_utils.randfloat(-100,100); + message.payload[2] = bench_utils.randfloat(-100,100); + message.payload[3] = bench_utils.randfloat(-100,100); transport.send(message); std::cout << "Send: " << message << "(" << message.get_buffer_capacity() << " bytes)" << std::endl; - consume_cpu_ms(1000, 0, false); + bench_utils.consume_cpu_ms(1000, 0, false); } // Send end-of-stream message so that JANA knows to shut down diff --git a/src/libraries/JANA/CMakeLists.txt b/src/libraries/JANA/CMakeLists.txt index b12d8afce..1ca7a8800 100644 --- a/src/libraries/JANA/CMakeLists.txt +++ b/src/libraries/JANA/CMakeLists.txt @@ -31,7 +31,7 @@ set(JANA2_SOURCES Utils/JCpuInfo.cc Utils/JProcessorMapping.cc - Utils/JPerfUtils.cc + Utils/JBenchUtils.cc Utils/JStringification.cc Utils/JAutoActivator.cc Utils/JTablePrinter.cc diff --git a/src/libraries/JANA/Utils/JPerfUtils.cc b/src/libraries/JANA/Utils/JBenchUtils.cc similarity index 59% rename from src/libraries/JANA/Utils/JPerfUtils.cc rename to src/libraries/JANA/Utils/JBenchUtils.cc index 864c53068..e05e0f612 100644 --- a/src/libraries/JANA/Utils/JPerfUtils.cc +++ b/src/libraries/JANA/Utils/JBenchUtils.cc @@ -3,15 +3,40 @@ // Subject to the terms in the LICENSE file found in the top-level directory. -#include -#include +#include "JBenchUtils.h" -#include "JPerfUtils.h" +void JBenchUtils::set_seed(size_t event_number, std::string caller_name) +{ + std::hash hasher; + long seed = event_number ^ hasher(caller_name); + m_generator = std::mt19937(seed); +} + + +size_t JBenchUtils::rand_size(size_t avg, double spread) { + auto delta = static_cast(avg*spread); + std::uniform_int_distribution distribution(avg-delta, avg+delta); + return distribution(m_generator); +} -thread_local std::mt19937* generator = nullptr; -uint64_t consume_cpu_ms(uint64_t millisecs, double spread, bool fix_flops) { +int JBenchUtils::randint(int min, int max) { + std::uniform_int_distribution distribution(min, max); + return distribution(m_generator); +} + +double JBenchUtils::randdouble(double min, double max) { + std::uniform_real_distribution dist(min, max); + return dist(m_generator); +} + +float JBenchUtils::randfloat(float min, float max) { + std::uniform_real_distribution dist(min, max); + return dist(m_generator); +} + +uint64_t JBenchUtils::consume_cpu_ms(uint64_t millisecs, double spread, bool fix_flops) { uint64_t sampled = rand_size(millisecs, spread); uint64_t result = 0; @@ -22,7 +47,7 @@ uint64_t consume_cpu_ms(uint64_t millisecs, double spread, bool fix_flops) { sampled *= appx_iters_per_millisec; for (uint64_t i=0; i& buffer) { +uint64_t JBenchUtils::read_memory(const std::vector& buffer) { auto length = buffer.size(); uint64_t sum = 0; @@ -51,7 +76,7 @@ uint64_t read_memory(const std::vector& buffer) { return sum; } -uint64_t write_memory(std::vector& buffer, uint64_t bytes, double spread) { +uint64_t JBenchUtils::write_memory(std::vector& buffer, uint64_t bytes, double spread) { uint64_t sampled = rand_size(bytes, spread); for (unsigned i=0; i& buffer, uint64_t bytes, double spread) return sampled*2; } -void init_generator() { - if (!generator) { - std::hash hasher; - long now = std::chrono::steady_clock::now().time_since_epoch().count(); - long seed = now + hasher(std::this_thread::get_id()); - generator = new std::mt19937(seed); - } -} - -size_t rand_size(size_t avg, double spread) { - auto delta = static_cast(avg*spread); - init_generator(); - std::uniform_int_distribution distribution(avg-delta, avg+delta); - return distribution(*generator); -} -int randint(int min, int max) { - init_generator(); - std::uniform_int_distribution distribution(min, max); - return distribution(*generator); -} - -double randdouble(double min, double max) { - init_generator(); - std::uniform_real_distribution dist(min, max); - return dist(*generator); -} - -float randfloat(float min, float max) { - init_generator(); - std::uniform_real_distribution dist(min, max); - return dist(*generator); -} - diff --git a/src/libraries/JANA/Utils/JBenchUtils.h b/src/libraries/JANA/Utils/JBenchUtils.h new file mode 100644 index 000000000..3e55aa14e --- /dev/null +++ b/src/libraries/JANA/Utils/JBenchUtils.h @@ -0,0 +1,35 @@ + +// Copyright 2020, Jefferson Science Associates, LLC. +// Subject to the terms in the LICENSE file found in the top-level directory. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + + +class JBenchUtils { + + std::mt19937 m_generator; + +public: + + JBenchUtils(){} + + void set_seed(size_t event_number, std::string caller_name); + + size_t rand_size(size_t avg, double spread); + int randint(int min, int max); + double randdouble(double min=0.0, double max=1000.0); + float randfloat(float min=0.0, float max=1000.0); + + uint64_t consume_cpu_ms(uint64_t millisecs, double spread=0.0, bool fix_flops=true); + uint64_t read_memory(const std::vector& buffer); + uint64_t write_memory(std::vector& buffer, uint64_t bytes, double spread=0.0); + +}; diff --git a/src/libraries/JANA/Utils/JPerfUtils.h b/src/libraries/JANA/Utils/JPerfUtils.h deleted file mode 100644 index 08813d4a6..000000000 --- a/src/libraries/JANA/Utils/JPerfUtils.h +++ /dev/null @@ -1,25 +0,0 @@ - -// Copyright 2020, Jefferson Science Associates, LLC. -// Subject to the terms in the LICENSE file found in the top-level directory. - -#pragma once - -#include -#include - -extern thread_local std::mt19937* generator; - - -uint64_t consume_cpu_ms(uint64_t millisecs, double spread=0.0, bool fix_flops=true); - -uint64_t read_memory(const std::vector& buffer); - -uint64_t write_memory(std::vector& buffer, uint64_t bytes, double spread=0.0); - -size_t rand_size(size_t avg, double spread); - -int randint(int min, int max); - -double randdouble(double min=0.0, double max=1000.0); - -float randfloat(float min=0.0, float max=1000.0); diff --git a/src/plugins/JTest/JTestDisentangler.h b/src/plugins/JTest/JTestDisentangler.h index 2cc08a8b4..155245cea 100644 --- a/src/plugins/JTest/JTestDisentangler.h +++ b/src/plugins/JTest/JTestDisentangler.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include "JTestDataObjects.h" #include "JTestCalibrationService.h" @@ -19,6 +19,7 @@ class JTestDisentangler : public JFactoryT { size_t m_write_bytes = 500000; double m_cputime_spread = 0.25; double m_write_spread = 0.25; + JBenchUtils m_bench_utils = JBenchUtils(); std::shared_ptr m_calibration_service; @@ -38,19 +39,20 @@ class JTestDisentangler : public JFactoryT { void Process(const std::shared_ptr &aEvent) override { + m_bench_utils.set_seed(aEvent->GetEventNumber(), NAME_OF_THIS); // Read (large) entangled event data auto eed = aEvent->GetSingle(); - read_memory(*eed->buffer); + m_bench_utils.read_memory(*eed->buffer); // Read calibration data m_calibration_service->getCalibration(); // Do a little bit of computation - consume_cpu_ms(m_cputime_ms, m_cputime_spread); + m_bench_utils.consume_cpu_ms(m_cputime_ms, m_cputime_spread); // Write (large) event data auto ed = new JTestEventData; - write_memory(ed->buffer, m_write_bytes, m_write_spread); + m_bench_utils.write_memory(ed->buffer, m_write_bytes, m_write_spread); Insert(ed); } }; diff --git a/src/plugins/JTest/JTestParser.h b/src/plugins/JTest/JTestParser.h index 83e2a7951..51bf6bd43 100644 --- a/src/plugins/JTest/JTestParser.h +++ b/src/plugins/JTest/JTestParser.h @@ -7,11 +7,13 @@ #include #include + #include #include #include -#include +#include + #include "JTestDataObjects.h" @@ -22,6 +24,7 @@ class JTestParser : public JEventSource { size_t m_write_bytes = 2000000; double m_cputime_spread = 0.25; double m_write_spread = 0.25; + JBenchUtils m_bench_utils = JBenchUtils(); std::shared_ptr> m_latest_entangled_buffer; size_t m_events_generated = 0; @@ -50,23 +53,27 @@ class JTestParser : public JEventSource { Result Emit(JEvent& event) override { - if ((m_events_generated % 40) == 0) { + const auto prev_m_events_generated = m_events_generated; + m_events_generated++; + event.SetEventNumber(m_events_generated); + + m_bench_utils.set_seed(m_events_generated, typeid(*this).name()); + + if ((prev_m_events_generated % 40) == 0) { // "Read" new entangled event every 40 events m_latest_entangled_buffer = std::shared_ptr>(new std::vector); - write_memory(*m_latest_entangled_buffer, m_write_bytes, m_write_spread); + m_bench_utils.write_memory(*m_latest_entangled_buffer, m_write_bytes, m_write_spread); } // Spin the CPU - consume_cpu_ms(m_cputime_ms, m_cputime_spread); + m_bench_utils.consume_cpu_ms(m_cputime_ms, m_cputime_spread); // Emit a shared pointer to the entangled event buffer auto eec = new JTestEntangledEventData; eec->buffer = m_latest_entangled_buffer; event.Insert(eec); - m_events_generated++; - event.SetEventNumber(m_events_generated); event.SetRunNumber(1); return Result::Success; } diff --git a/src/plugins/JTest/JTestPlotter.h b/src/plugins/JTest/JTestPlotter.h index 0c643f925..a37928b9d 100644 --- a/src/plugins/JTest/JTestPlotter.h +++ b/src/plugins/JTest/JTestPlotter.h @@ -7,6 +7,7 @@ #include #include +#include #include "JTestTracker.h" #include @@ -16,6 +17,7 @@ class JTestPlotter : public JEventProcessor { size_t m_write_bytes = 1000; double m_cputime_spread = 0.25; double m_write_spread = 0.25; + JBenchUtils m_bench_utils = JBenchUtils(); std::mutex m_mutex; public: @@ -35,9 +37,10 @@ class JTestPlotter : public JEventProcessor { void Process(const std::shared_ptr& event) override { + m_bench_utils.set_seed(event->GetEventNumber(), typeid(*this).name()); // Read the track data auto td = event->GetSingle(); - read_memory(td->buffer); + m_bench_utils.read_memory(td->buffer); // Read the extra data objects inserted by JTestTracker event->Get(); @@ -46,11 +49,11 @@ class JTestPlotter : public JEventProcessor { std::lock_guard lock(m_mutex); // Consume CPU - consume_cpu_ms(m_cputime_ms, m_cputime_spread); + m_bench_utils.consume_cpu_ms(m_cputime_ms, m_cputime_spread); // Write the histogram data auto hd = new JTestHistogramData; - write_memory(hd->buffer, m_write_bytes, m_write_spread); + m_bench_utils.write_memory(hd->buffer, m_write_bytes, m_write_spread); event->Insert(hd); } diff --git a/src/plugins/JTest/JTestTracker.h b/src/plugins/JTest/JTestTracker.h index 1f99dc6c9..3438d8fdb 100644 --- a/src/plugins/JTest/JTestTracker.h +++ b/src/plugins/JTest/JTestTracker.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include "JTestDataObjects.h" class JTestTracker : public JFactoryT { @@ -17,6 +17,7 @@ class JTestTracker : public JFactoryT { size_t m_write_bytes = 1000; double m_cputime_spread = 0.25; double m_write_spread = 0.25; + JBenchUtils m_bench_utils = JBenchUtils(); public: @@ -36,16 +37,17 @@ class JTestTracker : public JFactoryT { void Process(const std::shared_ptr &aEvent) override { + m_bench_utils.set_seed(aEvent->GetEventNumber(), typeid(*this).name()); // Read (large) event data auto ed = aEvent->GetSingle(); - read_memory(ed->buffer); + m_bench_utils.read_memory(ed->buffer); // Do lots of computation - consume_cpu_ms(m_cputime_ms, m_cputime_spread); + m_bench_utils.consume_cpu_ms(m_cputime_ms, m_cputime_spread); // Write (small) track data auto td = new JTestTrackData; - write_memory(td->buffer, m_write_bytes, m_write_spread); + m_bench_utils.write_memory(td->buffer, m_write_bytes, m_write_spread); Insert(td); // Insert some additional objects diff --git a/src/programs/unit_tests/Engine/ScaleTests.h b/src/programs/unit_tests/Engine/ScaleTests.h index 7e7e0aaaf..6369f5376 100644 --- a/src/programs/unit_tests/Engine/ScaleTests.h +++ b/src/programs/unit_tests/Engine/ScaleTests.h @@ -5,7 +5,7 @@ #ifndef JANA2_SCALETESTS_H #define JANA2_SCALETESTS_H -#include +#include #include #include @@ -16,11 +16,15 @@ struct DummySource : public JEventSource { SetCallbackStyle(CallbackStyle::ExpertMode); } - Result Emit(JEvent&) override { - consume_cpu_ms(20); + Result Emit(JEvent& event) override { + m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS); + m_bench_utils.consume_cpu_ms(20); std::this_thread::sleep_for(std::chrono::nanoseconds(1)); return Result::Success; } + + private: + JBenchUtils m_bench_utils = JBenchUtils(); }; struct DummyProcessor : public JEventProcessor { @@ -28,10 +32,14 @@ struct DummyProcessor : public JEventProcessor { DummyProcessor() { SetCallbackStyle(CallbackStyle::ExpertMode); } - void Process(const JEvent&) override { - consume_cpu_ms(100); + void Process(const JEvent& event) override { + m_bench_utils.set_seed(event.GetEventNumber(), NAME_OF_THIS); + m_bench_utils.consume_cpu_ms(100); std::this_thread::sleep_for(std::chrono::nanoseconds(1)); } + + private: + JBenchUtils m_bench_utils = JBenchUtils(); }; } // namespace scaletest #endif //JANA2_SCALETESTS_H diff --git a/src/programs/unit_tests/Topology/TopologyTests.cc b/src/programs/unit_tests/Topology/TopologyTests.cc index f66f08ef6..d13e89c48 100644 --- a/src/programs/unit_tests/Topology/TopologyTests.cc +++ b/src/programs/unit_tests/Topology/TopologyTests.cc @@ -8,7 +8,7 @@ #include #include "TestTopologyComponents.h" -#include +#include #include @@ -161,9 +161,11 @@ TEST_CASE("JTopology: Basic functionality") { step(emit_rand_ints); bool work_left = true; + JBenchUtils bench_utils = JBenchUtils(); + bench_utils.set_seed(5, "TopologyTests"); while (work_left) { // Pick a random arrow - JArrow* arrow = arrows[randint(0, 3)]; + JArrow* arrow = arrows[bench_utils.randint(0, 3)]; auto name = arrow->get_name(); JArrowMetrics metrics;