cpgcc

C, pgcc - automatic parallelization "not countable"


I use this for loop, which I want to have parallelizide automaticaly, it is used for count of PI number:

piece=1.0/100000;
for (t=0.0; t<1.0; t=t+piece){
    x=t+piece/(float)2;
    if(x<=1.0){
        integral=4/(1+x*x);
        sum=sum+integral;
        }
}

This is doint partial sum for all values in interval 0-1. Then I made from it PI value. But this is not the problem, problem is, when I use automatic parallelization with pgcc, I set up number of processes but I am told that "Loop not vectorized/parallelized: not countable" when I am compiling my program. I have tried everything, but still no change. Any ideas? Thanks


Solution

  • I'm guessing this is because your loop counter is a float or double. Try using an integral counter.

    int step;
    for (step = 0; step < 100000; step++) {
       // determine x from step
       ...
    }