Skip to content

Commit 8c66f5c

Browse files
authored
Document sequential phantom chunk simulation (#766)
* Document sequential phantom chunk simulation * Simplify sequential chunk docs
1 parent 0a47c81 commit 8c66f5c

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

docs/src/how-to/4-run-distributed-simulations.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,26 @@ raw = Distributed.@distributed (+) for i=1:nworkers()
108108
simulate(obj[parts[i]], seq, sys)
109109
end
110110
```
111+
112+
## Sequential Phantom Chunks on One GPU
113+
114+
If the phantom is too large to fit in GPU memory, it can also be split into
115+
chunks and simulated sequentially on a single device. This uses the same
116+
independent spin property as distributed simulations, but does not need extra
117+
workers.
118+
119+
```julia
120+
using KomaMRI
121+
122+
sys = Scanner()
123+
seq = PulseDesigner.EPI_example()
124+
obj = brain_phantom2D()
125+
126+
max_spins_per_chunk = 200_000
127+
nchunks = cld(length(obj), max_spins_per_chunk)
128+
parts = kfoldperm(length(obj), nchunks)
129+
130+
raw = mapreduce(+, parts) do part
131+
simulate(obj[part], seq, sys)
132+
end
133+
```

0 commit comments

Comments
 (0)