aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/mt-memcpy
diff options
context:
space:
mode:
authorJerry Zhao <jerryz123@berkeley.edu>2023-02-10 10:54:32 -0800
committerJerry Zhao <jerryz123@berkeley.edu>2023-05-22 14:54:40 -0700
commitcdd1b95d87fafeb5f237ddcbefeae693e05a1b2e (patch)
tree880dec721c82aba1ec335ae2e9281b9bec5c8efd /benchmarks/mt-memcpy
parente9fa54f4e771f4471d3af36397ae56beb215cfb8 (diff)
downloadriscv-tests-cdd1b95d87fafeb5f237ddcbefeae693e05a1b2e.zip
riscv-tests-cdd1b95d87fafeb5f237ddcbefeae693e05a1b2e.tar.gz
riscv-tests-cdd1b95d87fafeb5f237ddcbefeae693e05a1b2e.tar.bz2
Add vec-memcpy benchmark
Diffstat (limited to 'benchmarks/mt-memcpy')
-rw-r--r--benchmarks/mt-memcpy/dataset1.h2
-rwxr-xr-xbenchmarks/mt-memcpy/memcpy_gendata.pl6
-rw-r--r--benchmarks/mt-memcpy/mt-memcpy.c18
3 files changed, 13 insertions, 13 deletions
diff --git a/benchmarks/mt-memcpy/dataset1.h b/benchmarks/mt-memcpy/dataset1.h
index 6f6bb81..366026d 100644
--- a/benchmarks/mt-memcpy/dataset1.h
+++ b/benchmarks/mt-memcpy/dataset1.h
@@ -1,7 +1,7 @@
#define DATA_SIZE 6000
-int input_data[DATA_SIZE] =
+long input_data[DATA_SIZE] =
{
41, 454, 833, 335, 564, 1, 187, 989, 749, 365, 350, 572, 132, 64, 949, 153, 584, 216, 805, 140,
621, 210, 6, 572, 931, 339, 890, 593, 392, 898, 694, 228, 961, 12, 110, 883, 116, 750, 296, 646,
diff --git a/benchmarks/mt-memcpy/memcpy_gendata.pl b/benchmarks/mt-memcpy/memcpy_gendata.pl
index 4efc145..1a07796 100755
--- a/benchmarks/mt-memcpy/memcpy_gendata.pl
+++ b/benchmarks/mt-memcpy/memcpy_gendata.pl
@@ -31,7 +31,7 @@ sub usage()
print "\n";
print " Options:\n";
print " --help print this message\n";
- print " --size size of input data [1000]\n";
+ print " --size size of input data [6000]\n";
print " --seed random seed [1]\n";
print "$usageMsg";
@@ -42,7 +42,7 @@ sub processCommandLine()
{
$opts{"help"} = 0;
- $opts{"size"} = 1000;
+ $opts{"size"} = 6000;
$opts{"seed"} = 1;
Getopt::Long::GetOptions( \%opts, 'help|?', 'size:i', 'seed:i' ) or usage();
$opts{"help"} and usage();
@@ -61,7 +61,7 @@ sub printArray
my $numCols = 20;
my $arrayLen = scalar(@{$arrayRef});
- print "int ".$arrayName."[DATA_SIZE] = \n";
+ print "long ".$arrayName."[DATA_SIZE] = \n";
print "{\n";
if ( $arrayLen <= $numCols ) {
diff --git a/benchmarks/mt-memcpy/mt-memcpy.c b/benchmarks/mt-memcpy/mt-memcpy.c
index 404d0bf..4569add 100644
--- a/benchmarks/mt-memcpy/mt-memcpy.c
+++ b/benchmarks/mt-memcpy/mt-memcpy.c
@@ -43,26 +43,26 @@
void thread_entry(int cid, int nc)
{
// static allocates data in the binary, which is visible to both threads
- static int results_data[DATA_SIZE];
+ static long results_data[DATA_SIZE];
size_t block = (DATA_SIZE / nc) + 1;
size_t n = (nc == cid + 1) ? DATA_SIZE - cid * block : block;
- // First do out-of-place vvadd
+ // First do out-of-place memcpy
#if PREALLOCATE
barrier(nc);
- memcpy(results_data + block * cid, input_data + block * cid, sizeof(int) * n);
+ memcpy(results_data + block * cid, input_data + block * cid, sizeof(long) * n);
#endif
barrier(nc);
- stats(memcpy(results_data + block * cid, input_data + block * cid, sizeof(int) * n); barrier(nc), DATA_SIZE);
- /* barrier(nc); */
- /* if(cid == 0) { */
- /* int res = verify(DATA_SIZE, results_data, input_data); */
- /* if(res) exit(res); */
- /* } */
+ stats(memcpy(results_data + block * cid, input_data + block * cid, sizeof(long) * n); barrier(nc), DATA_SIZE);
+ barrier(nc);
+ if (cid == 0) {
+ int res = verify(DATA_SIZE * sizeof(long) / sizeof(int), (int*) results_data, (int*) input_data);
+ if (res) exit(res);
+ }
barrier(nc);
exit(0);
}