Skip to content

Commit ea52842

Browse files
Merge pull request #394 from ChrisRackauckas-Claude/runic-formatting
Switch from JuliaFormatter to Runic.jl for code formatting
2 parents 0264924 + 140ff70 commit ea52842

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2569
-1549
lines changed

.JuliaFormatter.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/FormatCheck.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
name: "Format Check"
1+
name: format-check
22

33
on:
44
push:
55
branches:
66
- 'master'
7+
- 'main'
8+
- 'release-'
79
tags: '*'
810
pull_request:
911

1012
jobs:
11-
format-check:
12-
name: "Format Check"
13-
uses: "SciML/.github/.github/workflows/format-check.yml@v1"
13+
runic:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: fredrikekre/runic-action@v1
18+
with:
19+
version: '1'

docs/make.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ include("pages.jl")
55
cp("./docs/Manifest.toml", "./docs/src/assets/Manifest.toml", force = true)
66
cp("./docs/Project.toml", "./docs/src/assets/Project.toml", force = true)
77

8-
makedocs(sitename = "DiffEqGPU.jl",
8+
makedocs(
9+
sitename = "DiffEqGPU.jl",
910
authors = "Chris Rackauckas",
1011
modules = [DiffEqGPU],
1112
clean = true, doctest = false, linkcheck = true,
1213
warnonly = [:missing_docs],
13-
format = Documenter.HTML(assets = ["assets/favicon.ico"],
14-
canonical = "https://docs.sciml.ai/DiffEqGPU/stable/"),
15-
pages = pages)
14+
format = Documenter.HTML(
15+
assets = ["assets/favicon.ico"],
16+
canonical = "https://docs.sciml.ai/DiffEqGPU/stable/"
17+
),
18+
pages = pages
19+
)
1620

17-
deploydocs(repo = "github.com/SciML/DiffEqGPU.jl.git";
18-
push_preview = true)
21+
deploydocs(
22+
repo = "github.com/SciML/DiffEqGPU.jl.git";
23+
push_preview = true
24+
)

docs/pages.jl

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
# Put in a separate page so it can be used by SciMLDocs.jl
22

3-
pages = ["index.md",
3+
pages = [
4+
"index.md",
45
"getting_started.md",
56
"Tutorials" => Any[
6-
"GPU Ensembles" => Any["tutorials/gpu_ensemble_basic.md",
7+
"GPU Ensembles" => Any[
8+
"tutorials/gpu_ensemble_basic.md",
79
"tutorials/parallel_callbacks.md",
810
"tutorials/modelingtoolkit.md",
911
"tutorials/multigpu.md",
1012
"tutorials/lower_level_api.md",
11-
"tutorials/weak_order_conv_sde.md"],
12-
"Within-Method GPU" => Any["tutorials/within_method_gpu.md"]],
13+
"tutorials/weak_order_conv_sde.md",
14+
],
15+
"Within-Method GPU" => Any["tutorials/within_method_gpu.md"],
16+
],
1317
"Examples" => Any[
1418
"GPU Ensembles" => Any[
1519
"examples/gpu_ensemble_random_decay.md",
1620
"examples/sde.md",
1721
"examples/ad.md",
18-
"examples/reductions.md"],
19-
"Within-Method GPU" => Any["examples/reaction_diffusion.md",
20-
"examples/bruss.md"]],
21-
"Manual" => Any["manual/ensemblegpukernel.md",
22+
"examples/reductions.md",
23+
],
24+
"Within-Method GPU" => Any[
25+
"examples/reaction_diffusion.md",
26+
"examples/bruss.md",
27+
],
28+
],
29+
"Manual" => Any[
30+
"manual/ensemblegpukernel.md",
2231
"manual/ensemblegpuarray.md",
2332
"manual/backends.md",
2433
"manual/optimal_trajectories.md",
25-
"manual/choosing_ensembler.md"]
34+
"manual/choosing_ensembler.md",
35+
],
2636
]

ext/AMDGPUExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using .AMDGPU
66
import .AMDGPU: ROCBackend
77

88
function DiffEqGPU.EnsembleGPUArray(cpu_offload::Float64)
9-
DiffEqGPU.EnsembleGPUArray(ROCBackend(), cpu_offload)
9+
return DiffEqGPU.EnsembleGPUArray(ROCBackend(), cpu_offload)
1010
end
1111
DiffEqGPU.maxthreads(::ROCBackend) = 256
1212
DiffEqGPU.maybe_prefer_blocks(::ROCBackend) = ROCBackend()

ext/CUDAExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using .CUDA
66
import .CUDA: CUDABackend
77

88
function DiffEqGPU.EnsembleGPUArray(cpu_offload::Float64)
9-
DiffEqGPU.EnsembleGPUArray(CUDABackend(), cpu_offload)
9+
return DiffEqGPU.EnsembleGPUArray(CUDABackend(), cpu_offload)
1010
end
1111
DiffEqGPU.maxthreads(::CUDABackend) = 256
1212
DiffEqGPU.maybe_prefer_blocks(::CUDABackend) = CUDABackend(; prefer_blocks = true)

