Skip to content

Instantly share code, notes, and snippets.

@pabloferz
Last active August 9, 2021 00:19
Show Gist options
  • Save pabloferz/1390d85383e3243015be7ad5b162bcc4 to your computer and use it in GitHub Desktop.
Save pabloferz/1390d85383e3243015be7ad5b162bcc4 to your computer and use it in GitHub Desktop.
Zygote+CUDA
using LinearAlgebra
using CUDA, StaticArrays, Zygote
dihedral_angle(p₁, p₂, p₃, p₄) = dihedral_angle(p₂ - p₁, p₃ - p₂, p₄ - p₃)
@inline function dihedral_angle(a, b, c)
p = a × b
q = b × c
return atan((p × q) ⋅ b, (p ⋅ q) * norm(b))
end
@inline function withgrad(f::F, ps) where {F}
val, back = Zygote._pullback(f, ps...)
grad = Zygote.tailmemaybe(back(Zygote.sensitivity(val)))
return val, grad
end
function val_and_grad(f, rs)
# @assert size(rs) == (3, 4)
T = eltype(rs)
g = ps -> withgrad(f, ps)
ps = reinterpret(reshape, SVector{4, SVector{3, T}}, vec(rs))
x = CUDA.fill(zero(T))
v = CUDA.fill(SVector((zeros(SVector{3, T}) for _ in 1:4)...))
function kernel(x, v, ps)
i = threadIdx().x
if i == 1
t = g(ps[])
x[] = t[1]
v[] = t[2]
end
return nothing
end
@cuda threads=1 kernel(x, v, ps)
return x, v
end
val_and_grad(dihedral_angle, CUDA.rand(Float64, 3, 4))
ERROR: LoadError: InvalidIRError: compiling kernel kernel(CuDeviceArray{Float64, 0, 1}, CuDeviceArray{SVector{4, SVector{3, Float64}}, 0, 1}, Base.ReinterpretArray{SVector{4, SVector{3, Float64}}, 0, Float64, CuDeviceVector{Float64, 1}, true}) resulted in invalid LLVM IR
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1515
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:14
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:9
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1516
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:15
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:9
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1534
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:77
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:9
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1535
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:78
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:9
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1534
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:77
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:8
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1535
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:78
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:8
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1534
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:77
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:7
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to fieldcount(t) in Base at reflection.jl:703)
Stacktrace:
[1] fieldnames
@ ./reflection.jl:176
[2] propertynames
@ ./reflection.jl:1579
[3] propertynames
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:39
[4] hasproperty
@ ./reflection.jl:1591
[5] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:216
[6] #1535
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:78
[7] unthunk
@ ~/.julia/packages/ChainRulesCore/Voykb/src/differentials/thunks.jl:189
[8] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:104
[9] map
@ ./tuple.jl:215
[10] wrap_chainrules_output
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:105
[11] ZBack
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:140
[12] Pullback
@ /tmp/cuda_zygote.jl:7
[13] Pullback
@ /tmp/cuda_zygote.jl:4
[14] Pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[15] withgrad
@ /tmp/cuda_zygote.jl:14
[16] #1
@ /tmp/cuda_zygote.jl:21
[17] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:72
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:7
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:73
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:7
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:72
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:8
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:73
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:8
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:72
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:9
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:73
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:9
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:10
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:9
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Reason: unsupported dynamic function invocation (call to TypeVar(n::Symbol, ub) in Core at boot.jl:382)
Stacktrace:
[1] ProjectTo
@ ~/.julia/packages/ChainRulesCore/Voykb/src/projection.jl:183
[2] rrule
@ ~/.julia/packages/ChainRules/P1iZ3/src/rulesets/LinearAlgebra/dense.jl:11
[3] rrule
@ ~/.julia/packages/ChainRulesCore/Voykb/src/rules.jl:134
[4] chain_rrule
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/chainrules.jl:152
[5] macro expansion
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[6] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:9
[7] _pullback
@ /tmp/cuda_zygote.jl:9
[8] _pullback
@ /tmp/cuda_zygote.jl:4
[9] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface2.jl:0
[10] _pullback
@ ~/.julia/packages/Zygote/l3aNG/src/compiler/interface.jl:34
[11] withgrad
@ /tmp/cuda_zygote.jl:13
[12] #1
@ /tmp/cuda_zygote.jl:21
[13] kernel
@ /tmp/cuda_zygote.jl:29
Stacktrace:
[1] check_ir(job::GPUCompiler.CompilerJob{GPUCompiler.PTXCompilerTarget, CUDA.CUDACompilerParams, GPUCompiler.FunctionSpec{var"#kernel#5"{var"#1#3"{typeof(dihedral_angle)}}, Tuple{CuDeviceArray{Float64, 0, 1}, CuDeviceArray{SVector{4, SVector{3, Float64}}, 0, 1}, Base.R
einterpretArray{SVector{4, SVector{3, Float64}}, 0, Float64, CuDeviceVector{Float64, 1}, true}}}}, args::LLVM.Module)
@ GPUCompiler ~/.julia/packages/GPUCompiler/v8cUl/src/validation.jl:111
[2] macro expansion
@ ~/.julia/packages/GPUCompiler/v8cUl/src/driver.jl:319 [inlined]
[3] macro expansion
@ ~/.julia/packages/TimerOutputs/ZQ0rt/src/TimerOutput.jl:236 [inlined]
[4] macro expansion
@ ~/.julia/packages/GPUCompiler/v8cUl/src/driver.jl:317 [inlined]
[5] emit_asm(job::GPUCompiler.CompilerJob, ir::LLVM.Module; strip::Bool, validate::Bool, format::LLVM.API.LLVMCodeGenFileType)
@ GPUCompiler ~/.julia/packages/GPUCompiler/v8cUl/src/utils.jl:62
[6] cufunction_compile(job::GPUCompiler.CompilerJob)
@ CUDA ~/.julia/packages/CUDA/hoMTi/src/compiler/execution.jl:317
[7] cached_compilation(cache::Dict{UInt64, Any}, job::GPUCompiler.CompilerJob, compiler::typeof(CUDA.cufunction_compile), linker::typeof(CUDA.cufunction_link))
@ GPUCompiler ~/.julia/packages/GPUCompiler/v8cUl/src/cache.jl:89
[8] cufunction(f::var"#kernel#5"{var"#1#3"{typeof(dihedral_angle)}}, tt::Type{Tuple{CuDeviceArray{Float64, 0, 1}, CuDeviceArray{SVector{4, SVector{3, Float64}}, 0, 1}, Base.ReinterpretArray{SVector{4, SVector{3, Float64}}, 0, Float64, CuDeviceVector{Float64, 1}, true}}}
; name::Nothing, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ CUDA ~/.julia/packages/CUDA/hoMTi/src/compiler/execution.jl:288
[9] cufunction(f::var"#kernel#5"{var"#1#3"{typeof(dihedral_angle)}}, tt::Type{Tuple{CuDeviceArray{Float64, 0, 1}, CuDeviceArray{SVector{4, SVector{3, Float64}}, 0, 1}, Base.ReinterpretArray{SVector{4, SVector{3, Float64}}, 0, Float64, CuDeviceVector{Float64, 1}, true}}}
)
@ CUDA ~/.julia/packages/CUDA/hoMTi/src/compiler/execution.jl:282
[10] macro expansion
@ ~/.julia/packages/CUDA/hoMTi/src/compiler/execution.jl:102 [inlined]
[11] val_and_grad(f::Function, rs::CuArray{Float64, 2, CUDA.Mem.DeviceBuffer})
@ Main /tmp/cuda_zygote.jl:36
[12] top-level scope
@ /tmp/cuda_zygote.jl:40
[13] include(fname::String)
@ Base.MainInclude ./client.jl:444
[14] top-level scope
@ REPL[2]:1
in expression starting at /tmp/cuda_zygote.jl:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment