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  // 3D discrete Laplacian
19  data.C[0] = 6;
20  data.C[1] = -1;
21  // Random matrix
22  prng_srand(1,&state);
23  for(i=0; i<SIZE; i++)
24  data.orig[i] = prng_rand(&state)%(MAX-MIN) + MIN;
25 
26  // Open and write
27  fd = open("input.data", O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
28  assert( fd>0 && "Couldn't open input data file" );
29  data_to_input(fd, (void *)(&data));
30 
31  return 0;
32 }
static uint64_t prng_rand(struct prng_rand_t *state)
Definition: support.h:85
void data_to_input(int fd, void *vdata)
Definition: local_support.c:34
TYPE C[2]
Definition: stencil.h:30
#define SIZE
Definition: adpcm.c:775
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
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