Skip to main content

Cuju Engine

cuju is a bit-exact, batched reimplementation of Google Research Football (GRF) for CUDA and the CPU. It runs thousands of matches at once on one NVIDIA GPU or across the cores of a CPU. With the same seed and actions, its states, observations, rewards and done flags equal GRF's bit for bit, so results compare directly with work on the original benchmark and a policy trained on cuju plays the same way there.

cuju suits on-policy and multi-agent training, self-play, large evaluations and sweeps, where the simulator is the bottleneck. Its software renderer draws GRF's frames byte for byte on the CPU, and GRF's own tools replay the dumps cuju writes. cuju is an independent project, neither affiliated with nor endorsed by Google.

Developer André Koraleski
Written in C++, CUDA, Python
Platforms Linux on x86-64 and Arm, Windows, macOS, WSL2
Backends NVIDIA GPUs of compute capability 7.5 or higher, CPUs with AVX2, BMI2 and FMA, 64-bit Arm CPUs
License Apache-2.0
Reference Google Research Football 2.10.3, commit 3d9e754

PyPI Open In Colab

Install

pip install cuju-engine
cuju check --device cpu

The distribution is cuju-engine, and code imports cuju. PyTorch comes along when missing. For a specific PyTorch build, such as another CUDA version, install it from pytorch.org first. Getting started covers each platform and GPU.

A first loop

import cuju
import torch

batch = cuju.BatchEnvironment('5_vs_5', environment_count=64, left_agents=4, device='auto')
observation = batch.reset()  # [64, 4, 115]
goals = torch.zeros((), dtype=torch.int64, device=batch.device)

for _ in range(1000):
    actions = torch.randint(0, batch.action_count, (64, 4), dtype=torch.int32, device=batch.device)
    observation, reward, done, information = batch.step(actions)
    goals += information['score_reward'].abs().sum()  # ended episodes restart inside the step

print(int(goals), 'goals')

Every call returns the same tensors and overwrites them, so clone what you keep. On a GPU, environment_count rises to thousands. The quickstart notebook runs on Colab's free GPU.

Speed

Engine Machine Configuration Environment steps per second
GRF AMD EPYC 7763 one process 207
GRF AMD EPYC 7763 31 processes 5,819
cuju, CPU AMD EPYC 7763 31 threads 38,497
cuju, GPU NVIDIA RTX 4090 16,384 environments 32,582

The numbers are for 5_vs_5 with four agents a side and simple115v2. Performance has the method and the commands that reproduce them.

Exactness

The reference is GRF 2.10.3 at commit 3d9e754 as built by GCC for x86-64 Linux with glibc 2.39. Both backends give the same bits whatever the thread count, and the renderer's frames equal GRF's on Mesa llvmpipe on every machine. Testing against GRF is internal, and cuju check and pytest tests/ tell whether a build reproduces the release. Issues are welcome, and a difference from GRF is the most valued report. Exactness has the details.

Coming from GRF

cuju.gfootball is GRF's own Python package over cuju's engine, so switching the imports runs GRF code unchanged. cuju.env.create_environment is a faster create_environment, and cuju.BatchEnvironment is the batch, where the speed is.

GRF cuju
create_environment('5_vs_5', number_of_left_players_agent_controls=4) BatchEnvironment('5_vs_5', left_agents=4, environment_count=...)
if done: env.reset() the step that ends an episode starts the next
env.get_state(), env.set_state(state) batch.get_state(index), batch.set_state(index, state)
representation, rewards, stacked, action_set the same names

Documentation

Page Covers
Getting started installation, the training loop, seeds, states, the machine config
API reference every public name, the command line, errors
Observations, rewards and actions what agents see, receive and do, frames and videos
Scenarios the shipped and custom scenarios
Migrating from GRF GRF's interfaces, option mapping, dumps
Controllers controllers for the agents of a batch, matches between them, Kaggle agents and other environments
Recording matches kept as files, replaying them, converting GRF dumps and Kaggle episodes
Scene the exact scene of a match as numpy arrays, with its events and constants
Exactness what equals GRF, how to check, differences
Performance backends, devices, threads, memory

The Cuju family also has cuju-arena for submissions and tournaments, cuju-render for the browser viewer, and an umbrella distribution that installs all of them.

Name

Cuju, written 蹴鞠 and pronounced cùjū, is the football of ancient China, and the earliest form of the game whose rules people wrote down. The name is a tribute, and the project is unconnected with any institution that preserves the game.

Citing

Research that uses cuju is asked to cite both cuju and GRF.

