Reputation: 1
Guys. I'm trying to speed up the loop using OpenMP.
If I speed up a loop that uses an integer variable, then everything works correctly:
void main()
{
//mpz_class i("0");
//mpz_class k("1");
//mpz_class l("1211728594799");
int k = 9;
int i = 0;
int l = 1998899087;
#pragma omp parallel for
for (i=k; i <= l; i++) {
if (i == 1998899085)
printf("kkk");
}
system("pause");
}
If I start using the MPIR variable in a loop, then I get errors when building the program in Visual Studio 2015. Here are the numbers of these errors: C3015, C3017,C3019. Here is the code that causes these errors:
void main()
{
mpz_class i("0");
mpz_class k("1");
mpz_class l("1211728594799");
//int k = 9;
//int i = 0;
//int l = 1998899087;
#pragma omp parallel for
for (i=k; i <= l; i++) {
if (i == 1998899085)
printf("kkk");
}
system("pause");
}
MPIR itself works correctly if I disable pragma omp parallel for then the code is going to be fine, but it works much slower than using int variable of the same range of numbers.
What should I do to make Open MP work correctly with MPIR and I could speed up my program by running it in parallel?
Upvotes: 0
Views: 104