COSMIC WARP
COSMIC WARP is a GPU-parallel spacecraft dynamics simulator built on
NVIDIA Warp. It propagates thousands to
millions of independent spacecraft environments at once — 6-DOF orbital and
attitude dynamics in float64, with thrusters, reaction wheels and
environmental perturbations — for Monte Carlo studies, trajectory and
parameter optimization with exact gradients, and reinforcement learning.
simulate() and the RL environment replay each step as a CUDA graph, with
no host round-trip inside the loop.
Documentation — installation, guides, examples, theory and API reference.
Status: 0.1 beta. The public API may change before 1.0; every breaking change is listed in the changelog.
Highlights
- GPU-parallel — physics, integration and termination fused into one
kernel per step for every environment;
simulate()replays the step as a CUDA graph - Float64 throughout — all dynamic state and physics in double precision
- Integrators — Euler, RK4 (default) and a symplectic kick–drift–kick scheme, each verified to reach its nominal order of convergence
- Physics — point-mass gravity, J2, atmospheric drag, gravity-gradient and magnetic torques, each switchable; variable mass from thruster propellant use
- Actuators — up to 8 thrusters (Isp, propellant use) and 4 reaction wheels (momentum saturation, viscous friction) per body
- Multi-body — several spacecraft per environment, configured per body and terminated together (no forces between them)
- Differentiable — reverse-mode gradients through the dynamics w.r.t. initial state, control sequences and vehicle parameters, checked against finite differences
- Reinforcement learning — on-device vectorized environment with
auto-reset and zero-copy torch views, adapters for rsl_rl, skrl and
rl_games, and a differentiable environment for first-order methods; a
reference task and a minimal SHAC trainer in
examples/ - Domain randomization and reset sampling — on-GPU, including orbital element sampling
- Validated — tests against analytic results: Kepler orbits, J2 secular rates, drag decay, torque-free rigid-body motion, Hohmann transfers, the rocket equation, Clohessy–Wiltshire relative motion, closed-form torques
Inside a step
One fused kernel per step integrates every entity: one GPU thread each, with
the forces, torques, actuators, integrator update and termination check
inside. simulate() records the step's kernels once as a CUDA graph and
replays them.
Learning through the dynamics
DiffVecEnv runs short windows of steps on torch's autograd graph, so a
loss built from the rewards differentiates through the policy and the
dynamics at every step — the gradient a first-order method such as SHAC
uses (example 17).
Installation
pip install cosmic-warp
Optional extras (quote the brackets):
| Extra | Adds |
|---|---|
torch |
PyTorch: torch views, differentiable RL |
rsl-rl, skrl, rl-games |
the trainer adapters (each pulls in torch) |
examples |
matplotlib for the example scripts |
pip install "cosmic-warp[torch,skrl]"
The examples and tests live in the repository; to run them, install from a clone:
git clone https://github.com/Pedro-g-Lima/COSMIC_WARP.git
cd COSMIC_WARP
pip install -U pip # the dependency groups below need pip 25.1
pip install -e ".[examples]"
A CUDA GPU is the intended target; everything also runs on the CPU
(device="cpu"; the default is "cuda", with no automatic fallback). See
Getting started.
Quick start
from cosmic_warp.core.pipeline import SpacecraftSimulator
# 1000 spacecraft in low Earth orbit, drawn from the default reset bounds
sim = SpacecraftSimulator(num_envs=1000, integrator="rk4", dt=1.0)
sim.reset()
trajectory = sim.simulate(num_steps=600, save_states=True)
positions = trajectory["positions"].numpy() # [num_steps, num_envs, 3]
Whole scenarios (physics, per-body vehicles and actuators, reset bounds, initial conditions) can be defined in YAML (this file ships with the repository; run from its root):
from cosmic_warp.core.config import create_simulator_from_yaml
sim = create_simulator_from_yaml("examples/multibody_orbit.yaml")
Continue with Getting started and the YAML reference.
Examples
Seventeen scripts in examples/, run from the repository root
(python examples/<name>.py --help):
| Topic | Examples |
|---|---|
| Orbits and integrators | 01 basic orbit, 02 integrator comparison, 05 energy conservation, 08 J2 |
| Batches | 03 Monte Carlo, 04 scalability, 09 multi-body, 10 domain randomization |
| Actuators | 06 thrusters, 07 reaction wheels |
| Gradients | 11 trajectory optimization, 12 system identification |
| Reinforcement learning | 13 environment, 14–16 PPO with rsl_rl / skrl / rl_games, 17 SHAC |
The examples gallery shows each script with its plots and explanation.
Documentation
| Section | Contents |
|---|---|
| Getting started | Install, verify Warp, first orbit |
| Guides | Configuration, vehicles, actuators, resets, physics, running, scaling, RL, differentiable simulation |
| Examples | One page per example script |
| Theory | Conventions, dynamics, gravity and J2, environment, actuators, integrators, sampling, GPU execution, gradients |
| Validation | What the test suite checks, against which results |
| Benchmarks | Measured throughput per GPU |
| API reference | Generated from the docstrings |
| Roadmap | Planned for 1.x and beyond |
Testing and benchmarks
pip install -e . --group dev # pinned test tools (pip >= 25.1)
pytest # full suite on CUDA
pytest --device cpu # the same suite without a GPU
pytest -m "not slow" # skip the end-to-end training tests
python benchmarks/bench.py --save # record this GPU's baseline (first run)
python benchmarks/bench.py # compare; exit 1 on a >15 % regression
Contributing
Contributions are welcome — see CONTRIBUTING.md. For questions, bugs and feature requests, open an issue.
Citation
If you use COSMIC WARP in your research, please cite it (GitHub's "Cite this
repository" uses CITATION.cff):
@software{cosmic_warp,
title = {COSMIC WARP: GPU-Accelerated Spacecraft Simulator},
author = {Lima, Pedro and Arora, Aman},
year = {2026},
version = {0.1.0},
url = {https://github.com/Pedro-g-Lima/COSMIC_WARP}
}
Please also cite the tools it builds on, in particular NVIDIA Warp. BibTeX for these and for every source behind the physics models is on the references page.
License
Acknowledgements
COSMIC WARP is developed by the SpaceR research group at SnT, University of Luxembourg.
Metadata
Release files for cosmic-warp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cosmic_warp-0.1.0.tar.gz | 3.1 MB | With provenance | Details for cosmic_warp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cosmic_warp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cosmic_warp-0.1.0-py3-none-any.whl |
Total release size: 3.2 MB
Release files / cosmic_warp-0.1.0.tar.gz
| Download URL | cosmic_warp-0.1.0.tar.gz |
|---|---|
| Size | 3.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08e00229cf2b125ad0954132f3ec3873d557f4d91c0e243439ce4e3edf3ca223
|
|
BLAKE2b-256 checksum How to use checksums |
def702ab6d831e2e91fef913b68089f20dfb46d9b1dd62540b2c6aa0748c8e86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logRelease files / cosmic_warp-0.1.0-py3-none-any.whl
| Download URL | cosmic_warp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 116.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f458be40d49bd1d9133bd20196a3c6aa988a9c308c100b7dee49d59d53485ca
|
|
BLAKE2b-256 checksum How to use checksums |
7e34466eddfc0eeb2fcb07bd8599c102c9186b051bd21918d6fb1e3aae5a16c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logSecurity for cosmic-warp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cosmic_warp-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.