clEsperanto / pyclesperanto

GPU-accelerated Image Processing library using OpenCL
https://clesperanto.github.io/pyclesperanto
BSD 3-Clause "New" or "Revised" License
31 stars 6 forks source link

[Feature] cle.execute is missing in API #156

Closed haesleinhuepf closed 7 months ago

haesleinhuepf commented 8 months ago

Is your feature request related to a problem? Please describe.

I would like to execute custom kernels, like using pyclesperanto_prototype.execute.

Describe the solution you'd like

It would be great to make this CLIc function available in the pyclesperanto API, ideally matching this function's API.

Additional context The cle.execute function is key for getting all the neighborhood-/graph-filters out of pyclesperanto

StRigaud commented 7 months ago

execute should mimic now the protoype execute function. Additionnaly, kernel source can now be passed either as a file (.cl) or as a string.

def execute(anchor = '__file__', kernel_source: str = '', kernel_name: str = '', global_size: tuple = (1, 1, 1), parameters: dict = {}, constants: dict = {}, device: Device = None):

exception done with the opencl_kernel_filename parameter renamed kernel_source to be more generic as it can now be a path or a string.