GPU Acceleration
MPIReco supports generic GPU acceleration. This means that the user can use any GPU array type that supports the GPUArrays interface. This includes CUDA.jl, AMDGPU.jl, and Metal.jl. To perform a reconstruction on the GPU, one has to load a GPU backend package such as CUDA and specify the GPU array type:
using CUDA
gpu = CuArray
Afterwards one can use the normal reconstruction interface and specify the arrayType
parameter. However, the default solver is Kaczmarz, which has poor GPU performance. One should instead use CGNR or other solver. Since those solvers usually converge slower, one also has to increase the number of iterations
params = Dict{Symbol, Any}()
params[:SNRThresh] = 5
params[:frames] = 1:1
params[:minFreq] = 80e3
params[:recChannels] = 1:2
params[:spectralLeakageCorrection] = true
params[:sf] = bSF
params[:weightingParams] = WhiteningWeightingParameters(whiteningMeas = bSF)
params[:reg] = [L2Regularization(0.1f0)]
1-element Vector{L2Regularization{Float32}}:
L2Regularization{Float32}(0.1f0)
Specifying the GPU array type to use, allows reconstruction algorithm to move the system matrix and data to the GPU after frequency filtering:
c = reconstruct("SinglePatch", b; params..., arrayType = gpu, iterations = 100, solver = CGNR);
[ Info: Loading SM
[ Info: Preparing SF
[ Info: Adapting SF
The resulting image is moved to the CPU at the end of the reconstruction and is accessible like any other reconstruction:
using CairoMakie
fig = heatmap(c[1, :, :, 1, 1].data.data)
hidedecorations!(fig.axis)
fig

This page was generated using Literate.jl.