Skip to content

Commit 2911d51

Browse files
authored
Merge pull request #163 from FourierFlows/UpgradeCuArrays
Upgrade CuArrays
2 parents 8609048 + 27bcf29 commit 2911d51

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ julia:1.0:
1717
- nvidia
1818

1919
# the "primary" target, where we require a new GPU to make sure all tests are run
20-
julia:1.3:
20+
julia:1.4:
2121
image: juliagpu/cuda:10.1-cudnn7-cutensor1-devel-ubuntu18.04
2222
extends:
23-
- .julia:1.3
23+
- .julia:1.4
2424
- .test
2525
tags:
2626
- nvidia
@@ -31,5 +31,5 @@ julia:1.3:
3131
# other tasks
3232
coverage:
3333
extends:
34-
- .julia:1.3
34+
- .julia:1.4
3535
- .coverage

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ os:
66

77
julia:
88
- 1.0
9-
- 1.3
9+
- 1.4
1010
- nightly
1111

1212
matrix:
@@ -20,7 +20,7 @@ matrix:
2020
jobs:
2121
include:
2222
- stage: "Documentation"
23-
julia: 1.3
23+
julia: 1.4
2424
os: linux
2525
script:
2626
- julia --project=docs/ -e 'using Pkg; Pkg.instantiate();

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2424

2525
[compat]
2626
AbstractFFTs = "^0.5"
27-
CUDAapi = "^2, 4.0"
28-
CuArrays = "^1"
27+
CUDAapi = "^2, ^4"
28+
CuArrays = "^1, ^2"
2929
FFTW = "^1"
3030
Interpolations = "^0.12"
3131
JLD2 = "^0.1"

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
environment:
22
matrix:
33
- julia_version: 1.0
4-
- julia_version: 1.3
4+
- julia_version: 1.4
55
- julia_version: nightly
66

77
platform:

test/runtests.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ for dev in devices
4949
# Test 1D grid
5050
g₁ = OneDGrid(dev, nx, Lx)
5151
@test testnx(g₁, nx)
52-
@test testdx(g₁)
52+
@test testdx(dev, g₁)
5353
@test testdk(g₁)
5454
@test testx(g₁)
5555
@test testk(g₁)
@@ -61,16 +61,16 @@ for dev in devices
6161
g₂ = TwoDGrid(dev, nx, Lx, ny, Ly)
6262
@test testnx(g₂, nx)
6363
@test testny(g₂, ny)
64-
@test testdx(g₂)
65-
@test testdy(g₂)
64+
@test testdx(dev, g₂)
65+
@test testdy(dev, g₂)
6666
@test testdk(g₂)
6767
@test testdl(g₂)
6868
@test testx(g₂)
6969
@test testy(g₂)
7070
@test testk(g₂)
7171
@test testkr(g₂)
7272
@test testl(g₂)
73-
@test testgridpoints(g₂)
73+
@test testgridpoints(dev, g₂)
7474
@test testdealias(g₂)
7575
@test testmakefilter(dev, g₂)
7676

@@ -79,9 +79,9 @@ for dev in devices
7979
@test testnx(g₃, nx)
8080
@test testny(g₃, ny)
8181
@test testnz(g₃, nz)
82-
@test testdx(g₃)
83-
@test testdy(g₃)
84-
@test testdz(g₃)
82+
@test testdx(dev, g₃)
83+
@test testdy(dev, g₃)
84+
@test testdz(dev, g₃)
8585
@test testdk(g₃)
8686
@test testdl(g₃)
8787
@test testdm(g₃)
@@ -92,7 +92,7 @@ for dev in devices
9292
@test testkr(g₃)
9393
@test testl(g₃)
9494
@test testm(g₃)
95-
@test testgridpoints(g₃)
95+
@test testgridpoints(dev, g₃)
9696
@test testdealias(g₃)
9797
@test testmakefilter(dev, g₃)
9898

