-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define adapt for contexts and devices
Update envs
- Loading branch information
1 parent
06d94a5
commit f4071f3
Showing
9 changed files
with
168 additions
and
51 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
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,14 +1,10 @@ | ||
name = "ClimaComms" | ||
uuid = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d" | ||
authors = [ | ||
"Kiran Pamnany <[email protected]>", | ||
"Simon Byrne <[email protected]>", | ||
"Charles Kawczynski <[email protected]>", | ||
"Sriharsha Kandala <[email protected]>", | ||
"Jake Bolewski <[email protected]>", | ||
"Gabriele Bozzola <[email protected]>", | ||
] | ||
version = "0.6.4" | ||
authors = ["Kiran Pamnany <[email protected]>", "Simon Byrne <[email protected]>", "Charles Kawczynski <[email protected]>", "Sriharsha Kandala <[email protected]>", "Jake Bolewski <[email protected]>", "Gabriele Bozzola <[email protected]>"] | ||
version = "0.6.5" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
|
||
[weakdeps] | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
|
@@ -20,5 +16,6 @@ ClimaCommsMPIExt = "MPI" | |
|
||
[compat] | ||
CUDA = "3, 4, 5" | ||
Adapt = "3, 4" | ||
MPI = "0.20.18" | ||
julia = "1.9" |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Adapt | ||
|
||
""" | ||
Adapt.adapt_structure(::Type{<:AbstractArray}, context::AbstractCommsContext) | ||
Adapt a given context to a context with a device associated with the given array type. | ||
# Example | ||
```julia | ||
Adapt.adapt_structure(Array, ClimaComms.context(ClimaComms.CUDADevice())) -> ClimaComms.CPUSingleThreaded() | ||
``` | ||
!!! note | ||
By default, adapting to `Array` creates a `CPUSingleThreaded` device, and | ||
there is currently no way to conver to a CPUMultiThreaded device. | ||
""" | ||
Adapt.adapt_structure(to::Type{<:AbstractArray}, ctx::AbstractCommsContext) = | ||
context(Adapt.adapt(to, device(ctx))) | ||
|
||
""" | ||
Adapt.adapt_structure(::Type{<:AbstractArray}, device::AbstractDevice) | ||
Adapt a given device to a device associated with the given array type. | ||
# Example | ||
```julia | ||
Adapt.adapt_structure(Array, ClimaComms.CUDADevice()) -> ClimaComms.CPUSingleThreaded() | ||
``` | ||
!!! note | ||
By default, adapting to `Array` creates a `CPUSingleThreaded` device, and | ||
there is currently no way to conver to a CPUMultiThreaded device. | ||
""" | ||
Adapt.adapt_structure(::Type{<:AbstractArray}, device::AbstractDevice) = | ||
CPUSingleThreaded() |
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
Oops, something went wrong.