-
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
0b580b7
commit 1c9ef7d
Showing
9 changed files
with
133 additions
and
12 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,16 +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" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" | ||
|
||
|
@@ -24,6 +18,7 @@ ClimaCommsMPIExt = "MPI" | |
|
||
[compat] | ||
CUDA = "3, 4, 5" | ||
Adapt = "3, 4" | ||
Logging = "1.9.4" | ||
LoggingExtras = "1.1.0" | ||
MPI = "0.20.18" | ||
|
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
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