{"id":13514884,"url":"https://github.com/takuseno/cpp-dqn","last_synced_at":"2025-07-23T10:33:52.876Z","repository":{"id":80512637,"uuid":"208546630","full_name":"takuseno/cpp-dqn","owner":"takuseno","description":"Blazingly Fast Implementation of Deep Q-Network in C++ with NNabla","archived":false,"fork":false,"pushed_at":"2020-03-03T06:36:47.000Z","size":108,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T07:16:37.053Z","etag":null,"topics":["cpp","deep-reinforcement-learning","nnabla"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takuseno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-09-15T05:26:42.000Z","updated_at":"2025-03-21T16:08:45.000Z","dependencies_parsed_at":"2023-04-06T13:28:14.978Z","dependency_job_id":null,"html_url":"https://github.com/takuseno/cpp-dqn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/takuseno/cpp-dqn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fcpp-dqn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fcpp-dqn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fcpp-dqn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fcpp-dqn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuseno","download_url":"https://codeload.github.com/takuseno/cpp-dqn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuseno%2Fcpp-dqn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266662855,"owners_count":23964624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","deep-reinforcement-learning","nnabla"],"created_at":"2024-08-01T05:01:03.128Z","updated_at":"2025-07-23T10:33:52.850Z","avatar_url":"https://github.com/takuseno.png","language":"C++","readme":"![](https://github.com/takuseno/cpp-dqn/workflows/Build%20and%20Test/badge.svg)\n![Docker Pulls](https://img.shields.io/docker/pulls/takuseno/cpp-dqn)\n![GitHub](https://img.shields.io/github/license/takuseno/cpp-dqn)\n\n# cpp-dqn\nDeep Q-Network implementation written in C++ with NNabla.\n\nThis project aims for the :zap: fastest and :smile: readable DQN implementation.\n\nmacOS and Linux are currently supported.\n\n## TODO\n- [ ] reproduce [the Nature paper](https://www.nature.com/articles/nature14236).\n- [ ] add more DQN-based algorithms (Double DQN, Prioritized DQN, ...)\n- [ ] use [CULE](https://github.com/NVlabs/cule) for further speed up.\n\n## third party\n- [nnabla](https://github.com/sony/nnabla)\n- [nnabla-ext-cuda](https://github.com/sony/nnabla-ext-cuda)\n- [Arcade Learning Environment](https://github.com/mgbellemare/Arcade-Learning-Environment)\n- [googletest](https://github.com/google/googletest)\n- [gflags](https://github.com/gflags/gflags)\n- [atari-py](https://github.com/openai/atari-py) (only for extracting ROMs)\n\n## pull prebuilt docker container\nIf you want to play with this implementation on docker container, please use the prebuilt container.\n```\n$ docker pull takuseno/cpp-dqn\n$ docker run -it --rm --runtime nvidia --name cpp-dqn takuseno/cpp-dqn:latest bash\nroot@834182ee578b:/cpp-dqn# ./bin/train -rom atari_roms/breakout.bin\n```\n\nDockerHub: https://hub.docker.com/r/takuseno/cpp-dqn\n\n## play with a pretrained model\n```\nroot@834182ee578b:/cpp-dqn# ./bin/play -rom atari_roms/breakout.bin -load logs/experiment_xxxx/10000000.param\n```\nIf you want to see GUI window through the container, try the following commands.\n```\n$ xhost + # this is required only once\n$ docker run -it --rm --runtime nvidia \\\n  -v /tmp/.X11-unix/:/tmp/.X11-unix \\\n  --shm-size=256m \\\n  -e QT_X11_NO_MITSHM=1 \\\n  -e DISPLAY=$DISPLAY \\\n  --name cpp-dqn takuseno/cpp-dqn:latest bash\nroot@834182ee578b:/cpp-dqn# ./bin/play -rom atari_roms/breakout.bin -load logs/experiment_xxxx/10000000.param -gui\n```\n\n## build with docker\nTo skip manual build, use prebuilt container and mount the current directory by running the following commands.\n```\n$ ./scripts/up.sh --runtime nvidia\nroot@834182ee578b:/cpp-dqn# mkdir build\nroot@834182ee578b:/cpp-dqn# cd build\nroot@834182ee578b:/cpp-dqn/build# cmake .. -DGPU=ON\nroot@834182ee578b:/cpp-dqn/build# make\nroot@834182ee578b:/cpp-dqn/build# cd ..\nroot@834182ee578b:/cpp-dqn# ./bin/train -rom atari_roms/breakout.bin\n```\n\nAs `scripts/up.sh` will enable X11 to show GUI window, you can use `-gui` option to see rendered screens.\n\n## manual build\n### nnabla\nBefore building this repository, you need to install NNabla.\nSee [official instruction](https://github.com/sony/nnabla/blob/master/doc/build/build_cpp_utils.md).\nNote that arguments of cmake must be as follows.\n```\n$ cmake -DBUILD_CPP_UTILS=ON -DBUILD_PYTHON_PACKAGE=OFF ..\n```\n\nIf you use GPU, you additionally need to install CUDA extension of NNabla.\nSee [official instruction](https://github.com/sony/nnabla-ext-cuda/blob/master/doc/build/build.md).\n\n### SDL\nBy default, SDL libraries are used to build to render GUI. Then you need to install related libraries.\nIf you need to omit this, you have to set `-DUSE_SDL=OFF`.\n```\n# macOS\n$ brew install sdl sdl_gfx sdl_image\n\n# Ubuntu\n$ sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libsdl-image1.2-dev\n```\n\n### build DQN\nFinally, run the following codes to build DQN.\n```\n$ mkdir build\n$ cd build\n$ cmake .. # add -DGPU=ON option to build with cuda extension\n$ make\n```\n\n## test\n```\n$ cd build\n$ make\n$ cd ..\n$ ./scripts/test.sh\n```\n\n## format codes\n`clang-format` is used to format entire codes with `llvm` style.\n```\n$ ./scripts/autoformat.sh\n```\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuseno%2Fcpp-dqn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuseno%2Fcpp-dqn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuseno%2Fcpp-dqn/lists"}