From 41cafca1baf4ece2bde5ac38125ae8b2fbc9f254 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Fri, 26 Jan 2024 19:26:36 +0100 Subject: [PATCH 01/11] update project --- Project.toml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 9c69f2d..8c27a7b 100644 --- a/Project.toml +++ b/Project.toml @@ -4,20 +4,24 @@ authors = ["Samuel Omlin"] version = "0.1.4" [deps] -AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +# [weakdeps] +# AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" +# CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + [compat] -Adapt = "3" -AMDGPU = "0.3.7, 0.4, 0.5, 0.6, 0.7, 0.8" -CUDA = "3.12, 4, 5" -julia = "1.7" +Adapt = "3" #TODO: , 4" +# AMDGPU = "0.3.7, 0.4, 0.5, 0.6, 0.7, 0.8" +# CUDA = "3.12, 4, 5" +julia = "1.9" # Minimum required Julia version (supporting extensions) StaticArrays = "1" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" +CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" [targets] -test = ["Test"] +test = ["Test", "AMDGPU", "CUDA"] \ No newline at end of file From d9f93dd9c6f3930108f021dcea18e26c310e0661 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Fri, 26 Jan 2024 19:27:28 +0100 Subject: [PATCH 02/11] update CI --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index dee2f66..05cf75a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: version: - - '1.7' # Minimum required Julia version. + - '1.9' # Minimum required Julia version (supporting extensions) - '1' # Latest stable 1.x release of Julia - 'nightly' os: From 757061a95ea4e3e6ef5046832ab9c6015fd0a3c1 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Fri, 26 Jan 2024 19:28:17 +0100 Subject: [PATCH 03/11] update ParallelStencil example --- examples/memcopyCellArray3D_ParallelStencil.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/memcopyCellArray3D_ParallelStencil.jl b/examples/memcopyCellArray3D_ParallelStencil.jl index 1e61446..c53f218 100644 --- a/examples/memcopyCellArray3D_ParallelStencil.jl +++ b/examples/memcopyCellArray3D_ParallelStencil.jl @@ -1,5 +1,6 @@ const USE_GPU = true using CellArrays, StaticArrays +import CUDA using ParallelStencil using ParallelStencil.FiniteDifferences3D @static if USE_GPU From 6fe7cc8764c2781ef322600cfc41aab2517d992b Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Fri, 26 Jan 2024 19:31:44 +0100 Subject: [PATCH 04/11] transfer aliases to macros --- src/CellArray.jl | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/src/CellArray.jl b/src/CellArray.jl index c0951e5..8fd6830 100644 --- a/src/CellArray.jl +++ b/src/CellArray.jl @@ -1,4 +1,4 @@ -using StaticArrays, Adapt, CUDA, AMDGPU +using StaticArrays, Adapt ## Constants @@ -104,7 +104,7 @@ Construct an uninitialized `N`-dimensional `CellArray` containing `Cells` of typ See also: [`CellArray`](@ref), [`CuCellArray`](@ref), [`ROCCellArray`](@ref) """ -CPUCellArray{T,N,B,T_elem} = CellArray{T,N,B,Array{T_elem,_N}} +macro CPUCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,Base.Array{$T_elem,$_N}})) end """ @@ -121,7 +121,7 @@ Construct an uninitialized `N`-dimensional `CellArray` containing `Cells` of typ See also: [`CellArray`](@ref), [`CPUCellArray`](@ref), [`ROCCellArray`](@ref) """ -CuCellArray{T,N,B,T_elem} = CellArray{T,N,B,CuArray{T_elem,_N}} +macro CuCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,CUDA.CuArray{$T_elem,$_N}})) end """ @@ -138,24 +138,15 @@ Construct an uninitialized `N`-dimensional `CellArray` containing `Cells` of typ See also: [`CellArray`](@ref), [`CPUCellArray`](@ref), [`CuCellArray`](@ref) """ -ROCCellArray{T,N,B,T_elem} = CellArray{T,N,B,ROCArray{T_elem,_N}} +macro ROCCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,AMDGPU.ROCArray{$T_elem,$_N}})) end -CPUCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = (check_T(T); CPUCellArray{T,N,B,eltype(T)}(undef, dims)) - CuCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = (check_T(T); CuCellArray{T,N,B,eltype(T)}(undef, dims)) -ROCCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = (check_T(T); ROCCellArray{T,N,B,eltype(T)}(undef, dims)) - -CPUCellArray{T,B}(::UndefInitializer, dims::Int...) where {T<:Cell,B} = CPUCellArray{T,B}(undef, dims) - CuCellArray{T,B}(::UndefInitializer, dims::Int...) where {T<:Cell,B} = CuCellArray{T,B}(undef, dims) -ROCCellArray{T,B}(::UndefInitializer, dims::Int...) where {T<:Cell,B} = ROCCellArray{T,B}(undef, dims) - -CPUCellArray{T}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N} = CPUCellArray{T,0}(undef, dims) - CuCellArray{T}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N} = CuCellArray{T,0}(undef, dims) -ROCCellArray{T}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N} = ROCCellArray{T,0}(undef, dims) - -CPUCellArray{T}(::UndefInitializer, dims::Int...) where {T<:Cell} = CPUCellArray{T}(undef, dims) - CuCellArray{T}(::UndefInitializer, dims::Int...) where {T<:Cell} = CuCellArray{T}(undef, dims) -ROCCellArray{T}(::UndefInitializer, dims::Int...) where {T<:Cell} = ROCCellArray{T}(undef, dims) +macro CPUCellArray(T,B, dims) esc(:(CellArrays.CellArray{$T,$B}(Base.Array, undef, $dims))) end +macro CPUCellArray(T, dims) esc(:(CellArrays.CellArray{$T }(Base.Array, undef, $dims))) end +macro CuCellArray(T,B, dims) esc(:(CellArrays.CellArray{$T,$B}(CUDA.CuArray, undef, $dims))) end +macro CuCellArray(T, dims) esc(:(CellArrays.CellArray{$T }(CUDA.CuArray, undef, $dims))) end +macro ROCCellArray(T,B, dims) esc(:(CellArrays.CellArray{$T,$B}(AMDGPU.ROCArray, undef, $dims))) end +macro ROCCellArray(T, dims) esc(:(CellArrays.CellArray{$T }(AMDGPU.ROCArray, undef, $dims))) end ## AbstractArray methods @@ -166,18 +157,6 @@ ROCCellArray{T}(::UndefInitializer, dims::Int...) where {T<:Cell} = ROCCellArray @inline Base.length(T::Type{<:Number}, args...) = 1 -@inline function Base.similar(A::CPUCellArray{T0,N0,B,T_elem0}, ::Type{T}, dims::NTuple{N,Int}) where {T0,N0,B,T_elem0,T<:Cell,N} - CPUCellArray{T,N,B,eltype(T)}(undef, dims) -end - -@inline function Base.similar(A::CuCellArray{T0,N0,B,T_elem0}, ::Type{T}, dims::NTuple{N,Int}) where {T0,N0,B,T_elem0,T<:Cell,N} - CuCellArray{T,N,B,eltype(T)}(undef, dims) -end - -@inline function Base.similar(A::ROCCellArray{T0,N0,B,T_elem0}, ::Type{T}, dims::NTuple{N,Int}) where {T0,N0,B,T_elem0,T<:Cell,N} - ROCCellArray{T,N,B,eltype(T)}(undef, dims) -end - @inline function Base.similar(A::CellArray{T0,N0,B,T_array0}, ::Type{T}, dims::NTuple{N,Int}) where {T0,N0,B,T_array0,T<:Cell,N} check_T(T) T_arraykind = Base.typename(T_array0).wrapper # Note: an alternative would be: T_array = typeof(similar(A.data, eltype(T), dims.*0)); CellArray{T,N,B}(T_array, dims) @@ -250,11 +229,11 @@ end return end -@inline function Base.getindex(A::CPUCellArray{T,N,1,T_elem}, i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} +@inline function Base.getindex(A::@CPUCellArray(T,N,1,T_elem), i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} getindex(reinterpret(reshape, T, view(A.data::Array{T_elem,_N},1,:,:)), i) # NOTE: reinterpret is not implemented for CUDA device arrays, i.e. for usage in kernels end -@inline function Base.setindex!(A::CPUCellArray{T,N,1,T_elem}, X::T, i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} +@inline function Base.setindex!(A::@CPUCellArray(T,N,1,T_elem), X::T, i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} setindex!(reinterpret(reshape, T, view(A.data::Array{T_elem,_N},1,:,:)), X ,i) # NOTE: reinterpret is not implemented for CUDA device arrays, i.e. for usage in kernels return end From 0b7e41a7ef76801c2ea1d8c3bc1e6ea6e04c4bfd Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Fri, 26 Jan 2024 19:32:28 +0100 Subject: [PATCH 05/11] transfer aliases to macros --- src/CellArrays.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CellArrays.jl b/src/CellArrays.jl index 16b1fcc..c18c193 100644 --- a/src/CellArrays.jl +++ b/src/CellArrays.jl @@ -31,5 +31,5 @@ using .Exceptions include("CellArray.jl") ## Exports (need to be after include of submodules if re-exports from them) -export CellArray, CPUCellArray, CuCellArray, ROCCellArray, cellsize, blocklength, field +export CellArray, @CPUCellArray, @CuCellArray, @ROCCellArray, cellsize, blocklength, field end From d900d60ead6b34f6f4095b50b123224bf3bb66e7 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Fri, 26 Jan 2024 19:32:50 +0100 Subject: [PATCH 06/11] transfer aliases to macros --- test/test_CellArray.jl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/test_CellArray.jl b/test/test_CellArray.jl index 6ae29b6..3ddca22 100644 --- a/test/test_CellArray.jl +++ b/test/test_CellArray.jl @@ -1,9 +1,21 @@ using Test using CUDA, AMDGPU, StaticArrays import CellArrays -import CellArrays: CPUCellArray, CuCellArray, ROCCellArray, cellsize, blocklength, _N +import CellArrays: @CPUCellArray, @CuCellArray, @ROCCellArray, cellsize, blocklength, _N, Cell import CellArrays: IncoherentArgumentError, ArgumentError +const CPUCellArray{T,N,B,T_elem} = @CPUCellArray(T,N,B,T_elem) +const CuCellArray{T,N,B,T_elem} = @CuCellArray(T,N,B,T_elem) +const ROCCellArray{T,N,B,T_elem} = @ROCCellArray(T,N,B,T_elem) + +const CPUCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = @CPUCellArray(T,B,dims) +const CuCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = @CuCellArray(T,B,dims) +const ROCCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = @ROCCellArray(T,B,dims) + +const CPUCellArray{T }(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N } = @CPUCellArray(T,dims) +const CuCellArray{T }(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N } = @CuCellArray(T,dims) +const ROCCellArray{T }(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N } = @ROCCellArray(T,dims) + test_cuda = CUDA.functional() test_amdgpu = AMDGPU.functional() From fa0de225f04f1a838dee091ffd8616d7a287e457 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Mon, 29 Jan 2024 12:50:47 +0100 Subject: [PATCH 07/11] move definition of aliases to user module --- src/CellArray.jl | 62 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/src/CellArray.jl b/src/CellArray.jl index 8fd6830..ded2874 100644 --- a/src/CellArray.jl +++ b/src/CellArray.jl @@ -104,10 +104,20 @@ Construct an uninitialized `N`-dimensional `CellArray` containing `Cells` of typ See also: [`CellArray`](@ref), [`CuCellArray`](@ref), [`ROCCellArray`](@ref) """ -macro CPUCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,Base.Array{$T_elem,$_N}})) end +const CPUCellArray{T,N,B,T_elem} = CellArray{T,N,B,Array{T_elem,_N}} + +CPUCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = (check_T(T); CPUCellArray{T,N,B,eltype(T)}(undef, dims)) +CPUCellArray{T,B}(::UndefInitializer, dims::Int...) where {T<:Cell,B} = CPUCellArray{T,B}(undef, dims) +CPUCellArray{T}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N} = CPUCellArray{T,0}(undef, dims) +CPUCellArray{T}(::UndefInitializer, dims::Int...) where {T<:Cell} = CPUCellArray{T}(undef, dims) """ + @define_CuCellArray + +Define the following type alias and constructors in the caller module: + +******************************************************************************** CuCellArray{T<:Cell,N,B,T_elem} <: AbstractArray{T,N} where Cell <: Union{Number, SArray, FieldArray} `N`-dimensional CellArray with cells of type `T`, blocklength `B`, and `T_array` being a `CuArray` of element type `T_elem`: alias for `CellArray{T,N,B,CuArray{T_elem,CellArrays._N}}`. @@ -120,11 +130,32 @@ macro CPUCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,Base.Array{ Construct an uninitialized `N`-dimensional `CellArray` containing `Cells` of type `T` which are stored in an array of kind `CuArray`. See also: [`CellArray`](@ref), [`CPUCellArray`](@ref), [`ROCCellArray`](@ref) +******************************************************************************** + +!!! note "Avoiding unneeded dependencies" + The type aliases and constructors for GPU `CellArray`s are provided via macros to avoid unneeded dependencies on the GPU packages in CellArrays. + +See also: [`@define_ROCCellArray`](@ref) """ -macro CuCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,CUDA.CuArray{$T_elem,$_N}})) end +macro define_CuCellArray() esc(define_CuCellArray()) end + +function define_CuCellArray() + quote + const CuCellArray{T,N,B,T_elem} = CellArrays.CellArray{T,N,B,CUDA.CuArray{T_elem,CellArrays._N}} + CuCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:CellArrays.Cell,N,B} = (CellArrays.check_T(T); CuCellArray{T,N,B,eltype(T)}(undef, dims)) + CuCellArray{T,B}(::UndefInitializer, dims::Int...) where {T<:CellArrays.Cell,B} = CuCellArray{T,B}(undef, dims) + CuCellArray{T}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:CellArrays.Cell,N} = CuCellArray{T,0}(undef, dims) + CuCellArray{T}(::UndefInitializer, dims::Int...) where {T<:CellArrays.Cell} = CuCellArray{T}(undef, dims) + end +end """ + @define_ROCCellArray + +Define the following type alias and constructors in the caller module: + +******************************************************************************** ROCCellArray{T<:Cell,N,B,T_elem} <: AbstractArray{T,N} where Cell <: Union{Number, SArray, FieldArray} `N`-dimensional CellArray with cells of type `T`, blocklength `B`, and `T_array` being a `ROCArray` of element type `T_elem`: alias for `CellArray{T,N,B,ROCArray{T_elem,CellArrays._N}}`. @@ -137,16 +168,25 @@ macro CuCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,CUDA.CuArray Construct an uninitialized `N`-dimensional `CellArray` containing `Cells` of type `T` which are stored in an array of kind `ROCArray`. See also: [`CellArray`](@ref), [`CPUCellArray`](@ref), [`CuCellArray`](@ref) +******************************************************************************** + +!!! note "Avoiding unneeded dependencies" + The type aliases and constructors for GPU `CellArray`s are provided via macros to avoid unneeded dependencies on the GPU packages in CellArrays. + +See also: [`@define_CuCellArray`](@ref) """ -macro ROCCellArray(T,N,B,T_elem) esc(:(CellArrays.CellArray{$T,$N,$B,AMDGPU.ROCArray{$T_elem,$_N}})) end +macro define_ROCCellArray() esc(define_ROCCellArray()) end +function define_ROCCellArray() + quote + const ROCCellArray{T,N,B,T_elem} = CellArrays.CellArray{T,N,B,AMDGPU.ROCArray{T_elem,CellArrays._N}} -macro CPUCellArray(T,B, dims) esc(:(CellArrays.CellArray{$T,$B}(Base.Array, undef, $dims))) end -macro CPUCellArray(T, dims) esc(:(CellArrays.CellArray{$T }(Base.Array, undef, $dims))) end -macro CuCellArray(T,B, dims) esc(:(CellArrays.CellArray{$T,$B}(CUDA.CuArray, undef, $dims))) end -macro CuCellArray(T, dims) esc(:(CellArrays.CellArray{$T }(CUDA.CuArray, undef, $dims))) end -macro ROCCellArray(T,B, dims) esc(:(CellArrays.CellArray{$T,$B}(AMDGPU.ROCArray, undef, $dims))) end -macro ROCCellArray(T, dims) esc(:(CellArrays.CellArray{$T }(AMDGPU.ROCArray, undef, $dims))) end + ROCCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:CellArrays.Cell,N,B} = (CellArrays.check_T(T); ROCCellArray{T,N,B,eltype(T)}(undef, dims)) + ROCCellArray{T,B}(::UndefInitializer, dims::Int...) where {T<:CellArrays.Cell,B} = ROCCellArray{T,B}(undef, dims) + ROCCellArray{T}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:CellArrays.Cell,N} = ROCCellArray{T,0}(undef, dims) + ROCCellArray{T}(::UndefInitializer, dims::Int...) where {T<:CellArrays.Cell} = ROCCellArray{T}(undef, dims) + end +end ## AbstractArray methods @@ -229,11 +269,11 @@ end return end -@inline function Base.getindex(A::@CPUCellArray(T,N,1,T_elem), i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} +@inline function Base.getindex(A::CPUCellArray{T,N,1,T_elem}, i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} getindex(reinterpret(reshape, T, view(A.data::Array{T_elem,_N},1,:,:)), i) # NOTE: reinterpret is not implemented for CUDA device arrays, i.e. for usage in kernels end -@inline function Base.setindex!(A::@CPUCellArray(T,N,1,T_elem), X::T, i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} +@inline function Base.setindex!(A::CPUCellArray{T,N,1,T_elem}, X::T, i::Int) where {T<:Union{SArray,FieldArray},N,T_elem} setindex!(reinterpret(reshape, T, view(A.data::Array{T_elem,_N},1,:,:)), X ,i) # NOTE: reinterpret is not implemented for CUDA device arrays, i.e. for usage in kernels return end From 7774e99ca1ec78ea74850e2f6c51cf275b29c40c Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Mon, 29 Jan 2024 12:51:10 +0100 Subject: [PATCH 08/11] move definition of aliases to user module --- src/CellArrays.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CellArrays.jl b/src/CellArrays.jl index c18c193..86bab21 100644 --- a/src/CellArrays.jl +++ b/src/CellArrays.jl @@ -6,11 +6,11 @@ Provides support for an AbstractArray subtype `CellArray`, which represents arra # General overview and examples https://github.com/omlins/CellArray.jl -# Constructors +# Constructors and type aliases - [`CellArray`](@ref) - [`CPUCellArray`](@ref) -- [`CuCellArray`](@ref) -- [`ROCCellArray`](@ref) +- `CuCellArray` (available via [`@define_CuCellArray`](@ref)) +- `ROCCellArray` (available via [`@define_ROCCellArray`](@ref)) # Functions (additional to standard AbstractArray functionality) - [`cellsize`](@ref) @@ -31,5 +31,5 @@ using .Exceptions include("CellArray.jl") ## Exports (need to be after include of submodules if re-exports from them) -export CellArray, @CPUCellArray, @CuCellArray, @ROCCellArray, cellsize, blocklength, field +export CellArray, CPUCellArray, @define_CuCellArray, @define_ROCCellArray, cellsize, blocklength, field end From c549f12cdfc82b454756f5050d51b802dda1e8f7 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Mon, 29 Jan 2024 12:57:54 +0100 Subject: [PATCH 09/11] move definition of aliases to user module --- examples/memcopyCellArray3D.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/memcopyCellArray3D.jl b/examples/memcopyCellArray3D.jl index 89826b3..3e49803 100644 --- a/examples/memcopyCellArray3D.jl +++ b/examples/memcopyCellArray3D.jl @@ -1,5 +1,7 @@ using CellArrays, StaticArrays, CUDA +@define_CuCellArray + function copy3D!(T2::CellArray, T::CellArray, Ci::CellArray) ix = (blockIdx().x-1) * blockDim().x + threadIdx().x iy = (blockIdx().y-1) * blockDim().y + threadIdx().y From 1d60bd4876ea882b55bc65dea102703e08423ea5 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Mon, 29 Jan 2024 12:58:21 +0100 Subject: [PATCH 10/11] move definition of aliases to user module --- test/test_CellArray.jl | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/test/test_CellArray.jl b/test/test_CellArray.jl index 3ddca22..e7d0068 100644 --- a/test/test_CellArray.jl +++ b/test/test_CellArray.jl @@ -1,21 +1,11 @@ using Test using CUDA, AMDGPU, StaticArrays import CellArrays -import CellArrays: @CPUCellArray, @CuCellArray, @ROCCellArray, cellsize, blocklength, _N, Cell +import CellArrays: CPUCellArray, @define_CuCellArray, @define_ROCCellArray, cellsize, blocklength, _N import CellArrays: IncoherentArgumentError, ArgumentError -const CPUCellArray{T,N,B,T_elem} = @CPUCellArray(T,N,B,T_elem) -const CuCellArray{T,N,B,T_elem} = @CuCellArray(T,N,B,T_elem) -const ROCCellArray{T,N,B,T_elem} = @ROCCellArray(T,N,B,T_elem) - -const CPUCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = @CPUCellArray(T,B,dims) -const CuCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = @CuCellArray(T,B,dims) -const ROCCellArray{T,B}(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N,B} = @ROCCellArray(T,B,dims) - -const CPUCellArray{T }(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N } = @CPUCellArray(T,dims) -const CuCellArray{T }(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N } = @CuCellArray(T,dims) -const ROCCellArray{T }(::UndefInitializer, dims::NTuple{N,Int}) where {T<:Cell,N } = @ROCCellArray(T,dims) - +@define_CuCellArray +@define_ROCCellArray test_cuda = CUDA.functional() test_amdgpu = AMDGPU.functional() From b701ea688ec21bb5a47c9dd07ea0a3789b867f47 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Mon, 29 Jan 2024 13:11:51 +0100 Subject: [PATCH 11/11] remove failing nightly CI --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 05cf75a..fc9e227 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,7 @@ jobs: version: - '1.9' # Minimum required Julia version (supporting extensions) - '1' # Latest stable 1.x release of Julia - - 'nightly' + #- 'nightly' # CUDA fails to pre-compile on nightly os: - ubuntu-latest - macOS-latest