API

Sending and receiving arrays

Python

Godot

Description

Class to manage shared memory. Handle is a string, that uniquely identifies the memory chunk.









Creates 1d integer tensor with the id name and number of elements size in the shared memory. Creates 1d float tensor with the id name and number of elements size in the shared memory. Class for reading and writing int32 tensors into shared memory. Reads 1d integer tensor from the shared memory. Writes 1d integer tensor to the shared memory. Class for reading and writing float32 tensors into shared memory. Reads 1d float tensor from the shared memory. Writes 1d float tensor to the shared memory.
Class to manage the shared memory. Reads the memory handle from the argument --handle, with which the environment was called. Checks if there is shared memory chunk with the handle, passed to the project. Searches 1d tensor with the id name in the shared memory. Searches 1d tensor with the id name in the shared memory. Class for reading and writing int32 tensors into shared memory. Reads 1d integer array from the shared memory. Writes 1d integer array to the shared memory. Class for reading and writing float32 tensors into shared memory. Reads 1d float tensor from the shared memory. Writes 1d float array to the shared memory.
These classes manage the sending and receiving Arrays or tensors in the shared memory. The Godot part does not allocate or deallocate memory. Only python part can create persistent tensors in the shared memory as well as allocate the memory chunk itself.

Godot classes get their shared memory handle from the command line arguments and assume that the chunk of the shared memory with such handle is already allocated by the caller process.
On the other hand, when python class is constructed it automatically allocates the shared memory chunk with the handle.

Semaphores

Python

Godot

Description

Creates a semaphore name in the shared memory with initial count init_val. Increases semaphore value by 1. Decreases semaphore value by 1. If the value is less or equal to zeros, blocks the process until the value increases.
Initializes the semaphore id to name. Assumes that such semaphore already exists in the shared memory. Increases semaphore value by 1. Decreases semaphore value by 1. If the value is less or equal to zeros, blocks the process until the value increases.
These classes manage the semaphores in the shared memory. Godot classes assume that the semaphores are already created. Meanwhile python classes create them on initialization.

Deployment

Godot

Description

Resource that loads model data from traced torch model. Recognizes .jit files. Stores model data in PoolByteArray. Class for executing torch models Loads data from cTorchModelData into torch model, that is ready for execution. Passes the argument input into torch model, returns the result. Input should be FloatArray.
These classes manage torch jit model loading and executing in Godot engine.