Migrating to SHTnsKit v3.0
SHTnsKit 3.0 adds the Apple Metal backend and broadens GPU and distributed support. It also corrects several results that 2.0 got wrong and rejects some inputs that 2.0 processed silently. Most code runs unchanged. Check the lists below if you use vorticity loss gradients, phi_scale = :quad, the create_config defaults, rotations on truncated layouts, or mixed precision.
Changed results
grad_loss_vorticity_Tlmandloss_and_grad_vorticity_Tlmreturn the Euclidean gradient, so entries withm > 0are twice the 2.0 values. They now agree withgrad_enstrophy_Tlm, thegrad_energy_*functions and Zygote.- With
phi_scale = :quad,analysisinvertssynthesis, where 2.0 returnedalm / 2π. The point and latitude evaluators carry the same φ factor as the grid they sample, and energies are scaled by 1/(2π)² relative to:dft. An unsetphi_scalenow means:dfton every grid. create_configdefaults tonlat = 2lmax + 1on equiangular grids and2(lmax + 1)on Driscoll–Healy grids, instead oflmax + 2, whose round trips were 7–22% off.create_regular_configstill defaults tolmax + 2.- QST transforms compute all three components at the precision promoted across them. A
Float32radial field withFloat64tangential fields gives threeComplexF64spectra. - On CUDA and ROCm, in-place scalar
analysis!andsynthesis!compute at the wider of the input and output precision. - With
robert_form = true,grid_energy_vectorexpects the sin(θ)-weighted components thatsynthesis_sphtorreturns.
Inputs that now raise
- Grids reject an
nlatbelow the minimum for theirlmax. On Gauss grids that meanslmax ≥ nlatraises. - Setting
cfg.lmax,cfg.mmaxorcfg.mresvalidates the whole layout before storing it, includingnlon ≥ 2mmax + 1. - Rotations that mix orders, with β other than 0 or π, raise on layouts with
mmax < lmax, serial and distributed. 2.0 silently dropped the orders abovemmax. - Robert-form
grid_energy_vectorraises on grids with nonzero-weight pole nodes when the spectrum includesm = 1. - Planned and in-place CPU transforms reject arrays whose axes do not start at 1, and planned vector transforms reject one array passed as both outputs.
- CUDA's
gpu_apply_laplacian!rejects a batch of fields, as ROCm already did. - In-place GPU transforms raise
BackendUnavailableErrorfor device arrays in deeper wrappers. GPU storage never reaches the CPU loops. - Reverse-mode AD on
PencilArrayinputs raisesArgumentErrorwhere 2.0 returned a wrong adjoint, and l-split spectral batches raise on every rank.
New in 3.0
- An Apple Metal backend for single-precision transforms. See GPU Acceleration.
- Allocating transforms accept deeper device wrappers, such as a view of a
PermutedDimsArray. CUDA and ROCm add configuration-level in-place transforms, and run on the GPU that owns an allocation. DistTransposePlantransforms run on CUDA- and ROCm-backed pencils, with or without GPU-aware MPI.zgrad_rotation_angles_realandzgrad_rotation_angles_cplxtake alosskeyword, so they can differentiate objectives such as alignment with a target.