Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to convert CUDA-Python to SYCL using dpctl? #1635

Open
AryanKarumuri opened this issue Apr 4, 2024 · 1 comment
Open

How to convert CUDA-Python to SYCL using dpctl? #1635

AryanKarumuri opened this issue Apr 4, 2024 · 1 comment
Labels
question Further information is requested

Comments

@AryanKarumuri
Copy link

Hi team,

Would you kindly provide guidance on transitioning CUDA-Python code to SYCL? Specifically, I am interested in converting the code available here to SYCL utilizing dpctl. And also, is there any tool available for auto-migration of CUDA-Python sample to SYCL? (like SYCLOMATIC tool)

Additionally, could you please furnish any documentation detailing the mapping process, if available?

Thank you in advance for your assistance.

@oleksandr-pavlyk
Copy link
Collaborator

An example of dispatching kernels written in OpenCL language can be found in the dpctl's test suite: https://github.com/IntelPython/dpctl/blob/master/dpctl/tests/test_sycl_kernel_submit.py#L44-L94

It leverages dpctl.program.create_program_from_source functions to compile OCL source, and submits kernel extracted from the program it using dpctl.SyclQueue.submit method.

That said, numba_dpex enables writing kernels in Python, not unlike numba.cuda. Please refer to https://intelpython.github.io/numba-dpex/latest/user_guide/kernel_programming/index.html for examples.

DPCTL comes with DPCTLSyclInterface library, which provides C-API to DPC++ runtime classes. Please refer https://github.com/IntelPython/dpctl/blob/master/libsyclinterface/tests/test_sycl_queue_submit.cpp for examples of kernel submission from C.

There is no automated tool like available to aid in transition from CUDA-Python to SYCL. However, Syclomatic could be used to convert CUDA program to SYCL, and Python extension can be created leveraging dpctl to invoke SYCL functions in the translated code from Python.

Examples of writing Python extensions using C++ that leverage SYCL can be found in https://github.com/IntelPython/dpctl/tree/master/examples/pybind11, but also in https://github.com/IntelPython/sample-data-parallel-extensions/

Please refer to https://dl.acm.org/doi/abs/10.1145/3529538.3529990 for more details.

@oleksandr-pavlyk oleksandr-pavlyk added the question Further information is requested label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants