summaryrefslogtreecommitdiff
path: root/keccak_bench.cu
diff options
context:
space:
mode:
Diffstat (limited to 'keccak_bench.cu')
-rw-r--r--keccak_bench.cu25
1 files changed, 25 insertions, 0 deletions
diff --git a/keccak_bench.cu b/keccak_bench.cu
new file mode 100644
index 0000000..962d69a
--- /dev/null
+++ b/keccak_bench.cu
@@ -0,0 +1,25 @@
+#include "keccak.cu"
+
+const int count = 100000;
+
+__device__ keccak::Result result;
+
+__global__ void bench_kernel() {
+ __shared__ keccak::SharedState s;
+ keccak::RegisterState r;
+ keccak::init(r);
+ for (int i=0; i<count; i++) {
+ int val = i * 1024 + threadIdx.x;
+ keccak::add(r, val);
+ }
+ keccak::finish(r, s, result);
+}
+
+int main(int argc, char **argv) {
+ dim3
+ dimGrid(1),
+ dimBlock(1024);
+ long count = (argc == 2) ? atol(argv[1]) : 1;
+ bench_kernel<<<dimGrid, dimBlock, 0>>>();
+ return cudaPeekAtLastError() != cudaSuccess;
+}
contact: Jan Huwald // Impressum