Installation

Prerequisites

WaveDM.jl requires Julia 1.12 or later (the CI suite runs on Julia 1.12.6). Download Julia from the official website and verify the installation:

julia --version

Optional: GPU support

If you plan to use GPU acceleration you will need:

  • An NVIDIA GPU with CUDA support.
  • The CUDA Toolkit (version 12.x recommended) and a working nvidia-smi on PATH.
  • On Windows, use the latest available NVIDIA driver that matches the CUDA toolkit bundled with CUDA.jl.

Installation

From the Julia registry (recommended)

Open a Julia REPL, press ] to enter package mode, then run:

pkg> add WaveDM

From GitHub (development version)

pkg> add https://github.com/JuliaAstroSim/WaveDM.jl

From a local clone (developer workflow)

git clone https://github.com/JuliaAstroSim/WaveDM.jl.git
cd WaveDM.jl
julia --project -e 'using Pkg; Pkg.develop(PackageSpec(path="."))'

Required dependencies

The following packages are required at runtime. They are installed automatically by Pkg.add WaveDM, so no extra step is needed for a CPU-only installation.

PackageRole
AstroICInitial condition generation
AstroNbodySimN-body gravity and the parallel runtime glue
AstroPlotAnalysis and post-processing visualization
AstroSimBaseCommon type and unit definitions
PhysicalParticlesN-body particle types and vector algebra
PhysicalFFTSpectral primitives for the SPE solver
PhysicalFDMFinite-difference operators (gradient, boundary)
PhysicalMeshesMesh bookkeeping used by the FFT Poisson solver
GalacticDynamicsDensity profiles and orbit calculations
FFTWCPU FFT backend
DistributedDistributed-memory parallelism
DataFrames, CSV, JLD2Data I/O
Unitful, UnitfulAstroUnit handling
LsqFit, Optim, DierckxProfile fitting
Observables, StatsBase, SpecialFunctionsNumerical utilities
GLMakie, CairoMakie, UnicodePlotsVisualization backends

Optional dependencies

PackageRequired for
CUDAGPU acceleration (gpu = true)
SundialsHigh-order N-body integrators via AstroNbodySim
DaggerDistributed task graph (advanced)
Tullio, ZygoteMacro-based and AD-accelerated kernels (advanced)
PaddedViews, StridedStrided-array optimizations for large grids
OffsetArraysOffset indexing for ghost-zone arrays

Setting up GPU support

1. Install the CUDA toolkit

Follow the CUDA.jl installation guide for your platform. On Windows:

  1. Install the latest NVIDIA Studio / Game Ready driver.
  2. Verify that nvidia-smi runs and shows your GPU.
  3. In the Julia REPL, run using CUDA; CUDA.functional()?true — it should print true.

2. Verify in Julia

using CUDA

if CUDA.has_cuda()
    println("CUDA is available")
    println("GPU:           ", CUDA.name(CUDA.device()))
    println("Capability:    ", CUDA.capability(CUDA.device()))
    println("Total memory:  ", CUDA.totalmemory(CUDA.device()) ÷ 1024^3, " GiB")
else
    println("CUDA is not available")
end

3. Smoke test WaveDM.jl on the GPU

using WaveDM
simulate_waveDM(;
    Nx = Ny = Nz = 64,
    Nt = 3,
    Xmax = 2.0,
    Tmax = 0.001,
    gpu = true,
    Realtime = false,         # headless test
    unicode_plot = true,      # terminal progress
    outputdir = mktempdir(),
)

Enabling high-performance FFT

For multi-threaded FFTW on a CPU node:

using FFTW
FFTW.set_provider!("mkl")            # or "fftw" if you prefer the bundled backend
FFTW.set_num_threads(Threads.nthreads())

Pair this with julia -t auto (or julia -t N) when launching Julia.

Enabling distributed memory

Add worker processes from inside your script before loading WaveDM:

using Distributed
addprocs(4)              # spawn four local workers
@everywhere using WaveDM

then pass distributed_memory = true to simulate_waveDM / SPE3D_waveDM. For multi-node clusters use addprocs([("node1", :auto), ("node2", :auto), ...]) with SSH or a cluster manager.

Warning

The distributed FFT Poisson solver is not implemented in the current release. Distributed workers currently accelerate initial-condition generation and N-body work; the full SPE loop must run on a single process.

Verifying the installation

pkg> test WaveDM

test WaveDM runs the unit, integration, and energy-convergence tests in test/.

  1. Use Julia ≥ 1.10 (we test against the current LTS and the latest release).
  2. Create a dedicated project environment for each simulation campaign — reproducibility matters.
  3. Launch with julia -t auto for multi-threading; add FFTW.set_num_threads(...) for the FFT path.
  4. Use GPU for grids $\gtrsim 256^3$; switch back to CPU for very small problems where kernel launch overhead dominates.
  5. For multi-node runs, always profile a small CPU run first to validate the setup before scaling out.
  6. Keep dependencies updated: pkg> update regularly.

Troubleshooting

SymptomLikely cause / fix
OutOfMemoryError on GPUReduce Nx, Ny, Nz or set gpu = false
Slow first runJulia JIT compile time — second runs are much faster; use PackageCompiler for a precompiled sysimage
MethodError: no method matching ... ::Float32The default V in simulate_waveDM is Float32; supply your own if you need Float64
FFTW.PROVIDERS not picking up MKLusing FFTW; FFTW.set_provider!("mkl") must be called before the first FFT
Distributed workers cannot load WaveDMAdd @everywhere using WaveDM after addprocs
CUDA initialization fails on WindowsMake sure the CUDA driver matches the CUDA toolkit bundled with your CUDA.jl version
Profile-fitting stallsReduce extract_min_t so fewer snapshots are scanned, or pre-fit on a single snapshot

If you encounter an issue not listed here, please open a GitHub Issue with a minimal reproduction.

Uninstallation

pkg> rm WaveDM

Next steps

  • Explore the Examples section for end-to-end simulations.
  • Read the Algorithms section to understand the SPE, split-step Fourier method, boundary conditions, and QSS diagnostics.
  • Check the API reference for the configuration structures.