From 6527f29f54d135797e62551eac0432a1e87c894d Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sat, 13 Jul 2019 07:48:55 -0400 Subject: [PATCH 1/9] add downstream GPU testing --- .gitlab-ci.yml | 78 ++++++++++++++++++++++++++++++++++++++++++ test/gpu/simple_gpu.jl | 25 ++++++++++++++ test/runtests.jl | 5 +++ 3 files changed, 108 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 test/gpu/simple_gpu.jl diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..6d56f19cf --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,78 @@ +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.build(\"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.test(\"OrdinaryDiffEq\"; coverage=true);" + only: + - master + - tags + - external + - pushes + artifacts: + untracked: true + paths: + - .julia/**/* + - julia-1.1.1/**/* + +coverage: + stage: deploy + tags: + - 'p6000' + dependencies: + - build + - test-GPU + script: + - export PATH="$(pwd)/julia-1.1.1/bin:$PATH" + - julia --project -e "using Pkg; + Pkg.add(\"Coverage\")" + - julia --project -e "using Coverage; + cl, tl = get_summary(process_folder()); + println(\"(\", cl/tl*100, \"%) covered\"); + Codecov.submit_local(process_folder(), ".")" + coverage: '/\(\d+.\d+\%\) covered/' diff --git a/test/gpu/simple_gpu.jl b/test/gpu/simple_gpu.jl new file mode 100644 index 000000000..6967fe0b4 --- /dev/null +++ b/test/gpu/simple_gpu.jl @@ -0,0 +1,25 @@ +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()) +sol = solve(prob,Rosenbrock23()) + +prob_nojac = ODEProblem(f,u0,tspan) +@test_broken sol = solve(prob_nojac,Rosenbrock23()) + +A = -rand(3,3)) +u0 = [1.0;0.0;0.0] +tspan = (0.0,100.0) +prob_nojac2 = ODEProblem(f,u0,tspan) +sol = solve(prob,Rosenbrock23(linsolve=LinSolveGPUFactorize())) diff --git a/test/runtests.jl b/test/runtests.jl index ca52f5fcf..f53f1dcf8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -39,4 +39,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 From 0701820841a61e3859671ef3b3710673dabbfbcd Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Sat, 13 Jul 2019 12:21:10 -0400 Subject: [PATCH 2/9] Update simple_gpu.jl --- test/gpu/simple_gpu.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/gpu/simple_gpu.jl b/test/gpu/simple_gpu.jl index 6967fe0b4..9f4d33a03 100644 --- a/test/gpu/simple_gpu.jl +++ b/test/gpu/simple_gpu.jl @@ -13,7 +13,7 @@ prob = ODEProblem(ff,u0,tspan) CuArrays.allowscalar(false) sol = solve(prob,Tsit5()) -sol = solve(prob,Rosenbrock23()) +@test_broken sol = solve(prob,Rosenbrock23()) prob_nojac = ODEProblem(f,u0,tspan) @test_broken sol = solve(prob_nojac,Rosenbrock23()) From 7759f15bad4b937b867486c1cf284fcb57642840 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sat, 13 Jul 2019 12:48:34 -0400 Subject: [PATCH 3/9] fix gpu tests --- test/gpu/simple_gpu.jl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/gpu/simple_gpu.jl b/test/gpu/simple_gpu.jl index 9f4d33a03..c9228eaf7 100644 --- a/test/gpu/simple_gpu.jl +++ b/test/gpu/simple_gpu.jl @@ -13,13 +13,23 @@ prob = ODEProblem(ff,u0,tspan) CuArrays.allowscalar(false) sol = solve(prob,Tsit5()) -@test_broken sol = solve(prob,Rosenbrock23()) +@test_broken solve(prob,Rosenbrock23()).retcode == :Success +solve(prob,Rosenbrock23(autodiff=false)) prob_nojac = ODEProblem(f,u0,tspan) -@test_broken sol = solve(prob_nojac,Rosenbrock23()) +@test_broken solve(prob_nojac,Rosenbrock23()).retcode == :Success +@test_broken solve(prob_nojac,Rosenbrock23(autodiff=false)).retcode == :Success -A = -rand(3,3)) +# 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_nojac2 = ODEProblem(f,u0,tspan) -sol = solve(prob,Rosenbrock23(linsolve=LinSolveGPUFactorize())) +prob_num = ODEProblem(ff2,u0,tspan) +sol = solve(prob_num,Rosenbrock23(linsolve=LinSolveGPUFactorize())) From 94d21a48aae8844e8217496c80d5cd390699e026 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sat, 13 Jul 2019 13:59:42 -0400 Subject: [PATCH 4/9] fix codecov --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d56f19cf..f82c0ab6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,5 +74,5 @@ coverage: - julia --project -e "using Coverage; cl, tl = get_summary(process_folder()); println(\"(\", cl/tl*100, \"%) covered\"); - Codecov.submit_local(process_folder(), ".")" + Codecov.submit_local(process_folder(), \".\")" coverage: '/\(\d+.\d+\%\) covered/' From da178a2f676fb191092f27b07c28bd7bd2b74c1b Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sat, 13 Jul 2019 15:01:00 -0400 Subject: [PATCH 5/9] remove GPU coverage --- .gitlab-ci.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f82c0ab6c..dfd764a8a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,20 +59,3 @@ test-GPU: paths: - .julia/**/* - julia-1.1.1/**/* - -coverage: - stage: deploy - tags: - - 'p6000' - dependencies: - - build - - test-GPU - script: - - export PATH="$(pwd)/julia-1.1.1/bin:$PATH" - - julia --project -e "using Pkg; - Pkg.add(\"Coverage\")" - - julia --project -e "using Coverage; - cl, tl = get_summary(process_folder()); - println(\"(\", cl/tl*100, \"%) covered\"); - Codecov.submit_local(process_folder(), \".\")" - coverage: '/\(\d+.\d+\%\) covered/' From c2f7ccc8a83828879bfe442000a85f58fb4bb7ca Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Tue, 16 Jul 2019 22:18:53 -0400 Subject: [PATCH 6/9] fix yml --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfd764a8a..07e0a05d5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,7 +21,7 @@ build: - julia --project -e "using Pkg; Pkg.update(); Pkg.instantiate(); - Pkg.build(\"OrdinaryDiffEq\"); + Pkg.add(\"OrdinaryDiffEq\"); pkg\"precompile\"; using OrdinaryDiffEq;" only: @@ -48,7 +48,7 @@ test-GPU: - julia -e "using InteractiveUtils; versioninfo()" - julia --project -e "using Pkg; Pkg.add(\"CuArrays\"); - Pkg.test(\"OrdinaryDiffEq\"; coverage=true);" + Pkg.test(\"DiffEqBase\"; coverage=true);" only: - master - tags From 8397aa2eb1dde1ca53ea8b809ec0f98cf5af4d4e Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Tue, 16 Jul 2019 22:31:20 -0400 Subject: [PATCH 7/9] fix test splitting --- test/runtests.jl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index f53f1dcf8..8818336f7 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") From b45e62858ea7fd60a3d9bc2295446cd53d9300c7 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Tue, 16 Jul 2019 22:36:13 -0400 Subject: [PATCH 8/9] fix test groups --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 8818336f7..25c2a274c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,7 +5,7 @@ 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 From 2158017f48235d28be70445f251d037cd02e3c8d Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Tue, 16 Jul 2019 22:41:58 -0400 Subject: [PATCH 9/9] add OrdinaryDiffEq --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 07e0a05d5..bbf468b74 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,6 +48,7 @@ test-GPU: - julia -e "using InteractiveUtils; versioninfo()" - julia --project -e "using Pkg; Pkg.add(\"CuArrays\"); + Pkg.add(\"OrdinaryDiffEq\"); Pkg.test(\"DiffEqBase\"; coverage=true);" only: - master