Migrating to SYCL
One-stop forum for getting assistance migrating your existing code to SYCL
27 Discussions

how to convert '__shared__ int' parameter in cuda to dpcpp

lisashi
Employee
800 Views

hi 

i try to convert a file from cuda to dpcpp. there is a '__shared__ int' parameter in this cuda kernel. i do not know how to use this parameter in dpcpp.

 

best

Lisa Shi

0 Kudos
1 Solution
ManjulaC_Intel
Moderator
765 Views

Hi,


Thanks for reaching out to us.


For successful migration of CUDA to DPC++ follow the document below:

https://www.intel.com/content/www/us/en/developer/articles/technical/intel-dpcpp-compatibility-tool-...


Shared local Memory in CUDA is migrated to accessors in DPC++. The access mode describes how we intend to use the memory associated with the accessor in the program. The accessor’s access modes are used by the runtime to create an execution order for the kernels and perform data movement. 


Refer shared local memory access section in the below document:

https://www.intel.com/content/www/us/en/developer/articles/technical/cuda-sycl-migration-jacobi-iter...


Regards,

Manjula





View solution in original post

4 Replies
ManjulaC_Intel
Moderator
766 Views

Hi,


Thanks for reaching out to us.


For successful migration of CUDA to DPC++ follow the document below:

https://www.intel.com/content/www/us/en/developer/articles/technical/intel-dpcpp-compatibility-tool-...


Shared local Memory in CUDA is migrated to accessors in DPC++. The access mode describes how we intend to use the memory associated with the accessor in the program. The accessor’s access modes are used by the runtime to create an execution order for the kernels and perform data movement. 


Refer shared local memory access section in the below document:

https://www.intel.com/content/www/us/en/developer/articles/technical/cuda-sycl-migration-jacobi-iter...


Regards,

Manjula





Dhimenvora
Beginner
710 Views
C++
struct complex
{
    float r;
    float i;
};

// __device__ := Invoke this function from device and execute it on device
__device__ complex operator*(complex a, complex b)
{
    return {a.r * b.r - a.i * b.i, a.r * b.i + a.i * b.r};
}

__device__ complex operator+(complex a, complex b)
{
   return {a.r + b.r, a.i + b.i};
}

__device__ float sqr_magnitude(complex c)
{
    return c.r * c.r + c.i * c.i;
}












ManjulaC_Intel
Moderator
638 Views

Hi,


A gentle reminder to respond.


Regards,

Manjula


ManjulaC_Intel
Moderator
588 Views

Hi,


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel. Have a nice day!


Regards,

Manjula


Reply