Software Archive
Read-only legacy content
17061 Discussions

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

Cucumber
Beginner
578 Views


Hi all,

I have a problem when apply parallel (using omp parallel for schedule(atuo)), please help me reslove 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 = (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 32bi.

How "schedule(auto)" affect to calculation result above? If use "omp parallel for" or "omp parallel for schedule(statistic)" 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

Thanks,

Cucumber

0 Kudos
2 Replies
Vladimir_P_1234567890
578 Views

Hello, 

the answer was posted to "Intel® Open Source OpenMP* Runtime Library" Forum

--Vladimir

0 Kudos
Cucumber
Beginner
578 Views

Hi Vladimir Polin,

Thanks for your answer.

Best regards,

Cucumber

0 Kudos
Reply