Skip to content

Commit

Permalink
remove runtime wrapper driver detection
Browse files Browse the repository at this point in the history
This will be handled by the runtime itself.

Signed-off-by: Jean-Francois Roy <[email protected]>
  • Loading branch information
jfroy committed Nov 6, 2024
1 parent 0c1e76a commit d9c52ec
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions tools/container/wrapper/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"io/fs"
"log"
"os"
"os/exec"
"path/filepath"
"strings"

"golang.org/x/sys/unix"
Expand All @@ -34,18 +32,6 @@ func main() {
if err != nil {
log.Fatalf("failed to get executable: %v", err)
}
if isRuntimeWrapper(program) && !isNvidiaModuleLoaded() {
log.Println("nvidia driver modules are not yet loaded, invoking runc directly")
program, err := exec.LookPath("runc")
if err != nil {
log.Fatalf("failed to find runc: %v", err)
}
argv := []string{"runc"}
argv = append(argv, os.Args[1:]...)
if err := unix.Exec(program, argv, os.Environ()); err != nil {
log.Fatalf("failed to exec %s: %v", program, err)
}
}
argv := makeArgv(program)
envv := makeEnvv(program)
if err := unix.Exec(program+".real", argv, envv); err != nil {
Expand All @@ -54,17 +40,6 @@ func main() {

}

func isRuntimeWrapper(program string) bool {
return filepath.Base(program) == "nvidia-container-runtime" ||
filepath.Base(program) == "nvidia-container-runtime.cdi" ||
filepath.Base(program) == "nvidia-container-runtime.legacy"
}

func isNvidiaModuleLoaded() bool {
_, err := os.Stat("/proc/driver/nvidia/version")
return err == nil
}

func makeArgv(program string) []string {
argv := []string{os.Args[0] + ".real"}
f, err := os.Open(program + ".argv")
Expand Down

0 comments on commit d9c52ec

Please sign in to comment.