Skip to content

Commit 39a68e4

Browse files
committed
Add CUDA tests
1 parent 2084b3d commit 39a68e4

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

DifferentiationInterface/Project.toml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DifferentiationInterface"
22
uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
33
authors = ["Guillaume Dalle", "Adrian Hill"]
4-
version = "0.7.0"
4+
version = "0.7.1"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -41,7 +41,9 @@ DifferentiationInterfaceForwardDiffExt = ["ForwardDiff", "DiffResults"]
4141
DifferentiationInterfaceGPUArraysCoreExt = "GPUArraysCore"
4242
DifferentiationInterfaceGTPSAExt = "GTPSA"
4343
DifferentiationInterfaceMooncakeExt = "Mooncake"
44-
DifferentiationInterfacePolyesterForwardDiffExt = ["PolyesterForwardDiff", "ForwardDiff", "DiffResults"]
44+
DifferentiationInterfacePolyesterForwardDiffExt = [
45+
"PolyesterForwardDiff", "ForwardDiff", "DiffResults"
46+
]
4547
DifferentiationInterfaceReverseDiffExt = ["ReverseDiff", "DiffResults"]
4648
DifferentiationInterfaceSparseArraysExt = "SparseArrays"
4749
DifferentiationInterfaceSparseConnectivityTracerExt = "SparseConnectivityTracer"
@@ -121,4 +123,21 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
121123
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
122124

123125
[targets]
124-
test = ["ADTypes", "Aqua", "ComponentArrays", "DataFrames", "ExplicitImports", "JET", "JLArrays", "JuliaFormatter", "Pkg", "Random", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings", "StableRNGs", "StaticArrays", "Test"]
126+
test = [
127+
"ADTypes",
128+
"Aqua",
129+
"ComponentArrays",
130+
"DataFrames",
131+
"ExplicitImports",
132+
"JET",
133+
"JLArrays",
134+
"JuliaFormatter",
135+
"Pkg",
136+
"Random",
137+
"SparseArrays",
138+
"SparseConnectivityTracer",
139+
"SparseMatrixColorings",
140+
"StableRNGs",
141+
"StaticArrays",
142+
"Test",
143+
]

DifferentiationInterface/test/GPU/CUDA/simple.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,26 @@
22
using Pkg
33
Pkg.add("CUDA")
44
using CUDA
5+
using DifferentiationInterface
6+
import DifferentiationInterface as DI
7+
using LinearAlgebra
8+
using Test
9+
510
CUDA.versioninfo()
11+
12+
@testset "Basis" begin
13+
x = CuVector(rand(Float32, 3))
14+
b = basis(x, 2)
15+
@test Array(b) == [0, 1, 0]
16+
17+
X = CuMatrix(rand(Float32, 2, 2))
18+
B = DI.multibasis(X, [2, 3])
19+
@test Array(B) == [0 1; 1 0]
20+
end
21+
22+
@testset "Jacobian" begin
23+
x = CuVector(rand(Float32, 3))
24+
backend = DI.AutoSimpleFiniteDiff()
25+
J = jacobian(identity, backend, x)
26+
@test J == I
27+
end

0 commit comments

Comments
 (0)