Bobby Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/72223?usp=email )

Change subject: gpu-compute: Remove use of 'std::random_shuffle'
......................................................................

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
---
M src/cpu/testers/gpu_ruby_test/address_manager.cc
1 file changed, 9 insertions(+), 2 deletions(-)



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

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/72223?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: hotfix-v23-0-0-1
Gerrit-Change-Id: Idd52bc997547c7f8c1be88f6130adff8a37b4116
Gerrit-Change-Number: 72223
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to