Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the manual threading approach in _build_weights with a batched GPU/CPU kernel via KernelAbstractions.jl, adds a helper for vector-dimension detection, updates autoselect_k to accept any AbstractVector, and brings in KernelAbstractions at the module level.
- Swap out
Threads.@threadsstencil construction for a@kernel-based batch processor. - Introduce
_get_vector_dimto compute point dimensionality generically and updateautoselect_k. - Add
using KernelAbstractionsin the main module and clean up old tests.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/solve.jl | Removed legacy _calculate_matrix_entry! tests after pruning the old threaded implementation. |
| src/utils.jl | Added _get_vector_dim methods and widened autoselect_k to AbstractVector. |
| src/solve.jl | Replaced threaded loops with a batched build_stencils_kernel; defaults to CPU but supports GPU. |
| src/RadialBasisFunctions.jl | Added using KernelAbstractions to enable kernel dispatch. |
| CLAUDE.md | New guidance file for automated code assistants. |
Comments suppressed due to low confidence (4)
test/solve.jl:46
- The legacy test set for
_calculate_matrix_entry!was removed, leaving no direct coverage for individual matrix-entry logic. Consider adding new tests that validate the outputs of thebuild_stencils_kernelor the resulting sparse matrix entries to maintain coverage.
end
src/solve.jl:50
- The variable
nmonis not defined or passed into the kernel; this will error. You should passnmonas an argument tobuild_stencils_kernelor declare it as a compile-time constant.
n = k + nmon
src/solve.jl:51
- The type parameter
TDis referenced inside the kernel but never passed in or defined within its scope. You need to supplyTD(e.g., element type) as an argument or use a constant within the kernel.
A = Symmetric(zeros(TD, n, n), :U)
src/solve.jl:39
- The
Jarray (column indices) is passed into the kernel but never assigned or updated, so it remains at its initial state. Add logic inside the kernel to populateJ[(i-1)*k + idx]alongsideIandV.
@kernel function build_stencils_kernel(
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
|
@Davide-Miotti could you give this a quick look, it is not too big of a PR |
Davide-Miotti
left a comment
There was a problem hiding this comment.
Nice job! Good ideas both the CLAUDE.md and the integration of KernelAbstractions.jl
This PR simply changes the construction of the operator to use KernelAbstractions.jl rather than plain threads, so in the future when we add support for GPU-based neighbor lists we can build the operator on the GPU.