Skip to content

Pass Discrete Sequence to GPU - #652

Open
mcgrathcm wants to merge 8 commits into
masterfrom
discreteseq-struct-gpu
Open

Pass Discrete Sequence to GPU#652
mcgrathcm wants to merge 8 commits into
masterfrom
discreteseq-struct-gpu

Conversation

@mcgrathcm

Copy link
Copy Markdown
Contributor

In preparation for higher order sequences, this adds:

  • Discrete sequences adapted and passed directly to GPU kernels
  • Spatial gradient Bz term moved to its own helper function
  • AbstractDiscreteSequence type added to allow dispatch when higher order sequences are added

… sequences, moved spatial gradient calculation to own function.
@codecov

codecov Bot commented Nov 23, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.02%. Comparing base (3a2aad0) to head (eeaeafc).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #652      +/-   ##
==========================================
+ Coverage   89.66%   90.02%   +0.35%     
==========================================
  Files          74       75       +1     
  Lines        5179     5181       +2     
==========================================
+ Hits         4644     4664      +20     
+ Misses        535      517      -18     
Flag Coverage Δ
base 86.48% <100.00%> (ø)
core 90.67% <100.00%> (+2.65%) ⬆️
files 95.26% <ø> (ø)
komamri 88.23% <ø> (ø)
plots 90.88% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
KomaMRIBase/src/KomaMRIBase.jl 85.71% <ø> (ø)
...IBase/src/datatypes/simulation/DiscreteSequence.jl 93.10% <100.00%> (ø)
KomaMRICore/src/KomaMRICore.jl 100.00% <ø> (ø)
KomaMRICore/src/simulation/Functors.jl 77.27% <ø> (ø)
...re/src/simulation/SimMethods/Bloch/cpu/BlochCPU.jl 100.00% <100.00%> (ø)
...re/src/simulation/SimMethods/Bloch/gpu/BlochGPU.jl 100.00% <ø> (ø)
...e/src/simulation/SimMethods/BlochDict/BlochDict.jl 96.96% <ø> (ø)
...ation/SimMethods/BlochMagnus/cpu/BlochMagnusCPU.jl 100.00% <ø> (ø)
...c/simulation/SimMethods/BlochSimple/BlochSimple.jl 100.00% <ø> (ø)
KomaMRICore/src/simulation/SimulatorCore.jl 90.69% <ø> (ø)
... and 1 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KomaMRI Benchmarks

Details
Benchmark suite Current: 17e586e Previous: 11d3180 Ratio
MRI Lab/Bloch/CPU/2 thread(s) 387199837.5 ns 337633469 ns 1.15
MRI Lab/Bloch/CPU/4 thread(s) 289067546 ns 276282606 ns 1.05
MRI Lab/Bloch/CPU/8 thread(s) 242467570.5 ns 209852165 ns 1.16
MRI Lab/Bloch/CPU/1 thread(s) 655549193 ns 555065232 ns 1.18
MRI Lab/Bloch/GPU/CUDA 20962776 ns 21231134 ns 0.99
MRI Lab/Bloch/GPU/oneAPI 85944808 ns 77053690 ns 1.12
MRI Lab/Bloch/GPU/Metal 104643083 ns 95540333 ns 1.10
MRI Lab/Bloch/GPU/AMDGPU 25102288 ns 24763685 ns 1.01
Slice Selection 3D/Bloch/CPU/2 thread(s) 1651013192 ns 1592087059 ns 1.04
Slice Selection 3D/Bloch/CPU/4 thread(s) 911694348 ns 889539516 ns 1.02
Slice Selection 3D/Bloch/CPU/8 thread(s) 599249406.5 ns 565401528.5 ns 1.06
Slice Selection 3D/Bloch/CPU/1 thread(s) 3109371230 ns 3029269071 ns 1.03
Slice Selection 3D/Bloch/GPU/CUDA 31822745 ns 32639703 ns 0.97
Slice Selection 3D/Bloch/GPU/oneAPI 133804680 ns 121489006.5 ns 1.10
Slice Selection 3D/Bloch/GPU/Metal 112492041 ns 111152750 ns 1.01
Slice Selection 3D/Bloch/GPU/AMDGPU 32559879.5 ns 32636098 ns 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@cncastillo

Copy link
Copy Markdown
Member

The macos fails are due to actions/runner-images#13341.

@cncastillo

Copy link
Copy Markdown
Member

Compare benchmarks with #653.

Update: macos cache problem fixed.

@cncastillo cncastillo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good, no significant performance regressions, but some of them could be explained by some of the suggestions below.

Comment thread KomaMRICore/src/simulation/SimMethods/Bloch/cpu/BlochCPU.jl Outdated
Comment thread KomaMRICore/src/simulation/SimMethods/Bloch/cpu/BlochCPU.jl Outdated
Comment thread KomaMRICore/src/simulation/SpatialEncoding.jl Outdated
@cncastillo cncastillo added the run-gpu-ci To run .buildkite CI label May 2, 2026
@cncastillo

Copy link
Copy Markdown
Member

This might generate some problems with Enzyme/Reactant, @KookiesNKareem what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-gpu-ci To run .buildkite CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants