Skip to main content

BipedalWalker OpenCL PPO Trainer

Note: This repository may be named python , but it is NOT a fork of the Python programming language. It is a standalone project containing an OpenCL-accelerated PPO trainer for the BipedalWalker-v3 Gymnasium environment, plus custom OpenCL kernels for neural network operations , Though text_trainer.py and setup_ocl.py needs Python.

What this is

  • PPO trainer for BipedalWalker-v3 with a custom laser hazard wrapper
  • OpenCL acceleration for neural network forward/backward passes via libtorch tensors
  • Tiled SGEMM kernel adapted from dlprimitives (MIT License, Artyom Beilis)
  • Optional pygame rendering + ffmpeg video recording
  • Config-driven hyperparameters (config.yaml)
  • Optional SyncVectorEnv parallel environments
  • CSV + TensorBoard logging
  • Live web dashboard (dashboard_server.py) via Flask + SSE
  • OpenCL cache limits configurable via opencl: section in config.yaml
  • Per-update memory logging and dashboard cache stats

Key files

File Purpose
text_trainer.py Main training / inference loop, PPO agent, LaserHazardWrapper, OpenCL dispatch, atomic live stats writer
dashboard_server.py Flask + SSE server for live browser dashboard
templates/dashboard.html Single-page dashboard UI
opencl_ocl.cc OpenCL kernels (tiled SGEMM, fused Linear+ReLU/Tanh, ReLU/Tanh, backward) + pybind11
setup_ocl.py Builds the OpenCL extension with CMake + libtorch
CMakeLists.txt CMake config (Torch, torch_python, OpenCL, pybind11)
config.yaml Hyperparameters (episodes, lr, laser, hidden, num_envs, compute_chain, dashboard…)
fixer.cc Forces pygame display.flip() + event.pump() via GDB every 33ms
fixer_opencl.cc Validates OpenCL vs CPU every 1s; calls cleanup() on mismatch
best_walker.pt / walker_checkpoint.pt Saved policy/value checkpoints
training_log.csv Per-episode reward / steps / laser_speed / best

Build

python setup_ocl.py

Train

python text_trainer.py --train

Live dashboard

# terminal 1
python text_trainer.py --train

# terminal 2
python dashboard_server.py

# browser
http://127.0.0.1:8080

Run inference

python text_trainer.py --run

Requirements

  • Python 3.12+
  • PyTorch with libtorch
  • OpenCL SDK / ICD
  • pybind11
  • gymnasium, pygame, numpy, pyyaml, psutil, flask

License

MIT — see LICENSE for details.

Attribution

Tiled SGEMM kernel adapted from dlprimitives (MIT License, Artyom Beilis).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencl_ocl-0.1.0-py3-none-any.whl (105.4 kB view details)

Uploaded Python 3

File details

Details for the file opencl_ocl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: opencl_ocl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 105.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for opencl_ocl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 572935d9f8016c8aa2df7f8dc3f21f156f1f865c0d9b7f86be8a498f508f42eb
MD5 b3dfe5c04b20af51490f746c2581821b
BLAKE2b-256 78c501fe74ec187f6196514628bdde4840cb3dd37c67a8f83051441936eb3b66

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

1 file

This release

0.1.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page