Skip to content

[envpool] modernize benchmark stack and switch procgen upstream - #337

Merged
Trinkle23897 merged 1 commit into
mainfrom
jiayi/envpool-phase2-benchmark-modernization
Mar 22, 2026
Merged

[envpool] modernize benchmark stack and switch procgen upstream#337
Trinkle23897 merged 1 commit into
mainfrom
jiayi/envpool-phase2-benchmark-modernization

Conversation

@Trinkle23897

Copy link
Copy Markdown
Collaborator

Why

The benchmark path was still pinned to an older Gym/Sample Factory era setup, and Procgen was still sourced from a fork that carried a small set of EnvPool-specific changes. This PR modernizes the benchmark path without touching the larger Bazel/toolchain upgrade track, and moves Procgen back to official upstream with a bounded local patch.

Summary

  • migrate benchmark baseline scripts and docs to the Gymnasium/ALE v5 stack
  • pin build-time setuptools to keep make bazel-build working on Linux
  • make benchmark/test_envpool.py choose a safe default batch_size for small smoke runs while still rejecting invalid explicit configs
  • switch Procgen from Trinkle23897/procgen to official openai/procgen 0.10.7 with a small local patch for Qt5 includes and EnvPool behavior

Test plan

  • dev-0: make flake8
  • dev-0: make py-format
  • dev-0: make docstyle
  • dev-0: make clang-tidy
  • dev-0 verify workspace: make bazel-test
  • dev-0 verify workspace: make bazel-build
  • dev-0 fresh venv: python benchmark/test_gym.py --env atari --num-envs 1 --total-step 20
  • dev-0 fresh venv: python benchmark/test_gym.py --env mujoco --num-envs 1 --total-step 20
  • dev-0 fresh venv: python benchmark/test_gym.py --env box2d --num-envs 1 --total-step 20
  • dev-0 fresh venv: python benchmark/test_envpool.py --env atari --num-envs 1 --total-step 20
  • dev-0 fresh venv: python benchmark/test_envpool.py --env mujoco --num-envs 1 --total-step 20
  • dev-0 fresh venv: python benchmark/test_envpool.py --env box2d --num-envs 1 --total-step 20

@Trinkle23897
Trinkle23897 merged commit 23d408f into main Mar 22, 2026
2 of 4 checks passed
@Trinkle23897
Trinkle23897 deleted the jiayi/envpool-phase2-benchmark-modernization branch March 22, 2026 01:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80d5636e7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +45 to +49
- if (options.use_sequential_levels && step_data.level_complete) {
- step_data.done = false;
- }
+ // if (options.use_sequential_levels && step_data.level_complete) {
+ // step_data.done = false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve sequential-level progression in the Procgen patch

The new local patch comments out upstream's if (options.use_sequential_levels && step_data.level_complete) step_data.done = false;. In EnvPool, any env that reports done is force-reset on the next action (envpool/core/async_envpool.h:126), so with use_sequential_levels=True a completed level now causes a full reset instead of advancing to the next sequential level. That turns an exposed Procgen option into a guaranteed misbehavior for every task that enables it.

Useful? React with 👍 / 👎.

Comment thread benchmark/test_gym.py
Comment on lines +85 to 86
env.close()
print(f"FPS = {frame_skip * total_step * num_envs / (time.time() - t):.2f}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude teardown time from the reported benchmark FPS

The timer is still running when env.close() is called, so the printed FPS now includes environment teardown instead of only stepping time. This especially skews the small smoke runs from the test plan (--total-step 20) and any short benchmark, and it penalizes AsyncVectorEnv most because worker shutdown is non-trivial. Measuring before close() keeps the result comparable to the previous benchmark numbers.

Useful? React with 👍 / 👎.

Comment thread benchmark/test_gym.py
env = make_vector_env(num_envs, async_, lambda: gym.make(task_id))
elif env == "box2d":
task_id = "LunarLander-v2"
task_id = "LunarLander-v3"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Benchmark the same Box2D task in Gym and EnvPool

For --env box2d, this script now runs LunarLander-v3, but benchmark/test_envpool.py:81 and envpool/box2d/registration.py:51 still use LunarLander-v2. That means the modernized benchmark stack no longer compares Gym and EnvPool on the same Box2D environment, so any throughput numbers collected for Box2D are not apples-to-apples.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant