Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
make.config
bazel-*
11 changes: 11 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cc_library(
name = "common",
hdrs = ["common.h"],
visibility = ["//visibility:public"],
)

py_binary(
name = "rand_c_arr",
srcs = ["rand_c_arr.py"],
visibility = ["//visibility:public"],
)
4 changes: 4 additions & 0 deletions CCa/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("//:base.bzl", "bench")

bench(
)
5 changes: 5 additions & 0 deletions CCe/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//:base.bzl", "bench")

bench(
randArr = True
)
2 changes: 1 addition & 1 deletion CCe/bench.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdio.h>
#include "randArr.h"
#include "CCe/randArr.h"
#include "common.h"

#define ASIZE 2048
Expand Down
5 changes: 5 additions & 0 deletions CCh/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//:base.bzl", "bench")

bench(
randArr = True
)
6 changes: 3 additions & 3 deletions CCh/bench.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdio.h>
#include "randArr.h"
#include "CCh/randArr.h"
#include "common.h"

#define ASIZE 0
Expand All @@ -23,8 +23,8 @@ int loop(int zero) {

int main(int argc, char* argv[]) {
argc&=10000;
ROI_BEGIN();
int t=loop(argc);
ROI_BEGIN();
int t=loop(argc);
ROI_END();
volatile int a = t;
}
72 changes: 43 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# microbench
Extremely Simple Microbenchmarks

To build X86 binaries,
To build X86 binaries,
```shell
make
```
Expand All @@ -21,43 +21,57 @@ To build X86, ARM, and RISCV binaries,
make all
```

To set the path to X86 compiler, change `$CC_X86` in `make.config` file.
To set the path to ARM compiler, change `$CC_ARM` in `make.config` file.
To set the path to RISCV compiler, change `$CC_RISCV` in `make.config` file.
To set the path to X86 compiler, change `$CC_X86` in `make.config` file.
To set the path to ARM compiler, change `$CC_ARM` in `make.config` file.
To set the path to RISCV compiler, change `$CC_RISCV` in `make.config` file.

The binaries are named `bench.X86`, `bench.ARM`, and `bench.RISCV` on each subdirectory.

From the original README file,

> Hi,
>
>
> This is an *extremely* simple microbenchmark suite.
>
> Its intended purpose is in the validation of general purpose out-of-order
> cores, by targetting individual micro-architectural features or effects.
> Of course this is by no means an exhaustive collection of necessary bencharks
> to test every mechanism in an OOO processor. This is merely a starting point.
>
> To use this, you should only need bash, make and python.
>
> Configure the versions of the compiler and python (tested with python-2.7):
>
> Its intended purpose is in the validation of general purpose out-of-order
> cores, by targetting individual micro-architectural features or effects.
> Of course this is by no means an exhaustive collection of necessary bencharks
> to test every mechanism in an OOO processor. This is merely a starting point.
>
> To use this, you should only need bash, make and python.
>
> Configure the versions of the compiler and python (tested with python-2.7):
> > vim make.config
>
> To make the benchmarks:
>
> To make the benchmarks:
> > make
>
> Clean the benchmarks:
>
> Clean the benchmarks:
> > make clean
>
> Describe basically what each benchmark is for:
>
> Describe basically what each benchmark is for:
> > describe.sh
>
> Run a benchmark: (no args on any current benchmark)
> > cd CCa
>
> Run a benchmark: (no args on any current benchmark)
> > cd CCa
> > ./test
>
> Tony Nowatzki
> Tuesday, April 14th, 2015
>
> PS: Also, some benchmarks use an LFSR setting to get a particular working set.
> Please see lfsr_settings.txt for example values. (bench ML2 uses this)
>
> Tony Nowatzki
> Tuesday, April 14th, 2015
>
> PS: Also, some benchmarks use an LFSR setting to get a particular working set.
> Please see lfsr_settings.txt for example values. (bench ML2 uses this)

# Building with Bazel

List all benchmarks

```
bazel query 'kind("cc_binary", //...)'
```

Build all benchmarks

```
bazel build $(bazel query 'kind("cc_binary", //...)')
```
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
workspace(
name = "edu_wisc_vertical_microbench"
)
26 changes: 26 additions & 0 deletions base.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Note: we should probably have a name parameter
def bench(randArr=False):
dps = ["//:common"]
if randArr:
dps += ["libRandArr"]

# It would probably be better to have a unique name.
native.cc_binary(
name = "bench",
srcs = ["bench.c"],
deps = dps
)

native.cc_library(
name = "libRandArr",
hdrs = ["randArr.h"],
visibility = ["//visibility:private"]
)

native.genrule(
name = "randArr",
srcs = ["rand_arr_args.txt"],
outs = ["randArr.h"],
tools = ["//:rand_c_arr"],
cmd = "./$(location //:rand_c_arr) `cat $(location rand_arr_args.txt)` > $@",
)
24 changes: 12 additions & 12 deletions rand_c_arr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import random
import argparse
Expand All @@ -20,29 +20,29 @@
else:
args.data_type='int'

out_file = open(args.output,'w')
out_file.write(args.data_type + " " + args.name + "[] = {\n")
#out_file = open(args.output,'w')
print(args.data_type + " " + args.name + "[] = {\n", end='')

for i in range(0,args.len):
if args.non_random:
out_file.write(str(i%args.range))
print(str(i%args.range), end='')
else:
out_file.write(str(random.randint(0,args.range-1)))
print(str(random.randint(0,args.range-1)), end='')

if i!=args.len-1:
out_file.write(",")
print(",", end='')

if args.range<=9:
if i % 64 == 63:
out_file.write("\n")
print("\n", end='')
elif args.range<=99:
if i % 32 == 31:
out_file.write("\n")
print("\n", end='')
else :
if i % 16 == 15:
out_file.write("\n")
print("\n", end='')


out_file.write("};")
print("};", end='')

out_file.close()
#out_file.close()