Skip to content

Commit 3152400

Browse files
committed
Update parameters for array_sum workloads
Signed-off-by: Jason Lowe-Power <[email protected]>
1 parent d3a795a commit 3152400

File tree

2 files changed

+28
-33
lines changed

2 files changed

+28
-33
lines changed

assignments/false-sharing/assignment.md

+22-27
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@ In all of these examples `tid` is the thread id (starting at `0` up to the `thre
5959
`threads` is the number of threads that we're using, and `length` is the number of elements in the array.
6060
Also, in all examples we will assume that the threads can *race* on the `result` so we must declare it as a `std::atomic` to make sure that all accesses are completed consistently.
6161

62-
You can find the compiled binary for this implementation in X86 under `workloads/array_sum/naive-native`.
63-
You can use this binary to run the program on real hardware.
62+
You can find the the makefile to compile the binary under `workloads/array_sum/naive-native`.
63+
Run `make all-native` to compile the binaries.
64+
You can use these binaries to run the program on real hardware.
6465
Here is an example of how you could run the binary on native hardware.
6566
This example sums up an array of size `32768 elements` with `8 threads`.
6667

6768
```shell
68-
./naive-native 32768 8
69+
./naive-native 16384 4
6970
```
7071

7172
**CAUTION**: You **SHOULD NOT** run `workloads/array_sum/naive-gem5` on real hardware.
@@ -76,19 +77,13 @@ Here is an example of how you should create an object of this workload.
7677
This example creates a workload of this binary that sums up `16384 elements` with `4 threads`.
7778

7879
```python
79-
from workloads.array_sum_workload import NaiveArraySumWorkload
80-
81-
workload = NaiveArraySumWorkload(16384, 4)
80+
workload = obtain_resource(f"array_sum_naive_run")
81+
workload.set_parameter("arguments", [32768, 16])
82+
board.set_workload(workload)
8283
```
8384

8485
This should take around 1-2 minutes.
8586

86-
To build the native binary for this implementation run the following command in `workloads/array_sum`.
87-
88-
```shell
89-
make naive-native
90-
```
91-
9287
To build the gem5 binary for this implementation run the following command in `workloads/array_sum`.
9388

9489
```shell
@@ -137,9 +132,9 @@ Here is an example of how you should create an object of this workload.
137132
This example creates a workload of this binary that sums up `16384 elements` with `4 threads`.
138133

139134
```python
140-
from workloads.array_sum_workload import ChunkingArraySumWorkload
141-
142-
workload = ChunkingArraySumWorkload(16384, 4)
135+
workload = obtain_resource(f"array_sum_chunking_run")
136+
workload.set_parameter("arguments", [32768, 16])
137+
board.set_workload(workload)
143138
```
144139

145140
To build the native binary for this implementation run the following command in `workloads/array_sum`.
@@ -196,9 +191,9 @@ To instantiate an object of this workload you need to pass **array_size** and **
196191
This example creates a workload of this binary that sums up `16384 elements` with `4 threads`.
197192

198193
```python
199-
from workloads.array_sum_workload import NoResultRaceArraySumWorkload
200-
201-
workload = NoResultRaceArraySumWorkload(16384, 4)
194+
workload = obtain_resource(f"array_sum_race_optimized_run")
195+
workload.set_parameter("arguments", [32768, 16])
196+
board.set_workload(workload)
202197
```
203198

204199
To build the native binary for this implementation run the following command in `workloads/array_sum`.
@@ -245,9 +240,9 @@ Here is an example of how you should create an object of this workload.
245240
This example creates a workload of this binary that sums up `16384 elements` with `4 threads`.
246241

247242
```python
248-
from workloads.array_sum_workload import ChunkingNoResultRaceArraySumWorkload
249-
250-
workload = ChunkingNoResultRaceArraySumWorkload(16384, 4)
243+
workload = obtain_resource(f"array_sum_chunking_race_optimized_run")
244+
workload.set_parameter("arguments", [32768, 16])
245+
board.set_workload(workload)
251246
```
252247

253248
To build the native binary for this implementation run the following command in `workloads/array_sum`.
@@ -297,9 +292,9 @@ Here is an example of how you should create an object of this workload.
297292
This example creates a workload of this binary that sums up `16384 elements` with `4 threads`.
298293

299294
```python
300-
from workloads.array_sum_workload import NoCacheBlockRaceArraySumWorkload
301-
302-
workload = NoCacheBlockRaceArraySumWorkload(16384, 4)
295+
workload = obtain_resource(f"array_sum_result_cache_optimized_run")
296+
workload.set_parameter("arguments", [32768, 16])
297+
board.set_workload(workload)
303298
```
304299

305300
To build the native binary for this implementation run the following command in `workloads/array_sum`.
@@ -344,9 +339,9 @@ Here is an example of how you should create an object of this workload.
344339
This example creates a workload of this binary that sums up `16384 elements` with `4 threads`.
345340

346341
```python
347-
from workloads.array_sum_workload import ChunkingNoBlockRaceArraySumWorkload
348-
349-
workload = ChunkingNoBlockRaceArraySumWorkload(16384, 4)
342+
workload = obtain_resource(f"array_sum_all_optimizations_run")
343+
workload.set_parameter("arguments", [32768, 16])
344+
board.set_workload(workload)
350345
```
351346

352347
To build the native binary for this implementation run the following command in `workloads/array_sum`.

workloads/resources.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@
525525
}
526526
},
527527
"additional_params": {
528-
"arguments": ["16384", 4]
528+
"arguments": ["32768", 16]
529529
}
530530
},
531531
{
@@ -544,7 +544,7 @@
544544
}
545545
},
546546
"additional_params": {
547-
"arguments": ["16384", 4]
547+
"arguments": ["32768", 16]
548548
}
549549
},
550550
{
@@ -563,7 +563,7 @@
563563
}
564564
},
565565
"additional_params": {
566-
"arguments": ["16384", 4]
566+
"arguments": ["32768", 16]
567567
}
568568
},
569569
{
@@ -582,7 +582,7 @@
582582
}
583583
},
584584
"additional_params": {
585-
"arguments": ["16384", 4]
585+
"arguments": ["32768", 16]
586586
}
587587
},
588588
{
@@ -601,7 +601,7 @@
601601
}
602602
},
603603
"additional_params": {
604-
"arguments": ["16384", 4]
604+
"arguments": ["32768", 16]
605605
}
606606
},
607607
{
@@ -620,7 +620,7 @@
620620
}
621621
},
622622
"additional_params": {
623-
"arguments": ["16384", 4]
623+
"arguments": ["32768", 16]
624624
}
625625
},
626626
{

0 commit comments

Comments
 (0)