Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
78 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

Accepted Solutions
Highlighted
78 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

gss

View solution in original post

0 Kudos
7 Replies
Highlighted
New Contributor I
78 Views

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

0 Kudos
Highlighted
New Contributor I
78 Views

Thank you

0 Kudos
Highlighted
Moderator
78 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

0 Kudos
Highlighted
78 Views

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

0 Kudos
Highlighted
79 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

gss

View solution in original post

0 Kudos
Highlighted
New Contributor I
78 Views

Thank you. Good suggestion.

0 Kudos
Highlighted
New Contributor I
78 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
0 Kudos