omlins/ParallelStencil.jl
Package for writing high-level code for parallel high-performance stencil computations that can be deployed on both GPUs and CPUs
What it solves
ParallelStencil.jl provides a way for domain scientists to write high-performance parallel stencil computations without needing to write low-level code for different hardware architectures. It bridges the gap between high-level Julia code and the performance of CUDA C or HIP, allowing researchers to deploy the same code across CPUs and various GPUs (Nvidia, AMD, Apple Metal) with minimal effort.
How it works
The library uses a set of macros, primarily @parallel, to parallelize and optimize functions. It leverages existing backends like CUDA.jl, AMDGPU.jl, Metal.jl, and KernelAbstractions.jl for GPUs, and Base.Threads and Polyester.jl for CPUs.
Key features include:
- Math-close notation: Specialized submodules (
FiniteDifferences1D,2D,3D) provide macros like@innand@d2_xithat allow users to write finite difference equations in a syntax that closely resembles mathematical notation. - Memory Optimization: The
memopt=trueargument in@parallelenables automatic optimization of registers and shared memory. - Hardware Agnosticism: Users can initialize the backend once and switch hardware targets at runtime using
KernelAbstractions.jlwithout redefining kernels. - Distributed Scaling: Through interoperability with
ImplicitGlobalGrid.jl, it supports massively scalable applications across thousands of GPUs/CPUs, including the ability to hide communication overhead behind computation. - Automatic Differentiation: It supports the automatic differentiation of parallel kernels via
Enzyme.jl.
Who it’s for
It is designed for domain scientists and researchers performing high-performance numerical simulations (e.g., heat diffusion, poro-hydro-mechanical applications) who need GPU acceleration and multi-node scaling but prefer to avoid the complexity of writing architecture-specific kernel code.
Highlights
- High Performance: Can achieve up to 70% of theoretical GPU performance bounds, significantly outperforming standard GPU array programming.
- Cross-Platform: Single codebase for CPU, Nvidia GPU, AMD GPU, and Apple Metal.
- Massive Scalability: Supports weak scaling on thousands of GPUs when paired with
ImplicitGlobalGrid.jl. - Developer Friendly: Provides math-like syntax for stencil operations and runtime hardware selection for interactive prototyping.
Related
- Project
- Project
- Project
- Project
- Project