Hello everybody.
I want to pass a Python object (model - an instance of a Python Class) to the GPU and to run the kernel function (myfunc) on the device, which is supposed to call an optimizer to solve a linear problem (working on CPU).
Is it possible to pass a Python object to the GPU with numba? I can find examples doing this in C++, but for Python there are just examples passing arrays to the GPU.
Or is there anything else wrong with that?
I get the following error message:
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
non-precise type array(pyobject, 1d, C)
During: typing of argument at basic_example.py (208)
#part of my code
model = solph.Model(energysystem)
d_model = cuda.to_device(model)
@cuda.jit()
def myfunc(model):
model.solve(solver=“gurobi_direct”)
threadsperblock = (16, 16)
blockspergrid = (50, 50)
myfunc[blockspergrid, threadsperblock] (d_model)
Thank you for your answer!