2

I am trying to understand how exactly I can use OpenACC to offload computation to my nvidia GPU on GCC 5.3. The more I google things the more confused I become. All the guides I find, they involve recompiling the entire gcc along with two libs called nvptx-tools and nvptx-newlib. Other sources say that OpenACC is part of GOMP library. Other sources say that the development for OpenACC support will continue only on GCC 6.x. Also I have read that support for OpenACC is in the main brunch of GCC. However if I compile a program with -fopenacc and -foffload=nvptx-non is just wont work. Can someone explain to me what exactly it takes to compiler and run OpenACC code with gcc 5.3+?

  • Why some guides seem to require (re)compilation of nvptx-tools, nvptx-newlib, and GCC, if, as some internet sources say, OpenACC support is part of GCC's main branch?
  • What is the role of the GOMP library in all this?
  • Is it true that development for OpenACC support will only be happening for GCC 6+ from now on?
  • When OpenACC support matures, is it the goal to enable it in a similar way we enable OpenMP (i.e., by just adding a couple of compiler flags)?
  • Can someone also provide answers to all the above after replacing "OpenACC" with "OpenMP 4.0 GPU/MIC offload capability"?

Thanks in advance

4

1 回答 1

4

下面的链接包含一个脚本,它将编译 gcc 以获得 OpenACC 支持。

https://github.com/olcf/OLCFHack15/blob/master/GCC5OffloadTest/auto-gcc5-offload-openacc-build-install.sh

  1. OpenACC 现在是 GCC 主要分支的一部分,但是有一些需要注意的地方。即使有一些库是 gcc 的一部分,当你编译 gcc 时,你也必须指定要编译哪些库。并非所有这些都将默认编译。对于 OpenACC,还有一个额外的问题。由于 NVIDIA 驱动程序不是开源的,GCC 不能直接将 OpenACC 编译为二进制文件。它需要将 OpenACC 编译为 Nvidia 运行时将处理的中间 NVPTX 指令。因此,您还需要安装 nvptx 库。

  2. GOMP 库是处理 OpenMP 和 OpenACC 的中间库

  3. 是的,我认为 OpenACC 开发只会在 GCC 6 中进行,但它可能仍会向后移植到 GCC 5。但最好的办法是使用 GCC 6。

  4. 虽然我无法评论 GCC 开发人员决定做什么,但我认为在第一点我已经说明了问题所在。除非 NVIDIA 将他们的驱动程序开源,否则我认为总是需要额外的步骤。

  5. 我相信现在 OpenMP 仅计划用于 CPU 和 MIC。我相信对两者的 OpenMP 支持可能会成为默认行为。我不确定针对 NVIDIA GPU 的 OpenMP 是否立即成为他们目标的一部分,但由于 GCC 将 GOMP 用于 OpenMP 和 OpenACC,我相信最终他们可能能够做到。此外,GCC 还针对使用 OpenMP 的 HSA,因此基本上是 AMD APU。我不确定 AMD GPU 是否会以同样的方式工作,但也许有可能。由于 AMD 正在使他们的驱动程序开源,我相信它们可能更容易集成到默认行为中。

于 2016-08-04T08:55:29.087 回答