-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
calling custom C ArrayFire functions in Julia #229
Comments
Not sure, but it seems that you are mixing up C++ and C pointers and calling conventions, not an expert, but I'm surprised that it works at all. af_array is a dumb C pointer and af::array is a pointer to a c++ class. You should use af_array both in Julia and in your C function definition. Inside your function either construct af::array objects out of af_array or use C version of the arrayfire functions throughout. |
I tried something like:
I don't found another way to get the device pointer from a |
I might need it someday :) Have you looked into http://arrayfire.org/docs/group__device__func__mem.htm#ga58fda2d491cd27f31108e699b5aef506
|
uy... I did not see it, it seems to be what I need, I'll try it and see if it works, I'll come back with news |
I managed to write the code, however I had to make some changes in order to handle
then in Julia it is possible to use this call:
For now, this works fine, it seems to go better than the function with |
I needed write some custom functions in C using the ArrayFire library, the functions basically uses custom OpenCL kernels, for example I have:
I use this kernel on ArrayFire arrays, so, I write the function:
Ref: Interoperability with OpenCL .
I call this function in Julia as follows:
It works well sometimes, but sometimes it fails (the kernel dies), depending on how the code is written, althought the call in C works fine. I wanted to change the arguments of the function to
af_array
instead ofaf::array
to call this function in Julia as I saw in some built-in functions inArrayFire.jl
, but the attempts I made did not go well since I only have the reference above.is there some general rules that I could use to write (in C) and call (in Julia) this functions?, I think I'm not doing it the right way.
The text was updated successfully, but these errors were encountered: