-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix adapt calls, rm device-side structs
- Loading branch information
1 parent
951f4f4
commit 041ca3e
Showing
9 changed files
with
81 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Adapt | ||
import CUDA | ||
import ClimaCore: Grids | ||
|
||
Adapt.adapt_structure( | ||
to::CUDA.KernelAdaptor, | ||
device::ClimaComms.CPUSingleThreaded, | ||
) = ClimaComms.CUDADevice() | ||
|
||
Adapt.adapt_structure( | ||
to::CUDA.KernelAdaptor, | ||
device::ClimaComms.CPUMultiThreaded, | ||
) = ClimaComms.CUDADevice() | ||
|
||
Adapt.adapt_structure( | ||
to::CUDA.KernelAdaptor, | ||
context::ClimaComms.SingletonCommsContext, | ||
) = ClimaComms.context(Adapt.adapt(to, context.device)) | ||
|
||
Adapt.adapt_structure( | ||
to::CUDA.KernelAdaptor, | ||
grid::Grids.SpectralElementGrid2D, | ||
) = Grids.DeviceSpectralElementGrid2D( | ||
Adapt.adapt(to, grid.topology), | ||
Adapt.adapt(to, grid.quadrature_style), | ||
Adapt.adapt(to, grid.global_geometry), | ||
Adapt.adapt(to, grid.local_geometry), | ||
Adapt.adapt(to, grid.local_dss_weights), | ||
Adapt.adapt(to, grid.internal_surface_geometry), | ||
Adapt.adapt(to, grid.boundary_surface_geometries), | ||
Adapt.adapt(to, grid.enable_bubble), | ||
) | ||
|
||
Adapt.adapt_structure( | ||
to::CUDA.KernelAdaptor, | ||
topology::Topologies.IntervalTopology, | ||
) = IntervalTopology( | ||
Adapt.adapt_structure(to, topology.context), | ||
Adapt.adapt_structure(to, topology.mesh), | ||
Adapt.adapt_structure(to, topology.boundaries), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1 @@ | ||
import ClimaComms | ||
|
||
# Sometimes, it is convenient to know whether something is running on a device or on its | ||
# host. We define new AbstractDevices and AbstractCommsContext to identify the case of a | ||
# function running on the device with data on the device. | ||
|
||
""" | ||
DeviceSideDevice() | ||
This device represents data defined on the device side of an accelerator. | ||
The most common example is data defined on a GPU. DeviceSideDevice() is used for | ||
operations within the accelerator. | ||
""" | ||
struct DeviceSideDevice <: ClimaComms.AbstractDevice end | ||
|
||
|
||
""" | ||
DeviceSideContext() | ||
Context associated to data defined on the device side of an accelerator. | ||
The most common example is data defined on a GPU. DeviceSideContext() is used for | ||
operations within the accelerator. | ||
""" | ||
struct DeviceSideContext <: ClimaComms.AbstractCommsContext end | ||
|
||
ClimaComms.context(::DeviceSideDevice) = DeviceSideContext() | ||
ClimaComms.device(::DeviceSideContext) = DeviceSideDevice() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters