Skip to content

About

A comprehensive Julia implementation of the SHTns C library.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,223 Commits

Folders and files

Repository files navigation

SHTnsKit.jl

Build Status Coverage MPI Examples JET Aqua

stable docs latest docs

High-Performance Spherical Harmonic Transforms in Julia

SHTnsKit.jl provides a pure-Julia implementation of spherical harmonic transforms on CPUs, NVIDIA CUDA, AMD ROCm, and Apple Metal GPUs, with distributed execution through MPI/PencilArrays.

Key Features

High-Performance Computing

  • Pure Julia transforms with FFTW for CPU longitude transforms
  • Multi-threading: Optimized with Julia threads and FFTW parallelization
  • MPI Parallel: Distributed computing with MPI + PencilArrays + PencilFFTs
  • GPU Native: CUDA, AMDGPU, and Metal device-array transforms through package extensions
  • SIMD Optimized: Vectorization with LoopVectorization.jl support
  • Extensible: Modular architecture for CPU/GPU/distributed computing

Complete Scientific Functionality

  • Transform Types: Scalar, vector, and complex field transforms
  • Grid Support: Gauss-Legendre, regular Fejér, pole-inclusive, and Driscoll-Healy grids
  • Conventions: Orthonormal, four-pi, and Schmidt normalization with configurable Condon-Shortley phase
  • Vector Analysis: Spheroidal-toroidal decomposition for flow fields
  • Differential Operators: Laplacian, gradient, divergence, vorticity
  • Spectral Analysis: Power spectra, correlation functions, filtering

Advanced Capabilities

  • Automatic Differentiation: Native ForwardDiff.jl and Zygote.jl support
  • Field Rotations: Wigner D-matrix rotations and coordinate transforms
  • Matrix Operators: Efficient spectral differential operators
  • Performance Tuning: Comprehensive benchmarking and optimization tools

Installation

Basic Installation (Serial Computing)

using Pkg
Pkg.add("SHTnsKit")

Full Installation (Parallel Computing)

For high-performance parallel computing on clusters:

using Pkg
Pkg.add(["SHTnsKit", "MPI", "PencilArrays", "PencilFFTs", "LoopVectorization"])

GPU Extensions

using Pkg
Pkg.add(["SHTnsKit", "CUDA", "GPUArrays", "GPUArraysCore", "KernelAbstractions"])   # NVIDIA
Pkg.add(["SHTnsKit", "AMDGPU", "GPUArrays", "GPUArraysCore", "KernelAbstractions"]) # AMD

Pkg.add(["SHTnsKit", "Metal"])                                                    # Apple Silicon

Generic analysis(cfg, device_array) and synthesis(cfg, coefficients) calls preserve the vendor device. Strict GPU() dispatch never silently falls back to CPU execution.

On Apple Silicon, load SHTnsKit and Metal and use Float32 fields or ComplexF32 coefficients. See the Metal example and supported transforms.

System Requirements

MPI Setup (for parallel computing):

# Ubuntu/Debian
sudo apt-get install libopenmpi-dev

# macOS  
brew install open-mpi

# To use the system MPI from your Julia project
julia --project=. -e 'using Pkg; Pkg.add("MPIPreferences"); using MPIPreferences; MPIPreferences.use_system_binary()'
julia --project=. -e 'using Pkg; Pkg.instantiate()'

Citation

If you use SHTnsKit.jl in your research, please cite:

@article{schaeffer2013efficient,
  title={Efficient spherical harmonic transforms aimed at pseudospectral numerical simulations},
  author={Schaeffer, Nathana{\"e}l},
  journal={Geochemistry, Geophysics, Geosystems},
  volume={14},
  number={3},
  pages={751--758},
  year={2013},
  publisher={Wiley Online Library}
}

License

SHTnsKit.jl is released under the GNU General Public License v3.0 (GPL-3.0), ensuring compatibility with the underlying SHTns library.

References

About

A comprehensive Julia implementation of the SHTns C library.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages