Skip to content

Commit

Permalink
Add no-cntlibs CLI option to nvidia-container-cli
Browse files Browse the repository at this point in the history
This change adds a --no-cntlibs option to the configure and info
commands of the nvidia-container-cli. This allows the no-cntlibs option
to be set via the commandline.

If this option is set, the CUDA compat libraries are not mounted into
the container but are still available to the user.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
  • Loading branch information
elezar committed Jan 22, 2025
1 parent 076da00 commit 7e3642d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli/configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const struct argp configure_usage = {
{"no-persistenced", 0x86, NULL, 0, "Don't include the NVIDIA persistenced socket", -1},
{"no-fabricmanager", 0x87, NULL, 0, "Don't include the NVIDIA fabricmanager socket", -1},
{"no-gsp-firmware", 0x88, NULL, 0, "Don't include GSP Firmware", -1},
{"no-cntlibs", 0x89, NULL, 0, "Don't overwrite host mounts with CUDA compat libs from the container", -1},
{0},
},
configure_parser,
Expand Down Expand Up @@ -165,6 +166,10 @@ configure_parser(int key, char *arg, struct argp_state *state)
if (str_join(&err, &ctx->driver_opts, "no-gsp-firmware", " ") < 0)
goto fatal;
break;
case 0x89:
if (str_join(&err, &ctx->container_flags, "no-cntlibs", " ") < 0)
goto fatal;
break;
case ARGP_KEY_ARG:
if (state->arg_num > 0)
argp_usage(state);
Expand Down
5 changes: 5 additions & 0 deletions src/cli/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const struct argp list_usage = {
{"no-persistenced", 0x84, NULL, 0, "Don't include the NVIDIA persistenced socket", -1},
{"no-fabricmanager", 0x85, NULL, 0, "Don't include the NVIDIA fabricmanager socket", -1},
{"no-gsp-firmware", 0x86, NULL, 0, "Don't include GSP Firmware", -1},
{"no-cntlibs", 0x87, NULL, 0, "Don't overwrite host mounts with CUDA compat libs from the container", -1},
{0},
},
list_parser,
Expand Down Expand Up @@ -86,6 +87,10 @@ list_parser(int key, char *arg, struct argp_state *state)
goto fatal;
ctx->list_firmwares = false;
break;
case 0x87:
if (str_join(&err, &ctx->container_flags, "no-cntlibs", " ") < 0)
goto fatal;
break;
case ARGP_KEY_END:
if (state->argc == 1 || (state->argc == 2 && ctx->imex_channels != NULL)) {
if ((ctx->devices = xstrdup(&err, "all")) == NULL)
Expand Down

0 comments on commit 7e3642d

Please # to comment.