Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
iamap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AMAP
iamap
Commits
2dd229a7
Commit
2dd229a7
authored
6 months ago
by
paul.tresson_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
check gpu before install
parent
18e5cef6
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
__init__.py
+4
-1
4 additions, 1 deletion
__init__.py
dialogs/check_gpu.py
+47
-0
47 additions, 0 deletions
dialogs/check_gpu.py
dialogs/packages_installer/packages_installer_dialog.py
+535
-84
535 additions, 84 deletions
dialogs/packages_installer/packages_installer_dialog.py
with
586 additions
and
85 deletions
__init__.py
+
4
−
1
View file @
2dd229a7
...
...
@@ -4,7 +4,10 @@ import inspect
cmd_folder
=
os
.
path
.
split
(
inspect
.
getfile
(
inspect
.
currentframe
()))[
0
]
def
classFactory
(
iface
):
from
.dialogs.check_gpu
import
has_gpu
from
.dialogs.packages_installer
import
packages_installer_dialog
packages_installer_dialog
.
check_required_packages_and_install_if_necessary
(
iface
=
iface
)
device
=
has_gpu
()
packages_installer_dialog
.
check_required_packages_and_install_if_necessary
(
iface
=
iface
,
device
=
device
)
# packages_installer_dialog.check_required_packages_and_install_if_necessary(iface=iface)
from
.iamap
import
IAMap
return
IAMap
(
iface
,
cmd_folder
)
This diff is collapsed.
Click to expand it.
dialogs/check_gpu.py
0 → 100644
+
47
−
0
View file @
2dd229a7
import
subprocess
import
platform
def
check_nvidia_gpu
():
try
:
# Run the nvidia-smi command and capture the output
output
=
subprocess
.
check_output
([
"
nvidia-smi
"
,
"
--query-gpu=name,driver_version
"
,
"
--format=csv,noheader
"
],
stderr
=
subprocess
.
STDOUT
)
output
=
output
.
decode
(
"
utf-8
"
).
strip
()
# Parse the output
gpu_info
=
output
.
split
(
'
,
'
)
gpu_name
=
gpu_info
[
0
].
strip
()
output_cuda_version
=
subprocess
.
run
([
'
nvidia-smi
'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
text
=
True
)
for
line
in
output_cuda_version
.
stdout
.
split
(
'
\n
'
):
if
'
CUDA Version
'
in
line
:
cuda_version
=
line
.
split
(
'
CUDA Version:
'
)[
1
].
split
()[
0
]
return
True
,
gpu_name
,
cuda_version
except
(
subprocess
.
CalledProcessError
,
FileNotFoundError
):
return
False
,
None
,
None
def
check_amd_gpu
():
try
:
if
platform
.
system
()
==
"
Windows
"
:
output
=
subprocess
.
check_output
([
"
wmic
"
,
"
path
"
,
"
win32_videocontroller
"
,
"
get
"
,
"
name
"
],
universal_newlines
=
True
)
if
"
AMD
"
in
output
or
"
Radeon
"
in
output
:
return
True
elif
platform
.
system
()
==
"
Linux
"
:
output
=
subprocess
.
check_output
([
"
lspci
"
],
universal_newlines
=
True
)
if
"
AMD
"
in
output
or
"
Radeon
"
in
output
:
return
True
elif
platform
.
system
()
==
"
Darwin
"
:
output
=
subprocess
.
check_output
([
"
system_profiler
"
,
"
SPDisplaysDataType
"
],
universal_newlines
=
True
)
if
"
AMD
"
in
output
or
"
Radeon
"
in
output
:
return
True
except
subprocess
.
CalledProcessError
:
return
False
return
False
def
has_gpu
():
has_nvidia
,
gpu_name
,
cuda_version
=
check_nvidia_gpu
()
if
has_nvidia
:
return
cuda_version
if
check_amd_gpu
():
return
'
amd
'
return
'
cpu
'
This diff is collapsed.
Click to expand it.
dialogs/packages_installer/packages_installer_dialog.py
+
535
−
84
View file @
2dd229a7
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment