gpu-compute: Remove use of 'std::random_shuffle'
This was deprecated in C++14 and removed in C++17. This has been
replaced with std::random. This has been implemented to ensure
reproducible results despite (pseudo)random behavior.
Change-Id: Idd52bc997547c7f8c1be88f6130adff8a37b4116
diff --git a/src/cpu/testers/gpu_ruby_test/address_manager.cc b/src/cpu/testers/gpu_ruby_test/address_manager.cc
index 37f7420..049ba86 100644
--- a/src/cpu/testers/gpu_ruby_test/address_manager.cc
+++ b/src/cpu/testers/gpu_ruby_test/address_manager.cc
@@ -32,6 +32,8 @@
#include "cpu/testers/gpu_ruby_test/address_manager.hh"
#include <algorithm>
+#include <climits>
+#include <random>
#include "base/intmath.hh"
#include "base/logging.hh"
@@ -58,8 +60,13 @@
randAddressMap[i] = (Addr)((i + 128) << floorLog2(sizeof(Value)));
}
- // randomly shuffle randAddressMap
- std::random_shuffle(randAddressMap.begin(), randAddressMap.end());
+ // randomly shuffle randAddressMap. The seed is determined by the random_mt
+ // gem5 rng. This allows for deterministic randomization.
+ std::shuffle(
+ randAddressMap.begin(),
+ randAddressMap.end(),
+ std::default_random_engine(random_mt.random<unsigned>(0,UINT_MAX))
+ );
// initialize atomic locations
// first and last normal location per atomic location