Commit db561393 authored by Martin Perdacher's avatar Martin Perdacher

bugfix dataIo

parent 049ac6fc
......@@ -7,18 +7,18 @@ void parsing_args(int argc, char* argv[], size_t *n, double *epsilon, size_t *d,
char c;
FILE *file;
// if ( argc < 6 ){
// fprintf (stderr, "There are obligatory parameters.\n");
// fprintf (stderr, "Usage: ./blasJoin ");
//
// fprintf(stderr, "Obligatory parameters: \n");
// fprintf(stderr, "n (number of objects in thousands (*1000))\ne (epsilon)\nd (dimensionality)\ns (blocksize)");
// fprintf(stderr, "Optional parameters: \n t number of threads\n\n");
// fprintf(stderr, "f (filename) if there is no filename we use random generated data [0.0, 100.0)\n");
// fprintf(stderr, "b use the -b argument without options to specify that it is a binary file.\n");
// fprintf(stderr, "Example (with default values): ./blasJoin -n 200 -e 0.2 -d 20 -s 5000 -t 64\n");
// exit(1);
// }
if ( argc < 6 ){
fprintf (stderr, "There are obligatory parameters.\n");
fprintf (stderr, "Usage: ./blasJoin ");
fprintf(stderr, "Obligatory parameters: \n");
fprintf(stderr, "n (number of objects in thousands (*1000))\ne (epsilon)\nd (dimensionality)\ns (blocksize)");
fprintf(stderr, "Optional parameters: \n t number of threads\n\n");
fprintf(stderr, "f (filename) if there is no filename we use random generated data [0.0, 100.0)\n");
fprintf(stderr, "b use the -b argument without options to specify that it is a binary file.\n");
fprintf(stderr, "Example (with default values): ./blasJoin -n 200 -e 0.2 -d 20 -s 5000 -t 64\n");
exit(1);
}
while ( (c = getopt(argc, argv, "n:e:d:t:s:f:b") ) != -1) {
......@@ -72,9 +72,9 @@ void parsing_args(int argc, char* argv[], size_t *n, double *epsilon, size_t *d,
}
}
if ( *blocksize > *n * 1000 || *blocksize <= 1 ){
if ( *blocksize > *n || *blocksize <= 1 ){
fprintf (stderr, "Blocksize has to be greater than 1 and smaller or equal to N\n");
printf("n:%d, blocksize: %d\n", *n * 1000, *blocksize);
printf("n:%d, blocksize: %d\n", *n, *blocksize);
exit(1);
}
......
......@@ -25,7 +25,7 @@ void read_file(double *array, const int N, const int D, char filename[], const b
size_t i=0,j=0;
char line[MAX_LINE_LENGTH];
char *token=NULL;
const char space[2] = " ";
const char space[2] = ",";
fp = fopen(filename,"r");
......@@ -35,9 +35,10 @@ void read_file(double *array, const int N, const int D, char filename[], const b
}
if ( IS_BINARY ){
// printf("isbinary!\n");
// read binary file, everything at once
counts = fread(array, N * D, sizeof(double), fp);
// printf("%dx%d: %d readed\n", N, D, counts);
if ( counts == 0 ) {
fprintf(stderr, "Binary file '%s' could not be read. Wrong format.", filename);
exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment