Skip to content

Commit 2adcd8a

Browse files
authored
Optimize precompilation during runtests (#284)
2 parents c63e627 + 00c6a92 commit 2adcd8a

File tree

6 files changed

+33
-20
lines changed

6 files changed

+33
-20
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ steps:
99
- "src/**"
1010
- "ext/QuantumToolboxCUDAExt.jl"
1111
- "test/runtests.jl"
12-
- "test/ext-test/cuda_ext.jl"
12+
- "test/ext-test/gpu/**"
1313
- "Project.toml"
1414
target: ".buildkite/CUDA_Ext.yml"
1515
agents:

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
3333
QuantumToolboxCUDAExt = "CUDA"
3434

3535
[compat]
36+
Aqua = "0.8"
3637
ArrayInterface = "6, 7"
3738
CUDA = "5"
3839
DiffEqBase = "6"
@@ -42,6 +43,7 @@ Distributed = "1"
4243
FFTW = "1.5"
4344
Graphs = "1.7"
4445
IncompleteLU = "0.2"
46+
JET = "0.9"
4547
LinearAlgebra = "1"
4648
LinearSolve = "2"
4749
OrdinaryDiffEqCore = "1"
@@ -59,8 +61,9 @@ Test = "1"
5961
julia = "1.10"
6062

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

6568
[targets]
66-
test = ["Test"]
69+
test = ["Aqua", "JET", "Test"]

test/core-test/code_quality.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Aqua, JET
2-
31
@testset "Code quality" verbose = true begin
42
@testset "Aqua.jl" begin
53
Aqua.test_all(QuantumToolbox; ambiguities = false, unbound_args = false)

test/ext-test/gpu/Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[deps]
2+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
3+
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
4+
5+
[compat]
6+
CUDA = "5"

test/ext-test/cuda_ext.jl renamed to test/ext-test/gpu/cuda_ext.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
using CUDA
2-
using CUDA.CUSPARSE
3-
CUDA.allowscalar(false) # Avoid unexpected scalar indexing
4-
5-
QuantumToolbox.about()
6-
CUDA.versioninfo()
7-
81
@testset "CUDA Extension" verbose = true begin
92
ψdi = Qobj(Int64[1, 0])
103
ψdf = Qobj(Float64[1, 0])

test/runtests.jl

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
using Test
22
using Pkg
3-
using QuantumToolbox
4-
using QuantumToolbox: position, momentum
5-
using Random
6-
using SciMLOperators
7-
import SciMLOperators: ScaledOperator
83

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

@@ -32,11 +27,18 @@ core_tests = [
3227
]
3328

3429
if (GROUP == "All") || (GROUP == "Code-Quality")
35-
Pkg.add(["Aqua", "JET"])
30+
using QuantumToolbox
31+
using Aqua, JET
32+
3633
include(joinpath(testdir, "core-test", "code_quality.jl"))
3734
end
3835

3936
if (GROUP == "All") || (GROUP == "Core")
37+
using QuantumToolbox
38+
import QuantumToolbox: position, momentum
39+
import Random: MersenneTwister
40+
import SciMLOperators: MatrixOperator
41+
4042
QuantumToolbox.about()
4143

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

4749
if (GROUP == "CUDA_Ext")# || (GROUP == "All")
48-
Pkg.add("CUDA")
49-
include(joinpath(testdir, "ext-test", "cuda_ext.jl"))
50+
Pkg.activate("ext-test/gpu")
51+
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
52+
Pkg.instantiate()
53+
54+
using QuantumToolbox
55+
using CUDA
56+
using CUDA.CUSPARSE
57+
CUDA.allowscalar(false) # Avoid unexpected scalar indexing
58+
59+
QuantumToolbox.about()
60+
CUDA.versioninfo()
61+
62+
include(joinpath(testdir, "ext-test", "gpu", "cuda_ext.jl"))
5063
end

0 commit comments

Comments
 (0)