Commit 3b3ea787 authored by Martin Perdacher's avatar Martin Perdacher

corrected randomgenerator

parent d4fa2b90
......@@ -72,7 +72,7 @@ void parsing_args(int argc, char* argv[], size_t *n, double *epsilon, size_t *d,
}
}
if ( *blocksize > *n /* * 1000 */ || *blocksize <= 1 ){
if ( *blocksize > *n * 1000 || *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);
exit(1);
......
......@@ -5,12 +5,18 @@ void random_init(double *array, const int N, const int D){
short unsigned seed[3];
int i;
seed[0]=1; seed[1]=1; seed[2]=2;
#pragma omp parallel for firstprivate(seed)
#pragma omp parallel
{
int tId = omp_get_thread_num();
seed[0]=(((tId*tId + 15) * 3)/7);
seed[1]=(((tId*tId + 13) * 2)/3);
seed[2]=tId;
#pragma omp for
for ( i=0 ; i < N * D ; i++ ){
array[i] = erand48(seed) * 100.0;
}
}
}
void read_file(double *array, const int N, const int D, char filename[], const bool IS_BINARY){
......
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