diff --git a/Project.toml b/Project.toml index 53bac9a5..eb72b463 100644 --- a/Project.toml +++ b/Project.toml @@ -16,6 +16,7 @@ MatrixAlgebraKitChainRulesCoreExt = "ChainRulesCore" Aqua = "0.6, 0.7, 0.8" ChainRulesCore = "1" ChainRulesTestUtils = "1" +CUDA = "5" JET = "0.9" LinearAlgebra = "1" SafeTestsets = "0.1" @@ -27,6 +28,7 @@ julia = "1.10" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" @@ -36,4 +38,5 @@ TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["Aqua", "JET", "SafeTestsets", "Test", "TestExtras","ChainRulesCore", "ChainRulesTestUtils", "StableRNGs", "Zygote"] +test = ["Aqua", "JET", "SafeTestsets", "CUDA", "Test", "TestExtras", "ChainRulesCore", + "ChainRulesTestUtils", "StableRNGs", "Zygote"] diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 00000000..c677086f --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,16 @@ +FROM nvidia/cuda:12.0.0-devel-ubuntu20.04 + +# julia +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive \ + apt-get install --yes --no-install-recommends \ + # basic stuff + curl ca-certificates \ + libcutensor-dev \ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ARG JULIA=1.6 +RUN curl -s -L https://julialang-s3.julialang.org/bin/linux/x64/${JULIA}/julia-${JULIA}-latest-linux-x86_64.tar.gz | \ + tar -C /usr/local -x -z --strip-components=1 -f - diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile new file mode 100644 index 00000000..1c37edce --- /dev/null +++ b/ci/Jenkinsfile @@ -0,0 +1,61 @@ +pipeline { + agent none + options { + disableConcurrentBuilds() + buildDiscarder(logRotator(numToKeepStr: '8', daysToKeepStr: '20')) + } + stages { + stage('GPU Testing') { + parallel { + stage('MatrixAlgebraKitCUDAExt julia-lts') { + options { + timeout(time: 45, unit: 'MINUTES') + } + agent { + dockerfile { + label 'gpu&&v100' + filename 'Dockerfile' + dir 'jenkins' + additionalBuildArgs '--build-arg JULIA=1.10' + args '--gpus "device=1"' + } + } + environment { + HOME = pwd(tmp:true) + OMP_NUM_THREADS = 4 + JULIA_NUM_THREADS = 4 + } + steps { + sh ''' + julia --project=. -e 'using Pkg: Pkg; Pkg.test("MatrixAlgebraKit"; test_args=["--group=cuda"])' + ''' + } + } + stage('MatrixAlgebraKitCUDAExt julia-1') { + options { + timeout(time: 45, unit: 'MINUTES') + } + agent { + dockerfile { + label 'gpu&&v100' + filename 'Dockerfile' + dir 'jenkins' + additionalBuildArgs '--build-arg JULIA=1.11' + args '--gpus "device=1"' + } + } + environment { + HOME = pwd(tmp:true) + OMP_NUM_THREADS = 4 + JULIA_NUM_THREADS = 4 + } + steps { + sh ''' + julia --project=. -e 'using Pkg: Pkg; Pkg.test("MatrixAlgebraKit"; test_args=["--group=cuda"])' + ''' + } + } + } + } + } +} diff --git a/test/cuda.jl b/test/cuda.jl new file mode 100644 index 00000000..171d42f5 --- /dev/null +++ b/test/cuda.jl @@ -0,0 +1,3 @@ +println("hello") +@test true +using CUDA diff --git a/test/runtests.jl b/test/runtests.jl index 7ad7c216..aa91641c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,43 +1,64 @@ using SafeTestsets -@safetestset "Truncate" begin - include("truncate.jl") -end -@safetestset "QR / LQ Decomposition" begin - include("qr.jl") - include("lq.jl") -end -@safetestset "Singular Value Decomposition" begin - include("svd.jl") -end -@safetestset "Hermitian Eigenvalue Decomposition" begin - include("eigh.jl") -end -@safetestset "General Eigenvalue Decomposition" begin - include("eig.jl") -end -@safetestset "Schur Decomposition" begin - include("schur.jl") -end -@safetestset "Polar Decomposition" begin - include("polar.jl") -end -@safetestset "Image and Null Space" begin - include("orthnull.jl") -end -@safetestset "ChainRules" begin - include("chainrules.jl") +const pat = r"(?:--group=)(\w+)" +arg_id = findfirst(contains(pat), ARGS) +const GROUP = if isnothing(arg_id) + uppercase(get(ENV, "GROUP", "ALL")) +else + uppercase(only(match(pat, ARGS[arg_id]).captures)) end -@safetestset "MatrixAlgebraKit.jl" begin - @safetestset "Code quality (Aqua.jl)" begin - using MatrixAlgebraKit - using Aqua - Aqua.test_all(MatrixAlgebraKit) +@time begin + if GROUP == "ALL" || GROUP == "DECOMPOSITIONS" + @safetestset "Truncate" begin + include("truncate.jl") + end + @safetestset "QR / LQ Decomposition" begin + include("qr.jl") + include("lq.jl") + end + @safetestset "Singular Value Decomposition" begin + include("svd.jl") + end + @safetestset "Hermitian Eigenvalue Decomposition" begin + include("eigh.jl") + end + @safetestset "General Eigenvalue Decomposition" begin + include("eig.jl") + end + @safetestset "Schur Decomposition" begin + include("schur.jl") + end + @safetestset "Polar Decomposition" begin + include("polar.jl") + end + @safetestset "Image and Null Space" begin + include("orthnull.jl") + end + end + + if GROUP == "ALL" || GROUP == "ChainRules" + @safetestset "ChainRules" begin + include("chainrules.jl") + end end - @safetestset "Code linting (JET.jl)" begin - using MatrixAlgebraKit - using JET - JET.test_package(MatrixAlgebraKit; target_defined_modules=true) + + if GROUP == "ALL" || GROUP == "CUDA" + @safetestset "CUDA" begin + include("cuda.jl") + end + end + + if GROUP == "ALL" || GROUP == "UTILITY" + @safetestset "Code quality (Aqua.jl)" begin + using MatrixAlgebraKit + using Aqua + Aqua.test_all(MatrixAlgebraKit) + end + @safetestset "Code linting (JET.jl)" begin + using MatrixAlgebraKit + using JET + JET.test_package(MatrixAlgebraKit; target_defined_modules=true) + end end end