Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nnain1
New Contributor I
257 Views

Why can't run code on GPGPU?

Jump to solution

I am testing the code on different devices. I tested on CPU, IntelGPU, GPGPU.

Can't run the code on GPGPU. May I know what is the problem?

My test code is as follows.
 

int main() {
  std::array<int, SIZE> myArray;
  for (int i = 0; i<SIZE; ++i)
    myArray = i;

  printf("Value at start:  myArray[42] is %d.\n",myArray[42]);
  {
    cl::sycl::queue myQ( gpu_selector{} ); /* use defaults today; parameters possible - future topic */
    std::cout << "Selected device: " << myQ.get_device().get_info<info::device::name>() << "\n";
    std::cout << "-> Device vendor: " << myQ.get_device().get_info<info::device::vendor>() << "\n";
    cl::sycl::range<1> mySize{SIZE};

    cl::sycl::buffer<int, 1> bufferA(myArray.data(), mySize);

    myQ.submit([&](cl::sycl::handler &myHandle) {
      auto deviceAccessorA =
        bufferA.get_access<cl::sycl::access::mode::read_write>(myHandle);
      myHandle.parallel_for<class uniqueID>(mySize,[=](cl::sycl::id<1> index) {
	  deviceAccessorA[index] *= 2;
      });
    });
  }
  printf("Value at finish: myArray[42] is %d.\n",myArray[42]);
}

The running outputs are as follows for different devices.

Value at start:  myArray[42] is 42.
Selected device: Quadro P4000
-> Device vendor: NVIDIA Corporation
Value at finish: myArray[42] is 42.
coie@coie-HP-Z440-Workstation:~/Data/coie/Softwares/oneAPI/dpc++/module01$ make all
dpcpp -O3 -std=c++14 -g -fsycl-unnamed-lambda    doubler.cpp   -o doubler
coie@coie-HP-Z440-Workstation:~/Data/coie/Softwares/oneAPI/dpc++/module01$ ./doubler
Value at start:  myArray[42] is 42.
Selected device: Intel(R) Xeon(R) CPU E5-1620 v4 @ 3.50GHz
-> Device vendor: Intel(R) Corporation
Value at finish: myArray[42] is 84.
coie@coie-HP-Z440-Workstation:~/Data/coie/Softwares/oneAPI/dpc++/module01$ make all
dpcpp -O3 -std=c++14 -g -fsycl-unnamed-lambda    doubler.cpp   -o doubler
coie@coie-HP-Z440-Workstation:~/Data/coie/Softwares/oneAPI/dpc++/module01$ ./doubler
Value at start:  myArray[42] is 42.
Selected device: Intel(R) FPGA Emulation Device
-> Device vendor: Intel(R) Corporation
Value at finish: myArray[42] is 84.

 

Tags (1)
0 Kudos
1 Solution
Gergana_S_Intel
Employee
257 Views

CodePlay has announced they're working on an open source module that allows you to run oneAPI/Data Parallel C++ codes on NVIDIA GPUs. From the announcement:

Software developers will be able to use this implementation with Intel's® oneAPI framework to target Nvidia GPUs using any SYCL code, without any porting or special tricks required.

Here is the full news brief. Targeting early 2020, it seems like. If interested, I recommend you subscribe to their news announcements. I'll also try to post here once I have more details.

~Gergana

View solution in original post

7 Replies
Dmitry_Savin
New Contributor I
257 Views

As you can see in the neighbor topic (842261), Nvidia GPUs are not supported yet.

nnain1
New Contributor I
257 Views

Thank you

AbhishekD_Intel
Moderator
257 Views

Hi,

You are trying to run the code on NVIDIA GPU which is not supported at this stage, so after running the queue it's giving the result produced on the host. DPC++ code generates SPIRV IR which is not compatible with Nvidia GPUs. On the other hand for NVIDIA GPU we need PTX as an intermediate file.

Let us know if this resolves your Issue.

-Abhishek

Connor__Dominic
Beginner
257 Views

Currently OneAPi does not support nVidia GPU, does anyone know when it might appear ?

Gergana_S_Intel
Employee
258 Views

CodePlay has announced they're working on an open source module that allows you to run oneAPI/Data Parallel C++ codes on NVIDIA GPUs. From the announcement:

Software developers will be able to use this implementation with Intel's® oneAPI framework to target Nvidia GPUs using any SYCL code, without any porting or special tricks required.

Here is the full news brief. Targeting early 2020, it seems like. If interested, I recommend you subscribe to their news announcements. I'll also try to post here once I have more details.

~Gergana

View solution in original post

nnain1
New Contributor I
257 Views

Thank you. Good suggestion.

Dmitry_Savin
New Contributor I
257 Views
Hi Nyan, If you are still interested, Codeplay has released the forementioned module. Read further https://www.codeplay.com/portal/02-03-20-codeplay-contribution-to-dpcpp-brings-sycl-support-for-nvid... Dima
Reply