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
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.4.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.4.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.4.0
File Size Uploaded Provenance Actions
cuju_engine-0.4.0.tar.gz 2.9 MB With provenance Details for cuju_engine-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cuju-engine 0.4.0
File Actions
cuju_engine-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for cuju_engine-0.4.0-py3-none-win_amd64.whl
cuju_engine-0.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for cuju_engine-0.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
cuju_engine-0.4.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.4.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
cuju_engine-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for cuju_engine-0.4.0-py3-none-macosx_11_0_arm64.whl
cuju_engine-0.4.0-py3-none-macosx_10_15_x86_64.whl Python 3 none macOS 10.15+ x86-64 Details for cuju_engine-0.4.0-py3-none-macosx_10_15_x86_64.whl

Total release size: 30.2 MB

Release files / cuju_engine-0.4.0.tar.gz

Download URL cuju_engine-0.4.0.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
ca586399962533e9a29c48b8cdcb299e08cebf5def1fa03b7163a3d95cf0f9e1
BLAKE2b-256 checksum
How to use checksums
40970c79c9b21fdc696fae23a8a19efe04b93ce0a98780fe4abb730d5d215a1b
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.4.0-py3-none-win_amd64.whl

Download URL cuju_engine-0.4.0-py3-none-win_amd64.whl
Size 9.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
8fa1dfb0cdf939576d18a22e7967e4fbdfe057330b64c964e4527cc91ef300f6
BLAKE2b-256 checksum
How to use checksums
562f883521ca8b22b7b1e741d06ee1e067eabec64bf81e681877256ddcbb58ee
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.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL cuju_engine-0.4.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 9.1 MB
Tags Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
9b1f0955a168db078e0fb8619561e2fda1d34b87fe0fd55e5f10ac9406213b82
BLAKE2b-256 checksum
How to use checksums
99f8c3bd38fadea26d7c6e19a4c2107d201deb60165e3ee93b61ec4b13df4d69
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.4.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL cuju_engine-0.4.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 3.1 MB
Tags Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
e1878770f3d4d259d0c8e2c6f27e077fe4bae8f967b5aa1c47d7e66c430540ca
BLAKE2b-256 checksum
How to use checksums
4b9376abff449446b11d6d9d5954397b9612bca74bdc6ff6b766892c129c7c84
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.4.0-py3-none-macosx_11_0_arm64.whl

Download URL cuju_engine-0.4.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
b23b941e0bf73ca44efdeac377da528669c94af95eba3114408d4775f3ec929a
BLAKE2b-256 checksum
How to use checksums
1b51f1bde3ebc7268bb2bb064cb7a82ff98462635feb88c644f5ec6b2d22e61b
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.4.0-py3-none-macosx_10_15_x86_64.whl

Download URL cuju_engine-0.4.0-py3-none-macosx_10_15_x86_64.whl
Size 3.0 MB
Tags Python 3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
889bfa1db67930b7d89fb83a0c0221d034975df1163021697a3498b7076576d5
BLAKE2b-256 checksum
How to use checksums
0b1dc3391971336fa4f827c4a2839c733bd4e3da736796c3bc8108a33350b489
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.4.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.4.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