Utilities and helpers#

Genesis World bundles a set of helper modules under genesis.utils for the operations that surround a simulation: selecting a compute backend, converting between array formats, applying geometric transforms, and loading assets from disk. This page is the entry point to those modules; each linked page documents one of them in detail.

Modules#

Initialization and globals#

Most utilities assume the library has been initialized. gs.init() selects the backend, sets the random seed and float precision, and populates the module-level globals below.

import genesis as gs

gs.init(
    backend=gs.gpu,  # CUDA on Linux, Metal on macOS
    precision="32",
    seed=42,
)

After gs.init() returns, these globals hold the resolved configuration:

Global

Type

Description

gs.device

torch.device

The active PyTorch device (for example, cuda:0, mps:0, or cpu).

gs.backend

backend enum

The backend that was actually selected, after resolving gs.gpu.

gs.EPS

float

Numerical epsilon for the active float precision.

Components#

See also#

  • Options: configuration options passed to the scene and solvers.