Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 25a51ba

Browse files
committed
Add kernel launch tests
1 parent 59b0d96 commit 25a51ba

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SimpleNonlinearSolve"
22
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
33
authors = ["SciML"]
4-
version = "1.2.0"
4+
version = "1.2.1"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
[![codecov](https://codecov.io/gh/SciML/SimpleNonlinearSolve.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/SciML/SimpleNonlinearSolve.jl)
77
[![Build Status](https://github.com/SciML/SimpleNonlinearSolve.jl/workflows/CI/badge.svg)](https://github.com/SciML/SimpleNonlinearSolve.jl/actions?query=workflow%3ACI)
8+
[![Build status](https://badge.buildkite.com/c5f7db4f1b5e8a592514378b6fc807d934546cc7d5aa79d645.svg?branch=main)](https://buildkite.com/julialang/simplenonlinearsolve-dot-jl)
89

910
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
1011
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)

src/nlsolve/dfsane.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ end
5656
function SimpleDFSane(; σ_min::Real = 1e-10, σ_max::Real = 1e10, σ_1::Real = 1.0,
5757
M::Union{Int, Val} = Val(10), γ::Real = 1e-4, τ_min::Real = 0.1, τ_max::Real = 0.5,
5858
nexp::Int = 2, η_strategy::F = (f_1, k, x, F) -> f_1 ./ k^2) where {F}
59-
return SimpleDFSane{SciMLBase._unwrap_val(M)}(σ_min, σ_max, σ_1, γ, τ_min, τ_max, nexp, η_strategy)
59+
return SimpleDFSane{SciMLBase._unwrap_val(M)}(σ_min, σ_max, σ_1, γ, τ_min, τ_max, nexp,
60+
η_strategy)
6061
end
6162

6263
function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleDFSane{M}, args...;

src/nlsolve/lbroyden.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,9 @@ function __init_low_rank_jacobian(u::StaticArray{S1, T1}, fu::StaticArray{S2, T2
259259
U = MArray{Tuple{prod(fuSize), threshold}, T}(undef)
260260
return U, Vᵀ
261261
end
262-
263262
@generated function __init_low_rank_jacobian(u::SVector{Lu, T1}, fu::SVector{Lfu, T2},
264263
::Val{threshold}) where {Lu, Lfu, T1, T2, threshold}
265264
T = promote_type(T1, T2)
266-
# Lfu, Lu = __prod_size(S2), __prod_size(S1)
267-
# Lfu, Lu = __prod(Size(fu)), __prod(Size(u))
268265
inner_inits_Vᵀ = [:(zeros(SVector{$Lu, $T})) for i in 1:threshold]
269266
inner_inits_U = [:(zeros(SVector{$Lfu, $T})) for i in 1:threshold]
270267
return quote
@@ -273,7 +270,6 @@ end
273270
return U, Vᵀ
274271
end
275272
end
276-
277273
function __init_low_rank_jacobian(u, fu, ::Val{threshold}) where {threshold}
278274
Vᵀ = similar(u, threshold, length(u))
279275
U = similar(u, length(fu), threshold)

test/cuda.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,26 @@ f!(du, u, p) = du .= u .* u .- 2
3333
@test maximum(abs, sol.resid) 1.0f-6
3434
end
3535
end
36+
37+
function kernel_function(prob, alg)
38+
solve(prob, alg; abstol = 1.0f-6, reltol = 1.0f-6)
39+
return nothing
40+
end
41+
42+
@testset "CUDA Kernel Launch Test" begin
43+
prob = NonlinearProblem{false}(f, @SVector[1.0f0, 1.0f0])
44+
45+
for alg in (SimpleNewtonRaphson(), SimpleDFSane(), SimpleTrustRegion(), SimpleBroyden(),
46+
SimpleLimitedMemoryBroyden(), SimpleKlement(), SimpleHalley())
47+
@test begin
48+
try
49+
@cuda kernel_function(prob, alg)
50+
@info "Successfully launched kernel for $(alg)."
51+
true
52+
catch err
53+
@error "Kernel Launch failed for $(alg)."
54+
false
55+
end
56+
end broken=(alg isa SimpleHalley)
57+
end
58+
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using SafeTestsets, Test
1+
using Pkg, SafeTestsets, Test
22

33
const GROUP = get(ENV, "GROUP", "All")
44

0 commit comments

Comments
 (0)