Skip to content
Closed
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9036232
Batch Cosmos camera views and follow the Sim-Transfer recipe in the s…
temiroff Oct 9, 2026
b1050c2
Warm the Cosmos service through its full history window
temiroff Oct 9, 2026
624b2dc
Verify Cosmos cache release and simplify prompt handling
temiroff Oct 9, 2026
d19d3e3
Initialize Cosmos view caches once and organize control documentation
temiroff Oct 9, 2026
2017beb
Keep Cosmos images on the GPU with CUDA IPC and serve on a private Un…
temiroff Oct 9, 2026
a1ee880
Release partial CUDA IPC channels and focus transport coverage
temiroff Oct 9, 2026
687fc86
Clarify CUDA IPC transfer guarantees and view limits
temiroff Oct 9, 2026
dbd6c8c
Document service-side CUDA synchronization accurately
temiroff Oct 9, 2026
a8539f0
Derive Cosmos view counts and episode budgets per session
temiroff Oct 9, 2026
1f57461
Merge service review fixes into Cosmos transport
temiroff Oct 9, 2026
7e5fadf
Queue image transfer controls only for the views a capture covers
temiroff Oct 9, 2026
a258568
Merge per-capture image transfer queueing into Cosmos transport
temiroff Oct 9, 2026
2b0bb1a
Explain the Shadow Hand Cosmos frame budget in the docs
temiroff Oct 9, 2026
ab54cb0
Merge Shadow Hand frame budget docs into Cosmos transport
temiroff Oct 9, 2026
66f0a62
Leave the episode budget out of the Cosmos prompt example
temiroff Oct 9, 2026
0fba320
Explain which canvas the Cosmos warmup compiles
temiroff Oct 9, 2026
ea78168
Default the Cosmos control to depth
temiroff Oct 9, 2026
fab989a
Name the replaced Cosmos frame-budget default in the changelog
temiroff Oct 9, 2026
a5c6e14
Merge service review fixes into Cosmos transport
temiroff Oct 9, 2026
6242a76
Remove the Cosmos server's episode length cap
temiroff Oct 10, 2026
69f3f18
Merge branch 'atemirov/review-service-publish' into atemirov/review-t…
temiroff Oct 10, 2026
49f8abf
Drop the removed episode cap from the transport test service
temiroff Oct 10, 2026
ef35574
Describe per-view frame budgets in the batch length comment
temiroff Oct 10, 2026
ceef4b8
Merge service comment fix into Cosmos transport
temiroff Oct 10, 2026
09656da
Check that restart seeds reach the Cosmos generation iterator
temiroff Oct 12, 2026
0a180fc
Count Cosmos episode frames in one helper that matches the environmen…
temiroff Oct 12, 2026
45906ae
Merge Cosmos frame budget helper and seeds test into Cosmos transport
temiroff Oct 12, 2026
c00f7b6
Describe both Cosmos stream input kinds in the service protocol
temiroff Oct 12, 2026
5067e8a
Use CUDA IPC in auto only for a Cosmos service on this machine
temiroff Oct 12, 2026
c6633e8
Let each Cosmos IPC process own the buffer it writes and free it only…
temiroff Oct 12, 2026
f02dfc9
Replace a Cosmos Unix socket file only when nothing listens on it
temiroff Oct 12, 2026
76a90e7
Merge exp/cosmos after the Cosmos service PR
temiroff Oct 12, 2026
6c5656a
Keep Cosmos IPC buffers until release is confirmed
temiroff Oct 12, 2026
19835cf
Explain why the blur control accepts arrays and device tensors
temiroff Oct 13, 2026
5f03dc5
Remove the unused blur control from the Cosmos service
temiroff Oct 19, 2026
ec5fc69
Merge the blur removal into the Cosmos transport PR
temiroff Oct 19, 2026
a859a07
Record the blur removal in a new changelog fragment
temiroff Oct 19, 2026
099a28d
Identify the service's machine by boot ID only and trim repeated tran…
temiroff Oct 19, 2026
ed04a20
Point the contributing guide's pull request link at main, as on main
temiroff Oct 19, 2026
8229a92
Keep only depth control for Cosmos and drop the modality setting
temiroff Oct 19, 2026
81cc5e0
Skip the isaaclab_tasks changelog for the preset's removed modality a…
temiroff Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* Added a CUDA IPC transport to the Cosmos service: on the same Linux machine and GPU, controls and generated images
move between the camera and service through shared GPU memory, ordered by interprocess CUDA events, without
host copies for that transfer. The camera-side IPC handoff uses events; the service synchronizes its CUDA
stream before replying to report GPU faults. Control preprocessing can still use the CPU: edge
extraction runs in the camera process, and blur filtering copies RGB to the CPU and back in the service.
:attr:`~isaaclab_experimental.cosmos.CosmosModelCfg.transport` selects ``auto`` (default), ``cuda_ipc`` or
``socket``; ``auto`` uses CUDA IPC only when the service's ``status`` reports this machine's boot ID and the
camera's GPU. Each process allocates the buffer it writes and frees it only after the other process released
it.
* Added Unix socket endpoints (``unix:///path``) to the Cosmos service. On Linux the service and cameras default
to ``/tmp/isaaclab-cosmos-<uid>.sock``, which only the user can open; ``tcp://host:port`` remains available for
Isaac Lab on another machine. ``isaaclab-cosmos-server --endpoint`` replaces ``--host`` and ``--port``.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Fixed delays of small Cosmos messages over TCP: each message was written in two parts without
``TCP_NODELAY``, so it could wait 40 ms for a delayed acknowledgment. Messages are now written at once with
``TCP_NODELAY`` on both ends.
* Fixed the Cosmos connection error to name the endpoint and how to start the server.
* Fixed CUDA IPC session setup leaking buffers and events when a later resource could not be created or opened.
Empty file.
55 changes: 47 additions & 8 deletions source/isaaclab_experimental/docs/cosmos.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ service's endpoint. Training uses the existing Isaac Lab environment and command

Start a compatible streaming service using the separate
[Cosmos service setup guide](cosmos_service.md), or use an endpoint provided by the
service operator. The default camera endpoint is `tcp://127.0.0.1:5555`.
service operator. The default camera endpoint is the server's default: on Linux the Unix socket
`/tmp/isaaclab-cosmos-<uid>.sock`, which only your user can open, and `tcp://127.0.0.1:5555` on Windows.
The public Framework's Ray HTTP server has a different interface and cannot be
used as this camera endpoint.

Expand All @@ -27,8 +28,8 @@ A successful response contains `"ready": true` and the model's capabilities. Che
that `"session_active": false` before connecting: this service supports one active
camera session. Wait for the service to finish loading and warming up before
starting training.
For a different endpoint, pass `--endpoint tcp://127.0.0.1:5556` to `status` and
set the camera's `CosmosModelCfg.endpoint` to the same address.
For a different endpoint, pass `--endpoint unix:///path/to/socket` or `--endpoint tcp://127.0.0.1:5556` to
`status` and set the camera's `CosmosModelCfg.endpoint` to the same address.

## Controls and prompts

Expand Down Expand Up @@ -86,7 +87,7 @@ Cosmos updates.

The preset selects one environment, a `640 x 640` RGB camera, and depth controls
covering `0.1` to `1.5` meters. Its prompt describes a Shadow Hand manipulating a
cube, and it connects to `tcp://127.0.0.1:5555`. The camera captures at 10 Hz of
cube, and it connects to the default endpoint. The camera captures at 10 Hz of
simulation time. After the initial generated frame, Cosmos updates every four
captures, so fresh generated observations arrive at 2.5 Hz of simulation time.
Generation latency determines the elapsed time needed to run those captures.
Expand Down Expand Up @@ -123,7 +124,7 @@ The implementation has three boundaries:
| --- | --- | --- |
| `isaaclab_experimental.cosmos.client` | Camera controls, frame queues, requests, resets, and RGB publication | Isaac Lab |
| `isaaclab_experimental.cosmos.server` | Checkpoint loading, inference, serving, and process startup | Cosmos Framework |
| `isaaclab_experimental.cosmos._protocol` | Shared TCP message format | Both |
| `isaaclab_experimental.cosmos._protocol` | Shared socket message format and endpoints | Both |

The standalone `isaaclab-cosmos` distribution installs only the Cosmos directory
into the Framework environment. The server imports the shared protocol and its
Expand All @@ -146,7 +147,6 @@ from isaaclab_experimental.cosmos.client import CosmosModelCfg, depth_processor

input_name, modifiers = depth_processor(
CosmosModelCfg(
endpoint="tcp://127.0.0.1:5555",
modality="depth",
prompt="A robot arm manipulating an object on a workbench.",
# The initial capture plus the episode's captures (here 10 s at 30 per second), rounded up to 1 + 4*k.
Expand Down Expand Up @@ -211,7 +211,7 @@ transfer modifier for queuing, resets, and publication, and validates Cosmos's
required frame cadence before opening a stream. `CosmosModelCfg` creates an
endpoint client implementing the generic image transfer model contract.
The client opens a generation session on its first control chunk. Requests carry
JSON metadata and binary uint8 image arrays over TCP; generated arrays return to
JSON metadata over the endpoint and, with the `socket` transport, binary uint8 image arrays; generated arrays return to
the control tensor's original device.

Each episode generates one initial frame, then updates in chunks of four captured
Expand Down Expand Up @@ -252,12 +252,51 @@ and a new batch size may compile on its first use.
each environment's prompt across its resets. With one environment, a prompt list changes per episode.
- An environment that resets mid-chunk starts its new episode at the next chunk with its newest capture, so all
environments keep one four-frame cadence; it shows black until then.
- One step's message carries at most 16 environments.
- With the socket transport, one step's image message carries at most 16 environments.
- Each environment's history window (`--kv-window`, default 30 latent frames) takes GPU memory. On a 48 GB GPU,
one environment fits with the default window; two need `--kv-window 8`. Larger GPUs fit more environments.
- Reference (RTX PRO 6000 Blackwell MIG 2g.48gb, compiled, 640 x 640, `--kv-window 8`): one environment 917 ms per
step, two 1596 ms (1.15x the throughput), with 39.7 GiB peak memory for two.

## Endpoints and transports

The **endpoint** is how Isaac Lab reaches the service; it carries the session's messages:

| Endpoint | Where it works |
|---|---|
| `unix:///path` (default on Linux, `/tmp/isaaclab-cosmos-<uid>.sock`) | Same machine. Only your user can open the socket; no network port is opened. |
| `tcp://host:port` | Also from another machine, for example Isaac Lab on Windows. |

The **transport** is how control images go to the service, and generated images come back:

| Transport | Data path | Where it works |
|---|---|---|
| `cuda_ipc` | Shared GPU buffers, opened once per session, ordered by interprocess CUDA events. Image transfer between the camera and service needs no host copies. Each step sends only a small message on the endpoint. | Service on the same Linux machine and the same GPU as the camera. |
| `socket` | Images go through host memory in the endpoint's messages. | Any endpoint. |

`CosmosModelCfg.transport` defaults to `auto`: CUDA IPC when the service reports it, runs on this machine (the same
boot ID), and uses the camera's GPU, the socket otherwise. `cuda_ipc` fails when it is unavailable instead of
falling back. `status` lists the service's transports. With the defaults on one Linux machine, image transport uses
shared GPU buffers and the messages use the Unix socket, so no TCP is involved. CUDA IPC avoids the socket
transport's 16-view protocol limit; the available GPU memory still limits the batch size.

Control preprocessing is separate from transport. Edge extraction uses CPU OpenCV in the camera process, and
blur filtering copies RGB from GPU to CPU and back inside the service. CUDA IPC does not remove those copies
or their synchronization costs; it avoids CPU staging when exchanging images between the two processes.
The camera-side IPC handoff orders GPU work with events. The service synchronizes its CUDA stream before
replying so GPU faults reach the client as errors; a complete inference step is not free of host synchronization.

Each process allocates the buffer it writes: the camera its controls, the service its generated images. CUDA
leaves freeing memory that the other process still has open undefined, so each side releases the other's buffer
first. After a failed session the service frees its buffer once the camera disconnects, and the camera keeps its
controls until it exits, because the service may still be reading them.

For Isaac Lab on another machine, start the service with `--endpoint tcp://127.0.0.1:5555` and forward that port,
for example with `ssh -L 5555:localhost:5555 gpu-host`, or keep the Unix socket and forward it with
`ssh -L 5555:/tmp/isaaclab-cosmos-<uid>.sock gpu-host`. Then set the camera's endpoint to `tcp://127.0.0.1:5555`;
the protocol has no authentication, so do not open a public interface. `auto` sees from the boot ID that a tunneled
service runs on another machine and uses the socket.

## Episode frame budget

Each session requests a frame budget, `1 + 4*k` frames per episode; the server sets no limit of its own. The
Expand Down
18 changes: 11 additions & 7 deletions source/isaaclab_experimental/docs/cosmos_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ the server does not import the camera client.

Cosmos Framework also provides a native [Ray serving interface](https://github.com/NVIDIA/cosmos-framework/blob/main/docs/faq.md#q-how-do-i-run-online-inference-with-ray).
That service accepts HTTP generation requests and returns output files. The server
below supplies the incremental TCP camera interface used by this integration.
below supplies the incremental camera interface used by this integration, over a Unix socket on the same
machine or TCP from another machine.

## Prerequisites and paths

Expand Down Expand Up @@ -104,9 +105,11 @@ uv run --no-sync isaaclab-cosmos-server \
--warmup
```

Wait for `Cosmos ready at tcp://127.0.0.1:5555`, then leave this terminal running.
The worker reserves the endpoint before loading the model on `cuda:0`, so a conflicting endpoint fails
immediately. It accepts requests after model loading and warmup; wait for the ready message before connecting.
Wait for `Cosmos ready at unix:///tmp/isaaclab-cosmos-<uid>.sock`, then leave this terminal running. The
server listens on that Unix socket, which only your user can open; it opens no network port.
The worker reserves the endpoint before loading the model once on `cuda:0`, so a conflicting endpoint
fails immediately. It accepts requests after model loading and warmup; wait for the ready message before
connecting from Isaac Lab's environment.

The server sets no episode length limit: each task requests its own frame budget when it opens a session. See
[Episode frame budget](cosmos.md#episode-frame-budget).
Expand All @@ -130,8 +133,9 @@ for one camera on the `(480, 832)` canvas; otherwise omit it to accept requests

The equivalent module entrypoint is
`uv run --no-sync python -m isaaclab_experimental.cosmos.server.worker` with the same
arguments. Use `--device cuda:1` for another GPU, `--port 5556` for another port, or
`--host` to choose the listening interface. Match that endpoint in the camera
arguments. Use `--device cuda:1` for another GPU, and `--endpoint unix:///path/to/socket` or
`--endpoint tcp://127.0.0.1:5556` for another endpoint, for example TCP for Isaac Lab on another machine through
an SSH tunnel (see [Endpoints and transports](cosmos.md#endpoints-and-transports)). Match that endpoint in the camera
configuration.

## Connect Isaac Lab
Expand All @@ -147,7 +151,7 @@ A ready service reports `"ready": true`. Before connecting a camera, check that
`"session_active": false`: the server runs one active generation session with the
camera count requested by Isaac Lab. If a session is active, close that camera or Isaac Lab
process before connecting another. For another endpoint, pass
`--endpoint tcp://127.0.0.1:5556` to the status command.
the same `--endpoint` to the status command.

Run the camera task or training command from [Cosmos camera integration](cosmos.md).
Resetting or closing the camera clears its generation history while keeping the
Expand Down
Loading
Loading