@software{cuju2026,
    author  = {Koraleski, Andr{\'e}},
    title   = {cuju: a bit-exact, batched reimplementation of {Google Research Football}, for {CUDA}
             and {CPU}},
    year    = {2026},
    version = {0.6.0},
    url     = {https://github.com/cuju-football/engine}
}

@inproceedings{kurach2020google,
    title     = {{Google Research Football}: A Novel Reinforcement Learning Environment},
    author    = {Kurach, Karol and Raichuk, Anton and Sta{\'n}czyk, Piotr and Zaj{\k{a}}c, Micha{\l}
               and Bachem, Olivier and Espeholt, Lasse and Riquelme, Carlos and Vincent, Damien
               and Michalski, Marcin and Bousquet, Olivier and Gelly, Sylvain},
    booktitle = {Proceedings of the AAAI Conference on Artificial Intelligence},
    volume    = {34},
    number    = {04},
    pages     = {4501--4510},
    year      = {2020},
    doi       = {10.1609/aaai.v34i04.5878}
}

CITATION.cff holds the same entry for GitHub's citation button.

License

cuju is licensed under Apache-2.0. It reimplements GRF, licensed under Apache-2.0 by Google LLC, and NOTICE lists every credit. The math functions in include/cuju/libm/ are ports of the GNU C Library under the LGPL 2.1 or later.

  • Using cuju in open or proprietary code carries no obligation. Obligations start with distribution.
  • Redistributing cuju's libraries means keeping LICENSE, NOTICE and LICENSES/ with them and offering the matching source, which every PyPI release carries as its sdist.
  • Compiling the C++ headers into another program brings the LGPL into that program.

Metadata

Release files for cuju-engine 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuju-engine 0.6.0
File Size Uploaded Provenance Actions
cuju_engine-0.6.0.tar.gz 3.0 MB With provenance Details for cuju_engine-0.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cuju-engine 0.6.0
File Actions
cuju_engine-0.6.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for cuju_engine-0.6.0-py3-none-win_amd64.whl
cuju_engine-0.6.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for cuju_engine-0.6.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuju_engine-0.6.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 Details for cuju_engine-0.6.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuju_engine-0.6.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for cuju_engine-0.6.0-py3-none-macosx_11_0_arm64.whl
cuju_engine-0.6.0-py3-none-macosx_10_15_x86_64.whl Python 3 none macOS 10.15+ x86-64 Details for cuju_engine-0.6.0-py3-none-macosx_10_15_x86_64.whl

Total release size: 30.8 MB

Release files / cuju_engine-0.6.0.tar.gz

Download URL cuju_engine-0.6.0.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
3ad0b9ad2d0b69f9c9b9eb46f60525880000f4754c599bc76075b8e9ec09f5da
BLAKE2b-256 checksum
How to use checksums
801d6faa2a671d98ea5527d7e97306e1c34f769585788365780b9c0195c0e27e
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 26, 2026.

Transparency log

Release files / cuju_engine-0.6.0-py3-none-win_amd64.whl

Download URL cuju_engine-0.6.0-py3-none-win_amd64.whl
Size 9.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
eda0ebae69c5728eab6f90e185b2a794586a6ec30f739ab535eb5e6a81b4fbc8
BLAKE2b-256 checksum
How to use checksums
20334d8af9b351ee9ad483f02539f9368ae415a0257af22a61bed2ffeccac822
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 26, 2026.

Transparency log

Release files / cuju_engine-0.6.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuju_engine-0.6.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 9.2 MB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
955b7a4f832db3a491396d53ba4eabfcb8af7d0b7489abe478e7ef1b2417f0d3
BLAKE2b-256 checksum
How to use checksums
8c5740f6da68bd51202a47717a4128ea47419a55070a95f066b4664379686476
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 26, 2026.

Transparency log

Release files / cuju_engine-0.6.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuju_engine-0.6.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 3.2 MB
Tags Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b12b63c59e642d003bd7e0372f78faf007387f09056fd872edeebbf9682b091c
BLAKE2b-256 checksum
How to use checksums
a2e495a79a10df0381c32ef6829a939fbded0dde31759ccb7ee8e1e2c3ce6840
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 26, 2026.

Transparency log

Release files / cuju_engine-0.6.0-py3-none-macosx_11_0_arm64.whl

Download URL cuju_engine-0.6.0-py3-none-macosx_11_0_arm64.whl
Size 3.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f48bda157a5f16eb02b75c79c3402aa51aeadc049607a82ea6171be095b77200
BLAKE2b-256 checksum
How to use checksums
31a89031962c4ec56ecbca641805eb8dbeab143bf5f178eec95d1980540b9c84
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 26, 2026.

Transparency log

Release files / cuju_engine-0.6.0-py3-none-macosx_10_15_x86_64.whl

Download URL cuju_engine-0.6.0-py3-none-macosx_10_15_x86_64.whl
Size 3.1 MB
Tags Python 3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
fc497b3e5d139635f844fb9c9c6f57ab959c90d45dea560e68ef48e05e736b95
BLAKE2b-256 checksum
How to use checksums
84c53f767a681369d98d8f6690e3fd6e34005c5a0df74d9a110bfb83564110bc
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 26, 2026.

Transparency log

Security for cuju-engine 0.6.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

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for cuju_engine-0.6.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 26, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page