Reference

Files

Genv uses JSON files to keep its state. These files are queried and modified by genv commands.

You can take a look at the files using the command:

cat ${GENV_TMPDIR:-/var/tmp/genv}/*.json

Note

These state files are saved under /var/tmp/genv by default. This can be configured with the environment variable GENV_TMPDIR.

These files are created by Genv on the first use as well as the temp directory. Genv makes sure that any Linux user would have permissions to these files.

This can be seen with the following command:

ls -la ${GENV_TMPDIR:-/var/tmp/genv}

You can see that the directory was created with rwxrwxrwx and the files with rw-rw-rw.


envs.json

Information about active environments and their configuration.


devices.json

Information about device attachments.

Environment Variables

GENV_BYPASS

Bypass shim behaviors and use similar behavior to the original applications. Default is 0.


GENV_TERMINATE_PROCESSES

Control whether to actually terminate enforced processes or not. Default is 1.


GENV_MOCK_COMPUTE_APPS_GPU_MEMORY

Used GPU memory for compute apps in the nvidia-smi mock shim. Default is 42mi.


GENV_MOCK_COMPUTE_APPS_PROCESS_NAME

Name of processes to be considered as compute apps in the nvidia-smi mock shim. Default is sleep (e.g. sleep infinity).


GENV_MOCK_CUDA_VERSION

CUDA version in the nvidia-smi mock shim. Default is 12.0.


GENV_MOCK_DEVICE_COUNT

Device count in the nvidia-smi mock shim. Default is 2.


GENV_MOCK_DEVICE_NAME

Device name in the nvidia-smi mock shim. Default is NVIDIA GeForce RTX 2080 Ti.


GENV_MOCK_DEVICE_TEMPERATURE

Device temperature in degrees C in the nvidia-smi mock shim. Default is 38.


GENV_MOCK_DEVICE_TOTAL_MEMORY

Total device memory. Used in the nvidia-smi mock shim and @genv.ray.remote.


GENV_MOCK_DEVICE_USED_MEMORY

Used device memory in the nvidia-smi mock shim. Default is 10mi.


GENV_MOCK_DEVICE_UTILIZATION

Device utilization in the nvidia-smi mock shim. Default is 93.


GENV_MOCK_DRIVER_VERSION

Driver version in the nvidia-smi mock shim. Default is 525.147.05.


GENV_TMPDIR

Path of the temp directory where all state JSON files are stored. Default is /var/tmp/genv.

Shims

A shim 1 is a small application that runs instead of the originally intended one and acts as a middleware. It manipulates the input and output of the real application, and provides an easy way to de-facto change the behavior of the original application.


docker

This shim modifies the argument --gpus if passed.

When all is passed, this shim passes the indices of all the devices that are attached to the environment. When a device count is passed (e.g. --gpus 2), this shim passes indices of this amount of devices that are attached to the environment. Any other value is not supported at the moment.


nvidia-smi

By default, nvidia-smi shows information about all GPUs and processes.

It supports showing information about some of the devices by passing the argument --id and specifying GPU indices. It is also good to note that nvidia-smi ignores the environment variable CUDA_VISIBLE_DEVICES as it uses NVML and not CUDA.

This shim passes the argument --id to nvidia-smi and specifies the device indices that are attached to this environment.

It also filters out processes that are not from the current environment, and shows GPU memory information that is relevant only for this environment, by summing the used GPU memory of all processes in this environment.

1

Shim (computing) - Wikipedia