Converting between devices

ClimaCore.to_deviceFunction
out = to_device(device, x::Union{
    DataLayouts.AbstractData,
    Spaces.AbstractSpace,
    Fields.Field,
    Fields.FieldVector,
})

Move x to the given device.

This is particularly useful to move different types of Space.AbstractSpaces, Fields.Fields, and Fields.FieldVectors from CPUs to GPUs and viceversa.

If the input is already defined on the target device, returns a copy.

This means that out === x will not in general be satisfied.

source
ClimaCore.to_cpuFunction
out = to_cpu(x::Union{
    DataLayouts.AbstractData,
    Spaces.AbstractSpace,
    Fields.Field,
    Fields.FieldVector,
})

Move x backing data to the CPU.

This is particularly useful for Space.AbstractSpaces, Fields.Fields, and Fields.FieldVectors.

Returns a copy.

This means that out === x will not in general be satisfied.

source