I am working on genetic programming, where I need to pick a function from a set of functions
fs by an integer index in each node of the tree. An example demonstrating the difficulty I encountered is given below.
using CUDA # a kernel function pass_func_array(x::Float32, fs) for f in fs x = f(x) end @cuprintln("x = $x") nothing end
fs is an array of functions. However, the following way does not work since
Function is not a bit type.
fs = CuArray([sin, cos]) LoadError: CuArray only supports bits types fs = CuArray([CUDA.sin, CUDA.cos]) LoadError: CuArray only supports bits types
Any ideas on how to fix this?
I tried to pass symbols (i.e., function names), but a
Symbol is not a bits type either.