Skip to content

Sanfee18/singularity-minerl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

singularity-minerl

A Singularity container for HPC headless GPU rendering, developed specially for MineRL executions. Inspiried by this docker repo by Xiaojian Ma.

Definition file

The container has three libraries installed: MineRL, Stable-baselines3 (for RL algorithms implementations) and Wandb (for monitoring purposes). Feel free to uninstall any library that you may not need, this are the three libraries that I've used to do my executions.

Also, make sure to change the mkdir -p at the end of the %post section to match the folder that contains the python script you're going to run.

Build

Since Singularity build command needs sudo to be run, if your are executing this on a HPC cluster, you probably don't have root permissions, therefore you will need to build the .sif file in other computer and then move it to your cluster (you can use scp command for it).

git clone https://github.com/Sanfee18/singularity-minerl && cd singularity-minerl
sudo singularity build <container name>.sif vglsingularity.def

Run

The command to run your MineRL program should be:

singularity exec --fakeroot --nv -w --bind /path/to/code:/path/to/code <container name>.sif ./setupvgl.sh vglrun /opt/conda/envs/minerl/bin/python /path/to/code/<script name>.py
  • --fakeroot: essential flag, since MineRL will need to write some files.
  • --nv: nvidia flag to enable GPU capabilities. (some warnings will raise but ignore them)
  • -w: enable writting inside the container. (.sif is read only)
  • --bind: path to the folder where your python scripts are.
  • If you are using Wandb, you will need to specify the Wandb API key for remote monitoring. This can be done adding the following flag to the above command: --env WANDB_API_KEY=XXXXXXXXXXXXXXXXX. You can check your key here.

A work around that can be done if the --fakeroot can't be enbled is to transform the .sif file to sandbox mode. This can be archived with the following command: sudo singularity build --sandbox <sandbox name> <container name>.sif This way, you will be able to use the -w flag to make the container writable.

Make sure to have the setupvgl.sh inside the folder from where you are executing the program, so that the instruction ./setupvgl.sh works, and the vglrun right after, before your python call.

About

A Singularity container that allows you to execute scripts on GPU inside headless environments.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages