PandA-2024.02
generate.c
Go to the documentation of this file.
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include <assert.h>
9 
10 #include "stencil.h"
11 
12 int main(int argc, char **argv)
13 {
14  struct bench_args_t data;
15  int i, fd;
16  struct prng_rand_t state;
17 
18  // Fill data structure
19  prng_srand(1,&state);
20  for(i=0; i<row_size*col_size; i++)
21  data.orig[i] = prng_rand(&state)%(MAX-MIN) + MIN;
22  for(i=0; i<f_size; i++)
23  data.filter[i] = prng_rand(&state)%(MAX-MIN) + MIN;
24 
25  // Open and write
26  fd = open("input.data", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
27  assert( fd>0 && "Couldn't open input data file" );
28  data_to_input(fd, (void *)(&data));
29 
30  return 0;
31 }
static uint64_t prng_rand(struct prng_rand_t *state)
Definition: support.h:85
TYPE filter[f_size]
Definition: stencil.h:28
void data_to_input(int fd, void *vdata)
Definition: local_support.c:34
#define col_size
Definition: gemm.h:17
#define row_size
Definition: gemm.h:16
int main(int argc, char **argv)
Definition: generate.c:12
static void prng_srand(uint64_t seed, struct prng_rand_t *state)
Definition: support.h:106
#define f_size
Definition: stencil.h:8
TYPE orig[row_size *col_size]
Definition: stencil.h:26

Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by doxygen 1.8.13