OpenMP 4.0 for accelerators: Nvidia GPU target

◇◆丶佛笑我妖孽 提交于 2020-01-25 18:08:26

问题


I'm trying to use openMP for accelerators (openMP 4.0) in Visual Studio 2012, using the Intel C++ 15.0 compiler.

My accelerator is an Nvidia GeForce GTX 670.

This code does not compile:

#include <stdio.h>
#include<iostream>
#include <omp.h>

using namespace std;

int main(){
    #pragma omp target
    #pragma omp parallel for
        for (int i=0; i<1000; i++)
            cout<<"Hello world, i am number "<< i <<endl;
    }

Of course, everything goes fine when I comment the #pragma omp target line.

I get the same problem when I do anything related to accelerators in OpenMP 4.0 norm (e.g. the omp_get_num_devices() function which should return the number of potential accelerators in my system)

What I get is the following errors and warning:

error #10340: problem encountered when performing target compilation
error : *MIC* cannot open source file "stdio.h"

warning #10362: Environment configuration problem encountered.  Please check for proper MPSS installation and environment setup.

Due to the *MIC* tag, here's my theory: by default my Intel compiler is trying to build a MIC application (for Xeon Phi accelerators) and does not accept my Nvidia GPU as a valid accelerator. How likely is this? Is that something I can manage in my VS project properties?

If not, I might have a more serious problem: does OpenMP 4.0 support Nvidia GPUs as accelerators? (I know OpenACC is made for that purpose, but for economical reasons I'd rather like to use evry OpenMP feature I can)

Any help will be really appreciated.


回答1:


To your first question: ICC supports only Intel MIC for offloading. So you cannot use OpenMP 4.0 with ICC to program your Nvidia GPU.

My knowledge may be outdated but the only available OpenMP 4.0 compiler which targets Nvidia GPUs is the Cray compiler Cray sells with their clusters. Maybe the PGI compiler can support OpenMP 4.0 but that is a wild guess. Anyway, these compilers won't be supported on Windows plattforms.




回答2:


OpenMP 4.0 does support Nvidia GPUs as accelerators. What you are really want to know whether the implementation of OpenMP by your particular compiler supports it. And if you are stuck with MSVC (even using the Intel compiler in the back) then the answer is NO. You may want to check out this however to see how it works with clang.



来源:https://stackoverflow.com/questions/28048365/openmp-4-0-for-accelerators-nvidia-gpu-target

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!