-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 | ||
|
||
# install python | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG PYTHON_VERSION=3.10 | ||
|
||
# ENV TZ=Europe/London | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \ | ||
software-properties-common \ | ||
build-essential \ | ||
curl \ | ||
ffmpeg \ | ||
git \ | ||
htop \ | ||
vim \ | ||
nano \ | ||
rsync \ | ||
wget \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN add-apt-repository ppa:deadsnakes/ppa | ||
RUN apt-get update && apt-get install -y -qq python${PYTHON_VERSION} \ | ||
python${PYTHON_VERSION}-dev \ | ||
python${PYTHON_VERSION}-distutils | ||
|
||
# Set python aliases | ||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1 | ||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 | ||
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py | ||
|
||
# default workdir | ||
WORKDIR /home/workdir | ||
|
||
# dev: install from source | ||
COPY . . | ||
|
||
#jaxmarl from source if needed, all the requirements | ||
RUN pip install --ignore-installed -e '.[qlearning, dev]' | ||
|
||
# install jax from to enable cuda | ||
RUN pip install --upgrade "jax[cuda11_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html | ||
#disabling preallocation | ||
ARG XLA_PYTHON_CLIENT_PREALLOCATE=false | ||
|
||
#for jupyter | ||
EXPOSE 9999 | ||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
NVCC_RESULT := $(shell which nvcc 2> NULL; rm NULL) | ||
NVCC_TEST := $(notdir $(NVCC_RESULT)) | ||
ifeq ($(NVCC_TEST),nvcc) | ||
GPUS=--gpus all | ||
else | ||
GPUS= | ||
endif | ||
|
||
|
||
# Set flag for docker run command | ||
BASE_FLAGS=-it --rm -v ${PWD}:/home/workdir --shm-size 20G | ||
RUN_FLAGS=$(GPUS) $(BASE_FLAGS) | ||
|
||
DOCKER_IMAGE_NAME = jaxmarl | ||
IMAGE = $(DOCKER_IMAGE_NAME):latest | ||
DOCKER_RUN=docker run $(RUN_FLAGS) $(IMAGE) | ||
USE_CUDA = $(if $(GPUS),true,false) | ||
|
||
# make file commands | ||
build: | ||
DOCKER_BUILDKIT=1 docker build --build-arg USE_CUDA=$(USE_CUDA) --tag $(IMAGE) --progress=plain ${PWD}/. | ||
|
||
run: | ||
$(DOCKER_RUN) /bin/bash | ||
|
||
test: | ||
$(DOCKER_RUN) /bin/bash -c "pytest ./tests/" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters