Skip to content

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

Open

Description

@AryanKarumuri

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.

Activity

  1. oleksandr-pavlyk commented on Apr 4, 2024

    @oleksandr-pavlyk
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions