minerl icon indicating copy to clipboard operation
minerl copied to clipboard

Support for headless rendering without virtual display

Open danijar opened this issue 4 years ago • 15 comments

Running on a server via xvfb-run can cause a range of difficult to debug problems and is incompatible with the OpenGL library that comes with the Nvidia GPU driver. There are several other people running into these problems (#21, #26, #34, #207, #223). I've heard you're thinking about supporting headless rendering directly in the environment. Is this true and what is the current status of this idea?

danijar avatar Sep 06 '19 17:09 danijar

In order to run minerl environments WITHOUT A HEAD use a software renderer such as 'xvfb':
		xvfb-run python3 <your_script.py>
	! NOTE: xvfb conflicts with NVIDIA-drivers! 
	! To run headless MineRL on a system with NVIDIA-drivers, please start a 
	! vnc server of your choosing and then `export DISPLAY=:<insert ur vnc server #>

If you're receiving this error and there is a monitor attached, make sure your current displayvariable is set correctly: 
		 DISPLAY=:0 python3 <your_script.py>
	! NOTE: For this to work your account must be logged on the physical monitor.

If none of these steps work, please complain in the discord!
If all else fails, JUST PUT THIS IN A DOCKER CONTAINER! :)

dcharrezt avatar Sep 14 '19 14:09 dcharrezt

Thanks! It would be worth providing instructions for how to do this. I have never used a VNC server and I can imagine this is true for many users of MineRL.

danijar avatar Sep 16 '19 21:09 danijar

we do not need to show frames when training. it is slow for training while showing frames. so how to turn off it?

starimpact avatar Sep 24 '19 07:09 starimpact

is there any tutorial for how to train in headless server?

starimpact avatar Sep 24 '19 07:09 starimpact

Hey all! Just wanted to chime in here.

Yes. We are planning on supporting headless rendering using EGL. This will require us basically taking over Malmo and upgrading its version of Minecraft to 1.14. We would then be able to support rendering without a head, super fast rendering of only game block state, etc. This is a major overhaul and will happen in some months.

In the mean time, I am planning on rehauling the documentation to make the process of running MineRL (malmo) on a headless server more reasonable. This plagues a series of other RL environments such as Unity and ROS and currently, the best solution seems to be to get VNCServer or Virtual Heads to work. Providing documentaiton that allows people to consistently set up VNC servers is f*ing difficult IMO, and I would love any help anyone is willing to provide in this regard!

I will keep eveyrone posted in discord as we push for this feature.

Thank you so much for your patience!

MadcowD avatar Sep 30 '19 19:09 MadcowD

Thanks for the update --- I'm very much looking forward to offline rendering. Do you have some preliminary instructions for the VNC server that I could start from? I imagine if a couple of people try it, we'll together end up with a list of instructions that generalize to other's servers.

danijar avatar Oct 03 '19 01:10 danijar

hahaha...Finally, I found a server with a head...

starimpact avatar Oct 09 '19 06:10 starimpact

@MadcowD Happy new year! I'm really excited about using MineRL for research once it supports headless rendering. Setting up a virtual server isn't feasible on the cluster we're using unfortunately. Are you still planning on upgrading to Minecraft 1.14 and supporting headless rendering through EGL?

danijar avatar Jan 07 '20 20:01 danijar

Any update with this?

JACKHAHA363 avatar Jul 13 '20 01:07 JACKHAHA363

@MadcowD are there plans to enable headless rendering in time for this year's MineRL competition?

akolobov avatar Jul 22 '20 06:07 akolobov

Any updates on this @Miffyli? Support for headless rendering Also curious if you were able to find a workaround @danijar?

ankeshanand avatar Oct 12 '21 19:10 ankeshanand

I assume this was question was handled for Discord :). The answer was "no updates".

An alternative to xvfb, that might work for some, is detailed here which is reported to result in similar performance as headed runs.

Miffyli avatar Oct 12 '21 20:10 Miffyli

Hi all,

Sorry for bringing this up here, but we made it to run MineRL with GPU rendering on a headless, rootless GPU server without host-side X configuration. Please check out this docker (kudos to the original repo). It has been tested with RTX 3090, V100, and A100 GPUs. You may also find this discussion relatable.

jeasinema avatar Jul 25 '22 02:07 jeasinema

@jeasinema Hey! Thanks a ton for sharing this! Would you feel like making a PR that adds this to docs? I can do this as well, but would like to know who I should credit for this beauty (assuming it is you, but I want to double-check) :)

Miffyli avatar Jul 25 '22 17:07 Miffyli

@Miffyli PR has been made here.

jeasinema avatar Jul 26 '22 04:07 jeasinema