Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[extensions]
StructArraysAdaptExt = "Adapt"
StructArraysGPUArraysCoreExt = ["GPUArraysCore", "KernelAbstractions"]
StructArraysLinearAlgebraExt = "LinearAlgebra"
StructArraysSparseArraysExt = "SparseArrays"
StructArraysStaticArraysExt = "StaticArrays"
AdaptExt = "Adapt"
GPUArraysCoreExt = "GPUArraysCore"
KernelAbstractionsExt = "KernelAbstractions"
LinearAlgebraExt = "LinearAlgebra"
SparseArraysExt = "SparseArrays"
StaticArraysExt = "StaticArrays"

[compat]
Adapt = "4"
Expand Down
2 changes: 1 addition & 1 deletion ext/StructArraysAdaptExt.jl → ext/AdaptExt.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module StructArraysAdaptExt
module AdaptExt
# Use Adapt allows for automatic conversion of CPU to GPU StructArrays
using Adapt, StructArrays

Expand Down
8 changes: 8 additions & 0 deletions ext/GPUArraysCoreExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module GPUArraysCoreExt

using StructArrays
import GPUArraysCore

StructArrays.always_struct_broadcast(::GPUArraysCore.AbstractGPUArrayStyle) = true

end # module
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module StructArraysGPUArraysCoreExt
module KernelAbstractionsExt

using StructArrays
using StructArrays: map_params, array_types

using Base: tail

import GPUArraysCore
import KernelAbstractions as KA

function KA.get_backend(x::T) where {T<:StructArray}
Expand All @@ -23,6 +21,4 @@ function KA.get_backend(x::T) where {T<:StructArray}
return backend
end

StructArrays.always_struct_broadcast(::GPUArraysCore.AbstractGPUArrayStyle) = true

end # module
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module StructArraysLinearAlgebraExt
module LinearAlgebraExt

using StructArrays
using LinearAlgebra
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module StructArraysSparseArraysExt
module SparseArraysExt

using StructArrays: StructArray, components, createinstance
import SparseArrays: sparse, issparse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module StructArraysStaticArraysExt
module StaticArraysExt

using StructArrays
using StaticArrays: StaticArray, FieldArray, tuple_prod, SVector, MVector, SOneTo, HeterogeneousShapeTuple
Expand Down
10 changes: 8 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
using StructArrays
using Test
import KernelAbstractions as KA

@testset "KernelAbstractions without GPUArraysCore" begin
s = StructArray(a=[1, 2], b=[3, 4])
@test (@inferred KA.get_backend(s)) == KA.CPU()
end

using StructArrays: staticschema, iscompatible, _promote_typejoin, append!!
using OffsetArrays: OffsetArray, OffsetVector, OffsetMatrix
using StaticArrays
Expand All @@ -8,12 +16,10 @@ using Adapt: adapt, Adapt
using ConstructionBase: constructorof, setproperties, getproperties, getfields
using JLArrays
using LinearAlgebra
using Test
using SparseArrays
using InfiniteArrays

import Aqua
import KernelAbstractions as KA
import Tables, PooledArrays, WeakRefStrings

using Documenter: doctest
Expand Down
Loading