Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hpc-compendium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ZIH
hpcsupport
hpc-compendium
Commits
64099f1e
Commit
64099f1e
authored
3 years ago
by
Martin Schroschk
Browse files
Options
Downloads
Patches
Plain Diff
Capitalize headings
parent
79dbc97f
No related branches found
No related tags found
3 merge requests
!412
Manual attempt to merge preview into main
,
!402
Solved issue-194. Added missing information regarding usage of SSH config for...
,
!388
Resolve "Missing a tutorial about how to get a PyTorch to GPUs"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc.zih.tu-dresden.de/docs/software/pytorch.md
+4
-4
4 additions, 4 deletions
doc.zih.tu-dresden.de/docs/software/pytorch.md
with
4 additions
and
4 deletions
doc.zih.tu-dresden.de/docs/software/pytorch.md
+
4
−
4
View file @
64099f1e
...
@@ -126,7 +126,7 @@ Remember that this does not break backward compatibility when you port the scrip
...
@@ -126,7 +126,7 @@ Remember that this does not break backward compatibility when you port the scrip
### Caveats
### Caveats
#### Moving
d
ata
b
ack to the CPU-
m
emory
#### Moving
D
ata
B
ack to the CPU-
M
emory
The CPU cannot directly access variables stored on the GPU. If you want to use the variables, e.g. in a
`print`
-statement or
The CPU cannot directly access variables stored on the GPU. If you want to use the variables, e.g. in a
`print`
-statement or
when editing with NumPy or anything that is not PyTorch, you have to move them back to the CPU-memory again. This then may look like this:
when editing with NumPy or anything that is not PyTorch, you have to move them back to the CPU-memory again. This then may look like this:
...
@@ -134,12 +134,12 @@ when editing with NumPy or anything that is not PyTorch, you have to move them b
...
@@ -134,12 +134,12 @@ when editing with NumPy or anything that is not PyTorch, you have to move them b
```
python3
```
python3
cpu_x_train = x_train.cpu()
cpu_x_train = x_train.cpu()
print(cpu_x_train)
print(cpu_x_train)
...
...
error_train = np.sqrt(metrics.mean_squared_error(y_train[:,1].cpu(), y_prediction_train[:,1]))
error_train = np.sqrt(metrics.mean_squared_error(y_train[:,1].cpu(), y_prediction_train[:,1]))
```
```
Remember that, without
`.detach()`
before the CPU, if you change
`cpu_x_train`
,
`x_train`
will also be changed.
Remember that, without
`.detach()`
before the CPU, if you change
`cpu_x_train`
,
`x_train`
will also be changed.
If you want to treat them independently, use
If you want to treat them independently, use
```
python3
```
python3
cpu_x_train = x_train.detach().cpu()
cpu_x_train = x_train.detach().cpu()
...
@@ -147,7 +147,7 @@ cpu_x_train = x_train.detach().cpu()
...
@@ -147,7 +147,7 @@ cpu_x_train = x_train.detach().cpu()
Now you can change
`cpu_x_train`
without
`x_train`
being affected.
Now you can change
`cpu_x_train`
without
`x_train`
being affected.
#### Speed
i
mprovements and
b
atch
s
ize
#### Speed
I
mprovements and
B
atch
S
ize
When you have a lot of very small data points, the speed may actually decrease when you try to train them on the GPU.
When you have a lot of very small data points, the speed may actually decrease when you try to train them on the GPU.
This is because moving data from the CPU-memory to the GPU-memory takes time. If this occurs, please try using
This is because moving data from the CPU-memory to the GPU-memory takes time. If this occurs, please try using
...
...
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