Unity-Technologies / obstacle-tower-env

Obstacle Tower Environment
Apache License 2.0
540 stars 124 forks source link

Is it possible to specify in which GPU I want the environment to run? #115

Open albertbou92 opened 4 years ago

albertbou92 commented 4 years ago

I have seen that, by default, all instances of the obstacle tower environment I start run in the primary GPU (in my case GPU:0). Is it possible to specify in which GPU I want each instance to run so I can distribute the load?

Thank you

awjuliani commented 4 years ago

Hi @albertbou92

You can pass this as a command line argument when the Unity executable launches: https://docs.unity3d.com/Manual/CommandLineArguments.html

-force-device-index

giadefa commented 4 years ago

Hi Arthur, this command works for linux? It says MacOs only. When using Metal, make the Editor use a particular GPU device by passing it the index of that GPU (macOS only).

On Thu, May 7, 2020 at 8:32 PM Arthur Juliani notifications@github.com wrote:

Hi @albertbou92 https://github.com/albertbou92

You can pass this as a command line argument when the Unity executable launches: https://docs.unity3d.com/Manual/CommandLineArguments.html

-force-device-index

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/obstacle-tower-env/issues/115#issuecomment-625424936, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3KUOTEF3FFLDVMPJ5EA43RQL5D7ANCNFSM4M3E22DQ .

awjuliani commented 4 years ago

It does. There are two sets of command line arguments in that document, one is for the editor, the other is for standalone builds. The instructions for standalone builds states that the argument works on windows, mac, and linux. It looks though that Vulkan is required.

Screen Shot 2020-05-07 at 1 36 45 PM
JeniaJitsev commented 4 years ago

Hey folks, I have the same endeavor right now with ml-agents. There seems to be an undocumented flag to switch GPUs according to this here: "There is a Unity command line option -gpu # which lets you select which GPU Unity apps run with UnityApp.exe -gpu 1 editor.exe -gpu 0 I haven't seen this command line argument documented but it let's me test on my integrated and dedicated GPU." https://stackoverflow.com/questions/38256297/how-to-select-gpus-for-rendering-in-unity

awjuliani commented 4 years ago

Hi @JeniaJitsev

Does the force-device-index flag not work for you?

JeniaJitsev commented 4 years ago

Hey @awjuliani , doesn't seem like. I use -force-vulkan and see also Vulkan debug output, but Unity instances are all put on device index 0 independent of what I specify for force-device-index. (This is for Ubuntu 18.04.)

JeniaJitsev commented 4 years ago

Situation is following: machine has 4 RTX GPUs. I would like to have a run setup, where following happens:

GPU 0 : Unity Rendering GPU 1 : CUDA (training) GPU 3 : Unity Rendering GPU 4 : CUDA (training)

I can control CUDA (training part) just fine by setting corresponding CUDA_VISIBLE_DEVICES. However, Unity Rendering always lands at GPU 0, no matter how I assign the force-device-index flag. X sees all 4 GPUs.

awjuliani commented 4 years ago

This may be a Unity bug, I would recommend asking about it in the official Unity forums. There is a linux section: https://forum.unity.com/forums/linux.109/?_ga=2.221155870.701444405.1590081452-1673116819.1520720368

armando-fandango commented 3 years ago

2021 and this option isnt working still

andrearlotta commented 2 years ago

2021 and this option isnt working still

still

armando-fandango commented 2 years ago

people who are using -force-vulkan on linux for -force-device-index, make sure that you are using the vulkan build while building the standalone binary. If the standalone binary is built using opengl, how can you force it to run vulkan :-)