-
Notifications
You must be signed in to change notification settings - Fork 950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: support nvidia-container 2.0 to enable GPU access #2029
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2029 +/- ##
==========================================
+ Coverage 58.64% 63.91% +5.27%
==========================================
Files 206 206
Lines 15840 15902 +62
==========================================
+ Hits 9289 10164 +875
+ Misses 5413 4468 -945
- Partials 1138 1270 +132
|
daemon/mgr/container_utils.go
Outdated
return nil | ||
} | ||
|
||
if err := vlidateNvidiaDriver(r); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/validate/vlidate?
daemon/mgr/container_utils.go
Outdated
return nil | ||
} | ||
|
||
func stringInSlice(a string, list []string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not need to add this function, this has been covered in utils.StringInSlice
.
Path: path, | ||
Args: append(args, "prestart"), | ||
} | ||
spec.s.Hooks.Prestart = append(spec.s.Hooks.Prestart, nvidiaPrestart) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we already have a prestart hook, will the nvidia prestart take effect here? Just double check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, prestart commands are executed after the container namespaces are created.
How to use this? Do we need to support this in pouch CLI? |
d7d928c
to
36d9682
Compare
@allencloud |
daemon/mgr/container_utils.go
Outdated
@@ -5,14 +5,14 @@ import ( | |||
"strconv" | |||
"strings" | |||
|
|||
"github.com/opencontainers/selinux/go-selinux/label" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the third party to next to the pouch group.
daemon/mgr/container_validation.go
Outdated
|
||
"github.com/alibaba/pouch/apis/types" | ||
"github.com/alibaba/pouch/daemon/logger/syslog" | ||
"github.com/alibaba/pouch/pkg/system" | ||
|
||
"github.com/sirupsen/logrus" | ||
"github.com/alibaba/pouch/pkg/utils" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in pouch, we use three groups to manage the packages like:
"os"
"strconv"
"strings"
"github.com/alibaba/pouch/apis/types"
"github.com/alibaba/pouch/daemon/logger/syslog"
"github.com/alibaba/pouch/pkg/system"
"github.com/alibaba/pouch/pkg/utils"
"github.com/sirupsen/logrus"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add UT for the validation part.
daemon/mgr/container_validation.go
Outdated
return nil | ||
} | ||
|
||
supportedDrivers := []string{"compute", "compat32", "graphics", "utility", "video", "display"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use map global var to hold the supportedDrivers, like
var supportedNvidiaDrivers = map[string]struct{}{
"compute": struct{},
....
}
therefore, we don't need to allocate new memory in the utils.StringInSlice
.
2b3ef3f
to
05ebcbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I will merge after rebase the master
@@ -69,6 +74,24 @@ function build_pouch() | |||
popd | |||
} | |||
|
|||
# install nvidia-container-runtime | |||
function build_nvidia_runtime(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next time, I will rewrite the package folder
Signed-off-by: codejuan <xh@decbug.com>
Thanks for your great work. I will merge this. @CodeJuan |
Do we have a document to help users use GPU with pouchcontainer? @CodeJuan |
Ⅰ. Describe what this PR did
Make pouch natively support GPU devices
Ⅱ. Does this pull request fix one issue?
fixes #824 #2033
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
NvidiaConfig
.NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system
, then add a link to libnvidia-ml.soⅤ. Special notes for reviews