Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/src/how-to/4-run-distributed-simulations.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,26 @@ raw = Distributed.@distributed (+) for i=1:nworkers()
simulate(obj[parts[i]], seq, sys)
end
```

## Sequential Phantom Chunks on One GPU

If the phantom is too large to fit in GPU memory, it can also be split into
chunks and simulated sequentially on a single device. This uses the same
independent spin property as distributed simulations, but does not need extra
workers.

```julia
using KomaMRI

sys = Scanner()
seq = PulseDesigner.EPI_example()
obj = brain_phantom2D()

max_spins_per_chunk = 200_000
nchunks = cld(length(obj), max_spins_per_chunk)
parts = kfoldperm(length(obj), nchunks)

raw = mapreduce(+, parts) do part
simulate(obj[part], seq, sys)
end
```
Loading