takagi / cl-cuda

Cl-cuda is a library to use NVIDIA CUDA in Common Lisp programs.
MIT License
280 stars 24 forks source link

Adding CUDA-X #96

Open Symbolics opened 5 years ago

Symbolics commented 5 years ago

This issue is to discuss CUDA-X, and how it might work with cl-cuda. From the architecture diagram, it appears that the CUDA-X libraries are built on top of CUDA.

Would it make sense to have cl-cuda include CUDA-X functionality? Or, would it be better to apply the same techniques in cl-cuda and write a separate library for CUDA-X that ran on top of cl-cuda, following the NVIDIA architecture?

Symbolics commented 5 years ago

More information: the CUDA-X libraries, part of the RAPIDS project, are C/C++ libraries that use CUDA to talk to the GPU. For example cuGraph, a graph database component of CUDA-X, is built as a shared library, and then Python and Java bindings are added for the user level API. This appears to be just what cl-cuda does for the base CUDA library (adds a Common Lisp user level API). Given this architecture:

                   +---------------------------------+-----------+-----------+
                   | defkernel                       | memory    | context   |
       cl-cuda.api +---------------------------------+           |           |
                   | kernel-manager                  |           |           |
                   +---------------------------------+-----------+-----------+
                   +----------------------------+----------------------------+
      cl-cuda.lang | Kernel description lang.   | the Compiler               |
                   +----------------------------+----------------------------+
                   +---------------------------------------------------------+
cl-cuda.driver-api | driver-api                                              |
                   +---------------------------------------------------------+
                   +---------------------------------------------------------+
              CUDA | CUDA driver API                                         |
                   +---------------------------------------------------------+

It seems that something at the same level as the cl-cuda.api, that makes use of cl-cuda.lang might be most the most appropriate place to add a cl-cuGraph API?

@takagi, any thoughts on how to approach this? If there is anyway to reuse parts of cl-cuda, that's obviously the best solution.

takagi commented 5 years ago

Hi. While I'm not sure about the detail of CUDA-X's API, I suppose that a reasonable approach is to define CFFI entries for CUDA-X API as cl-cuda.driver-api does for CUDA driver API as well as to provide some features for convenience in cl-cuda.api.