Skip to content

Commit

Permalink
adds GPU functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed Jan 3, 2020
1 parent 63941a5 commit 9cf525e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
5 changes: 4 additions & 1 deletion Project.toml
Expand Up @@ -8,6 +8,8 @@ version = "0.1.0"
versions = ["0.1.0"]

[deps]
CUDAapi = "3895d2a7-ec45-59b8-82bb-cfc6a382f9b3"
CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FourierFlows = "2aec4490-903f-5c70-9b11-9bed06a700e1"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Expand All @@ -23,7 +25,8 @@ FourierFlows = "≥ 0.3.0"
julia = "≥ 1.0.0"

[extras]
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Test", "Coverage"]
2 changes: 2 additions & 0 deletions src/PassiveTracerFlows.jl
@@ -1,5 +1,7 @@
module PassiveTracerFlows

using FourierFlows

include("traceradvdiff.jl")

end # module
44 changes: 28 additions & 16 deletions test/runtests.jl
Expand Up @@ -10,28 +10,40 @@ using
import # use 'import' rather than 'using' for submodules to keep namespace clean
PassiveTracerFlows.TracerAdvDiff

# the devices on which tests will run
devices = (CPU(),)
@has_cuda devices = (CPU(), GPU())
@has_cuda using CuArrays

const rtol_traceradvdiff = 1e-12 # tolerance for rtol_traceradvdiff tests

# Run tests
testtime = @elapsed begin

for dev in devices

println("testing on "*string(typeof(dev)))

@testset "TracerAdvDiff" begin
include("test_traceradvdiff.jl")
@testset "TracerAdvDiff" begin
include("test_traceradvdiff.jl")

@test test_noflow()

stepper = "RK4"
dt, nsteps = 1e-2, 40
@test test_constvel(stepper, dt, nsteps)
dt, tfinal = 0.002, 0.1
@test test_timedependentvel(stepper, dt, tfinal)
dt, tfinal = 0.005, 0.1
@test test_diffusion(stepper, dt, tfinal; steadyflow=true)
dt, tfinal = 0.005, 0.1
@test test_diffusion(stepper, dt, tfinal; steadyflow=false)
dt, tfinal = 0.005, 0.1
@test test_hyperdiffusion(stepper, dt, tfinal)
@test test_noflow()

stepper = "RK4"
dt, nsteps = 1e-2, 40
@test test_constvel(stepper, dt, nsteps)
dt, tfinal = 0.002, 0.1
@test test_timedependentvel(stepper, dt, tfinal)
dt, tfinal = 0.005, 0.1
@test test_diffusion(stepper, dt, tfinal; steadyflow=true)
dt, tfinal = 0.005, 0.1
@test test_diffusion(stepper, dt, tfinal; steadyflow=false)
dt, tfinal = 0.005, 0.1
@test test_hyperdiffusion(stepper, dt, tfinal)
end

end

end
end #time

println("Total test time: ", testtime)

0 comments on commit 9cf525e

Please sign in to comment.