Converting between devices

ClimaCore.to_device — Function
to_device(device, x)

Move x to the given device.

x is typically a DataLayouts.DataLayout, Spaces.AbstractSpace, Fields.Field, or Fields.FieldVector, but can be anything that Adapt.adapt moves; this moves the backing arrays between CPUs and GPUs in either direction. Moving to a ClimaComms.CPUMultiThreaded device is not supported.

Returns

A version of x with its backing arrays on device, as a freshly built wrapper (so out === x does not hold). A move between CPU and GPU allocates new arrays; when x already lives on device, out may share x's arrays rather than copy them.

source
ClimaCore.to_cpu — Function
to_cpu(x)

Move the backing data of x to the CPU.

x is typically a DataLayouts.DataLayout, Spaces.AbstractSpace, Fields.Field, or Fields.FieldVector, as for to_device. Equivalent to to_device(ClimaComms.CPUSingleThreaded(), x).

Returns

A version of x with its backing data on the CPU, as a freshly built wrapper (so out === x does not hold). When x already lives on the CPU, out may share x's arrays rather than copy them.

source
ClimaCore.DeviceSideDevice — Type
DeviceSideDevice()

Device marking data defined on the device side of an accelerator.

The most common example is data defined on a GPU. DeviceSideDevice() identifies operations that run within the accelerator.

source
ClimaCore.DeviceSideContext — Type
DeviceSideContext()

Context associated with data defined on the device side of an accelerator.

The most common example is data defined on a GPU. DeviceSideContext() identifies operations that run within the accelerator.

source