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

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

lisashi
Employee
1,576 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
1,541 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-best-practices.html


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-iterative-method.html#gs.emcovr


Regards,

Manjula





View solution in original post

0 Kudos
4 Replies
ManjulaC_Intel
Moderator
1,542 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-best-practices.html


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-iterative-method.html#gs.emcovr


Regards,

Manjula





0 Kudos
Dhimenvora
Beginner
1,486 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;
}












0 Kudos
ManjulaC_Intel
Moderator
1,414 Views

Hi,


A gentle reminder to respond.


Regards,

Manjula


0 Kudos
ManjulaC_Intel
Moderator
1,364 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


0 Kudos
Reply