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
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.5.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.5.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.5.0
File Size Uploaded Provenance Actions
cuju_engine-0.5.0.tar.gz 3.0 MB With provenance Details for cuju_engine-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cuju-engine 0.5.0
File Actions
cuju_engine-0.5.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for cuju_engine-0.5.0-py3-none-win_amd64.whl
cuju_engine-0.5.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.5.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuju_engine-0.5.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.5.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuju_engine-0.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for cuju_engine-0.5.0-py3-none-macosx_11_0_arm64.whl
cuju_engine-0.5.0-py3-none-macosx_10_15_x86_64.whl Python 3 none macOS 10.15+ x86-64 Details for cuju_engine-0.5.0-py3-none-macosx_10_15_x86_64.whl

Total release size: 30.6 MB

Release files / cuju_engine-0.5.0.tar.gz

Download URL cuju_engine-0.5.0.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d6f41c5fcb090ad4a87804feff8ff1dcace6f414cfc510dbf0bec925cbf332c6
BLAKE2b-256 checksum
How to use checksums
e1a0ee89275fd8001fca3cae4fab9aec29b01921997e1cd21f8613932dc23218
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.5.0-py3-none-win_amd64.whl

Download URL cuju_engine-0.5.0-py3-none-win_amd64.whl
Size 9.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d12ddd0f36f130ee74c748bef63435b513295df8f6d99f74664193a5fb33e4e9
BLAKE2b-256 checksum
How to use checksums
2c8e8c3e1917a50494e7e924be8c16641a5d8659de5682cb99c448b1dffb00d2
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.5.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuju_engine-0.5.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
ef59a0b39656bb2a2aea17ae4f6d6f52b1fe33c21702617b37c0ffbd67be0e00
BLAKE2b-256 checksum
How to use checksums
7b82e0e0ba73a57bce81ec57e5bfe81684beef5d3b4407dc2249146af6906eb7
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.5.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuju_engine-0.5.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
4b392098b5ee08b741a191c5ce6ab50dfda8b10c5a84be2fdad5d2d56cd15f0c
BLAKE2b-256 checksum
How to use checksums
83d0a2cd906772ce3f4018c41d8427fd6de7460edddc5e384c26b9eb66d6ac31
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.5.0-py3-none-macosx_11_0_arm64.whl

Download URL cuju_engine-0.5.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
282186f5f5f40391169408ef85718b66a29daeb1de9d9dbfe8679a72d8e02fb9
BLAKE2b-256 checksum
How to use checksums
373dd9a5a172a9f11f6d779aa2cf8cc410fda4b5e8bb06a50a4ad0ced669799b
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.5.0-py3-none-macosx_10_15_x86_64.whl

Download URL cuju_engine-0.5.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
4a5447df4f5bb9f3d828db60fb5d99d7c485cbbc193d78c43079c07b81a9188e
BLAKE2b-256 checksum
How to use checksums
d3ebb8be4632ad5d4361e0488045274627400248db2cd7f2bd371648d8fbc2d0
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.5.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.5.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