src/algorithms.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,24 @@ struct EnsembleGPUKernel{Dev} <: EnsembleKernelAlgorithm
156156
cpu_offload::Float64
157157
end
158158

159-
cpu_alg = Dict(GPUTsit5 => (GPUSimpleTsit5(), GPUSimpleATsit5()),
159+
cpu_alg = Dict(
160+
GPUTsit5 => (GPUSimpleTsit5(), GPUSimpleATsit5()),
160161
GPUVern7 => (GPUSimpleVern7(), GPUSimpleAVern7()),
161-
GPUVern9 => (GPUSimpleVern9(), GPUSimpleAVern9()))
162+
GPUVern9 => (GPUSimpleVern9(), GPUSimpleAVern9())
163+
)
162164

163165
# Work around the fact that Zygote cannot handle the task system
164166
# Work around the fact that Zygote isderiving fails with constants?
165167
function EnsembleGPUArray(dev)
166-
EnsembleGPUArray(dev, 0.2)
168+
return EnsembleGPUArray(dev, 0.2)
167169
end
168170

169171
function EnsembleGPUKernel(dev)
170-
EnsembleGPUKernel(dev, 0.0)
172+
return EnsembleGPUKernel(dev, 0.0)
171173
end
172174

173175
function ChainRulesCore.rrule(::Type{<:EnsembleGPUArray})
174-
EnsembleGPUArray(0.0), _ -> NoTangent()
176+
return EnsembleGPUArray(0.0), _ -> NoTangent()
175177
end
176178

177179
ZygoteRules.@adjoint function EnsembleGPUArray(dev)

src/ensemblegpuarray/callbacks.jl

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,52 @@ function generate_callback(callback::ContinuousCallback, I, ensemblealg)
99
condition = function (out, u, t, integrator)
1010
version = get_backend(u)
1111
wgs = workgroupsize(version, size(u, 2))
12-
continuous_condition_kernel(version)(_condition, out, u, t, integrator.p;
12+
continuous_condition_kernel(version)(
13+
_condition, out, u, t, integrator.p;
1314
ndrange = size(u, 2),
14-
workgroupsize = wgs)
15-
nothing
15+
workgroupsize = wgs
16+
)
17+
return nothing
1618
end
1719

1820
affect! = function (integrator, event_idx)
1921
version = get_backend(integrator.u)
2022
wgs = workgroupsize(version, size(integrator.u, 2))
21-
continuous_affect!_kernel(version)(_affect!, event_idx, integrator.u,
23+
return continuous_affect!_kernel(version)(
24+
_affect!, event_idx, integrator.u,
2225
integrator.t, integrator.p;
2326
ndrange = size(integrator.u, 2),
24-
workgroupsize = wgs)
27+
workgroupsize = wgs
28+
)
2529
end
2630

2731
affect_neg! = function (integrator, event_idx)
2832
version = get_backend(integrator.u)
2933
wgs = workgroupsize(version, size(integrator.u, 2))
30-
continuous_affect!_kernel(version)(_affect_neg!, event_idx, integrator.u,
34+
return continuous_affect!_kernel(version)(
35+
_affect_neg!, event_idx, integrator.u,
3136
integrator.t, integrator.p;
3237
ndrange = size(integrator.u, 2),
33-
workgroupsize = wgs)
38+
workgroupsize = wgs
39+
)
3440
end
3541

36-
return VectorContinuousCallback(condition, affect!, affect_neg!, I,
37-
save_positions = callback.save_positions)
42+
return VectorContinuousCallback(
43+
condition, affect!, affect_neg!, I,
44+
save_positions = callback.save_positions
45+
)
3846
end
3947

4048
function generate_callback(callback::CallbackSet, I, ensemblealg)
41-
return CallbackSet(map(cb -> generate_callback(cb, I, ensemblealg),
42-
(callback.continuous_callbacks...,
43-
callback.discrete_callbacks...))...)
49+
return CallbackSet(
50+
map(
51+
cb -> generate_callback(cb, I, ensemblealg),
52+
(
53+
callback.continuous_callbacks...,
54+
callback.discrete_callbacks...,
55+
)
56+
)...
57+
)
4458
end
4559

4660
generate_callback(::Tuple{}, I, ensemblealg) = nothing
@@ -55,10 +69,12 @@ function generate_callback(prob, I, ensemblealg; kwargs...)
5569
kwarg_cb = get(kwargs, :merge_callbacks, false) ? get(kwargs, :callback, ()) : ()
5670

5771
if (prob_cb === nothing || isempty(prob_cb)) &&
58-
(kwarg_cb === nothing || isempty(kwarg_cb))
72+
(kwarg_cb === nothing || isempty(kwarg_cb))
5973
return nothing
6074
else
61-
return CallbackSet(generate_callback(prob_cb, I, ensemblealg),
62-
generate_callback(kwarg_cb, I, ensemblealg))
75+
return CallbackSet(
76+
generate_callback(prob_cb, I, ensemblealg),
77+
generate_callback(kwarg_cb, I, ensemblealg)
78+
)
6379
end
6480
end

0 commit comments

Comments
 (0)