diff --git a/.gitignore b/.gitignore index 7de4d962b..62a48b999 100644 --- a/.gitignore +++ b/.gitignore @@ -139,3 +139,4 @@ trained_policies/** *~ cmake-build* +envs/doom/multiplayer/tests/_vizdoom/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..650aeb0f6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: python +dist: bionic +python: + - "3.7" + +notifications: + email: false + +before_install: + - sudo apt-get update + - sudo apt-get install libboost-all-dev libsdl2-dev zlib1g-dev libbz2-dev + - sudo apt-get install libjpeg-dev libfluidsynth-dev libgme-dev libopenal-dev libmpg123-dev + - sudo apt-get install libsndfile1-dev libwildmidi-dev libgtk-3-dev timidity nasm tar chrpath + +install: + - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - source "$HOME/miniconda/etc/profile.d/conda.sh" + - hash -r + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + - conda info -a + - patch environment.yml ./.travis/patchfile.patch + - conda env create -q -f environment.yml + - conda activate sample-factory + +script: + - python -m unittest diff --git a/.travis/patchfile.patch b/.travis/patchfile.patch new file mode 100644 index 000000000..a64185c26 --- /dev/null +++ b/.travis/patchfile.patch @@ -0,0 +1,31 @@ +7a8 +> - astroid=2.4.0=py37_0 +13c14 +< - cudatoolkit=10.1.243=h6bb024c_0 +--- +> - cpuonly=1.0=0 +30a32 +> - isort=4.3.21=py37_0 +33a36 +> - lazy-object-proxy=1.4.3=py37h7b6447c_0 +50a54 +> - mccabe=0.6.1=py37_1 +68a73 +> - pylint=2.5.0=py37_1 +71c76 +< - pytorch=1.4.0=py3.7_cuda10.1.243_cudnn7.6.3_0 +--- +> - pytorch=1.5.0=py3.7_cpu_0 +78c83,85 +< - torchvision=0.5.0=py37_cu101 +--- +> - toml=0.10.0=py37h28b3542_0 +> - torchvision=0.6.0=py37_cpu +> - typed-ast=1.4.1=py37h7b6447c_0 +109a117 +> - gym-minigrid==1.0.1 +125a134,135 +> - tensorflow-cpu==1.15.0 +> - tensorflow-estimator==1.15.1 +129a140 +> - git+https://github.com/alex-petrenko/ViZDoom@doom_bot_project#egg=vizdoom diff --git a/README.md b/README.md index 164891eb9..da2310cb8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/alex-petrenko/sample-factory.svg?branch=master)](https://travis-ci.org/github/alex-petrenko/sample-factory) + # Sample Factory Codebase for high throughput asynchronous reinforcement learning. diff --git a/algorithms/appo/tests/test_model.py b/algorithms/appo/tests/test_model.py index 0025ca8e6..90c4b5b96 100644 --- a/algorithms/appo/tests/test_model.py +++ b/algorithms/appo/tests/test_model.py @@ -1,3 +1,4 @@ +import unittest from unittest import TestCase import torch @@ -11,7 +12,9 @@ class TestModel(TestCase): - def test_forward_pass(self): + + @staticmethod + def forward_pass(device_type): env_name = 'atari_breakout' cfg = default_cfg(algo='APPO', env=env_name) cfg.actor_critic_share_weights = True @@ -24,7 +27,7 @@ def test_forward_pass(self): torch.backends.cudnn.benchmark = True actor_critic = create_actor_critic(cfg, env.observation_space, env.action_space) - device = torch.device('cuda') + device = torch.device(device_type) actor_critic.to(device) timing = Timing() @@ -43,3 +46,10 @@ def test_forward_pass(self): log.debug('Progress %d/%d', i, n) log.debug('Timing: %s', timing) + + def test_forward_pass_cpu(self): + self.forward_pass('cpu') + + @unittest.skipUnless(torch.cuda.is_available(), 'This test requires a GPU') + def test_forward_pass_gpu(self): + self.forward_pass('cuda') diff --git a/envs/doom/multiplayer/doom_multiagent_wrapper.py b/envs/doom/multiplayer/doom_multiagent_wrapper.py index f8631ea09..c89b96142 100644 --- a/envs/doom/multiplayer/doom_multiagent_wrapper.py +++ b/envs/doom/multiplayer/doom_multiagent_wrapper.py @@ -255,7 +255,7 @@ def _ensure_initialized(self): time.sleep(0.05) for i, worker in enumerate(self.workers): - worker.result_queue.get(timeout=5) + worker.result_queue.get(timeout=20) worker.result_queue.task_done() worker.task_queue.join() except filelock.Timeout: