diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..bbf468b74 --- /dev/null +++ b/.gitlab-ci.yml @@ -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/**/* diff --git a/test/gpu/simple_gpu.jl b/test/gpu/simple_gpu.jl new file mode 100644 index 000000000..c9228eaf7 --- /dev/null +++ b/test/gpu/simple_gpu.jl @@ -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())) diff --git a/test/runtests.jl b/test/runtests.jl index ca52f5fcf..25c2a274c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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") @@ -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