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.

How to Install

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 Distribution

opencl_ocl-0.1.1.tar.gz (108.7 kB view details)

Uploaded Source

File details

Details for the file opencl_ocl-0.1.1.tar.gz.

File metadata

  • Download URL: opencl_ocl-0.1.1.tar.gz
  • Upload date:
  • Size: 108.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for opencl_ocl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db89de3e34b55bda1a4c6718a23a6d7a21d518bb97954dc09cb885e511b2ace4
MD5 ee04ef471a81dae68226ab7190e67bca
BLAKE2b-256 16682963676a14fb94f6fed55b739817f926671043b33f7cac379581d85b7416

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 file

0.1.0

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