英特尔编译器的 OpenMP 错误?

发布于 2024-12-01 18:11:08 字数 653 浏览 4 评论 0原文

以下代码

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

产生“浮点异常”。有人遇到过类似的事情吗?

更多详细信息:

  • 当我尝试打印字符串或整数时没有问题。
  • 如果不使用 OpenMP 也没有问题。
  • 我在 Mac OSX 10.6.8 和 Intel C++ 编译器 12.0.4 上运行它。
  • 除此之外,OpenMP 运行良好。

代码:

#include <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);
}

编译:

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

产生:

1111
...
Floating point exception

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:

#include <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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文