Skip to content

Commit

Permalink
dividing Dockerfiles and updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobiagiola committed Aug 13, 2024
1 parent 0013bf3 commit 06207cf
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/cpu/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "muprl - CPU",
"build": {
"dockerfile": "../../Dockerfile"
}
"dockerfile": "../../Dockerfile_CPU"
},
"runArgs": ["--rm"]
}
4 changes: 2 additions & 2 deletions .devcontainer/gpu/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "muprl - GPU",
"build": {
"dockerfile": "../../Dockerfile"
"dockerfile": "../../Dockerfile_GPU"
},
"runArgs": ["--gpus", "all"]
"runArgs": ["--rm", "--gpus", "all"]
}
21 changes: 21 additions & 0 deletions Dockerfile_CPU
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.8-slim

RUN apt update \
&& apt upgrade -y \
&& apt install -y freeglut3-dev

# # Install Python packages
COPY requirements.txt /tmp/requirements.txt
COPY requirements_torch_cpu.txt /tmp/requirements_torch_cpu.txt

RUN echo "Installing requirements" \
&& pip install setuptools==65.5.0 "wheel<0.40.0" \
&& pip install -r /tmp/requirements_torch_cpu.txt \
&& pip install -r /tmp/requirements.txt \
&& pip install gym==0.25.0

RUN rm /tmp/requirements.txt \
&& rm /tmp/requirements_torch_cpu.txt

ENTRYPOINT [ "/bin/bash" ]

File renamed without changes.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@

## 1.1 Build the docker container

If you do not have an NVIDIA GPU type:

```commandline
docker build -t muprl:latest .
docker run --gpus all -it -u ${UID} --rm --mount type=bind,source="$(pwd)",target=/home/muPRL --workdir /home/muPRL --name muPRL-container muprl:latest
docker build -f Dockerfile_CPU -t muprl:latest .
docker run -it -u ${UID} --rm --mount type=bind,source="$(pwd)",target=/home/muPRL --workdir /home/muPRL --name muPRL-container muprl:latest
```

Remove the `--gpus all` argument if your machine does not have an Nvidia GPU (make sure to install the [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) if your machine has an Nvidia GPU).
The image size should be around 2.6 GB.

If you have an NVIDIA GPU, make sure to install the [Nvidia Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) and type:

```commandline
docker build -f Dockerfile_GPU -t muprl:latest .
docker run --gpus all -it -u ${UID} --rm --mount type=bind,source="$(pwd)",target=/home/muPRL --workdir /home/muPRL --name muPRL-container muprl:latest
```

The image size is ~8 GB.
The image size should be around 8 GB.

## 1.2 (Optional): Use VSCode Devcontainer instead of step 1.1

- Download [VSCode](https://code.visualstudio.com/Download) for your platform;
- Install DevContainer Extension;
- In VSCode, use the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS) to run the "Dev Containers: Open Folder in Container..." command;
- You will be prompted with two options: CPU dev container or CUDA dev container. Choose the one you want to run.
- You will be prompted with two options: CPU dev container or GPU dev container. Choose the one you want to run.

# 2. Mutation testing pipeline

Expand Down

0 comments on commit 06207cf

Please sign in to comment.