Skip to content

Commit 3f2eaab

Browse files
authored
Avoid scalar indexing in runtests and fix buildkite pipeline (qutip#222)
* fix buildkite pipeline * fix typos * fix whitespaces in buildkite config * fix whitespaces in buildkite config * fix typo * fix `CUDA` runtests
1 parent 13b0413 commit 3f2eaab

File tree

5 files changed

+48
-21
lines changed

5 files changed

+48
-21
lines changed

.buildkite/CUDA_Ext.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
steps:
2+
- label: "CUDA Julia {{matrix.version}}"
3+
matrix:
4+
setup:
5+
version:
6+
- "1.10" # oldest
7+
#- "1" # latest
8+
plugins:
9+
- JuliaCI/julia#v1:
10+
version: "{{matrix.version}}"
11+
- JuliaCI/julia-test#v1:
12+
test_args: "--quickfail"
13+
- JuliaCI/julia-coverage#v1:
14+
codecov: true
15+
dirs:
16+
- src
17+
- ext
18+
agents:
19+
queue: "juliagpu"
20+
cuda: "*"
21+
env:
22+
GROUP: "CUDA_Ext"
23+
SECRET_CODECOV_TOKEN: "ZfhQu/IcRLqNyZ//ZNs5sjBPaV76IHfU5gui52Qn+Rp8tOurukqgScuyDt+3HQ4R0hJYBw1/Nqg6jmBsvWSc9NEUx8kGsUJFHfN3no0+b+PFxA8oJkWc9EpyIsjht5ZIjlsFWR3f0DpPqMEle/QyWOPcal63CChXR8oAoR+Fz1Bh8GkokLlnC8F9Ugp9xBlu401GCbyZhvLTZnNIgK5yy9q8HBJnBg1cPOhI81J6JvYpEmcIofEzFV/qkfpTUPclu43WNoFX2DZPzbxilf3fsAd5/+nRkRfkNML8KiN4mnmjHxPPbuY8F5zC/PS5ybXtDpfvaMQc01WApXCkZk0ZAQ==;U2FsdGVkX1+eDT7dqCME5+Ox5i8GvWRTQbwiP/VYjapThDbxXFDeSSIC6Opmon+M8go22Bun3bat6Fzie65ang=="
24+
timeout_in_minutes: 60
25+
if: |
26+
// Don't run Buildkite if the commit message includes the text [skip ci], [ci skip], or [no ci]
27+
// Don't run Buildkite for PR draft
28+
// Only run Buildkite when new commits and PR are made to main branch
29+
build.message !~ /\[skip ci\]/ &&
30+
build.message !~ /\[ci skip\]/ &&
31+
build.message !~ /\[no ci\]/ &&
32+
!build.pull_request.draft &&
33+
(build.branch =~ /main/ || build.pull_request.base_branch =~ /main/)

.buildkite/pipeline.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1+
# see: https://github.com/staticfloat/forerunner-buildkite-plugin
12
steps:
2-
- label: "QuantumToolboxCUDAExt"
3+
- label: ":runner: Dynamically launch pipelines"
34
plugins:
4-
- JuliaCI/julia#v1:
5-
version: "1"
6-
- JuliaCI/julia-test#v1:
7-
test_args: "--quickfail"
8-
- JuliaCI/julia-coverage#v1:
9-
dirs:
10-
- src
11-
- ext
5+
- staticfloat/forerunner:
6+
watch:
7+
- ".buildkite/pipeline.yml"
8+
- ".buildkite/CUDA_Ext.yml"
9+
- "src/**"
10+
- "ext/QuantumToolboxCUDAExt.jl"
11+
- "test/runtests.jl"
12+
- "test/cuda_ext.jl"
13+
- "Project.toml"
14+
target: ".buildkite/CUDA_Ext.yml"
1215
agents:
1316
queue: "juliagpu"
14-
cuda: "*"
15-
env:
16-
GROUP: "CUDA_Ext"
17-
SECRET_CODECOV_TOKEN: "ZfhQu/IcRLqNyZ//ZNs5sjBPaV76IHfU5gui52Qn+Rp8tOurukqgScuyDt+3HQ4R0hJYBw1/Nqg6jmBsvWSc9NEUx8kGsUJFHfN3no0+b+PFxA8oJkWc9EpyIsjht5ZIjlsFWR3f0DpPqMEle/QyWOPcal63CChXR8oAoR+Fz1Bh8GkokLlnC8F9Ugp9xBlu401GCbyZhvLTZnNIgK5yy9q8HBJnBg1cPOhI81J6JvYpEmcIofEzFV/qkfpTUPclu43WNoFX2DZPzbxilf3fsAd5/+nRkRfkNML8KiN4mnmjHxPPbuY8F5zC/PS5ybXtDpfvaMQc01WApXCkZk0ZAQ==;U2FsdGVkX1+eDT7dqCME5+Ox5i8GvWRTQbwiP/VYjapThDbxXFDeSSIC6Opmon+M8go22Bun3bat6Fzie65ang=="
18-
timeout_in_minutes: 60
19-
if: |
20-
// Don't run Buildkite if the commit message includes the text [skip tests]
21-
// Don't run Buildkite for PR draft
22-
// Only run Buildkite when new commits and PR are made to main branch
23-
build.message !~ /\[skip tests\]/ &&
24-
!build.pull_request.draft &&
25-
(build.branch =~ /main/ || build.pull_request.base_branch =~ /main/)

docs/src/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ We can easily pass the computation to the GPU, by simply passing all the `Qobj`s
103103
```julia
104104
using QuantumToolbox
105105
using CUDA
106+
CUDA.allowscalar(false) # Avoid unexpected scalar indexing
106107

107108
a_gpu = cu(destroy(N)) # The only difference in the code is the cu() function
108109

docs/src/users_guide/extensions/cuda.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This extension will be automatically loaded if user imports both `QuantumToolbox
1313
using QuantumToolbox
1414
using CUDA
1515
using CUDA.CUSPARSE
16+
CUDA.allowscalar(false) # Avoid unexpected scalar indexing
1617
```
1718

1819
We wrapped several functions in `CUDA` and `CUDA.CUSPARSE` in order to not only converting `QuantumObject.data` into GPU arrays, but also changing the element type and word size (`32` and `64`) since some of the GPUs perform better in `32`-bit. The functions are listed as follows (where input `A` is a [`QuantumObject`](@ref)):

test/cuda_ext.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CUDA
22
using CUDA.CUSPARSE
3+
CUDA.allowscalar(false) # Avoid unexpected scalar indexing
34

45
QuantumToolbox.about()
56
CUDA.versioninfo()

0 commit comments

Comments
 (0)