public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Simon Ser <simon.ser@intel.com>, Intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 15/15] gem_wsim: Allow random seed control
Date: Wed, 22 May 2019 16:57:20 +0100	[thread overview]
Message-ID: <20190522155720.28723-16-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20190522155720.28723-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

New command line option to allow controling the initial pseudo random
generator seed in order to allow repeatable runs.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Suggested-by: Simon Ser <simon.ser@intel.com>
---
 benchmarks/gem_wsim.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index c43bbbc8c94d..e2ffb93a94d5 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2946,6 +2946,7 @@ static void print_help(void)
 "  -t <n>          Nop calibration tolerance percentage.\n"
 "                  Use when there is a difficulty obtaining calibration with the\n"
 "                  default settings.\n"
+"  -I <n>          Initial randomness seed.\n"
 "  -p <n>          Context priority to use for the following workload on the\n"
 "                  command line.\n"
 "  -w <desc|path>  Filename or a workload descriptor.\n"
@@ -3119,11 +3120,9 @@ int main(int argc, char **argv)
 	init_clocks();
 
 	master_prng = time(NULL);
-	srand(master_prng);
-	master_prng = rand();
 
 	while ((c = getopt(argc, argv,
-			   "hqv2RsSHxGdc:n:r:w:W:a:t:b:p:")) != -1) {
+			   "hqv2RsSHxGdc:n:r:w:W:a:t:b:p:I:")) != -1) {
 		switch (c) {
 		case 'W':
 			if (master_workload >= 0) {
@@ -3210,6 +3209,9 @@ int main(int argc, char **argv)
 				return 1;
 			}
 			break;
+		case 'I':
+			master_prng = strtol(optarg, NULL, 0);
+			break;
 		case 'h':
 			print_help();
 			return 0;
@@ -3294,6 +3296,7 @@ int main(int argc, char **argv)
 		clients = nr_w_args;
 
 	if (verbose > 1) {
+		printf("Random seed is %u.\n", master_prng);
 		printf("Using %lu nop calibration for %uus delay.\n",
 		       nop_calibration, nop_calibration_us);
 		printf("%u client%s.\n", clients, clients > 1 ? "s" : "");
@@ -3312,6 +3315,9 @@ int main(int argc, char **argv)
 		}
 	}
 
+	srand(master_prng);
+	master_prng = rand();
+
 	if (master_workload >= 0 && clients == 1)
 		master_workload = -1;
 
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-05-22 15:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 15:57 [igt-dev] [PATCH i-g-t 00/15] Remaining bits of Virtual Engine tooling Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 01/15] gem_wsim: Engine map support Tvrtko Ursulin
2019-05-23 13:23   ` [igt-dev] [Intel-gfx] " Chris Wilson
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 02/15] gem_wsim: Save some lines by changing to implicit NULL checking Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 03/15] gem_wsim: Compact int command parsing with a macro Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 04/15] gem_wsim: Engine map load balance command Tvrtko Ursulin
2019-05-23 13:25   ` Chris Wilson
2019-05-23 13:58     ` Tvrtko Ursulin
2019-05-22 15:57 ` [Intel-gfx] [PATCH i-g-t 05/15] gem_wsim: Engine bond command Tvrtko Ursulin
2019-05-22 15:57 ` [Intel-gfx] [PATCH i-g-t 06/15] gem_wsim: Some more example workloads Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 07/15] gem_wsim: Infinite batch support Tvrtko Ursulin
2019-05-23 14:05   ` Chris Wilson
2019-05-23 14:09     ` Chris Wilson
2019-05-23 14:17       ` Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 08/15] gem_wsim: Command line switch for specifying low slice count workloads Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 09/15] gem_wsim: Per context SSEU control Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 10/15] gem_wsim: Allow RCS virtual engine with " Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 11/15] gem_wsim: Consolidate engine assignments into helpers Tvrtko Ursulin
2019-05-23 13:26   ` Chris Wilson
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 12/15] gem_wsim: Discover engines Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 13/15] gem_wsim: Support Icelake parts Tvrtko Ursulin
2019-05-22 15:57 ` [igt-dev] [PATCH i-g-t 14/15] gem_wsim: Fix prng usage Tvrtko Ursulin
2019-05-22 16:51   ` Chris Wilson
2019-05-22 15:57 ` Tvrtko Ursulin [this message]
2019-05-22 16:52   ` [igt-dev] [PATCH i-g-t 15/15] gem_wsim: Allow random seed control Chris Wilson
2019-05-22 17:21 ` [igt-dev] ✓ Fi.CI.BAT: success for Remaining bits of Virtual Engine tooling Patchwork
2019-05-23 14:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522155720.28723-16-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=simon.ser@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox