Skip to content

Commit

Permalink
Avoid scalar indexing in runtests and fix buildkite pipeline (#222)
Browse files Browse the repository at this point in the history
* fix buildkite pipeline

* fix typos

* fix whitespaces in buildkite config

* fix whitespaces in buildkite config

* fix typo

* fix `CUDA` runtests
  • Loading branch information
ytdHuang authored Sep 11, 2024
1 parent 13b0413 commit 3f2eaab
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 21 deletions.
33 changes: 33 additions & 0 deletions .buildkite/CUDA_Ext.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
steps:
- label: "CUDA Julia {{matrix.version}}"
matrix:
setup:
version:
- "1.10" # oldest
#- "1" # latest
plugins:
- JuliaCI/julia#v1:
version: "{{matrix.version}}"
- JuliaCI/julia-test#v1:
test_args: "--quickfail"
- JuliaCI/julia-coverage#v1:
codecov: true
dirs:
- src
- ext
agents:
queue: "juliagpu"
cuda: "*"
env:
GROUP: "CUDA_Ext"
SECRET_CODECOV_TOKEN: "ZfhQu/IcRLqNyZ//ZNs5sjBPaV76IHfU5gui52Qn+Rp8tOurukqgScuyDt+3HQ4R0hJYBw1/Nqg6jmBsvWSc9NEUx8kGsUJFHfN3no0+b+PFxA8oJkWc9EpyIsjht5ZIjlsFWR3f0DpPqMEle/QyWOPcal63CChXR8oAoR+Fz1Bh8GkokLlnC8F9Ugp9xBlu401GCbyZhvLTZnNIgK5yy9q8HBJnBg1cPOhI81J6JvYpEmcIofEzFV/qkfpTUPclu43WNoFX2DZPzbxilf3fsAd5/+nRkRfkNML8KiN4mnmjHxPPbuY8F5zC/PS5ybXtDpfvaMQc01WApXCkZk0ZAQ==;U2FsdGVkX1+eDT7dqCME5+Ox5i8GvWRTQbwiP/VYjapThDbxXFDeSSIC6Opmon+M8go22Bun3bat6Fzie65ang=="
timeout_in_minutes: 60
if: |
// Don't run Buildkite if the commit message includes the text [skip ci], [ci skip], or [no ci]
// Don't run Buildkite for PR draft
// Only run Buildkite when new commits and PR are made to main branch
build.message !~ /\[skip ci\]/ &&
build.message !~ /\[ci skip\]/ &&
build.message !~ /\[no ci\]/ &&
!build.pull_request.draft &&
(build.branch =~ /main/ || build.pull_request.base_branch =~ /main/)
33 changes: 12 additions & 21 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
# see: https://github.com/staticfloat/forerunner-buildkite-plugin
steps:
- label: "QuantumToolboxCUDAExt"
- label: ":runner: Dynamically launch pipelines"
plugins:
- JuliaCI/julia#v1:
version: "1"
- JuliaCI/julia-test#v1:
test_args: "--quickfail"
- JuliaCI/julia-coverage#v1:
dirs:
- src
- ext
- staticfloat/forerunner:
watch:
- ".buildkite/pipeline.yml"
- ".buildkite/CUDA_Ext.yml"
- "src/**"
- "ext/QuantumToolboxCUDAExt.jl"
- "test/runtests.jl"
- "test/cuda_ext.jl"
- "Project.toml"
target: ".buildkite/CUDA_Ext.yml"
agents:
queue: "juliagpu"
cuda: "*"
env:
GROUP: "CUDA_Ext"
SECRET_CODECOV_TOKEN: "ZfhQu/IcRLqNyZ//ZNs5sjBPaV76IHfU5gui52Qn+Rp8tOurukqgScuyDt+3HQ4R0hJYBw1/Nqg6jmBsvWSc9NEUx8kGsUJFHfN3no0+b+PFxA8oJkWc9EpyIsjht5ZIjlsFWR3f0DpPqMEle/QyWOPcal63CChXR8oAoR+Fz1Bh8GkokLlnC8F9Ugp9xBlu401GCbyZhvLTZnNIgK5yy9q8HBJnBg1cPOhI81J6JvYpEmcIofEzFV/qkfpTUPclu43WNoFX2DZPzbxilf3fsAd5/+nRkRfkNML8KiN4mnmjHxPPbuY8F5zC/PS5ybXtDpfvaMQc01WApXCkZk0ZAQ==;U2FsdGVkX1+eDT7dqCME5+Ox5i8GvWRTQbwiP/VYjapThDbxXFDeSSIC6Opmon+M8go22Bun3bat6Fzie65ang=="
timeout_in_minutes: 60
if: |
// Don't run Buildkite if the commit message includes the text [skip tests]
// Don't run Buildkite for PR draft
// Only run Buildkite when new commits and PR are made to main branch
build.message !~ /\[skip tests\]/ &&
!build.pull_request.draft &&
(build.branch =~ /main/ || build.pull_request.base_branch =~ /main/)
1 change: 1 addition & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ We can easily pass the computation to the GPU, by simply passing all the `Qobj`s
```julia
using QuantumToolbox
using CUDA
CUDA.allowscalar(false) # Avoid unexpected scalar indexing

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

Expand Down
1 change: 1 addition & 0 deletions docs/src/users_guide/extensions/cuda.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This extension will be automatically loaded if user imports both `QuantumToolbox
using QuantumToolbox
using CUDA
using CUDA.CUSPARSE
CUDA.allowscalar(false) # Avoid unexpected scalar indexing
```

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)):
Expand Down
1 change: 1 addition & 0 deletions test/cuda_ext.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CUDA
using CUDA.CUSPARSE
CUDA.allowscalar(false) # Avoid unexpected scalar indexing

QuantumToolbox.about()
CUDA.versioninfo()
Expand Down

0 comments on commit 3f2eaab

Please sign in to comment.