-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPU support #974
Comments
Can we apply operators by |
@simonbyrne is this still a draft or a we fully ready here? |
I guess it's ready? |
Purpose
The purpose of the Proposal and how it accomplishes a team/CliMA objective.
Link to any relevant PRs/issues.
Add GPU support to ClimaCore
Cost/benefits/risks
An analysis of the cost/benefits/risks associated with the proposal.
The key benefit of this proposal is that it would allow us to run code on GPUs, hopefully with minimal changes required to user code.
Producers
A list of the resources and named personnel required to implement the Proposal.
Components
A description of the main components of the software solution.
Inputs
A description of the inputs to the solution (designs, references, equations, closures, discussions etc).
The core ideas is to build a mechanism to describe GPU kernels at a high-level, which can then be used to generate efficient GPU code.
Horizontal kernel
Horizontal kernels are those which include horizontal (spectral element) operations. Internally, we will aim to generate kernels using a similar model as ClimateMachine.jl, which has proven to be very performant.
Threading will use a block for each slab, and a thread for each node inside the slab. As a result, simple broadcasting over a field e.g.
would consist of a simple kernel, using KernelAbstractions.jl (KA from here on) notation:
Operators (gradient, divergence, curl, interpolation, restriction) will consist of the following operations:
@localmem
in KA, or shared memory in CUDA)@private
in KA],MArray
in CUDA)For example, a gradient operation
would correspond to a kernel such as:
Interface
We will continue to make use of the broadcasting syntax for high-level specification, and combined that with the
byslab
function. Consider the following expression:This is really just a different syntax for the following:
The basic idea is to transform
k
into a kernel function, which will then be launched bybyslab
.We should be able to do this transformation by defining a
SlabNodeIndex
type:and defining rules such that for
getindex(::Field, ::SlabNodeIndex)
will give a "slab-node index view"broadcasted
will propagate this viewOperators.allocate_work
will allocate the work arraysOperators.apply_slab
will:materialize!
will copy the broadcasted result into the output array.Results and deliverables
A description of the key results, deliverables, quality expectations, and performance metrics.
Task breakdown
Phase 1: shallow water equations
Topology2D
andDistributedTopology2D
(Remove Topology2D, rename DistributedTopology2D to Topology2D (reduce code duplication) #1057)CUDACommsContext
which wraps aCuContext
: any topologies, spaces, etc created with this will use CuArrays instead of Arrays #1085Topology2D
parametric #1074DataLayouts
#1075SpectralElementSpace2D
#1076Field
s: should be functional after spaces and fields #1077Timeline: end of January 2023
Phase 2: a 3D model
Timeline: aim for end of Feb 2023
Phase 3: Multi GPU and other features
Phase 4: Fix GPU-incompatible physics implementations in ClimaAtmos
Timeline: aim for end of May 2023
Reviewers
The names of CliMA personnel who will review the Proposal and subsequent PRs.
The text was updated successfully, but these errors were encountered: