copapy.Target#
- class copapy.Target(arch='native', optimization='O3')#
Bases:
_LocalMemoryTarget device for compiling for and running on copapy code.
Initialize Target object
- Parameters:
arch (
str) – Target architectureoptimization (
str) – Optimization level
- buffer(variable)#
Returns memory of an array on the target as memoryview.
Only available for the local target. All buffers must be released or deleted before a new program is compiled on the same target.
- Parameters:
variable (
array[Any]) – Array-variable to get the memory of- Return type:
memoryview[Any]- Returns:
Writable memoryview of the array memory
- compile(*values)#
Compiles the code to compute the given values.
- Parameters:
values (
Any) – Values, vectors, tensors and arrays to compute, also in (nested) sequences or as values of dicts- Return type:
None
- read_value(variables)#
Reads the numeric value of a copapy type.
- Overloads:
- Parameters:
variables (
Any) – Variable or multiple variables to read- Returns:
Numeric value or values. Arrays are returned as nested lists, arrays marked with map_to_buffer or map_to_numpy as memoryview or numpy array. Sequences and dicts are returned as lists and dicts of the values of their items.
- read_value_remote(variable)#
Reads the raw data of a value by the runner.
- Return type:
None
- run()#
Runs the compiled code on the target device.
- Return type:
None
- sdb: stencil_database#