Skip to content

Commit

Permalink
updagrad CUDA.jl to 5.0 (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu authored Sep 28, 2023
1 parent 8681af0 commit 2037a9b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
12 changes: 2 additions & 10 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
name = "CuYao"
uuid = "b48ca7a8-dd42-11e8-2b8e-1b7706800275"
version = "0.3.8"
version = "0.3.9"

[deps]
BitBasis = "50ba71b6-fa0f-514d-ae9a-0916efc90dcf"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LuxurySparse = "d05aeea4-b7d4-55ac-b691-9e7fabb07ba2"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
Yao = "5872b779-8223-5990-8dd0-5abbb0748c8c"

[compat]
BitBasis = "0.8"
CUDA = "4"
LuxurySparse = "0.7"
CUDA = "4, 5"
Reexport = "0.2, 1"
StaticArrays = "0.12, 1"
StatsBase = "0.33-0.34"
TupleTools = "1"
Yao = "0.8"
julia = "1"
Expand Down
5 changes: 2 additions & 3 deletions src/CuYao.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module CuYao
using LuxurySparse, StaticArrays, LinearAlgebra, Base.Cartesian
using StatsBase
using BitBasis
using Yao.YaoArrayRegister.LuxurySparse, Yao.YaoArrayRegister.StaticArrays, LinearAlgebra, Base.Cartesian
using Yao.YaoArrayRegister.StatsBase, Yao.YaoArrayRegister.BitBasis
using Reexport
import TupleTools
using Random
Expand Down
2 changes: 1 addition & 1 deletion test/CUDApatch.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CuYao
using CUDA
using Test
using YaoBlocks
using Yao.YaoBlocks

@testset "isapprox-complex" begin
ca = CuArray(randn(ComplexF64,3,3))
Expand Down
15 changes: 14 additions & 1 deletion test/instructs.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using LinearAlgebra, Yao.ConstGate
using Test, Random
using CuYao
using StaticArrays
using Yao.YaoArrayRegister.StaticArrays
using Yao.ConstGate: SWAPGate
using CUDA

Expand Down Expand Up @@ -120,3 +120,16 @@ end
reg = rand_state(10)
@test apply!(copy(reg), g) apply!(reg |> cu, g) |> cpu
end

# fix: https://github.com/QuantumBFS/CuYao.jl/issues/81
@testset "generic sparse (pqc circuit)" begin
# kron of Rx
pqc_circuit = subroutine(10, kron(Rx(0.4), Rx(0.5), Rx(0.6), Rx(0.8)), (1, 2, 6, 5))
proxy_reg = zero_state(10)
@test apply!(proxy_reg |> cu, pqc_circuit) |> cpu apply(proxy_reg, pqc_circuit)

# kron of Rz
pqc_circuit = subroutine(10, kron(Rz(0.4), Rz(0.5), Rz(0.6), Rz(0.8)), (1, 2, 6, 5))
proxy_reg = zero_state(10)
@test apply!(proxy_reg |> cu, pqc_circuit) |> cpu apply(proxy_reg, pqc_circuit)
end
4 changes: 2 additions & 2 deletions test/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ using Test
using CuYao
using CuYao: tri2ij
using LinearAlgebra
using BitBasis
using Yao.YaoArrayRegister.BitBasis
using Statistics: mean
using StaticArrays
using Yao.YaoArrayRegister.StaticArrays
using CUDA
using Yao.YaoArrayRegister: batched_kron, batched_kron!, batch_normalize!
CUDA.allowscalar(false)
Expand Down

0 comments on commit 2037a9b

Please sign in to comment.