Use DDA to pass GPU to container

%3CLINGO-SUB%20id%3D%22lingo-sub-215577%22%20slang%3D%22en-US%22%3EUse%20DDA%20to%20pass%20GPU%20to%20container%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-215577%22%20slang%3D%22en-US%22%3E%3CP%3EDear%20community%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20pass%20a%20Quadro%20GPU%20to%20a%20container%20on%20a%20Windows%20Server%20host.%3C%2FP%3E%3CP%3EWhat%20I%20want%20to%20change%20in%20our%20build%20infrastructure%20are%20idleing%20machines.%20We%20got%20Linux%20machines%20and%20Windows%20machines.%20Different%20Linux%20distributions.%20Some%20of%20them%20are%20idleing%20most%20of%20the%20time.%20So%20I%20thought%20about%20moving%20everything%2C%20Linux%20and%20Windows%2C%20in%20a%20container%20and%20run%20the%20GPU%20tests%20(CUDA%20and%20OpenGL)%20there.%20Since%20Linux%20containers%20don%E2%80%99t%20have%20access%20to%20the%20GPU%20I%20was%20wondering%20if%20I%20can%20make%20use%20of%20and%20assign%20the%20GPU%20to%20any%20of%20my%20containers%20at%20runtime%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20this%20is%20possible%2C%20can%20you%20please%20explain%20how%20this%20is%20done%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%26nbsp%3Balso%20asked%20in%20the%20docker%20forums%3A%20%3CA%20href%3D%22https%3A%2F%2Fforums.docker.com%2Ft%2Fgpu-in-container%2F54058%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fforums.docker.com%2Ft%2Fgpu-in-container%2F54058%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-215577%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EContainers%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDDA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDocker%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EGPU%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHyper-V%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EServer%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EServer%20Insider%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-226759%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20DDA%20to%20pass%20GPU%20to%20container%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-226759%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Craig%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20reply.%20I%20also%20found%20your%20answer%20on%20uservoice%20about%20GPU%20support%20for%20WSL%20and%20tweeted%20to%20you%20but%20I%20guess%20you%20don't%20use%20Twitter%20that%20much%20%3A).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20more%20about%20the%20issue%20I'm%20currently%20facing.%20I%20assume%20DDA%20would%20be%20one%20possible%20solution.%20My%20expectation%20would%20be%20that%20I%20would%20exclusively%20hand%20the%20GPU%20over%20to%20one%20container%20which%20then%20runs%20GPU%20tests.%20Once%20this%20test%20is%20done%20I%20would%20take%20the%20GPU%20off%20this%20container%20and%20assign%20it%20to%20the%20next%20one.%20This%20means%2C%20only%20one%20container%20would%20have%20the%20GPU%20at%20a%20time.%20This%20would%20be%20sufficient%20for%20my%20scenario.%20This%20would%20also%20ensure%20that%20I%20test%20the%20actual%20driver%20for%20the%20OS%20which%20needs%20to%20be%20installed%20in%20the%20container%2C%20right%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20an%20example%20how%20this%20would%20look%20like%20if%20GPU%20access%20would%20be%20possible%20in%20containers%3A%20Each%20machine%20has%20a%20WindowsServerCore%20container%20and%20around%204%20to%205%20containers%20with%20different%20Linux%20distributions.%20The%20number%20of%20Linux%20containers%20might%20increase%20over%20time.%20Maybe%20also%20some%20can%20be%20dropped%20in%20the%20future.%20I%20guess%20there%20will%20never%20be%20more%20than%207%20different%20distributions.%20It%20might%20be%20that%20we%20have%20more%20different%20images%20with%20different%20GPU%20drivers%20in%20the%20future%20but%20it%20is%20not%20necessary%20at%20the%20moment.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20means%20I%20could%20run%20any%20test%20on%20any%20machine%20at%20any%20time%20vs.%20now%20some%20machines%20are%20idling%20because%2C%20for%20example%2C%20older%20branches%20for%20older%20Linux%20distributions%20don't%20need%20all%20the%20fixes%20and%20are%20less%20frequent%20triggert%20for%20a%20build.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20you%20get%20the%20idea%20how%20I%20would%20use%20GPU%20access%20in%20containers.%20Are%20there%20any%20other%20ways%20you%20could%20think%20of%20to%20get%20the%20same%20benefits%20as%20with%20DDA%3F%20Any%20other%20suggestions%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20is%20also%20the%20nvidia%20docker.%20Unfortunately%20it%20is%20only%20available%20on%20Linux.%20I%20found%20a%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FNVIDIA%2Fnvidia-docker%2Fissues%2F197%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Erequest%20on%20Github%20%3C%2FA%3Ewhere%20someone%20asked%20for%20a%20Windows%20version%20but%20their%20statement%20was%20that%20they%20would%20need%20to%20make%20use%20of%20DDA%20and%20this%20feature%20is%20only%20available%20on%20Windows%20Server%20and%20not%20Windows%2010.%20So%20I%20replied%20to%20this%20request%20and%20asked%20if%20they%20are%20working%20on%20a%20Windows%20version%20since%20the%20latest%20Windows%2010%20supports%20DDA.%20I%20didn't%20get%20any%20answer%20yet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-226172%22%20slang%3D%22en-US%22%3ERe%3A%20Use%20DDA%20to%20pass%20GPU%20to%20container%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-226172%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20Daniel%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20appreciate%20your%20question.%20At%20this%20time%2C%20we%20do%20not%20support%20passing%20GPUs%20to%20Windows%20Server%20containers%20or%20Linux%20containers%20on%20Windows.%20You%20stated%20this%20would%20be%20used%20for%20running%20GPU-related%20tests%3B%20I%20am%20curious%20to%20know%20what%20your%20expectation%20would%20around%20how%20the%20GPU%20gets%20shared.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20called%20out%20DDA--would%20you%20want%20to%20give%20the%20GPU%20exclusively%20to%20a%20container%2C%20as%20DDA%20would%20imply%3F%20Would%20you%20rather%20share%20it%20amongst%20several%20containers%3F%20Share%20the%20GPU%20between%20the%20container%20in%20the%20host%3F%20Or%20even%20something%20else.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAlso%20curious%20to%20know%20the%20%25%20deployment%20of%20Windows%20Server%20containers%20vs%20Linux%20containers%20for%20these%20GPU%20test%20workloads.%20Assuming%20Linux%20containers%20on%20Windows%20could%20support%20GPU%2C%20would%20that%20be%20better%20for%20your%20use%20cases%2C%20do%20you%20have%20a%2050%2F50%20split%20between%20OS%20types%2C%20etc.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Dear community,

 

