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
This commit is contained in:
Bobby R. Bruce
2023-05-09 15:30:11 -07:00
parent 1db206b9d3
commit fbaa164b6a

View File

@@ -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 @@ AddressManager::AddressManager(int n_atomic_locs, int n_normal_locs_per_atomic)
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