Use shared as default.

This commit is contained in:
Nicolás A. Ortega 2017-01-31 22:24:06 +01:00
parent 76936644cd
commit 9673a4da57
No known key found for this signature in database
GPG Key ID: 614272579C2070D1

View File

@ -163,7 +163,7 @@ int main(int argc, char *argv[]) {
goto releaseMemory;
}
#pragma omp parallel shared(run, num)
#pragma omp parallel default(shared)
{
// Variable for sqrt of `privNum'
mpz_t numRoot;
@ -172,16 +172,21 @@ int main(int argc, char *argv[]) {
mpz_t privNum;
mpz_init(privNum);
mpz_add_ui(privNum, num, omp_get_thread_num() * 2);
/*mpz_out_str(stdout, base, privNum);*/
/*printf("-\n");*/
#pragma omp barrier
do {
// Calculate the sqrt(num)
mpz_sqrt(numRoot, privNum);
#pragma omp critical
{
mpz_out_str(stdout, base, numRoot);
printf(" - ");
mpz_out_str(stdout, base, privNum);
printf("\n");
}
// Make sure a number larger than numRoot exists
while(mpz_cmp(primes.list[primes.end], numRoot) <= 0) {
while(mpz_cmp(primes.list[primes.end], numRoot) < 0) {
if(!run)
goto leaveLoop;
}