Skip to content

Commit

Permalink
Merge pull request #396 from mboisson/gpu_allow_profiling
Browse files Browse the repository at this point in the history
control if profiling is restricted only to admin users or not
  • Loading branch information
cmd-ntrf authored Jan 16, 2025
2 parents 5de4c7f + de5389d commit d1c44cf
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion site/profile/manifests/gpu.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
}

class profile::gpu::install (
String $lib_symlink_path = undef
String $lib_symlink_path = undef,
Boolean $allow_profiling_for_all = false
) {
ensure_resource('file', '/etc/nvidia', { 'ensure' => 'directory' })
ensure_packages(['kernel-devel'], { 'name' => "kernel-devel-${facts['kernelrelease']}" })
Expand Down Expand Up @@ -59,6 +60,21 @@

kmod::load { $nvidia_kmod: }

if $allow_profiling_for_all {
file { '/etc/modprobe.d/nvidia.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
}
file_line { 'allow_profiling_for_all':
path => '/etc/modprobe.d/nvidia.conf',
line => 'options nvidia NVreg_RestrictProfilingToAdminUsers=0',
require => File['/etc/modprobe.d/nvidia.conf'],
before => (if ! $facts['nvidia_grid_gpu'] { Class['profile::gpu::install::passthrough'] } else { Class['profile::gpu::install::vgpu'] }),
}
}

if $lib_symlink_path {
$lib_symlink_path_split = split($lib_symlink_path, '/')
$lib_symlink_dir = Hash(
Expand Down

0 comments on commit d1c44cf

Please sign in to comment.