| 1 | # ABSTRACT: Base class of the per-distro NVIDIA driver setups (experimental) | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | package Rex::GPU::NVIDIA::Setup; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 36 | our $VERSION = '0.005'; | |||||||||||||||||||||||||||||||||||||||||
| 5 | 36 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 36 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 36 | ▶ | use Rex::Commands::File (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 36 | ▶ | use Rex::Commands::Gather (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 36 | ▶ | use Rex::Commands::Pkg (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 36 | ▶ | use Rex::Commands::Run (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 36 | ▶ | use Rex::Logger (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 36 | ▶ | use Rex::GPU::NVIDIA::Requirement (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 36 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 36 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # No `use utf8` here, on purpose: the die messages carry UTF-8 em dashes as | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # byte strings exactly like Rex::GPU::NVIDIA always emitted them. | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 36 | has gpu => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||||||||
| 21 | 36 | has gpus => ( is => 'lazy', writer => '_set_gpus' ); | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 116 | ▶ | sub _build_gpus { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_gpus: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 116 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 116 | ▶ | return defined $self->gpu ? [ $self->gpu ] : []; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 775 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 775 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 30 | croak __PACKAGE__.'->new: pass gpu or gpus, not both' | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 775 | ▶ | if defined $args->{gpu} && defined $args->{gpus}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $args->{"gpu"} and defined $args->{"gpus"}
MC/DC100%2/2
defined $args->{"gpu"} and defined $args->{"gpus"}
defined $args->{"gpu"}
defined $args->{"gpus"}
Truth table100%3/3
A and B
A= defined $args->{"gpu"}B= defined $args->{"gpus"}
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | croak __PACKAGE__.'->new: gpus must be an arrayref of GPU hashrefs' | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 774 | ▶ | if defined $args->{gpus} && ref $args->{gpus} ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $args->{"gpus"} and ref $args->{"gpus"} ne "ARRAY"
MC/DC100%2/2
defined $args->{"gpus"} and ref $args->{"gpus"} ne "ARRAY"
defined $args->{"gpus"}
ref $args->{"gpus"} ne "ARRAY"
Truth table100%3/3
A and B
A= defined $args->{"gpus"}B= ref $args->{"gpus"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | croak __PACKAGE__.'->new: nvswitches must be an arrayref' | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 773 | ▶ | if defined $args->{nvswitches} && ref $args->{nvswitches} ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $args->{"nvswitches"} and ref $args->{"nvswitches"} ne "ARRAY"
MC/DC100%2/2
defined $args->{"nvswitches"} and ref $args->{"nvswitches"} ne "ARRAY"
defined $args->{"nvswitches"}
ref $args->{"nvswitches"} ne "ARRAY"
Truth table100%3/3
A and B
A= defined $args->{"nvswitches"}B= ref $args->{"nvswitches"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 772 | ▶ | $self->_check_gpus($args->{gpus} // [ defined $args->{gpu} ? $args->{gpu} : () ]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$args->{"gpus"} // [defined $args->{"gpu"} ? $args->{"gpu"} : ()]
MC/DC100%1/1
$args->{"gpus"} // [defined $args->{"gpu"} ? $args->{"gpu"} : ()]
$args->{"gpus"}
Truth table100%2/2
A
A= $args->{"gpus"}
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | # A device_id that is there but not four hex digits ("0x2b85" from sysfs, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # "2b85\n" from a cat) would make Requirement->from_gpu see an unknown GPU: | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # no Kepler refusal, no open module for Blackwell. Croak instead (karr #42). | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 783 | ▶ | sub _check_gpus { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_gpus: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 783 | my ( $self, $gpus ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 783 | for my $gpu (grep { ref $_ eq 'HASH' } @$gpus) { | |||||||||||||||||||||||||||||||||||||||||
| 45 | 913 | my $id = $gpu->{device_id}; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 913 | ▶ | next if !defined $id || $id =~ /\A[0-9a-f]{4}\z/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $id or $id =~ /\A[0-9a-f]{4}\z/i
MC/DC100%2/2
not defined $id or $id =~ /\A[0-9a-f]{4}\z/i
not defined $id
$id =~ /\A[0-9a-f]{4}\z/i
Truth table100%3/3
not(A) or B
A= not defined $idB= $id =~ /\A[0-9a-f]{4}\z/i
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 8 | ▶ | croak "NVIDIA GPU '".( $gpu->{name} // 'unknown' )."': device_id '".$id."' is not " | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$gpu->{"name"} // "unknown"
MC/DC100%1/1
$gpu->{"name"} // "unknown"
$gpu->{"name"}
Truth table100%2/2
A
A= $gpu->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | .'a PCI device ID of four hex digits, e.g. 2b85 (no 0x, no newline). No driver ' | ||||||||||||||||||||||||||||||||||||||||||
| 49 | .'package was installed and no package source was added'; | ||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 775 | return; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 36 | has nvswitches => ( is => 'lazy', writer => '_set_nvswitches' ); | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 511 | ▶ | sub _build_nvswitches { [] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_nvswitches: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 2019 | ▶ | sub fabric_manager_needed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_needed: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 2019 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 2019 | ▶ | return 1 if grep { ref $_ eq 'HASH' } @{ $self->nvswitches }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1926 | return $self->nvlink_fabric_needed; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 87 | ▶ | sub fabric_label { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_label: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 87 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 87 | ▶ | return ( grep { ref $_ eq 'HASH' } @{ $self->nvswitches } ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | ? 'NVSwitch' : 'HGX B200/B300 NVLink fabric'; | ||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 3586 | ▶ | sub nvlink_platform_ids { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_platform_ids: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 3586 | '2901' => 'hgx-nvlink5', # B200 | |||||||||||||||||||||||||||||||||||||||||
| 75 | '2909' => 'hgx-nvlink5', # B200 | ||||||||||||||||||||||||||||||||||||||||||
| 76 | '3182' => 'hgx-nvlink5', # B300 SXM6 AC | ||||||||||||||||||||||||||||||||||||||||||
| 77 | '2941' => 'nvl72', # GB200 | ||||||||||||||||||||||||||||||||||||||||||
| 78 | '31c2' => 'nvl72', # GB300 | ||||||||||||||||||||||||||||||||||||||||||
| 79 | '31c3' => 'nvl72' # GB300 | ||||||||||||||||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 3588 | ▶ | sub nvlink_platforms { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_platforms: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 3588 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 3588 | my %platform = $self->nvlink_platform_ids; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 1011 | my %seen = map { $_ => 1 } | |||||||||||||||||||||||||||||||||||||||||
| 87 | 4854 | grep { defined } | |||||||||||||||||||||||||||||||||||||||||
| 88 | 4854 | ▶ | map { $platform{ lc( $_->{device_id} // '' ) } } | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"device_id"} // ""
MC/DC100%1/1
$_->{"device_id"} // ""
$_->{"device_id"}
Truth table100%2/2
A
A= $_->{"device_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 3588 | grep { ref $_ eq 'HASH' } @{ $self->gpus }; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 3588 | return sort keys %seen; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 3166 | ▶ | sub nvlink_fabric_needed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_fabric_needed: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 3166 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 3166 | ▶ | return ( grep { $_ eq 'hgx-nvlink5' } $self->nvlink_platforms ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | # extra_requirement may be given as a plain hashref; it becomes an object of | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # the class's requirement_class here, so a typo croaks at construction -- on | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # every host, not only on one that gets as far as plan. | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 779 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 779 | my ( $orig, $class, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 779 | my $args = $class->$orig(@args); | |||||||||||||||||||||||||||||||||||||||||
| 104 | $args->{extra_requirement} = $class->_coerce_requirement($args->{extra_requirement}) | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 779 | ▶ | if defined $args->{extra_requirement}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 775 | return $args; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 36 | }; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 36 | has requirement => ( is => 'lazy', predicate => '_has_requirement' ); | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 36 | has extra_requirement => ( is => 'ro', writer => '_set_extra_requirement' ); | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 1312 | ▶ | sub requirement_class { 'Rex::GPU::NVIDIA::Requirement' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requirement_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 529 | ▶ | sub _build_requirement { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_requirement: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 529 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 529 | my $class = $self->requirement_class; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 529 | my $extra = $self->extra_requirement; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 529 | my @gpus = grep { ref $_ eq 'HASH' } @{ $self->gpus }; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 529 | ▶ | return $extra // $class->new unless @gpus; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$extra // $class->new
MC/DC0%0/2
$extra // $class->new
$extra
$class->new
Truth table66%2/3
A // B
A= $extraB= $class->new
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 494 | my @reqs = map { $class->from_gpu($_) } @gpus; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 494 | ▶ | if ( my @conflicts = $class->conflicts(@reqs) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 24 | die 'No single NVIDIA driver supports all GPUs on this host: ' | |||||||||||||||||||||||||||||||||||||||||
| 125 | .join('; ', @conflicts).'. No driver package was installed and no package ' | ||||||||||||||||||||||||||||||||||||||||||
| 126 | .'source was added. Install the ' | ||||||||||||||||||||||||||||||||||||||||||
| 127 | ."driver yourself; once `nvidia-smi -L` lists the GPUs and libcuda.so.1 is in " | ||||||||||||||||||||||||||||||||||||||||||
| 128 | ."the linker cache, install_driver skips the driver step\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 470 | my $gpu_req = $class->intersect(@reqs); | |||||||||||||||||||||||||||||||||||||||||
| 131 | 470 | ▶ | return $gpu_req unless $extra; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | # The user's requirement only tightens (karr #34): a conflict with what the | ||||||||||||||||||||||||||||||||||||||||||
| 133 | # GPUs need dies here, in plan, before anything on the host is changed. | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 6 | ▶ | if ( my @conflicts = $class->conflicts($gpu_req, $extra) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | die 'No NVIDIA driver meets both what the GPUs need and '.$extra->who.' (' | |||||||||||||||||||||||||||||||||||||||||
| 136 | .$extra->describe.'): '.join('; ', @conflicts).'. No driver package was ' | ||||||||||||||||||||||||||||||||||||||||||
| 137 | .'installed and no package source was added. ' | ||||||||||||||||||||||||||||||||||||||||||
| 138 | ."Loosen the requirement, or install the driver yourself\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | return $class->intersect($gpu_req, $extra); | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 36 | my %REQUIREMENT_KEY = map { $_ => 1 } qw( kernel_module min_branch max_branch name ); | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | # A hashref or requirement object -> requirement object. Callable on the class | ||||||||||||||||||||||||||||||||||||||||||
| 146 | # (BUILDARGS) and on an object (adopt). | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 15 | ▶ | sub _coerce_requirement { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_coerce_requirement: called CC=7 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 15 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 15 | my $base = $self->requirement_class; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 15 | ▶ | return $req if blessed($req) && $req->isa($base); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($req) and $req->isa($base)
MC/DC50%1/2
builtin::blessed($req) and $req->isa($base)
builtin::blessed($req)
$req->isa($base)
Truth table66%2/3
A and B
A= builtin::blessed($req)B= $req->isa($base)
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 14 | ▶ | croak __PACKAGE__.': a requirement is a hashref or a '.$base.' object, not ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | .( defined $req ? "'".$req."'" : 'undef' ) | ||||||||||||||||||||||||||||||||||||||||||
| 153 | unless ref $req eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 13 | my @unknown = sort grep { !$REQUIREMENT_KEY{$_} } keys %$req; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 13 | ▶ | croak __PACKAGE__.': unknown requirement key'.( @unknown == 1 ? '' : 's' ).' ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | .join(', ', @unknown).' -- known: kernel_module, min_branch, max_branch, name' | ||||||||||||||||||||||||||||||||||||||||||
| 157 | if @unknown; | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 11 | return $self->requirement_class->new(name => 'the requirement option', %$req); | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 12 | ▶ | sub adopt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
adopt: called CC=17 SCAR=28.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 12 | my ( $self, %arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 12 | ▶ | my $gpus = $arg{gpus} // []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$arg{"gpus"} // []
MC/DC100%1/1
$arg{"gpus"} // []
$arg{"gpus"}
Truth table100%2/2
A
A= $arg{"gpus"}
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 12 | ▶ | croak __PACKAGE__.'->adopt: gpus must be an arrayref of GPU hashrefs' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | unless ref $gpus eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 12 | ▶ | croak ref($self).' object passed as setup => has already run install -- it ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | .'holds that host\'s facts and GPUs. Build a new object per host, or pass a ' | ||||||||||||||||||||||||||||||||||||||||||
| 169 | .'class name. No driver package was installed and no package source was added' | ||||||||||||||||||||||||||||||||||||||||||
| 170 | if $self->_installed; | ||||||||||||||||||||||||||||||||||||||||||
| 171 | my $extra = defined $arg{extra_requirement} | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 11 | ▶ | ? $self->_coerce_requirement($arg{extra_requirement}) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 11 | $self->_check_gpus($gpus); | |||||||||||||||||||||||||||||||||||||||||
| 174 | 10 | ▶ | my $nvswitches = $arg{nvswitches} // []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$arg{"nvswitches"} // []
MC/DC100%1/1
$arg{"nvswitches"} // []
$arg{"nvswitches"}
Truth table100%2/2
A
A= $arg{"nvswitches"}
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 10 | ▶ | croak __PACKAGE__.'->adopt: nvswitches must be an arrayref' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | unless ref $nvswitches eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||
| 177 | # NVSwitches add the Fabric Manager step and a source filter plan applies; | ||||||||||||||||||||||||||||||||||||||||||
| 178 | # they do not touch the requirement, so no fixed-requirement check for them. | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 10 | ▶ | $self->_set_nvswitches($nvswitches) if @$nvswitches && !@{ $self->nvswitches }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$nvswitches and not @{$self->nvswitches;}
MC/DC50%1/2
@$nvswitches and not @{$self->nvswitches;}
@$nvswitches
not @{$self->nvswitches;}
Truth table66%2/3
A and not(B)
A= @$nvswitchesB= not @{$self->nvswitches;}
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 10 | ▶ | my $take_gpus = @$gpus && !@{ $self->gpus }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@$gpus && !@{$self->gpus;}
MC/DC100%2/2
@$gpus && !@{$self->gpus;}
@$gpus
!@{$self->gpus;}
Truth table100%3/3
A && not(B)
A= @$gpusB= !@{$self->gpus;}
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 10 | ▶ | return $self unless $take_gpus || $extra; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$take_gpus or $extra
MC/DC100%2/2
$take_gpus or $extra
$take_gpus
$extra
Truth table100%3/3
A or B
A= $take_gpusB= $extra
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 7 | ▶ | croak ref($self).' object passed as setup => already has a fixed requirement ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | .'(given to new or built by plan), so the detected GPUs or the requirement ' | ||||||||||||||||||||||||||||||||||||||||||
| 184 | .'option could not be checked. Build it without requirement =>, or pass a ' | ||||||||||||||||||||||||||||||||||||||||||
| 185 | .'class name. No driver package was installed and no package source was added' | ||||||||||||||||||||||||||||||||||||||||||
| 186 | if $self->_has_requirement; | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 6 | ▶ | croak ref($self).' object passed as setup => has an extra_requirement of its ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$extra and $self->extra_requirement
MC/DC100%2/2
$extra and $self->extra_requirement
$extra
$self->extra_requirement
Truth table100%3/3
A and B
A= $extraB= $self->extra_requirement
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | .'own and the requirement option was given too; pass one of them. No driver ' | ||||||||||||||||||||||||||||||||||||||||||
| 189 | .'package was installed and no package source was added' | ||||||||||||||||||||||||||||||||||||||||||
| 190 | if $extra && $self->extra_requirement; | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | ▶ | $self->_set_gpus($gpus) if $take_gpus; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 5 | ▶ | $self->_set_extra_requirement($extra) if $extra; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 36 | has os => ( is => 'lazy' ); | |||||||||||||||||||||||||||||||||||||||||
| 198 | 36 | has release => ( is => 'lazy' ); | |||||||||||||||||||||||||||||||||||||||||
| 199 | 36 | has arch => ( is => 'lazy' ); | |||||||||||||||||||||||||||||||||||||||||
| 200 | 36 | has kernel => ( is => 'lazy' ); | |||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 439 | ▶ | sub _build_os { Rex::Commands::Gather::operating_system() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_os: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 356 | ▶ | sub _build_release { Rex::Commands::Gather::operating_system_release() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_release: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 155 | ▶ | sub _build_arch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_arch: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 155 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 155 | my $arch = $self->run_cmd('uname -m', auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 208 | 155 | ▶ | chomp $arch if defined $arch; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 155 | return $arch; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 440 | ▶ | sub _build_kernel { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_kernel: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 440 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 214 | # auto_die left to Rex's default, as install_driver always read it | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 440 | my $kernel = $self->run_cmd('uname -r'); | |||||||||||||||||||||||||||||||||||||||||
| 216 | 440 | chomp $kernel; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 440 | return $kernel; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | #### The host seam ############################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 5214 | ▶ | sub run_cmd { my ( $self, @args ) = @_; return Rex::Commands::Run::run(@args) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_cmd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 103 | ▶ | sub pkg_cmd { my ( $self, @args ) = @_; return Rex::Commands::Pkg::pkg(@args) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pkg_cmd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 438 | ▶ | sub file_cmd { my ( $self, @args ) = @_; return Rex::Commands::File::file(@args) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_cmd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | #### The flow ################################################################# | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | # Set once install starts: the object has read (and cached) one host's facts | ||||||||||||||||||||||||||||||||||||||||||
| 231 | # and GPUs, so adopt refuses to hand it to another host. | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 36 | has _installed => ( is => 'rwp', init_arg => undef ); | |||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | 561 | ▶ | sub install { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 561 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 561 | $self->_set__installed(1); | |||||||||||||||||||||||||||||||||||||||||
| 237 | 561 | ▶ | return 0 if $self->already_installed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 499 | my $plan = $self->plan; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 394 | $self->prepare_host($plan); | |||||||||||||||||||||||||||||||||||||||||
| 240 | 392 | $self->prepare_source($plan); | |||||||||||||||||||||||||||||||||||||||||
| 241 | 380 | $self->resolve_plan($plan); | |||||||||||||||||||||||||||||||||||||||||
| 242 | 372 | $self->install_packages($plan); | |||||||||||||||||||||||||||||||||||||||||
| 243 | 372 | $self->verify_packages($plan); | |||||||||||||||||||||||||||||||||||||||||
| 244 | 367 | ▶ | $self->install_fabric_manager($plan) if $self->fabric_manager_needed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 362 | ▶ | $self->install_nvlink_fabric($plan) if $self->nvlink_fabric_needed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 360 | $self->post_install($plan); | |||||||||||||||||||||||||||||||||||||||||
| 247 | 360 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 563 | ▶ | sub already_installed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
already_installed: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 563 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 253 | # nvidia-smi -L lists a "GPU N:" device only when the module is loaded and | ||||||||||||||||||||||||||||||||||||||||||
| 254 | # functional, so it is the safe, OS-neutral signal. Distro-neutral and | ||||||||||||||||||||||||||||||||||||||||||
| 255 | # BEFORE package selection: a host set up from NVIDIA's CUDA repo would | ||||||||||||||||||||||||||||||||||||||||||
| 256 | # otherwise get a different (possibly lower) driver whose libs conflict. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 563 | my $smi = $self->run_cmd('nvidia-smi -L 2>&1', auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 258 | 563 | ▶ | chomp $smi if defined $smi; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 563 | ▶ | return 0 unless $self->_driver_present($smi); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | # ... and libcuda (karr #42): a module without the CUDA user-space library | ||||||||||||||||||||||||||||||||||||||||||
| 261 | # cannot run a CUDA workload, so it is not "installed". Probed only after | ||||||||||||||||||||||||||||||||||||||||||
| 262 | # nvidia-smi passed: a fresh host runs no more than the one probe. | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 85 | ▶ | unless ($self->_libcuda_present) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 23 | Rex::Logger::info("nvidia-smi lists a GPU ($smi) but libcuda.so.1 is not in the " | |||||||||||||||||||||||||||||||||||||||||
| 265 | .'linker cache (ldconfig -p) — installing the driver packages', 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 23 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 62 | Rex::Logger::info("NVIDIA driver already present and working — skipping driver install ($smi)"); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 62 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 439 | ▶ | sub libcuda_command { q{/sbin/ldconfig -p 2>/dev/null | grep -q '^[[:space:]]*libcuda\.so\.1 '} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
libcuda_command: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | # Runs libcuda_command; 1 if it exited 0. | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 85 | ▶ | sub _libcuda_present { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_libcuda_present: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 85 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 85 | $self->run_cmd($self->libcuda_command, auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 85 | ▶ | return $? == 0 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 596 | ▶ | sub plan { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plan: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 596 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 284 | # vGPU guest (karr #24): after already_installed (a guest whose vGPU | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # driver runs passes there) and before anything on the host is changed. | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 596 | $self->_reject_vgpu_guest; | |||||||||||||||||||||||||||||||||||||||||
| 287 | # Kepler or older (karr #26), on any GPU in the list: die here, after | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # already_installed (a host whose operator installed 470 by hand still | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # passes) and before anything on the host is changed or even read. | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 570 | $self->_reject_unsupported_gpu($_) for @{ $self->gpus }; | |||||||||||||||||||||||||||||||||||||||||
| 291 | # Multi-GPU (karr #33): one driver for all of them, or die untouched. | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 522 | my $requirement = $self->requirement; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 498 | Rex::Logger::info('Installing NVIDIA drivers on '.$self->os.' (kernel '.$self->kernel.')'); | |||||||||||||||||||||||||||||||||||||||||
| 294 | Rex::Logger::info(' Driver requirement: '.$requirement->who.': '.$requirement->describe) | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 498 | ▶ | if @{ $self->gpus } || $self->extra_requirement; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@{$self->gpus;} or $self->extra_requirement
MC/DC50%1/2
@{$self->gpus;} or $self->extra_requirement
@{$self->gpus;}
$self->extra_requirement
Truth table66%2/3
A or B
A= @{$self->gpus;}B= $self->extra_requirement
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 498 | my $plan = { packages => [ $self->kernel_packages ], verify => [] }; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 498 | my @sources = $self->sources; | |||||||||||||||||||||||||||||||||||||||||
| 299 | 498 | ▶ | return $plan unless @sources; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 497 | my $source = $self->select_source(@sources); | |||||||||||||||||||||||||||||||||||||||||
| 301 | # HGX B200/B300 (karr #56): nvlsm must have a source too, known before any | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # change -- a driver without it cannot run CUDA there either. | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 477 | ▶ | if ($self->nvlink_fabric_needed) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 25 | my $why = $self->nvlink_fabric_unavailable($source); | |||||||||||||||||||||||||||||||||||||||||
| 305 | 25 | ▶ | die 'HGX B200/B300 on this '.$self->os.' '.( $self->release // '' ).' host: '.$why | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->release // ""
MC/DC0%0/1
$self->release // ""
$self->release
Truth table50%1/2
A
A= $self->release
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | .'. Without nvlsm and Fabric Manager CUDA fails with cudaErrorSystemNotReady, so ' | ||||||||||||||||||||||||||||||||||||||||||
| 307 | .'no driver package was installed and no package source was added. Install the ' | ||||||||||||||||||||||||||||||||||||||||||
| 308 | ."driver, Fabric Manager and nvlsm yourself\n" if defined $why; | ||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 474 | $plan->{source} = $source; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 474 | ▶ | push @{ $plan->{packages} }, @{ $source->{packages} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$source->{"packages"} // []
MC/DC100%1/1
$source->{"packages"} // []
$source->{"packages"}
Truth table100%2/2
A
A= $source->{"packages"}
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 474 | ▶ | $plan->{verify} = [ @{ $source->{verify} // [] } ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$source->{"verify"} // []
MC/DC100%1/1
$source->{"verify"} // []
$source->{"verify"}
Truth table100%2/2
A
A= $source->{"verify"}
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 474 | return $plan; | |||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 81 | ▶ | sub kernel_packages { () } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
kernel_packages: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | ▶ | sub sources { () } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sources: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 284 | ▶ | sub resolve_source { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_source: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 284 | my ( $self, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 284 | return $source; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 497 | ▶ | sub select_source { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
select_source: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 497 | my ( $self, @candidates ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 497 | my $requirement = $self->requirement; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 497 | my @rejected; | |||||||||||||||||||||||||||||||||||||||||
| 328 | 497 | for my $candidate (@candidates) { | |||||||||||||||||||||||||||||||||||||||||
| 329 | 720 | ▶ | my $why = $candidate->{unavailable} // $requirement->why_not($candidate) | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
($candidate->{"unavailable"} // $requirement->why_not($candidate)) // $self->_fabric_manager_why_not($candidate)
$candidate->{"unavailable"} // $requirement->why_not($candidate)
MC/DC100%3/3
($candidate->{"unavailable"} // $requirement->why_not($candidate)) // $self->_fabric_manager_why_not($candidate)
$candidate->{"unavailable"}
$requirement->why_not($candidate)
$self->_fabric_manager_why_not($candidate)
Truth table100%4/4
A // B // C
A= $candidate->{"unavailable"}B= $requirement->why_not($candidate)C= $self->_fabric_manager_why_not($candidate)
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | // $self->_fabric_manager_why_not($candidate); | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 720 | ▶ | unless (defined $why) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 477 | Rex::Logger::info(' Driver source: '.$candidate->{name}); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 477 | return $candidate; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 243 | push @rejected, $candidate->{name}.': '.$why; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 20 | ▶ | die 'No NVIDIA driver source on this '.$self->os.' '.( $self->release // '' ).' host fits ' | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->release // ""
MC/DC100%1/1
$self->release // ""
$self->release
Truth table100%2/2
A
A= $self->release
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | .$requirement->who.' ('.$requirement->describe.') -- '.join('; ', @rejected) | ||||||||||||||||||||||||||||||||||||||||||
| 339 | .'. No driver package was installed and no package source was added. Install ' | ||||||||||||||||||||||||||||||||||||||||||
| 340 | .'the driver yourself; once ' | ||||||||||||||||||||||||||||||||||||||||||
| 341 | ."`nvidia-smi -L` lists the GPU and libcuda.so.1 is in the linker cache, " | ||||||||||||||||||||||||||||||||||||||||||
| 342 | ."install_driver skips the driver step\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 386 | ▶ | sub resolve_plan { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_plan: called CC=11 SCAR=24.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 386 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 347 | 386 | ▶ | my $source = $plan->{source} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | # After prepare_source (karr #35): the package index is fresh now, so a | ||||||||||||||||||||||||||||||||||||||||||
| 349 | # source that picks its package from it (Ubuntu's apt-cache search) sees | ||||||||||||||||||||||||||||||||||||||||||
| 350 | # what the repository carries, not a fresh image's stale or empty lists. | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 386 | my $resolved = $self->resolve_source($source); | |||||||||||||||||||||||||||||||||||||||||
| 352 | 386 | my $requirement = $self->requirement; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 386 | ▶ | my $why = $resolved->{unavailable} // $requirement->why_not($resolved); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$resolved->{"unavailable"} // $requirement->why_not($resolved)
MC/DC100%2/2
$resolved->{"unavailable"} // $requirement->why_not($resolved)
$resolved->{"unavailable"}
$requirement->why_not($resolved)
Truth table100%3/3
A // B
A= $resolved->{"unavailable"}B= $requirement->why_not($resolved)
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 386 | ▶ | die 'The NVIDIA driver source '.$source->{name}.' chosen for '.$requirement->who | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->release // ""
MC/DC0%0/1
$self->release // ""
$self->release
Truth table50%1/2
A
A= $self->release
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | .' ('.$requirement->describe.') has nothing to install on this '.$self->os.' ' | ||||||||||||||||||||||||||||||||||||||||||
| 356 | .( $self->release // '' ).' host: '.$why.'. No driver package was installed, ' | ||||||||||||||||||||||||||||||||||||||||||
| 357 | .'only the package sources were prepared. Install the driver yourself; once ' | ||||||||||||||||||||||||||||||||||||||||||
| 358 | ."`nvidia-smi -L` lists the GPU and libcuda.so.1 is in the linker cache, " | ||||||||||||||||||||||||||||||||||||||||||
| 359 | ."install_driver skips the driver step\n" | ||||||||||||||||||||||||||||||||||||||||||
| 360 | if defined $why; | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 376 | ▶ | $self->_check_fabric_manager_source($resolved) if $self->fabric_manager_needed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 375 | ▶ | return if $resolved == $source; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | my %old = map { $_ => 1 } @{ $source->{packages} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$source->{"packages"} // []
MC/DC0%0/1
$source->{"packages"} // []
$source->{"packages"}
Truth table50%1/2
A
A= $source->{"packages"}
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 68 | $plan->{source} = $resolved; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 68 | $plan->{packages} = [ ( grep { !$old{$_} } @{ $plan->{packages} } ), | |||||||||||||||||||||||||||||||||||||||||
| 366 | 68 | ▶ | @{ $resolved->{packages} // [] } ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$resolved->{"packages"} // []
MC/DC0%0/1
$resolved->{"packages"} // []
$resolved->{"packages"}
Truth table50%1/2
A
A= $resolved->{"packages"}
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 68 | ▶ | $plan->{verify} = [ @{ $resolved->{verify} // [] } ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$resolved->{"verify"} // []
MC/DC0%0/1
$resolved->{"verify"} // []
$resolved->{"verify"}
Truth table50%1/2
A
A= $resolved->{"verify"}
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 68 | ▶ | Rex::Logger::info(' Driver packages: '.join(', ', @{ $resolved->{packages} // [] })); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$resolved->{"packages"} // []
MC/DC0%0/1
$resolved->{"packages"} // []
$resolved->{"packages"}
Truth table50%1/2
A
A= $resolved->{"packages"}
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 68 | return; | |||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | # NVSwitch host (karr #23): a source that names no Fabric Manager package | ||||||||||||||||||||||||||||||||||||||||||
| 373 | # cannot make the GPUs usable -- without Fabric Manager CUDA init fails with | ||||||||||||||||||||||||||||||||||||||||||
| 374 | # cudaErrorSystemNotReady -- so it does not fit, like a wrong branch. | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 484 | ▶ | sub _fabric_manager_why_not { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fabric_manager_why_not: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 484 | my ( $self, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 484 | ▶ | return unless $self->fabric_manager_needed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 43 | ▶ | return if defined $source->{fabric_manager}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 7 | return 'no NVIDIA Fabric Manager package for the '.$self->fabric_label.' on this host'; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | # After resolve (the branch is exact now): the package name must be complete | ||||||||||||||||||||||||||||||||||||||||||
| 383 | # and the repository must carry it -- dies before any driver package goes in. | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 24 | ▶ | sub _check_fabric_manager_source { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_fabric_manager_source: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 24 | my ( $self, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 24 | my $fm = $self->fabric_manager_package($source); | |||||||||||||||||||||||||||||||||||||||||
| 387 | my $why = defined $fm | ||||||||||||||||||||||||||||||||||||||||||
| 388 | ? $self->fabric_manager_unavailable($fm) | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 24 | ▶ | : 'its Fabric Manager package '.( $source->{fabric_manager} // '(none)' ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$source->{"fabric_manager"} // "(none)"
MC/DC0%0/1
$source->{"fabric_manager"} // "(none)"
$source->{"fabric_manager"}
Truth table0%0/2
A
A= $source->{"fabric_manager"}
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | .' needs an exact driver branch, and none is known'; | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 24 | ▶ | die 'The NVIDIA driver source '.$source->{name}.' has no Fabric Manager for the ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | .$self->fabric_label.' on this host: '.$why.'. No driver package was installed, only the package sources ' | ||||||||||||||||||||||||||||||||||||||||||
| 393 | ."were prepared. Install the driver and a Fabric Manager of exactly its version yourself\n" | ||||||||||||||||||||||||||||||||||||||||||
| 394 | if defined $why; | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 23 | Rex::Logger::info(' Fabric Manager package: '.$fm); | |||||||||||||||||||||||||||||||||||||||||
| 396 | 23 | return; | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 84 | ▶ | sub fabric_manager_package { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_package: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 84 | my ( $self, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 84 | return $self->_with_branch($source->{fabric_manager}, $source); | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 9 | ▶ | sub fabric_manager_unavailable { return } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_unavailable: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 103 | ▶ | sub fabric_manager_service { 'nvidia-fabricmanager.service' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_service: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 24 | ▶ | sub install_fabric_manager { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_fabric_manager: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 24 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 24 | ▶ | my $source = $plan->{source} // {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$plan->{"source"} // {}
MC/DC0%0/1
$plan->{"source"} // {}
$plan->{"source"}
Truth table50%1/2
A
A= $plan->{"source"}
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 24 | my $fm = $self->fabric_manager_package($source); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 24 | ▶ | die 'No Fabric Manager package is known for the '.$self->fabric_label.' on this host; the ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | ."driver is installed, Fabric Manager is not\n" unless defined $fm; | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 24 | my $version = $self->installed_driver_version($source); | |||||||||||||||||||||||||||||||||||||||||
| 416 | 22 | ▶ | die 'Cannot read the installed NVIDIA driver version ('.( $version // 'nothing' ).'); ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$version // "nothing"
MC/DC0%0/1
$version // "nothing"
$version
Truth table50%1/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | .'Fabric Manager must match it exactly, so none was installed. The driver is ' | ||||||||||||||||||||||||||||||||||||||||||
| 418 | ."installed, Fabric Manager is not\n" | ||||||||||||||||||||||||||||||||||||||||||
| 419 | unless $self->_is_driver_version($version); | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 21 | Rex::Logger::info(' Installing NVIDIA Fabric Manager '.$fm.' '.$version.' ('.$self->fabric_label.')'); | |||||||||||||||||||||||||||||||||||||||||
| 421 | 21 | $self->install_versioned_package($fm, $version); | |||||||||||||||||||||||||||||||||||||||||
| 422 | 20 | $self->verify_versioned_package($fm, $version); | |||||||||||||||||||||||||||||||||||||||||
| 423 | 18 | my $unit = $self->fabric_manager_service; | |||||||||||||||||||||||||||||||||||||||||
| 424 | 18 | $self->run_cmd('systemctl enable '.$unit, auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 425 | 18 | ▶ | die 'systemctl enable '.$unit.' failed after installing '.$fm.' '.$version."\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | if $? != 0; | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 17 | return; | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 24 | ▶ | sub retrofit_fabric_manager { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
retrofit_fabric_manager: called CC=16 SCAR=27.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 24 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 433 | 24 | ▶ | return 0 unless $self->fabric_manager_needed; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | 24 | my $unit = $self->fabric_manager_service; | |||||||||||||||||||||||||||||||||||||||||
| 435 | 24 | my $version = $self->loaded_driver_version; | |||||||||||||||||||||||||||||||||||||||||
| 436 | 24 | my @present = $self->installed_fabric_managers; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 24 | ▶ | if (@present) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 7 | ▶ | my @other = grep { !defined $version || !defined $_->[1] || $_->[1] ne $version } @present; | ||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
!(defined $version && defined $_->[1]) || $_->[1] ne $version
defined $version && defined $_->[1]
MC/DC66%2/3
!(defined $version && defined $_->[1]) || $_->[1] ne $version
defined $version
defined $_->[1]
$_->[1] ne $version
Truth table75%3/4
not(A && B) || C
A= defined $versionB= defined $_->[1]C= $_->[1] ne $version
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 7 | ▶ | Rex::Logger::info($self->fabric_label.': Fabric Manager '.join(', ', map { $_->[0].' '.( $_->[1] // 'unknown' ) } @other) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$_->[1] // "unknown"
$version // "unknown"
MC/DC100%1/1
$_->[1] // "unknown"
$_->[1]
MC/DC0%0/1
$version // "unknown"
$version
Truth table100%2/2
A
A= $_->[1]
Truth table50%1/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | .' is installed, but the loaded NVIDIA driver is '.( $version // 'unknown' ) | ||||||||||||||||||||||||||||||||||||||||||
| 441 | .'. Fabric Manager must match the driver exactly or '.$unit.' refuses to start; ' | ||||||||||||||||||||||||||||||||||||||||||
| 442 | .'it is left as it is -- install the matching version yourself', 'warn') | ||||||||||||||||||||||||||||||||||||||||||
| 443 | if @other; | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 7 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 17 | my $fix = 'install NVIDIA Fabric Manager of exactly the loaded driver version yourself'; | |||||||||||||||||||||||||||||||||||||||||
| 447 | 17 | ▶ | unless ($self->_is_driver_version($version)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 3 | Rex::Logger::info($self->fabric_label.' present and no Fabric Manager installed, but the loaded ' | |||||||||||||||||||||||||||||||||||||||||
| 449 | .'driver version cannot be read (nvidia-smi --query-gpu=driver_version); nothing ' | ||||||||||||||||||||||||||||||||||||||||||
| 450 | .'was installed -- '.$fix, 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 14 | my ($branch) = $version =~ /^(\d+)\./; | |||||||||||||||||||||||||||||||||||||||||
| 454 | 14 | my ( %seen, @packages ); | |||||||||||||||||||||||||||||||||||||||||
| 455 | 14 | for my $source ($self->sources) { | |||||||||||||||||||||||||||||||||||||||||
| 456 | 35 | my $fm = $self->fabric_manager_package({ %$source, branch => $branch }); | |||||||||||||||||||||||||||||||||||||||||
| 457 | 35 | ▶ | push @packages, $fm if defined $fm && !$seen{$fm}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $fm and not $seen{$fm}++
MC/DC100%2/2
defined $fm and not $seen{$fm}++
defined $fm
not $seen{$fm}++
Truth table100%3/3
A and not(B)
A= defined $fmB= not $seen{$fm}++
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 14 | ▶ | unless (@packages) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | 1 | Rex::Logger::info($self->fabric_label.' present and no Fabric Manager installed: no driver source ' | |||||||||||||||||||||||||||||||||||||||||
| 461 | .'Rex::GPU knows on this '.$self->os.' host has a Fabric Manager package, so none is ' | ||||||||||||||||||||||||||||||||||||||||||
| 462 | .'installed for the loaded driver '.$version.' -- '.$fix, 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 463 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | 13 | $self->refresh_package_index; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 13 | my @why; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 13 | for my $fm (@packages) { | |||||||||||||||||||||||||||||||||||||||||
| 468 | 13 | my $why = $self->fabric_manager_version_unavailable($fm, $version); | |||||||||||||||||||||||||||||||||||||||||
| 469 | 13 | ▶ | if (defined $why) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | 6 | push @why, $why; | |||||||||||||||||||||||||||||||||||||||||
| 471 | 6 | next; | |||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 7 | Rex::Logger::info(' Installing NVIDIA Fabric Manager '.$fm.' '.$version | |||||||||||||||||||||||||||||||||||||||||
| 474 | .' for the already-installed driver ('.$self->fabric_label.')'); | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 7 | $self->install_versioned_package($fm, $version); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 7 | $self->verify_versioned_package($fm, $version); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 6 | $self->run_cmd('systemctl enable '.$unit, auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 478 | 6 | ▶ | die 'systemctl enable '.$unit.' failed after installing '.$fm.' '.$version | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | ."; the driver is unchanged\n" if $? != 0; | ||||||||||||||||||||||||||||||||||||||||||
| 480 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 482 | 6 | Rex::Logger::info($self->fabric_label.' present and no Fabric Manager installed: the package sources ' | |||||||||||||||||||||||||||||||||||||||||
| 483 | .'configured on this host offer none for the loaded driver '.$version.' (' | ||||||||||||||||||||||||||||||||||||||||||
| 484 | .join('; ', @why).'). No package source was added and nothing was installed -- ' | ||||||||||||||||||||||||||||||||||||||||||
| 485 | .$fix, 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 6 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | sub installed_fabric_managers { () } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
installed_fabric_managers: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 24 | ▶ | sub loaded_driver_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loaded_driver_version: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | 24 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 493 | 24 | my $out = $self->run_cmd('nvidia-smi --query-gpu=driver_version --format=csv,noheader 2>&1', | |||||||||||||||||||||||||||||||||||||||||
| 494 | auto_die => 0); | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 24 | ▶ | return if $? != 0 || !defined $out; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$? != 0 or not defined $out
MC/DC50%1/2
$? != 0 or not defined $out
$? != 0
not defined $out
Truth table66%2/3
A or not(B)
A= $? != 0B= not defined $out
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 23 | my %v; | |||||||||||||||||||||||||||||||||||||||||
| 497 | 23 | $v{ s/^\s+|\s+$//gr } = 1 for grep { /\S/ } split /\n/, $out; | |||||||||||||||||||||||||||||||||||||||||
| 498 | 23 | ▶ | return unless keys %v == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 499 | 21 | my ($version) = keys %v; | |||||||||||||||||||||||||||||||||||||||||
| 500 | 21 | ▶ | return $self->_is_driver_version($version) ? $version : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 4 | ▶ | sub refresh_package_index { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh_package_index: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub fabric_manager_version_unavailable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_manager_version_unavailable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my ( $self, $pkg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | return ref($self).' cannot list the versions of '.$pkg.' its package sources offer'; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | # Pure: is this package name a Fabric Manager (nvidia-fabricmanager, | ||||||||||||||||||||||||||||||||||||||||||
| 511 | # nvidia-fabricmanager-580, the older nvidia-fabric-manager)? Not -dev or | ||||||||||||||||||||||||||||||||||||||||||
| 512 | # libnvidia-nscq. | ||||||||||||||||||||||||||||||||||||||||||
| 513 | 15 | ▶ | sub _is_fabric_manager_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_fabric_manager_name: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 15 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 15 | ▶ | return defined $name && $name =~ /\Anvidia-fabric-?manager(?:-\d+)?\z/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $name and $name =~ /\Anvidia-fabric-?manager(?:-\d+)?\z/
MC/DC50%1/2
defined $name and $name =~ /\Anvidia-fabric-?manager(?:-\d+)?\z/
defined $name
$name =~ /\Anvidia-fabric-?manager(?:-\d+)?\z/
Truth table66%2/3
A and B
A= defined $nameB= $name =~ /\Anvidia-fabric-?manager(?:-\d+)?\z/
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | sub installed_driver_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
installed_driver_version: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | die ref($self)." has no packaging layer to read the driver version from\n"; | |||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | sub install_versioned_package { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_versioned_package: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | die ref($self)." has no packaging layer to install Fabric Manager with\n"; | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | ▶ | sub verify_versioned_package { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_versioned_package: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | die ref($self)." has no packaging layer to verify Fabric Manager with\n"; | |||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | # Pure: an NVIDIA driver version, "580.95.05" / "570.211.01" -- two or three | ||||||||||||||||||||||||||||||||||||||||||
| 534 | # dot-separated numbers, nothing else. | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 62 | ▶ | sub _is_driver_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_driver_version: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 62 | my ( $self, $version ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 537 | 62 | ▶ | return defined $version && $version =~ /\A\d+\.\d+(?:\.\d+)?\z/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $version and $version =~ /\A\d+\.\d+(?:\.\d+)?\z/
MC/DC100%2/2
defined $version and $version =~ /\A\d+\.\d+(?:\.\d+)?\z/
defined $version
$version =~ /\A\d+\.\d+(?:\.\d+)?\z/
Truth table100%3/3
A and B
A= defined $versionB= $version =~ /\A\d+\.\d+(?:\.\d+)?\z/
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | # Pure: a source key's %s filled with the source's exact branch; undef when | ||||||||||||||||||||||||||||||||||||||||||
| 541 | # there is no key, or a %s and no exact branch. | ||||||||||||||||||||||||||||||||||||||||||
| 542 | 108 | ▶ | sub _with_branch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_with_branch: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 108 | my ( $self, $name, $source ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 544 | 108 | ▶ | return unless defined $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | 102 | ▶ | return $name unless $name =~ /%s/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | 57 | ▶ | return unless defined $source->{branch}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 547 | 56 | ( my $filled = $name ) =~ s/%s/$source->{branch}/g; | |||||||||||||||||||||||||||||||||||||||||
| 548 | 56 | return $filled; | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | #### HGX B200/B300 NVLink fabric (karr #56) ################################### | ||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | sub nvlink_fabric_packages { () } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_fabric_packages: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | sub nvlink_fabric_unavailable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_fabric_unavailable: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | return if $self->nvlink_fabric_packages; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | return ref($self).' knows no package source for the NVLink Subnet Manager (nvlsm)'; | |||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | 4 | ▶ | sub prepare_nvlink_fabric_source { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_nvlink_fabric_source: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 12 | ▶ | sub install_nvlink_fabric { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_nvlink_fabric: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | 12 | my ( $self, $plan ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 566 | 12 | $self->warn_nvlink_kernel; | |||||||||||||||||||||||||||||||||||||||||
| 567 | 12 | my @packages = $self->nvlink_fabric_packages; | |||||||||||||||||||||||||||||||||||||||||
| 568 | 12 | Rex::Logger::info(' HGX B200/B300: NVLink Subnet Manager and InfiniBand user space (' | |||||||||||||||||||||||||||||||||||||||||
| 569 | .join(', ', @packages).')'); | ||||||||||||||||||||||||||||||||||||||||||
| 570 | 12 | $self->prepare_nvlink_fabric_source($plan); | |||||||||||||||||||||||||||||||||||||||||
| 571 | 11 | $self->install_packages({ packages => [ @packages ] }); | |||||||||||||||||||||||||||||||||||||||||
| 572 | 11 | $self->verify_packages({ verify => [ @packages ] }); | |||||||||||||||||||||||||||||||||||||||||
| 573 | 10 | $self->load_ib_umad; | |||||||||||||||||||||||||||||||||||||||||
| 574 | 10 | return; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 2 | ▶ | sub retrofit_nvlink_fabric { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
retrofit_nvlink_fabric: called CC=7 SCAR=19.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 579 | 2 | $self->warn_nvlink_kernel; | |||||||||||||||||||||||||||||||||||||||||
| 580 | 2 | my @packages = $self->nvlink_fabric_packages; | |||||||||||||||||||||||||||||||||||||||||
| 581 | 2 | my @missing = grep { !$self->_package_installed($_) } @packages; | |||||||||||||||||||||||||||||||||||||||||
| 582 | 2 | $self->run_cmd(q{lsmod | grep -q '^ib_umad '}, auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 583 | 2 | my $loaded = $? == 0; | |||||||||||||||||||||||||||||||||||||||||
| 584 | 2 | ▶ | return 0 if !@missing && $loaded; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @missing and $loaded
MC/DC50%1/2
not @missing and $loaded
not @missing
$loaded
Truth table66%2/3
not(A) and B
A= not @missingB= $loaded
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 1 | ▶ | if (@missing) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 586 | 1 | Rex::Logger::info(' HGX B200/B300: installing '.join(', ', @missing) | |||||||||||||||||||||||||||||||||||||||||
| 587 | .' for the already-installed driver, from the host\'s own package sources'); | ||||||||||||||||||||||||||||||||||||||||||
| 588 | 1 | $self->refresh_package_index; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | $self->install_packages({ packages => [ @missing ] }); | |||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | ▶ | if (my @still = grep { !$self->_package_installed($_) } @missing) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | ▶ | Rex::Logger::info('HGX B200/B300: '.join(', ', @still).' not installed -- the package ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 592 | .'sources configured on this host do not offer '.( @still == 1 ? 'it' : 'them' ) | ||||||||||||||||||||||||||||||||||||||||||
| 593 | .' (nvlsm comes from NVIDIA\'s CUDA repository). No package source was added; ' | ||||||||||||||||||||||||||||||||||||||||||
| 594 | .'without nvlsm CUDA fails with cudaErrorSystemNotReady -- install ' | ||||||||||||||||||||||||||||||||||||||||||
| 595 | .( @still == 1 ? 'it' : 'them' ).' yourself', 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 1 | $self->load_ib_umad; | |||||||||||||||||||||||||||||||||||||||||
| 599 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | # Whether one of nvlink_fabric_packages is installed: verify_packages for it | ||||||||||||||||||||||||||||||||||||||||||
| 603 | # alone, which dies when it is not. | ||||||||||||||||||||||||||||||||||||||||||
| 604 | 9 | ▶ | sub _package_installed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_package_installed: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | 9 | my ( $self, $pkg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 606 | 9 | ▶ | return eval { $self->verify_packages({ verify => [ $pkg ] }); 1 } ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | 11 | ▶ | sub load_ib_umad { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_ib_umad: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 610 | 11 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 611 | 11 | $self->file_cmd('/etc/modules-load.d/ib_umad.conf', content => "ib_umad\n"); | |||||||||||||||||||||||||||||||||||||||||
| 612 | 11 | $self->run_cmd('modprobe ib_umad', auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 613 | 11 | ▶ | Rex::Logger::info('modprobe ib_umad failed: the Fabric Manager start script needs the ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->kernel // "\$(uname -r)"
MC/DC0%0/1
$self->kernel // "\$(uname -r)"
$self->kernel
Truth table0%0/2
A
A= $self->kernel
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | .'module, so nvidia-fabricmanager.service will not start until it is loaded (on Ubuntu ' | ||||||||||||||||||||||||||||||||||||||||||
| 615 | .'it is in linux-modules-extra-'.( $self->kernel // '$(uname -r)' ).')', 'warn') | ||||||||||||||||||||||||||||||||||||||||||
| 616 | if $? != 0; | ||||||||||||||||||||||||||||||||||||||||||
| 617 | 11 | return; | |||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | 16 | ▶ | sub nvlink_kernel_backported { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nvlink_kernel_backported: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 20 | ▶ | sub warn_nvlink_kernel { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warn_nvlink_kernel: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 20 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 624 | 20 | ▶ | return if $self->nvlink_kernel_backported; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 625 | 16 | my $kernel = $self->kernel; | |||||||||||||||||||||||||||||||||||||||||
| 626 | 16 | ▶ | my ( $major, $minor ) = ( $kernel // '' ) =~ /^(\d+)\.(\d+)/; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$kernel // ""
MC/DC0%0/1
$kernel // ""
$kernel
Truth table50%1/2
A
A= $kernel
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 16 | ▶ | if (!defined $major) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 628 | 1 | ▶ | Rex::Logger::info('HGX B200/B300: cannot read the kernel version ('.( $kernel // 'nothing' ) | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$kernel // "nothing"
MC/DC0%0/1
$kernel // "nothing"
$kernel
Truth table50%1/2
A
A= $kernel
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | .'); NVIDIA requires kernel 5.17 or newer for the NVLink fabric', 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 630 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||
| 632 | 15 | ▶ | return if $major > 5 || ( $major == 5 && $minor >= 17 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$major > 5 or $major == 5 and $minor >= 17
$major == 5 and $minor >= 17
MC/DC100%3/3
$major > 5 or $major == 5 and $minor >= 17
$major > 5
$major == 5
$minor >= 17
Truth table100%4/4
A or B and C
A= $major > 5B= $major == 5C= $minor >= 17
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | 3 | Rex::Logger::info('HGX B200/B300: kernel '.$kernel.' is older than 5.17, which NVIDIA ' | |||||||||||||||||||||||||||||||||||||||||
| 634 | .'requires for the NVLink 5 fabric (Fabric Manager user guide); Fabric Manager and nvlsm ' | ||||||||||||||||||||||||||||||||||||||||||
| 635 | .'may not come up on it. Boot a newer kernel -- on Ubuntu 22.04 the HWE kernel ' | ||||||||||||||||||||||||||||||||||||||||||
| 636 | .'(linux-generic-hwe-22.04). Rex::GPU does not change the kernel', 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 637 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | 11 | ▶ | sub fabric_state_poll { ( 12, 10 ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fabric_state_poll: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | 12 | ▶ | sub check_nvlink_fabric { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_nvlink_fabric: called CC=11 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 643 | 12 | my ( $self, $active ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 644 | 12 | my ( $reads, $seconds ) = $self->fabric_state_poll; | |||||||||||||||||||||||||||||||||||||||||
| 645 | 12 | my $want = scalar grep { ref $_ eq 'HASH' } @{ $self->gpus }; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 12 | my @states; | |||||||||||||||||||||||||||||||||||||||||
| 647 | 12 | ▶ | for my $read (1 .. ( $active ? $reads : 1 )) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | 15 | ▶ | sleep $seconds if $read > 1 && $seconds; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$read > 1 and $seconds
MC/DC0%0/2
$read > 1 and $seconds
$read > 1
$seconds
Truth table66%2/3
A and B
A= $read > 1B= $seconds
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 15 | my $out = $self->run_cmd('nvidia-smi -q 2>&1', auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 650 | 15 | @states = $self->_fabric_states($out); | |||||||||||||||||||||||||||||||||||||||||
| 651 | 15 | ▶ | if ($self->_fabric_complete($want, @states)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 9 | ▶ | Rex::Logger::info(' [ok] NVLink fabric: Fabric State Completed, Status Success on ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 653 | .scalar(@states).' GPU'.( @states == 1 ? '' : 's' )); | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 9 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | my $seen = @states | ||||||||||||||||||||||||||||||||||||||||||
| 658 | 3 | ▶ | ? join('; ', map { 'GPU '.$_.': '.( $states[$_]{state} // 'no State' ).' / ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | 16 | ▶ | .( $states[$_]{status} // 'no Status' ) } 0 .. $#states) | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$states[$_]{"state"} // "no State"
$states[$_]{"status"} // "no Status"
MC/DC0%0/1
$states[$_]{"state"} // "no State"
$states[$_]{"state"}
MC/DC0%0/1
$states[$_]{"status"} // "no Status"
$states[$_]{"status"}
Truth table50%1/2
A
A= $states[$_]{"state"}
Truth table50%1/2
A
A= $states[$_]{"status"}
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | : 'no Fabric section'; | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 3 | my $unit = $self->fabric_manager_service; | |||||||||||||||||||||||||||||||||||||||||
| 662 | 3 | ▶ | Rex::Logger::info('HGX B200/B300: the NVLink fabric is not up -- nvidia-smi -q reports ' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | .$seen.( $want > @states ? ' ('.$want.' GPUs expected)' : '' ) | ||||||||||||||||||||||||||||||||||||||||||
| 664 | .', not State Completed / Status Success on every GPU. CUDA jobs fail with ' | ||||||||||||||||||||||||||||||||||||||||||
| 665 | .'cudaErrorSystemNotReady until it is. Look at systemctl status '.$unit | ||||||||||||||||||||||||||||||||||||||||||
| 666 | .', journalctl -u '.$unit.', /var/log/nvlsm.log, lsmod | grep ib_umad and the kernel ' | ||||||||||||||||||||||||||||||||||||||||||
| 667 | .'(5.17 or newer); after the first-deploy reboot check again with nvidia-smi -q', 'warn'); | ||||||||||||||||||||||||||||||||||||||||||
| 668 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | # Pure: every "Fabric" section of `nvidia-smi -q` output, in GPU order, as | ||||||||||||||||||||||||||||||||||||||||||
| 672 | # { state => ..., status => ... } (a key is missing when the section has no | ||||||||||||||||||||||||||||||||||||||||||
| 673 | # such line). The first State / Status inside the section count; a line | ||||||||||||||||||||||||||||||||||||||||||
| 674 | # indented no deeper than "Fabric" ends it. | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 22 | ▶ | sub _fabric_states { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fabric_states: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 22 | my ( $self, $out ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 677 | 22 | my ( @states, $cur, $indent ); | |||||||||||||||||||||||||||||||||||||||||
| 678 | 22 | ▶ | for my $line (split /\n/, $out // '') { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$out // ""
MC/DC0%0/1
$out // ""
$out
Truth table50%1/2
A
A= $out
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | 1256 | ▶ | next unless $line =~ /\S/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 680 | 1256 | my $depth = length( ( $line =~ /^([ \t]*)/ )[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 681 | 1256 | ▶ | if ($line =~ /^[ \t]*Fabric[ \t]*$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 140 | $cur = {}; | |||||||||||||||||||||||||||||||||||||||||
| 683 | 140 | $indent = $depth; | |||||||||||||||||||||||||||||||||||||||||
| 684 | 140 | push @states, $cur; | |||||||||||||||||||||||||||||||||||||||||
| 685 | 140 | next; | |||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||
| 687 | 1116 | ▶ | next unless $cur; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 688 | 836 | ▶ | if ($depth <= $indent) { undef $cur; next } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 689 | 696 | ▶ | if ($line =~ /^[ \t]*(State|Status)[ \t]*:[ \t]*(.*?)\s*$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 690 | 278 | ▶ | $cur->{ lc $1 } //= $2; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$$cur{lc $1} //= $2
MC/DC0%0/2
$$cur{lc $1} //= $2
$$cur{lc $1}
$2
Truth table33%1/3
A //= B
A= $$cur{lc $1}B= $2
| |||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||
| 693 | 22 | return @states; | |||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | # Pure: at least $want sections (and at least one), each Completed / Success. | ||||||||||||||||||||||||||||||||||||||||||
| 697 | 20 | ▶ | sub _fabric_complete { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fabric_complete: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 20 | my ( $self, $want, @states ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 699 | 20 | ▶ | return 0 unless @states && @states >= $want; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@states and @states >= $want
MC/DC100%2/2
@states and @states >= $want
@states
@states >= $want
Truth table100%3/3
A and B
A= @statesB= @states >= $want
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | 17 | for my $s (@states) { | |||||||||||||||||||||||||||||||||||||||||
| 701 | 91 | ▶ | return 0 unless ( $s->{state} // '' ) eq 'Completed' && ( $s->{status} // '' ) eq 'Success'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition71%5/7
($s->{"state"} // "") eq "Completed" and ($s->{"status"} // "") eq "Success"
$s->{"state"} // ""
$s->{"status"} // ""
MC/DC0%0/2
($s->{"state"} // "") eq "Completed" and ($s->{"status"} // "") eq "Success"
$s->{"state"}
$s->{"status"}
Truth table33%1/3
A and B
A= $s->{"state"}B= $s->{"status"}
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 10 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | sub prepare_host { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_host: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | sub prepare_source { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_source: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | sub install_packages { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_packages: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | ▶ | sub verify_packages { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify_packages: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||
| 713 | 359 | ▶ | sub post_install { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_install: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | 359 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 715 | 359 | $self->file_cmd('/etc/modprobe.d/blacklist-nouveau.conf', | |||||||||||||||||||||||||||||||||||||||||
| 716 | content => "blacklist nouveau\noptions nouveau modeset=0\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 717 | 359 | $self->run_cmd($self->initramfs_command, auto_die => 0); | |||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | 200 | ▶ | sub initramfs_command { 'dracut --force 2>/dev/null' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initramfs_command: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | #### Pure helpers ############################################################# | ||||||||||||||||||||||||||||||||||||||||||
| 723 | # | ||||||||||||||||||||||||||||||||||||||||||
| 724 | # Callable on the class as on an object, and with explicit arguments, because | ||||||||||||||||||||||||||||||||||||||||||
| 725 | # Rex::GPU::NVIDIA keeps some old private names as thin wrappers over them | ||||||||||||||||||||||||||||||||||||||||||
| 726 | # (t/ calls those). | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | # Given `nvidia-smi -L` output: is a working driver loaded? Every failure form | ||||||||||||||||||||||||||||||||||||||||||
| 729 | # (NVML init error, "No devices were found", "command not found") does not | ||||||||||||||||||||||||||||||||||||||||||
| 730 | # match. | ||||||||||||||||||||||||||||||||||||||||||
| 731 | 570 | ▶ | sub _driver_present { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_driver_present: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | 570 | my ( $self, $smi ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 733 | 570 | ▶ | return 0 unless defined $smi; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 734 | 569 | ▶ | return $smi =~ /GPU \d+:/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | # Die for a GPU no installable branch supports -- Kepler or older, max_branch | ||||||||||||||||||||||||||||||||||||||||||
| 738 | # 470. Maintainer decision (epic karr #25): reject loudly instead of | ||||||||||||||||||||||||||||||||||||||||||
| 739 | # installing the EOL 470 driver. Quiet for every other GPU, 580 included, and | ||||||||||||||||||||||||||||||||||||||||||
| 740 | # for anything that is not a GPU hashref. | ||||||||||||||||||||||||||||||||||||||||||
| 741 | 760 | ▶ | sub _reject_unsupported_gpu { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reject_unsupported_gpu: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 760 | my ( $self, $gpu ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 743 | 760 | ▶ | return unless $gpu && ref $gpu eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$gpu and ref $gpu eq "HASH"
MC/DC100%2/2
$gpu and ref $gpu eq "HASH"
$gpu
ref $gpu eq "HASH"
Truth table100%3/3
A and B
A= $gpuB= ref $gpu eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | 757 | my $req = $self->requirement_class->from_gpu($gpu); | |||||||||||||||||||||||||||||||||||||||||
| 745 | 757 | ▶ | return unless defined $req->max_branch && $req->max_branch < 580; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $req->max_branch and $req->max_branch < 580
MC/DC100%2/2
defined $req->max_branch and $req->max_branch < 580
defined $req->max_branch
$req->max_branch < 580
Truth table100%3/3
A and B
A= defined $req->max_branchB= $req->max_branch < 580
| |||||||||||||||||||||||||||||||||||||||||||
| 746 | 50 | ▶ | die "NVIDIA GPU '" . ($gpu->{name} // 'unknown') . "' (10de:$gpu->{device_id}) is " | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$gpu->{"name"} // "unknown"
MC/DC0%0/1
$gpu->{"name"} // "unknown"
$gpu->{"name"}
Truth table50%1/2
A
A= $gpu->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 747 | . $req->generation." silicon: no driver newer than the end-of-life " | ||||||||||||||||||||||||||||||||||||||||||
| 748 | . $req->max_branch." branch supports it, and Rex::GPU does not install " | ||||||||||||||||||||||||||||||||||||||||||
| 749 | . "that. No driver package was installed and no package source was added. " | ||||||||||||||||||||||||||||||||||||||||||
| 750 | . "Install the driver yourself; once " | ||||||||||||||||||||||||||||||||||||||||||
| 751 | . "`nvidia-smi -L` lists the GPU and libcuda.so.1 is in the linker cache, " | ||||||||||||||||||||||||||||||||||||||||||
| 752 | . "install_driver skips the driver step\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | # Die for a vGPU guest device among the GPUs (karr #24): it needs NVIDIA's | ||||||||||||||||||||||||||||||||||||||||||
| 756 | # licensed vGPU guest driver, which no package source carries, and the open | ||||||||||||||||||||||||||||||||||||||||||
| 757 | # nvidia.ko of the datacenter packages refuses an Ampere+ vGPU function. With | ||||||||||||||||||||||||||||||||||||||||||
| 758 | # a non-vGPU GPU next to it both are named: one NVIDIA kernel module drives | ||||||||||||||||||||||||||||||||||||||||||
| 759 | # every GPU of the host, so the two drivers cannot both be installed. A GPU | ||||||||||||||||||||||||||||||||||||||||||
| 760 | # hash without vgpu (a caller that finds its GPUs itself) is not a vGPU. | ||||||||||||||||||||||||||||||||||||||||||
| 761 | 596 | ▶ | sub _reject_vgpu_guest { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reject_vgpu_guest: called CC=8 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||
| 762 | 596 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 763 | 596 | my @gpus = grep { ref $_ eq 'HASH' } @{ $self->gpus }; | |||||||||||||||||||||||||||||||||||||||||
| 764 | 596 | my @vgpu = grep { $_->{vgpu} } @gpus; | |||||||||||||||||||||||||||||||||||||||||
| 765 | 596 | ▶ | return unless @vgpu; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 26 | my @other = grep { !$_->{vgpu} } @gpus; | |||||||||||||||||||||||||||||||||||||||||
| 767 | die join('; ', map { | ||||||||||||||||||||||||||||||||||||||||||
| 768 | 'NVIDIA vGPU guest (type '.( $_->{vgpu_type} // 'unknown' ).', 10de:' | ||||||||||||||||||||||||||||||||||||||||||
| 769 | 26 | ▶ | .( $_->{device_id} // '????' ).' sub '.( $_->{subsystem_id} // '????' ).')' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$_->{"vgpu_type"} // "unknown"
$_->{"device_id"} // "????"
$_->{"subsystem_id"} // "????"
MC/DC0%0/1
$_->{"vgpu_type"} // "unknown"
$_->{"vgpu_type"}
MC/DC0%0/1
$_->{"device_id"} // "????"
$_->{"device_id"}
MC/DC0%0/1
$_->{"subsystem_id"} // "????"
$_->{"subsystem_id"}
Truth table50%1/2
A
A= $_->{"vgpu_type"}
Truth table50%1/2
A
A= $_->{"device_id"}
Truth table50%1/2
A
A= $_->{"subsystem_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 770 | } @vgpu) | ||||||||||||||||||||||||||||||||||||||||||
| 771 | .( @other | ||||||||||||||||||||||||||||||||||||||||||
| 772 | ? ' next to '.join(', ', map { | ||||||||||||||||||||||||||||||||||||||||||
| 773 | 26 | "NVIDIA GPU '".( $_->{name} // 'unknown' )."' (10de:" | |||||||||||||||||||||||||||||||||||||||||
| 774 | 12 | ▶ | .( $_->{device_id} // '????' ).', not a vGPU)' | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$_->{"name"} // "unknown"
$_->{"device_id"} // "????"
MC/DC0%0/1
$_->{"name"} // "unknown"
$_->{"name"}
MC/DC0%0/1
$_->{"device_id"} // "????"
$_->{"device_id"}
Truth table50%1/2
A
A= $_->{"name"}
Truth table50%1/2
A
A= $_->{"device_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 775 | } @other) | ||||||||||||||||||||||||||||||||||||||||||
| 776 | .': one NVIDIA kernel module drives every GPU of the host, and the ' | ||||||||||||||||||||||||||||||||||||||||||
| 777 | .'driver Rex::GPU installs does not drive a vGPU' | ||||||||||||||||||||||||||||||||||||||||||
| 778 | : '' ) | ||||||||||||||||||||||||||||||||||||||||||
| 779 | .': install the licensed NVIDIA vGPU guest driver, then run again. ' | ||||||||||||||||||||||||||||||||||||||||||
| 780 | ."No driver package was installed and no package source was added\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | # `uname -m` / dpkg arch -> the token NVIDIA's CUDA repos use under | ||||||||||||||||||||||||||||||||||||||||||
| 784 | # repos/<distro>/<arch>/: aarch64/arm64 are "sbsa", everything else (an empty | ||||||||||||||||||||||||||||||||||||||||||
| 785 | # string included) "x86_64". NOT the libnvidia-container toolkit repo's token, | ||||||||||||||||||||||||||||||||||||||||||
| 786 | # which is "aarch64" for the same machine. | ||||||||||||||||||||||||||||||||||||||||||
| 787 | 261 | ▶ | sub _cuda_repo_arch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cuda_repo_arch: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 788 | 261 | my ( $self, $machine ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 789 | 261 | ▶ | $machine //= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$machine //= ""
MC/DC100%1/1
$machine //= ""
$machine
Truth table100%2/2
A
A= $machine
| |||||||||||||||||||||||||||||||||||||||||||
| 790 | 261 | ▶ | return 'sbsa' if $machine eq 'aarch64' || $machine eq 'arm64'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$machine eq "aarch64" or $machine eq "arm64"
MC/DC100%2/2
$machine eq "aarch64" or $machine eq "arm64"
$machine eq "aarch64"
$machine eq "arm64"
Truth table100%3/3
A or B
A= $machine eq "aarch64"B= $machine eq "arm64"
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | 255 | return 'x86_64'; | |||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | # Major version from a raw release string ("10.1" -> 10, "trixie/sid" -> 0). | ||||||||||||||||||||||||||||||||||||||||||
| 795 | # operating_system_version() strips the dots, so it is never the input. | ||||||||||||||||||||||||||||||||||||||||||
| 796 | 829 | ▶ | sub _major_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_major_version: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 797 | 829 | my ( $self, $release ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 798 | 829 | ▶ | my ($major) = ($release // '') =~ /^(\d+)/; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$release // ""
MC/DC100%1/1
$release // ""
$release
Truth table100%2/2
A
A= $release
| |||||||||||||||||||||||||||||||||||||||||||
| 799 | 829 | ▶ | return ($major // 0) + 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$major // 0
MC/DC100%1/1
$major // 0
$major
Truth table100%2/2
A
A= $major
| |||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | 36 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | __END__ | ||||||||||||||||||||||||||||||||||||||||||