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

corrected randomgenerator

parent d4fa2b90
......@@ -60,7 +60,7 @@ void parsing_args(int argc, char* argv[], size_t *n, double *epsilon, size_t *d,
}else{
switch(c){
case 'b':
*isBinary = true;
*isBinary = true;
break;
case '?':
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
......@@ -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,11 +5,17 @@ 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)
for ( i=0 ; i < N * D ; i++ ){
array[i] = erand48(seed) * 100.0;
#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;
}
}
}
......
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