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 "gemm.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<N; i++) {
21  data.m1[i] = ((TYPE)prng_rand(&state))/((TYPE)PRNG_RAND_MAX);
22  data.m2[i] = ((TYPE)prng_rand(&state))/((TYPE)PRNG_RAND_MAX);
23  }
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
void data_to_input(int fd, void *vdata)
Definition: local_support.c:34
TYPE m1[N]
Definition: gemm.h:34
#define TYPE
Definition: backprop.h:21
uint_fast16_t i
Definition: support.h:78
#define N
Definition: dfdiv.c:60
TYPE m2[N]
Definition: gemm.h:35
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 PRNG_RAND_MAX
Definition: support.h:82

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