From b329c380262b05da4c0da9b555bd7637fa604261 Mon Sep 17 00:00:00 2001 From: Jackson Clark Date: Mon, 7 Aug 2023 17:29:55 -0500 Subject: [PATCH 1/2] Added conda envirnoments and useful guides. --- README.md | 27 ++++----- environment.yml | 133 ++++++++++++++++++++++++++++++++++++++++++ environment_gpu.yml | 133 ++++++++++++++++++++++++++++++++++++++++++ installation_guide.md | 31 ++++++++++ 4 files changed, 307 insertions(+), 17 deletions(-) create mode 100644 environment.yml create mode 100644 environment_gpu.yml create mode 100644 installation_guide.md diff --git a/README.md b/README.md index 1bb1ef5..5cb21b5 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,17 @@ larger environments. testing a trained model on them. As an example, the trained model used in our paper can be found [here](https://drive.google.com/file/d/1AtAeUwLF1Rn_X3b2FHkHi4fI5vveUHF6/view?usp=sharing). -## Before compilation: compile cpp_mstar code +### Requirements +- [Anaconda](`https://docs.anaconda.com/free/anaconda/install/index.html`) +- [Boost](https://www.boost.org/`) +- If using GPU: + - cuDNN 6 + - CUDA 8 + - GCC 4. +- Ubuntu is strongly reccomended -- cd into the od_mstar3 folder. -- python3 setup.py build_ext (may need --inplace as extra argument). -- copy so object from build/lib.*/ at the root of the od_mstar3 folder. -- Check by going back to the root of the git folder, -running python3 and "import cpp_mstar" +## Installing dependencies +- Follow the [Installation Guide](installation_guide.md) ### Custom testing @@ -51,17 +55,6 @@ Hotkeys: - up/down arrows: change size - p: pause inference -### Requirements -- Python 3.4 -- Cython 0.28.4 -- OpenAI Gym 0.9.4 -- Tensorflow 1.3.1 -- Numpy 1.13.3 -- matplotlib -- imageio (for GIFs creation) -- tk -- networkx (if using od_mstar.py and not the C++ version) - ### Authors [Guillaume Sartoretti](guillaume.sartoretti@gmail.com) diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..efbf626 --- /dev/null +++ b/environment.yml @@ -0,0 +1,133 @@ +name: primal +channels: + - conda-forge + - defaults +dependencies: + - _libgcc_mutex=0.1=main + - _openmp_mutex=5.1=1_gnu + - blas=1.0=mkl + - ca-certificates=2023.05.30=h06a4308_0 + - certifi=2021.5.30=py36h06a4308_0 + - cycler=0.11.0=pyhd3eb1b0_0 + - cython=0.28.4=py36hf484d3e_0 + - dbus=1.13.18=hb2f20db_0 + - decorator=5.1.1=pyhd3eb1b0_0 + - defusedxml=0.7.1=pyhd3eb1b0_0 + - entrypoints=0.4=pyhd8ed1ab_0 + - expat=2.4.9=h6a678d5_0 + - fontconfig=2.14.1=h52c9d5c_1 + - freetype=2.12.1=h4a9f257_0 + - glib=2.69.1=h4ff587b_1 + - gst-plugins-base=1.14.1=h6a678d5_1 + - gstreamer=1.14.1=h5eee18b_1 + - icu=58.2=he6710b0_3 + - imageio=2.9.0=pyhd3eb1b0_0 + - intel-openmp=2022.1.0=h9e868ea_3769 + - ipykernel=5.5.5=py36hcb3619a_0 + - ipython=5.8.0=py36_1 + - ipython_genutils=0.2.0=pyhd3eb1b0_1 + - ipywidgets=7.6.5=pyhd3eb1b0_1 + - jinja2=3.0.3=pyhd3eb1b0_0 + - jpeg=9e=h5eee18b_1 + - jsonschema=2.6.0=py36_0 + - jupyter=1.0.0=py36_7 + - jupyter_client=5.3.4=py36_0 + - jupyter_console=5.2.0=py36_1 + - jupyterlab_widgets=1.0.0=pyhd3eb1b0_1 + - kiwisolver=1.3.1=py36h2531618_0 + - lcms2=2.12=h3be6417_0 + - ld_impl_linux-64=2.38=h1181459_1 + - lerc=3.0=h295c915_0 + - libdeflate=1.17=h5eee18b_0 + - libffi=3.3=he6710b0_2 + - libgcc-ng=11.2.0=h1234567_1 + - libgfortran-ng=7.5.0=ha8ba4b0_17 + - libgfortran4=7.5.0=ha8ba4b0_17 + - libgomp=11.2.0=h1234567_1 + - libpng=1.6.39=h5eee18b_0 + - libsodium=1.0.18=h7b6447c_0 + - libstdcxx-ng=11.2.0=h1234567_1 + - libtiff=4.5.0=h6a678d5_2 + - libuuid=1.41.5=h5eee18b_0 + - libwebp-base=1.2.4=h5eee18b_1 + - libxcb=1.15=h7f8727e_0 + - libxml2=2.9.14=h74e7548_0 + - lz4-c=1.9.4=h6a678d5_0 + - markupsafe=2.0.1=py36h27cfd23_0 + - matplotlib=3.1.1=py36h5429711_0 + - mistune=0.8.4=py36h7b6447c_0 + - mkl=2018.0.3=1 + - mkl_fft=1.0.6=py36h7dd41cf_0 + - mkl_random=1.0.1=py36h4414c95_1 + - nbconvert=5.6.1=py36_0 + - nbformat=5.1.3=pyhd3eb1b0_0 + - ncurses=6.4=h6a678d5_0 + - notebook=6.0.1=py36_0 + - numpy=1.13.3=py36hdbf6ddf_4 + - olefile=0.46=py36_0 + - openjpeg=2.4.0=h3ad879b_0 + - openssl=1.1.1t=h7f8727e_0 + - packaging=21.3=pyhd3eb1b0_0 + - pandoc=2.12=h06a4308_3 + - pandocfilters=1.5.0=pyhd3eb1b0_0 + - pcre=8.45=h295c915_0 + - pexpect=4.8.0=pyhd3eb1b0_3 + - pickleshare=0.7.5=pyhd3eb1b0_1003 + - pillow=8.3.1=py36h2c7a002_0 + - pip=21.2.2=py36h06a4308_0 + - prometheus_client=0.13.1=pyhd3eb1b0_0 + - prompt_toolkit=1.0.15=py_1 + - ptyprocess=0.7.0=pyhd3eb1b0_2 + - pygments=2.11.2=pyhd3eb1b0_0 + - pyparsing=3.0.4=pyhd3eb1b0_0 + - pyqt=5.9.2=py36h05f1152_2 + - python=3.6.13=h12debd9_1 + - python-dateutil=2.8.2=pyhd3eb1b0_0 + - python_abi=3.6=2_cp36m + - pytz=2021.3=pyhd3eb1b0_0 + - pyzmq=19.0.2=py36h9947dbf_2 + - qt=5.9.7=h5867ecd_1 + - qtconsole=5.2.2=pyhd3eb1b0_0 + - qtpy=2.0.1=pyhd3eb1b0_0 + - readline=8.2=h5eee18b_0 + - scipy=1.1.0=py36hd20e5f9_0 + - send2trash=1.8.0=pyhd3eb1b0_1 + - setuptools=58.0.4=py36h06a4308_0 + - simplegeneric=0.8.1=py36_2 + - sip=4.19.8=py36hf484d3e_0 + - six=1.16.0=pyhd3eb1b0_1 + - sqlite=3.41.2=h5eee18b_0 + - terminado=0.9.4=py36h06a4308_0 + - testpath=0.5.0=pyhd3eb1b0_0 + - tk=8.6.12=h1ccaba5_0 + - tornado=6.1=py36h27cfd23_0 + - traitlets=4.3.3=pyhd8ed1ab_2 + - wcwidth=0.2.5=pyhd3eb1b0_0 + - webencodings=0.5.1=py36_1 + - wheel=0.37.1=pyhd3eb1b0_0 + - widgetsnbextension=3.5.1=py36_0 + - xz=5.4.2=h5eee18b_0 + - zeromq=4.3.4=h2531618_0 + - zlib=1.2.13=h5eee18b_0 + - zstd=1.5.5=hc292b87_0 + - pip: + - bleach==1.5.0 + - charset-normalizer==2.0.12 + - dataclasses==0.8 + - gym==0.9.4 + - html5lib==0.9999999 + - idna==3.4 + - importlib-metadata==4.8.3 + - jupyter-core==4.9.2 + - markdown==3.3.7 + - protobuf==3.19.6 + - pyglet==2.0.7 + - python-version==0.0.2 + - requests==2.27.1 + - tensorflow==1.3.0 + - tensorflow-tensorboard==0.1.8 + - typing-extensions==4.1.1 + - urllib3==1.26.16 + - werkzeug==2.0.3 + - zipp==3.6.0 + diff --git a/environment_gpu.yml b/environment_gpu.yml new file mode 100644 index 0000000..02a84d6 --- /dev/null +++ b/environment_gpu.yml @@ -0,0 +1,133 @@ +name: primal +channels: + - conda-forge + - defaults +dependencies: + - _libgcc_mutex=0.1=main + - _openmp_mutex=5.1=1_gnu + - blas=1.0=mkl + - ca-certificates=2023.05.30=h06a4308_0 + - certifi=2021.5.30=py36h06a4308_0 + - cycler=0.11.0=pyhd3eb1b0_0 + - cython=0.28.4=py36hf484d3e_0 + - dbus=1.13.18=hb2f20db_0 + - decorator=5.1.1=pyhd3eb1b0_0 + - defusedxml=0.7.1=pyhd3eb1b0_0 + - entrypoints=0.4=pyhd8ed1ab_0 + - expat=2.4.9=h6a678d5_0 + - fontconfig=2.14.1=h52c9d5c_1 + - freetype=2.12.1=h4a9f257_0 + - glib=2.69.1=h4ff587b_1 + - gst-plugins-base=1.14.1=h6a678d5_1 + - gstreamer=1.14.1=h5eee18b_1 + - icu=58.2=he6710b0_3 + - imageio=2.9.0=pyhd3eb1b0_0 + - intel-openmp=2022.1.0=h9e868ea_3769 + - ipykernel=5.5.5=py36hcb3619a_0 + - ipython=5.8.0=py36_1 + - ipython_genutils=0.2.0=pyhd3eb1b0_1 + - ipywidgets=7.6.5=pyhd3eb1b0_1 + - jinja2=3.0.3=pyhd3eb1b0_0 + - jpeg=9e=h5eee18b_1 + - jsonschema=2.6.0=py36_0 + - jupyter=1.0.0=py36_7 + - jupyter_client=5.3.4=py36_0 + - jupyter_console=5.2.0=py36_1 + - jupyterlab_widgets=1.0.0=pyhd3eb1b0_1 + - kiwisolver=1.3.1=py36h2531618_0 + - lcms2=2.12=h3be6417_0 + - ld_impl_linux-64=2.38=h1181459_1 + - lerc=3.0=h295c915_0 + - libdeflate=1.17=h5eee18b_0 + - libffi=3.3=he6710b0_2 + - libgcc-ng=11.2.0=h1234567_1 + - libgfortran-ng=7.5.0=ha8ba4b0_17 + - libgfortran4=7.5.0=ha8ba4b0_17 + - libgomp=11.2.0=h1234567_1 + - libpng=1.6.39=h5eee18b_0 + - libsodium=1.0.18=h7b6447c_0 + - libstdcxx-ng=11.2.0=h1234567_1 + - libtiff=4.5.0=h6a678d5_2 + - libuuid=1.41.5=h5eee18b_0 + - libwebp-base=1.2.4=h5eee18b_1 + - libxcb=1.15=h7f8727e_0 + - libxml2=2.9.14=h74e7548_0 + - lz4-c=1.9.4=h6a678d5_0 + - markupsafe=2.0.1=py36h27cfd23_0 + - matplotlib=3.1.1=py36h5429711_0 + - mistune=0.8.4=py36h7b6447c_0 + - mkl=2018.0.3=1 + - mkl_fft=1.0.6=py36h7dd41cf_0 + - mkl_random=1.0.1=py36h4414c95_1 + - nbconvert=5.6.1=py36_0 + - nbformat=5.1.3=pyhd3eb1b0_0 + - ncurses=6.4=h6a678d5_0 + - notebook=6.0.1=py36_0 + - numpy=1.13.3=py36hdbf6ddf_4 + - olefile=0.46=py36_0 + - openjpeg=2.4.0=h3ad879b_0 + - openssl=1.1.1t=h7f8727e_0 + - packaging=21.3=pyhd3eb1b0_0 + - pandoc=2.12=h06a4308_3 + - pandocfilters=1.5.0=pyhd3eb1b0_0 + - pcre=8.45=h295c915_0 + - pexpect=4.8.0=pyhd3eb1b0_3 + - pickleshare=0.7.5=pyhd3eb1b0_1003 + - pillow=8.3.1=py36h2c7a002_0 + - pip=21.2.2=py36h06a4308_0 + - prometheus_client=0.13.1=pyhd3eb1b0_0 + - prompt_toolkit=1.0.15=py_1 + - ptyprocess=0.7.0=pyhd3eb1b0_2 + - pygments=2.11.2=pyhd3eb1b0_0 + - pyparsing=3.0.4=pyhd3eb1b0_0 + - pyqt=5.9.2=py36h05f1152_2 + - python=3.6.13=h12debd9_1 + - python-dateutil=2.8.2=pyhd3eb1b0_0 + - python_abi=3.6=2_cp36m + - pytz=2021.3=pyhd3eb1b0_0 + - pyzmq=19.0.2=py36h9947dbf_2 + - qt=5.9.7=h5867ecd_1 + - qtconsole=5.2.2=pyhd3eb1b0_0 + - qtpy=2.0.1=pyhd3eb1b0_0 + - readline=8.2=h5eee18b_0 + - scipy=1.1.0=py36hd20e5f9_0 + - send2trash=1.8.0=pyhd3eb1b0_1 + - setuptools=58.0.4=py36h06a4308_0 + - simplegeneric=0.8.1=py36_2 + - sip=4.19.8=py36hf484d3e_0 + - six=1.16.0=pyhd3eb1b0_1 + - sqlite=3.41.2=h5eee18b_0 + - terminado=0.9.4=py36h06a4308_0 + - testpath=0.5.0=pyhd3eb1b0_0 + - tk=8.6.12=h1ccaba5_0 + - tornado=6.1=py36h27cfd23_0 + - traitlets=4.3.3=pyhd8ed1ab_2 + - wcwidth=0.2.5=pyhd3eb1b0_0 + - webencodings=0.5.1=py36_1 + - wheel=0.37.1=pyhd3eb1b0_0 + - widgetsnbextension=3.5.1=py36_0 + - xz=5.4.2=h5eee18b_0 + - zeromq=4.3.4=h2531618_0 + - zlib=1.2.13=h5eee18b_0 + - zstd=1.5.5=hc292b87_0 + - pip: + - bleach==1.5.0 + - charset-normalizer==2.0.12 + - dataclasses==0.8 + - gym==0.9.4 + - html5lib==0.9999999 + - idna==3.4 + - importlib-metadata==4.8.3 + - jupyter-core==4.9.2 + - markdown==3.3.7 + - protobuf==3.19.6 + - pyglet==2.0.7 + - python-version==0.0.2 + - requests==2.27.1 + - tensorflow-gpu==1.3.0 + - tensorflow-tensorboard==0.1.8 + - typing-extensions==4.1.1 + - urllib3==1.26.16 + - werkzeug==2.0.3 + - zipp==3.6.0 + diff --git a/installation_guide.md b/installation_guide.md new file mode 100644 index 0000000..e855343 --- /dev/null +++ b/installation_guide.md @@ -0,0 +1,31 @@ +# PRIMAL Installation directions +## Prerequisites +- Git +- [Anaconda](`https://docs.anaconda.com/free/anaconda/install/index.html`) +- [Boost](https://www.boost.org/`) +- If using GPU: + - cuDNN 6 + - CUDA 8 + - GCC 4.8 +## Installation steps +- Run this command: `conda env create -f environment.yml` (or, if using a GPU `conda env create -f environment_gpu.yml`) This will create a new conda environment called `primal` that includes all the dependencies +- Activate the environment with this command: `conda activate primal` +- Run `cd od_mstar3` and then `python3 setup.py build_ext --inplace`, this builds the cpp_mstar library. (Note: if `python3` in the previous command does not work, try using just `python`) +- Run `cd ..` to get back in the main directory +## Installing pre-trained model +- Make sure you're in the root directory +- Create a directory called `model_primal` if it does not exist +- Download this file: `https://drive.google.com/file/d/1AtAeUwLF1Rn_X3b2FHkHi4fI5vveUHF6/view` (it will take some time) +- Extract the contents of that file to the model_primal directory +### You're all done! +## Notes: +- Training is done by the `DRLMAPF_A3C_RNN.ipynb` notebook. I do reccommend using the pre-trained model instead of retraining. Do not train unless you know what you're doing. +- To use the map creator, just run `python mapgenerator.py` +- Hotkeys for map generator: + - o: obstacle mode + - a: agent mode + - g: goal mode, click an agent then click a free tile to place its goal + - c: clear agents + - r: reset + - up/down arrows: change size + - p: pause inference \ No newline at end of file From ad7fd41dfaf231411b5a89680ee035911797c33c Mon Sep 17 00:00:00 2001 From: Jackson Clark Date: Wed, 23 Aug 2023 19:32:41 -0500 Subject: [PATCH 2/2] Added example PBS compute job script. --- compute_job.sh | 33 +++++++++++++++++++++++++++++++++ devel_compute.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 compute_job.sh create mode 100644 devel_compute.sh diff --git a/compute_job.sh b/compute_job.sh new file mode 100644 index 0000000..aeec476 --- /dev/null +++ b/compute_job.sh @@ -0,0 +1,33 @@ +##!/bin/bash +##This script test different conda environments running on Cascade Lake GPU Nodes +## This script was adapted from the NAS example for conda environments and needs some changes to the configuration.. +## The actual shell code that is used for the job (below the module statements) should be working well. +#PBS -q v100@pbspl4 +#PBS -W block=true +#PBS -lselect=1:ncpus=96:ngpus=8:model=cas_gpu:mem=600g +#PBS -l place=scatter:exclhost +#PBS -l walltime=48:00:00 +#PBS -j oe +#PBS -N model_cas_gpu-check +#PBS -W group_list=a1509 + + +# load analytix modules +module use -a /swbuild/analytix/tools/modulefiles +module load miniconda3/v4 +# We might need to load cuda here +#module load cuda/10.1.243 +#q: How can I specify that cuda 8 is used +#a: module load cuda/8.0.61 +# module load cuda/8.0.61 +# NOTE: cuda 8 isn't listed as a current module, you might have to ask the NAS on how to use it. + + +# Activate conda environment here: +source activate primal-deploy + + +## Run script here +python DRLMAPF_A3C_RNN.py + +conda deactivate \ No newline at end of file diff --git a/devel_compute.sh b/devel_compute.sh new file mode 100644 index 0000000..e9a20cd --- /dev/null +++ b/devel_compute.sh @@ -0,0 +1,28 @@ +##!/bin/bash +##This script test different conda environments running on Cascade Lake GPU Nodes +#PBS -q v100@pbspl4 +#PBS -lselect=1:ncpus=12:ngpus=2:model=cas_gpu:mem=30g +#PBS -l place=scatter:exclhost +#PBS -j oe +#PBS -N model_cas_gpu-check +#PBS -W group_list=a1509 + + +# load analytix modules +module use -a /swbuild/analytix/tools/modulefiles +module load miniconda3/v4 +# We might need to load cuda here +#module load cuda/10.1.243 +#q: How can I specify that cuda 8 is used +#a: module load cuda/8.0.61 +# module load cuda/8.0.61 + + +# Activate conda environment here: +source activate primal-deploy + + +## Run script here +python DRLMAPF_A3C_RNN.py + +conda deactivate \ No newline at end of file