Skip to content

Commit

Permalink
Generate data for bnenchmarks and tests. Also move to /data
Browse files Browse the repository at this point in the history
  • Loading branch information
kondziu committed Mar 27, 2020
1 parent 486f196 commit 84574b5
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 36 deletions.
13 changes: 0 additions & 13 deletions ufovectors/benchmark/create_binary_files.sh

This file was deleted.

23 changes: 0 additions & 23 deletions ufovectors/benchmark/matrix.R

This file was deleted.

20 changes: 20 additions & 0 deletions ufovectors/data/gen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main (int argc,char *argv[]) {
if (argc != 4) {
printf("usage: gen FILE N_ITEMS VALUE");
exit(1);
}

char *path = argv[1];
size_t n = atoi(argv[2]);
uint32_t v = atoi(argv[3]);

FILE *fp = fopen(path, "w");
for (size_t i = 0; i < n; i++) {
fwrite(&v, sizeof(uint32_t), 1, fp);
}
fclose(fp);
}
13 changes: 13 additions & 0 deletions ufovectors/data/gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
[ ! -e "gen" ] && (gcc -o gen gen.c)

if [ $# -ne 3 ]
then
echo "usage: gen.sh FILE N_ITEMS VALUE"
exit 1
fi

case "$3" in
random) head -c $((4 * $2)) /dev/urandom > "$1";;
*) ./gen "$1" "$2" "$3";;
esac
25 changes: 25 additions & 0 deletions ufovectors/data/generate_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

function generate_both {
echo "generating ${1}_rand_int.bin"
./gen "${1}_rand_int.bin" $2 random

echo "generating ${1}_ones_int.bin"
./gen "${1}_ones_int.bin" $2 1
}

function generate_ones {
echo "generating ${1}_ones_int.bin"
./gen "${1}_ones_int.bin" $2 1
}

# T G M K 1
generate_both 1K 1000 # 3.9 KB
generate_both 100K 100000 # 392 KB
generate_both 1M 1000000 # 3.8 MB
generate_both 10M 10000000 # 38 MB
generate_both 100M 100000000 # 381 MB
generate_ones 1G 1000000000 # 3.7 GB
# T G M K 1


0 comments on commit 84574b5

Please sign in to comment.