I want to pass a Quadro GPU to a container on a Windows Server host.

What I want to change in our build infrastructure are idleing machines. We got Linux machines and Windows machines. Different Linux distributions. Some of them are idleing most of the time. So I thought about moving everything, Linux and Windows, in a container and run the GPU tests (CUDA and OpenGL) there. Since Linux containers don’t have access to the GPU I was wondering if I can make use of and assign the GPU to any of my containers at runtime?

 

If this is possible, can you please explain how this is done?

 

 

I also asked in the docker forums: https://forums.docker.com/t/gpu-in-container/54058

 

2 Replies

Hey Daniel,

 

I appreciate your question. At this time, we do not support passing GPUs to Windows Server containers or Linux containers on Windows. You stated this would be used for running GPU-related tests; I am curious to know what your expectation would around how the GPU gets shared.

 

You called out DDA--would you want to give the GPU exclusively to a container, as DDA would imply? Would you rather share it amongst several containers? Share the GPU between the container in the host? Or even something else.

 

Also curious to know the % deployment of Windows Server containers vs Linux containers for these GPU test workloads. Assuming Linux containers on Windows could support GPU, would that be better for your use cases, do you have a 50/50 split between OS types, etc.

Hi Craig,

 

Thank you for your reply. I also found your answer on uservoice about GPU support for WSL and tweeted to you but I guess you don't use Twitter that much :).

 

So more about the issue I'm currently facing. I assume DDA would be one possible solution. My expectation would be that I would exclusively hand the GPU over to one container which then runs GPU tests. Once this test is done I would take the GPU off this container and assign it to the next one. This means, only one container would have the GPU at a time. This would be sufficient for my scenario. This would also ensure that I test the actual driver for the OS which needs to be installed in the container, right?

 

As an example how this would look like if GPU access would be possible in containers: Each machine has a WindowsServerCore container and around 4 to 5 containers with different Linux distributions. The number of Linux containers might increase over time. Maybe also some can be dropped in the future. I guess there will never be more than 7 different distributions. It might be that we have more different images with different GPU drivers in the future but it is not necessary at the moment.

 

This means I could run any test on any machine at any time vs. now some machines are idling because, for example, older branches for older Linux distributions don't need all the fixes and are less frequent triggert for a build.

 

I hope you get the idea how I would use GPU access in containers. Are there any other ways you could think of to get the same benefits as with DDA? Any other suggestions?

 

There is also the nvidia docker. Unfortunately it is only available on Linux. I found a request on Github where someone asked for a Windows version but their statement was that they would need to make use of DDA and this feature is only available on Windows Server and not Windows 10. So I replied to this request and asked if they are working on a Windows version since the latest Windows 10 supports DDA. I didn't get any answer yet.