Hello,
what kind of "ordinary functions" do you have in mind ? are you talking about functions found in glibc, or your own code ?
OpenCL has defined restrictions, described e.g. here:
https://www.khronos.org/registry/OpenCL//sdk/2.2/docs/man/html/restrictions.html
In particular:
"Unless defined in the OpenCL specification, the library functions, macros, types, and constants defined in the C99 standard headers assert.h, ctype.h, complex.h, errno.h, fenv.h, float.h, inttypes.h, limits.h, locale.h, setjmp.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h, tgmath.h, time.h, wchar.h and wctype.h are not available and cannot be included by a program"
... so none of the functions from those headers can be called in OpenCL. There is printf() and a huge math function library, but other than that, the answer is negative.
Regards,
-- mb
________________________________
From: mashilamani sambasivam <kan...@gm...>
Sent: Monday, July 6, 2020 9:16 PM
To: poc...@li... <poc...@li...>
Subject: [pocl-devel] calling ordinary C functions from kernel functions in opencl
Hi,
I am new to opencl. I am trying to port huge amount of C code to run on GPU with minimum modification to original C code.
In that direction, I am trying to call ordinary C functions from my kernel functions.
I want to know if that is possible with opencl 1.2 which you have implemented.
Assume that I am taking care that each kernel has its own address space, its own stack etc which dont clash with other kernels.
I have NVIDIA GTX1060 6GB.
Thanks much,
mani
PS> I have tried in openmp and failed. In openmp, it is impossible to call ordinary functions from a function which is executing on "target" device.
|