test/test_grid.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ testny(g, ny) = isapprox(g.ny, ny)
33
testnz(g, nz) = isapprox(g.nz, nz)
44

55
# Physical grid tests
6-
function testdx(g::AbstractGrid{T}) where {T, Ta}
6+
function testdx(dev, g::Union{OneDGrid{T}, TwoDGrid{T}, ThreeDGrid{T}}) where T
77
dxgrid = @. g.x[2:end] - g.x[1:end-1]
8-
dxones = g.dx*ones(T, size(dxgrid))
8+
dxones = ArrayType(dev)(g.dx*ones(T, size(dxgrid)))
99
isapprox(dxgrid, dxones)
1010
end
1111

12-
function testdy(g::AbstractGrid{T, Ta}) where {T, Ta}
12+
function testdy(dev, g::Union{TwoDGrid{T}, ThreeDGrid{T}}) where T
1313
dygrid = @. g.y[2:end] - g.y[1:end-1]
14-
dyones = g.dy*ones(T, size(dygrid))
14+
dyones = ArrayType(dev)(g.dy*ones(T, size(dygrid)))
1515
isapprox(dygrid, dyones)
1616
end
1717

18-
function testdz(g::AbstractGrid{T, Ta}) where {T, Ta}
18+
function testdz(dev, g::ThreeDGrid{T}) where T
1919
dzgrid = @. g.z[2:end] - g.z[1:end-1]
20-
dzones = g.dz*ones(T, size(dzgrid))
20+
dzones = ArrayType(dev)(g.dz*ones(T, size(dzgrid)))
2121
isapprox(dzgrid, dzones)
2222
end
2323

@@ -47,23 +47,23 @@ testl(g::Union{TwoDGrid, ThreeDGrid}) = testwavenumberalignment(g.l, g.ny)
4747
testm(g::ThreeDGrid) = testwavenumberalignment(g.m, g.nz)
4848
testkr(g) = isapprox(cat(g.k[1:g.nkr-1], abs(g.k[g.nkr]), dims=1), g.kr)
4949

50-
function testgridpoints(g::TwoDGrid{T, Ta}) where {T, Ta}
50+
function testgridpoints(dev::Device, g::TwoDGrid{T}) where T
5151
X, Y = gridpoints(g)
5252
dXgrid = @. X[2:end, :] - X[1:end-1, :]
5353
dYgrid = @. Y[:, 2:end] - Y[:, 1:end-1]
54-
dXones = g.dx*ones(T, size(dXgrid))
55-
dYones = g.dy*ones(T, size(dYgrid))
54+
dXones = ArrayType(dev)(g.dx*ones(T, size(dXgrid)))
55+
dYones = ArrayType(dev)(g.dy*ones(T, size(dYgrid)))
5656
isapprox(dXgrid, dXones) && isapprox(dYgrid, dYones)
5757
end
5858

59-
function testgridpoints(g::ThreeDGrid{T, Ta}) where {T, Ta}
59+
function testgridpoints(dev::Device, g::ThreeDGrid{T}) where T
6060
X, Y, Z = gridpoints(g)
6161
dXgrid = @. X[2:end, :, :] - X[1:end-1, :, :]
6262
dYgrid = @. Y[:, 2:end, :] - Y[:, 1:end-1, :]
6363
dZgrid = @. Z[:, :, 2:end] - Z[:, :, 1:end-1]
64-
dXones = g.dx*ones(T, size(dXgrid))
65-
dYones = g.dy*ones(T, size(dYgrid))
66-
dZones = g.dz*ones(T, size(dZgrid))
64+
dXones = ArrayType(dev)(g.dx*ones(T, size(dXgrid)))
65+
dYones = ArrayType(dev)(g.dy*ones(T, size(dYgrid)))
66+
dZones = ArrayType(dev)(g.dz*ones(T, size(dZgrid)))
6767
isapprox(dXgrid, dXones) && isapprox(dYgrid, dYones) && isapprox(dZgrid, dZones)
6868
end
6969

0 commit comments

Comments
 (0)