summaryrefslogtreecommitdiff
path: root/keccak_bench.cu
blob: 962d69aa6733e76814c25c2fa62a570c32cf45ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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