开发者

OpenMP bug with Intel Compiler?

开发者 https://www.devze.com 2023-03-30 17:10 出处:网络
The following piece code #pragma omp parallel printf(\"%f\", 1.0f); produces the a \"Floating point exception\". Has anyone encountered anything like that?

The following piece code

#pragma omp parallel
printf("%f", 1.0f);

produces the a "Floating point exception". Has anyone encountered anything like that?

More details:

  • No problems when I try to print out strings or integers.
  • No problem if OpenMP is not used.
  • I am running it on Mac OSX 10.6.8 and the Intel C++ compiler 12.0.4.
  • Other than that, OpenMP works fine.

The code:

#inc开发者_如何学Clude <stdio.h>
#include <omp.h>

int main()
{
#pragma omp parallel
  printf("%d", 1);
printf("\n...\n");
  fflush(stdout);
#pragma omp parallel
  printf("%f", 2.0);
}

compiled with:

icpc -o test test.cc -fp-trap-all=all -openmp

produces:

1111
...
Floating point exception
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号