From d81741514bf2fd9fee26bc43ba5833d887494ca8 Mon Sep 17 00:00:00 2001 From: Ludovic Raess Date: Tue, 1 Oct 2024 18:55:40 +0200 Subject: [PATCH] Update doc --- docs/src/concepts/architectures.md | 8 +++++++- docs/src/concepts/grids.md | 3 +++ docs/src/getting_started.md | 6 +++++- docs/src/index.md | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/src/concepts/architectures.md b/docs/src/concepts/architectures.md index 3a673841..c9a8a2f5 100644 --- a/docs/src/concepts/architectures.md +++ b/docs/src/concepts/architectures.md @@ -2,7 +2,7 @@ ## Backend Selection & Architecture Initialization -Chmy.jl supports CPUs, as well as CUDA and ROC backends for Nvidia and AMD GPUs through a thin wrapper around the [`KernelAbstractions.jl`](https://github.com/JuliaGPU/KernelAbstractions.jl) for users to select desirable backends. +Chmy.jl supports CPUs, as well as CUDA, ROC and Metal backends for Nvidia, AMD and Apple M-serie GPUs through a thin wrapper around the [`KernelAbstractions.jl`](https://github.com/JuliaGPU/KernelAbstractions.jl) for users to select desirable backends. ```julia # Default with CPU @@ -21,6 +21,12 @@ using AMDGPU arch = Arch(ROCBackend()) ``` +```julia +using Metal + +arch = Arch(MetalBackend()) +``` + At the beginning of program, one may specify the backend and initialize the architecture they desire to use. The initialized `arch` variable will be required explicitly at creation of some objects such as grids and kernel launchers. ## Specifying the device ID and stream priority diff --git a/docs/src/concepts/grids.md b/docs/src/concepts/grids.md index 3cf07b29..ec7c50f7 100644 --- a/docs/src/concepts/grids.md +++ b/docs/src/concepts/grids.md @@ -48,6 +48,9 @@ grid = UniformGrid(arch; dims=(nx, ny, nz)) ``` +!!! warning "Metal backend" + If using the Metal backend, ensure to initialise the grid using `Float32` (`f0`) values in the `origin` and `extent` tuples. + !!! info "Interactive Grid Visualization" - [grids_2d.jl](https://github.com/PTsolvers/Chmy.jl/blob/main/examples/grids_2d.jl): Visualization of a 2D `StructuredGrid` - [grids_3d.jl](https://github.com/PTsolvers/Chmy.jl/blob/main/examples/grids_3d.jl): Visualization of a 3D `StructuredGrid` diff --git a/docs/src/getting_started.md b/docs/src/getting_started.md index 4dc281df..b087995c 100644 --- a/docs/src/getting_started.md +++ b/docs/src/getting_started.md @@ -47,6 +47,7 @@ using KernelAbstractions # for backend-agnostic kernels using Printf, CairoMakie # for I/O and plotting # using CUDA # using AMDGPU +# using Metal ``` In this introductory tutorial, we will use the CPU backend for simplicity: @@ -56,7 +57,10 @@ backend = CPU() arch = Arch(backend) ``` -If a different backend is desired, one needs to load the relevant package accordingly. For example, if Nvidia or AMD GPUs are available, one can comment out `using CUDA` or `using AMDGPU` and make sure to use `arch = Arch(CUDABackend())` or `arch = Arch(ROCBackend())`, respectively, when selecting the architecture. For further information about executing on a single-device or multi-device architecture, see the documentation section for [Architectures](./concepts/architectures.md) +If a different backend is desired, one needs to load the relevant package accordingly. For example, if Nvidia or AMD GPUs are available, one can comment out `using CUDA`, `using AMDGPU` or `using Metal` and make sure to use `arch = Arch(CUDABackend())`, `arch = Arch(ROCBackend())` or `arch = Arch(MetalBackend())`, respectively, when selecting the architecture. For further information about executing on a single-device or multi-device architecture, see the documentation section for [Architectures](./concepts/architectures.md) + +!!! warning "Metal backend" + Metal backend restricts floating point arithmetic precision of computations to `Float32` or lower. In Chmy, this can be achieved by initialising the grid object using `Float32` (`f0`) elements in the `origin` and `extent` tuples. ## Writing & Launch Compute Kernels diff --git a/docs/src/index.md b/docs/src/index.md index 087b885d..b5ee7a90 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -31,6 +31,7 @@ Chmy.jl provides a comprehensive framework for handling complex computational ta A general list of the features is: +- Backend-agnostic implementation relying on [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl) - Distributed computing support with [MPI.jl](https://github.com/JuliaParallel/MPI.jl) - Multi-dimensional, parameterizable discrete and continuous fields on structured grids - High-level interface for specifying boundary conditions with automatic batching for performance