diff options
author | Jianyi Cheng <jcheng@Jianyis-Beast.home.ukb> | 2020-06-12 13:02:33 +0100 |
---|---|---|
committer | Jianyi Cheng <jcheng@Jianyis-Beast.home.ukb> | 2020-06-12 13:02:33 +0100 |
commit | cb1d47636f9bb9adbdfb3f18982417b746b2bf40 (patch) | |
tree | 56fb65f7590b4ed73d714d3bfc8ce8e6e4594e51 /benchmarks/fft/generate.c | |
parent | c54b32a91427e5342ce5ffa94b2398a2fcb8c144 (diff) | |
download | vericert-kvx-cb1d47636f9bb9adbdfb3f18982417b746b2bf40.tar.gz vericert-kvx-cb1d47636f9bb9adbdfb3f18982417b746b2bf40.zip |
Adding benchmarks to branch_jc
Diffstat (limited to 'benchmarks/fft/generate.c')
-rw-r--r-- | benchmarks/fft/generate.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/benchmarks/fft/generate.c b/benchmarks/fft/generate.c new file mode 100644 index 0000000..f5135e2 --- /dev/null +++ b/benchmarks/fft/generate.c @@ -0,0 +1,43 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <assert.h> + +#include "fft.h" +// Fake benchmark function to satisfy the extern +void fft1D_512(double data_x[512], double data_y[512]){ } + +void generate_binary() +{ + struct bench_args_t data; + char *ptr; + int status, i, fd, written=0; + + // Fill data structure + srandom(1); + for(i=0; i<512; i++){ + data.work_x[i] = (double)random(); + data.work_y[i] = (double)random(); + } + + // Open and write + fd = open("input.data", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); + assert( fd>0 && "Couldn't open input data file" ); + + ptr = (char *) &data; + while( written<sizeof(data) ) { + status = write( fd, ptr, sizeof(data)-written ); + assert( status>=0 && "Couldn't write input data file" ); + written += status; + } +} + +int main(int argc, char **argv) +{ + generate_binary(); + return 0; +}
\ No newline at end of file |