Skip to content

Commit 1e43d05

Browse files
mcabbottmaleadt
andauthored
Move JLArray to a subpackage (#418)
Co-authored-by: Tim Besard <tim.besard@gmail.com>
1 parent 5860812 commit 1e43d05

File tree

6 files changed

+73
-3
lines changed

6 files changed

+73
-3
lines changed

lib/JLArrays/LICENSE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
The MIT License (MIT)
2+
3+
Copyright &copy; 2016 Simon Danisch
4+
5+
Copyright &copy; 2018 JuliaGPU developers
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.

lib/JLArrays/Project.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name = "JLArrays"
2+
uuid = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
3+
authors = ["Tim Besard <tim.besard@gmail.com>"]
4+
version = "0.1.0"
5+
6+
[deps]
7+
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
8+
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
9+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
10+
11+
[compat]
12+
Adapt = "2.0, 3.0"
13+
GPUArrays = "8.4.1"
14+
julia = "1.6"

lib/JLArrays/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# JLArrays.jl
2+
3+
This package serves as a reference implementation for [GPUArrays.jl](https://github.com/JuliaGPU/GPUArrays.jl),
4+
running on the CPU. It was used internally for tests, and is now a registered sub-package to enable easier use
5+
in testing other packages.
6+
7+
```julia
8+
julia> using JLArrays
9+
[ Info: Precompiling JLArrays [27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb]
10+
11+
julia> jl(ones(3)) .+ 1
12+
3-element JLArray{Float64, 1}:
13+
2.0
14+
2.0
15+
2.0
16+
17+
julia> ans[2]
18+
┌ Warning: Performing scalar indexing on task Task (runnable) @0x0000000108fc4010.
19+
│ Invocation of getindex resulted in scalar indexing of a GPU array.
20+
│ This is typically caused by calling an iterating implementation of a method.
21+
│ Such implementations *do not* execute on the GPU, but very slowly on the CPU,
22+
│ and therefore are only permitted from the REPL for prototyping purposes.
23+
│ If you did intend to index this array, annotate the caller with @allowscalar.
24+
└ @ GPUArraysCore ~/.julia/packages/GPUArraysCore/rSIl2/src/GPUArraysCore.jl:81
25+
2.0
26+
```
File renamed without changes.

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[deps]
22
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
33
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
4+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
45
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
56
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
67
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/runtests.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
using GPUArrays, Test
1+
using GPUArrays, Test, Pkg
22

33
include("testsuite.jl")
44

55
@testset "JLArray" begin
6-
include("jlarray.jl")
7-
using .JLArrays
6+
# install the JLArrays subpackage in a temporary environment
7+
old_project = Base.active_project()
8+
Pkg.activate(; temp=true)
9+
Pkg.develop(path=joinpath(dirname(@__DIR__), "lib", "JLArrays"))
10+
11+
using JLArrays
812

913
jl([1])
1014

1115
TestSuite.test(JLArray)
16+
17+
Pkg.activate(old_project)
1218
end
1319

1420
@testset "Array" begin

0 commit comments

Comments
 (0)