Calling external device functions

0 views
Skip to first unread message

it...@zmbq.com

unread,
Sep 19, 2016, 9:41:43 AM9/19/16
to Numba Public Discussion - Public
Hi.

I'm using Numba (incredible job, by the way, it's basically magic) for creating GPU kernels. I want to call a device function that is already implemented in C++. Is there anyway way of calling external device functions?

Thanks,
Itay.

Siu Kwan Lam

unread,
Sep 19, 2016, 10:24:17 AM9/19/16
to Numba Public Discussion - Public
Hi,

We have an old, unstable API for that.  I made a gist to demonstrate its usage.  See https://gist.github.com/sklam/702af16db009caf66dc4bff2c190ebd7 .  

The idea is to compile the CUDA-C/C++ code with relocatable device code (-dc flag).  And have Numba link to it at runtime.  The C device function is declared with `cuda.declare_device(name, numba_signature)`.  Beware that the C code must follow the numba calling convention, in which the first arg is the return value.

It is unstable and undocumented because we don't have any usecase for it and the feature is probably limiting.   Any feedback would help.

Regards,

--
You received this message because you are subscribed to the Google Groups "Numba Public Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numba-users...@continuum.io.
To post to this group, send email to numba...@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/numba-users/c9bba36c-6cf8-4409-8422-9fb2f99390ca%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.
--
Siu Kwan Lam
Software Engineer
Continuum Analytics
Reply all
Reply to author
Forward
0 new messages