Skip to content

Commit

Permalink
Optimize precompilation during runtests (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
ytdHuang authored Nov 5, 2024
2 parents c63e627 + 00c6a92 commit 2adcd8a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
- "src/**"
- "ext/QuantumToolboxCUDAExt.jl"
- "test/runtests.jl"
- "test/ext-test/cuda_ext.jl"
- "test/ext-test/gpu/**"
- "Project.toml"
target: ".buildkite/CUDA_Ext.yml"
agents:
Expand Down
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
QuantumToolboxCUDAExt = "CUDA"

[compat]
Aqua = "0.8"
ArrayInterface = "6, 7"
CUDA = "5"
DiffEqBase = "6"
Expand All @@ -42,6 +43,7 @@ Distributed = "1"
FFTW = "1.5"
Graphs = "1.7"
IncompleteLU = "0.2"
JET = "0.9"
LinearAlgebra = "1"
LinearSolve = "2"
OrdinaryDiffEqCore = "1"
Expand All @@ -59,8 +61,9 @@ Test = "1"
julia = "1.10"

[extras]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Aqua", "JET", "Test"]
2 changes: 0 additions & 2 deletions test/core-test/code_quality.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Aqua, JET

@testset "Code quality" verbose = true begin
@testset "Aqua.jl" begin
Aqua.test_all(QuantumToolbox; ambiguities = false, unbound_args = false)
Expand Down
6 changes: 6 additions & 0 deletions test/ext-test/gpu/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"

[compat]
CUDA = "5"
7 changes: 0 additions & 7 deletions test/ext-test/cuda_ext.jl → test/ext-test/gpu/cuda_ext.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
using CUDA
using CUDA.CUSPARSE
CUDA.allowscalar(false) # Avoid unexpected scalar indexing

QuantumToolbox.about()
CUDA.versioninfo()

@testset "CUDA Extension" verbose = true begin
ψdi = Qobj(Int64[1, 0])
ψdf = Qobj(Float64[1, 0])
Expand Down
29 changes: 21 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using Test
using Pkg
using QuantumToolbox
using QuantumToolbox: position, momentum
using Random
using SciMLOperators
import SciMLOperators: ScaledOperator

const GROUP = get(ENV, "GROUP", "All")

Expand Down Expand Up @@ -32,11 +27,18 @@ core_tests = [
]

if (GROUP == "All") || (GROUP == "Code-Quality")
Pkg.add(["Aqua", "JET"])
using QuantumToolbox
using Aqua, JET

include(joinpath(testdir, "core-test", "code_quality.jl"))
end

if (GROUP == "All") || (GROUP == "Core")
using QuantumToolbox
import QuantumToolbox: position, momentum
import Random: MersenneTwister
import SciMLOperators: MatrixOperator

QuantumToolbox.about()

for test in core_tests
Expand All @@ -45,6 +47,17 @@ if (GROUP == "All") || (GROUP == "Core")
end

if (GROUP == "CUDA_Ext")# || (GROUP == "All")
Pkg.add("CUDA")
include(joinpath(testdir, "ext-test", "cuda_ext.jl"))
Pkg.activate("ext-test/gpu")
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
Pkg.instantiate()

using QuantumToolbox
using CUDA
using CUDA.CUSPARSE
CUDA.allowscalar(false) # Avoid unexpected scalar indexing

QuantumToolbox.about()
CUDA.versioninfo()

include(joinpath(testdir, "ext-test", "gpu", "cuda_ext.jl"))
end

0 comments on commit 2adcd8a

Please sign in to comment.