Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
medai
software
mednet
Commits
a0f264f0
Commit
a0f264f0
authored
1 year ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[ptbench.utils.accelerator] Add support for mps backend
parent
99f52320
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Reviewed DataModule design+docs+types
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ptbench/utils/accelerator.py
+6
-2
6 additions, 2 deletions
src/ptbench/utils/accelerator.py
with
6 additions
and
2 deletions
src/ptbench/utils/accelerator.py
+
6
−
2
View file @
a0f264f0
...
@@ -18,8 +18,10 @@ class AcceleratorProcessor:
...
@@ -18,8 +18,10 @@ class AcceleratorProcessor:
"""
"""
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
# Note: "auto" is a valid accelerator in lightning, but there doesn't seem to be a way to check which accelerator it will actually use so we don't take it into account for now.
# Note: "auto" is a valid accelerator in lightning, but there doesn't
self
.
torch_to_lightning
=
{
"
cpu
"
:
"
cpu
"
,
"
cuda
"
:
"
gpu
"
}
# seem to be a way to check which accelerator it will actually use so
# we don't take it into account for now.
self
.
torch_to_lightning
=
{
"
cpu
"
:
"
cpu
"
,
"
cuda
"
:
"
gpu
"
,
"
mps
"
:
"
mps
"
}
self
.
lightning_to_torch
=
{
self
.
lightning_to_torch
=
{
v
:
k
for
k
,
v
in
self
.
torch_to_lightning
.
items
()
v
:
k
for
k
,
v
in
self
.
torch_to_lightning
.
items
()
...
@@ -57,6 +59,8 @@ class AcceleratorProcessor:
...
@@ -57,6 +59,8 @@ class AcceleratorProcessor:
"
Environment variable
'
CUDA_VISIBLE_DEVICES
'
is not set.
"
"
Environment variable
'
CUDA_VISIBLE_DEVICES
'
is not set.
"
"
Please set
'
CUDA_VISIBLE_DEVICES
'
of specify a device to use, e.g. cuda:0
"
"
Please set
'
CUDA_VISIBLE_DEVICES
'
of specify a device to use, e.g. cuda:0
"
)
)
elif
self
.
accelerator
==
"
mps
"
:
self
.
device
=
1
else
:
else
:
# No need to check the CUDA_VISIBLE_DEVICES environment variable if cpu
# No need to check the CUDA_VISIBLE_DEVICES environment variable if cpu
pass
pass
...
...
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