-
Notifications
You must be signed in to change notification settings - Fork 80
[0.10] add get_backend for StaticArrays #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
(cherry picked from commit b8b53da)
|
|
||
| [extras] | ||
| StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
| EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" | ||
| LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
| SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| [extras] | |
| StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | |
| EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" | |
| LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | |
| SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" |
Since test/Project.toml exists, I think this can be deleted and the StaticArrays entry added to that file instead
| import KernelAbstractions: get_backend, CPU | ||
| using StaticArrays: SizedArray, MArray | ||
|
|
||
| get_backend(A::SizedArray) = get_backend(A.data) | ||
| get_backend(::MArray) = CPU() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import KernelAbstractions: get_backend, CPU | |
| using StaticArrays: SizedArray, MArray | |
| get_backend(A::SizedArray) = get_backend(A.data) | |
| get_backend(::MArray) = CPU() | |
| import KernelAbstractions: get_backend, POCLBackend | |
| using StaticArrays: SizedArray, MArray | |
| get_backend(A::SizedArray) = get_backend(A.data) | |
| get_backend(::MArray) = POCLBackend() |
Reduces the amount of work required when GPU and CPU get removed
| backendT = typeof(backend).name.wrapper # To look through CUDABackend{true, false} | ||
| @test backend isa backendT | ||
|
|
||
| @test KernelAbstractions.get_backend(@MMatrix [1.0]) isa CPU |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @test KernelAbstractions.get_backend(@MMatrix [1.0]) isa CPU | |
| @test KernelAbstractions.get_backend(@MMatrix [1.0]) isa KernelAbstractions.POCLBackend |
Port of #621