I was trying to play around with PointNeighbors on the GPU and was running into the following problem. Totally understand that GPU compatibility is still work in progress, so please let me know if this is expected, being worked on, and/or a duplicate of something referenced in another issue e.g. #26. If so, let me know if I should close this issue.
When attempting to run update!() on the GPU, I get an error:
ERROR: InvalidIRError: compiling MethodInstance for PointNeighbors.gpu_generic_kernel(::KernelAbstractions.CompilerMetadata{…}, ::PointNeighbors.var"#11#12"{…}) resulted in invalid LLVM IR
Reason: unsupported dynamic function invocation (call to modify!)
Here's a working example:
using PointNeighbors
using CUDA
# Generate some points
pts = rand(2, 100)
search_radius = 0.25
min_corner = (minimum(pts[1,:]), minimum(pts[2,:]))
maxcorner = (maximum(pts[1,:]), maximum(pts[2,:]))
# Create neighborhood search
cell_list = FullGridCellList(min_corner=min_corner, max_corner=maxcorner, search_radius=search_radius,
backend=PointNeighbors.DynamicVectorOfVectors{Int32}, max_points_per_cell = 100)
nhs = GridNeighborhoodSearch{2}(search_radius=search_radius, n_points=size(pts,2), cell_list=cell_list, update_strategy=nothing)
# Initialize neighborhood search
PointNeighbors.initialize!(nhs, pts, pts)
# Copy neighborhood search onto GPU
nhs_gpu = PointNeighbors.Adapt.adapt(CuArray, nhs)
# Attemp to update points
pts_gpu = cu(pts) # copy points onto GPU
PointNeighbors.update!(nhs_gpu, pts_gpu, pts_gpu);
Please let me know if I'm doing something wrong here. I assumed the initialization had to happen on the CPU first before adapting to the GPU because I would get the common scalar indexing error, but maybe I am wrong.
Thanks in advance for any help!
I was trying to play around with PointNeighbors on the GPU and was running into the following problem. Totally understand that GPU compatibility is still work in progress, so please let me know if this is expected, being worked on, and/or a duplicate of something referenced in another issue e.g. #26. If so, let me know if I should close this issue.
When attempting to run update!() on the GPU, I get an error:
Here's a working example:
Please let me know if I'm doing something wrong here. I assumed the initialization had to happen on the CPU first before adapting to the GPU because I would get the common scalar indexing error, but maybe I am wrong.
Thanks in advance for any help!