Why when use "omp parallel for schedule(auto)" make different calculation result with environment is 32bit

Why when use "omp parallel for schedule(auto)" make different calculation result with environment is 32bit

Hi all,

I have a problem when apply parallel (using omp parallel for schedule(atuo)), please help me resolve it.

The problem is explained as below:

1. Setup environment

- Win XP 32 bit

- Visual Studio 2008

- Intel Parallel Studio 2011

2. Scenario

- Configure Floating Point Model: Stric (/fp:strick)

- Source code apply parallel

void ParallelOMP(short *    outputData)
{
    int datasize = 512*512;
    #pragma omp parallel for schedule(auto)
    for(int i=0; i<datasize; i++)
    {
        double cal = (i%5 * 10/3) + i/5;
        outputData[i] = (short)cal;
    }
}

-Code calculate [total] variable

 [DllImport("OMPParallel")]
 public static extern void ParallelOMP(short[] outputData);
 private void btn_Compute_Click(object sender, EventArgs e)
 {
       short[] inputData = new short[512 * 512];
       ParallelOMP(inputData);
       double kernel = -0.80000000000000004;
       short input = 155;
       double total = -37.692307692307693;
       total += kernel * input;
       MessageBox.Show("total = " + total.ToString("G17"));
}

3. Results

- When apply parallel, [total] = -161.69230769230771

- When not apply parallel, [total] = -161.69230769230768

4. Question

Why when use "omp parallel for schedule(auto)" to different calculation result with environment is 32bit.

How "schedule(auto)" affect to calculation result above? If use "omp parallel for" or "omp parallel for schedule(static)" not effect to calculation result.

Note: At Win7 64bit, value of [total] variable is the same when apply or not apply parallel and value is -161.69230769230768.

I don't known what the problem is. Does anyone have experience about it?

Thanks,

TuanHD

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi TuanHD,

Thank you for reporting the problem. I was able to reproduce your results, though only with long double type. Looks like for schedule(auto) the OpenMP runtime library sets the FP precision mode to 64bit and does not restore it back to default 53bit, the problem is specific to Windows 32bit. This is a bug in the library, we will fix it in future compiler release.

Thanks,
Andrey

Hi Andrey Churbanov ,

Thanks for your answer.

Best Regards,

TuanHD.

Leave a Comment

Please sign in to add a comment. Not a member? Join today