Converting between devices
ClimaCore.to_device — Function
to_device(device, x)Move x to the given device.
x is a DataLayouts.DataLayout, Spaces.AbstractSpace, Fields.Field, or Fields.FieldVector; this moves the backing arrays between CPUs and GPUs in either direction.
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.
ClimaCore.to_cpu — Function
to_cpu(x)Move the backing data of x to the CPU.
x is a DataLayouts.DataLayout, Spaces.AbstractSpace, Fields.Field, or Fields.FieldVector. 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.
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.
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.