Giter Site home page Giter Site logo

cleanvi's Introduction

CleanVI : MDP Solver Benchmark

Clean Single File Implementations of Value Iteration Across Frameworks and Hardware

This repository contains code for single file implementations for benchmarking an MDP (Markov Decision Process) solver. The solvers are tested on the Frozen Lake environment, which is a dynamic grid-based environment with configurable map size and probability of holes.

Features

  • Implements a core MDP solver class MDP_CORE with support for GPU acceleration.
  • Benchmarks the MDP solver on the Frozen Lake environment with configurable map size and hole probability.
  • Optionally plots the optimal policy and value function for the solved MDP.

Usage

To run the MDP solver benchmark for a particular mode run

python benchmark.py --gamma 0.9975 --epsilon 0.001 --map_size 100 100 --headless --mode torch_cpu

The benchmark script will solve the MDP for the Frozen Lake environment using the specified parameters. It will display the time elapsed, number of backups performed, and the residual error upon convergence. If not running in headless mode, the script will also plot the optimal policy and value function for the solved MDP

Hardware Support

The MDP solver has been implemented on different hardware types and frameworks.

  • CPU
    • Pure Python
    • Numpy
    • Torch
  • GPU
    • Torch (NVIDIA)
    • MLX (APPLE)
    • Jax (NVIDIA)
    • CUDA Kernel (NVIDIA)

Benchmark Results

The following table shows the solve time for different modes of the MDP solver:

Mode Map Size Hole Probability Discount Factor Epsilon Solve Time (seconds) Speedup
pure python 1000x1000 0.05 0.9975 0.001 >5000s -
torch_cpu 1000x1000 0.05 0.9975 0.001 26.91s 1x
torch_gpu 1000x1000 0.05 0.9975 0.001 1.59s 17x

cleanvi's People

Contributors

idigitopia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.