Skip to content

Commit

Permalink
Merge pull request #292 from JuliaDiffEq/gpu
Browse files Browse the repository at this point in the history
add downstream GPU testing
  • Loading branch information
ChrisRackauckas authored Jul 17, 2019
2 parents 68fd464 + 2158017 commit a61f04b
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 10 deletions.
62 changes: 62 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
image: "julia:1"

variables:
JULIA_DEPOT_PATH: "$CI_PROJECT_DIR/.julia/"
JULIA_NUM_THREADS: '8'

cache:
paths:
- .julia/

build:
stage: build
tags:
- 'p6000'
script:
- curl https://julialang-s3.julialang.org/bin/linux/x64/1.1/julia-1.1.1-linux-x86_64.tar.gz -o julia.tar.gz
- unp julia.tar.gz
- export PATH="$(pwd)/julia-1.1.1/bin:$PATH"
- julia -e "using InteractiveUtils;
versioninfo()"
- julia --project -e "using Pkg;
Pkg.update();
Pkg.instantiate();
Pkg.add(\"OrdinaryDiffEq\");
pkg\"precompile\";
using OrdinaryDiffEq;"
only:
- master
- tags
- external
- pushes
artifacts:
untracked: true
paths:
- .julia/**/*
- julia-1.1.1/**/*

test-GPU:
stage: test
tags:
- 'p6000'
dependencies:
- build
variables:
GROUP: "GPU"
script:
- export PATH="$(pwd)/julia-1.1.1/bin:$PATH"
- julia -e "using InteractiveUtils;
versioninfo()"
- julia --project -e "using Pkg; Pkg.add(\"CuArrays\");
Pkg.add(\"OrdinaryDiffEq\");
Pkg.test(\"DiffEqBase\"; coverage=true);"
only:
- master
- tags
- external
- pushes
artifacts:
untracked: true
paths:
- .julia/**/*
- julia-1.1.1/**/*
35 changes: 35 additions & 0 deletions test/gpu/simple_gpu.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using OrdinaryDiffEq, CuArrays, LinearAlgebra, Test
function f(du,u,p,t)
mul!(du,A,u)
end
function jac(J,u,p,t)
J .= A
end
ff = ODEFunction(f,jac=jac)
A = cu(-rand(3,3))
u0 = cu([1.0;0.0;0.0])
tspan = (0.0,100.0)
prob = ODEProblem(ff,u0,tspan)

CuArrays.allowscalar(false)
sol = solve(prob,Tsit5())
@test_broken solve(prob,Rosenbrock23()).retcode == :Success
solve(prob,Rosenbrock23(autodiff=false))

prob_nojac = ODEProblem(f,u0,tspan)
@test_broken solve(prob_nojac,Rosenbrock23()).retcode == :Success
@test_broken solve(prob_nojac,Rosenbrock23(autodiff=false)).retcode == :Success

# Test auto-offload
_A = -rand(3,3)
function f2(du,u,p,t)
mul!(du,_A,u)
end
function jac2(J,u,p,t)
J .= _A
end
ff2 = ODEFunction(f2,jac=jac2)
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)
prob_num = ODEProblem(ff2,u0,tspan)
sol = solve(prob_num,Rosenbrock23(linsolve=LinSolveGPUFactorize()))
20 changes: 10 additions & 10 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using SafeTestsets

if haskey(ENV,"GROUP")
group = ENV["GROUP"]
else
group = "All"
end

is_APPVEYOR = ( Sys.iswindows() && haskey(ENV,"APPVEYOR") )
is_TRAVIS = haskey(ENV,"TRAVIS")
const GROUP = get(ENV, "GROUP", "All")
const is_APPVEYOR = ( Sys.iswindows() && haskey(ENV,"APPVEYOR") )
const is_TRAVIS = haskey(ENV,"TRAVIS")

@time begin
if group == "All" || group == "Core"
if GROUP == "All" || GROUP == "Core"
@time @safetestset "Fast Broadcast" begin include("fastbc.jl") end
@time @safetestset "Number of Parameters Calculation" begin include("numargs_test.jl") end
@time @safetestset "Data Arrays" begin include("data_array_tests.jl") end
Expand All @@ -25,7 +20,7 @@ if group == "All" || group == "Core"
@time @safetestset "Export tests" begin include("export_tests.jl") end
@time @safetestset "High Level solve Interface" begin include("high_level_solve.jl") end
end
if !is_APPVEYOR && group == "Downstream"
if !is_APPVEYOR && GROUP == "Downstream"
if is_TRAVIS
using Pkg
Pkg.add("OrdinaryDiffEq")
Expand All @@ -39,4 +34,9 @@ if !is_APPVEYOR && group == "Downstream"
@time @safetestset "Event Detection Tests" begin include("downstream/event_detection_tests.jl") end
@time @safetestset "PSOS and Energy Conservation Event Detection" begin include("downstream/psos_and_energy_conservation.jl") end
end

if !is_APPVEYOR && GROUP == "GPU"
@time @safetestset "Simple GPU" begin include("gpu/simple_gpu.jl") end
end

end

0 comments on commit a61f04b

Please sign in to comment.