Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
starrygl-DynamicHistory
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhlj
starrygl-DynamicHistory
Commits
4d52b404
Commit
4d52b404
authored
Dec 14, 2023
by
Wenjie Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uvm_share_() -> uvm_share()
parent
2bfb3403
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
starrygl/uvm.py
+3
-3
No files found.
starrygl/uvm.py
View file @
4d52b404
...
@@ -7,7 +7,7 @@ from typing import *
...
@@ -7,7 +7,7 @@ from typing import *
__all__
=
[
__all__
=
[
"uvm_empty"
,
"uvm_empty"
,
"uvm_share
_
"
,
"uvm_share"
,
"uvm_advise"
,
"uvm_advise"
,
"uvm_prefetch"
,
"uvm_prefetch"
,
"cudaMemoryAdvise"
,
"cudaMemoryAdvise"
,
...
@@ -22,17 +22,17 @@ def uvm_empty(*sizes: int, dtype: torch.dtype, device: Any):
...
@@ -22,17 +22,17 @@ def uvm_empty(*sizes: int, dtype: torch.dtype, device: Any):
size_bytes
=
torch
.
Size
(
sizes
)
.
numel
()
*
dtype
.
itemsize
size_bytes
=
torch
.
Size
(
sizes
)
.
numel
()
*
dtype
.
itemsize
# default strides
dims
=
len
(
sizes
)
dims
=
len
(
sizes
)
strides
=
[
1
]
*
dims
strides
=
[
1
]
*
dims
for
i
in
range
(
1
,
dims
):
for
i
in
range
(
1
,
dims
):
strides
[
dims
-
i
-
1
]
=
strides
[
dims
-
i
]
*
sizes
[
dims
-
i
]
strides
[
dims
-
i
-
1
]
=
strides
[
dims
-
i
]
*
sizes
[
dims
-
i
]
strides
=
torch
.
Size
(
strides
)
strides
=
torch
.
Size
(
strides
)
print
(
strides
)
storage
=
starrygl
.
ops
.
uvm_storage_new
(
size_bytes
,
device
.
index
)
storage
=
starrygl
.
ops
.
uvm_storage_new
(
size_bytes
,
device
.
index
)
return
torch
.
empty
(
0
,
dtype
=
dtype
,
device
=
device
)
.
set_
(
storage
,
0
,
sizes
,
strides
)
return
torch
.
empty
(
0
,
dtype
=
dtype
,
device
=
device
)
.
set_
(
storage
,
0
,
sizes
,
strides
)
def
uvm_share
_
(
x
:
Tensor
,
device
:
Any
):
def
uvm_share
(
x
:
Tensor
,
device
:
Any
):
device
=
torch
.
device
(
device
)
device
=
torch
.
device
(
device
)
if
device
.
type
==
"cpu"
:
if
device
.
type
==
"cpu"
:
storage
=
starrygl
.
ops
.
uvm_storage_to_cpu
(
x
.
untyped_storage
())
storage
=
starrygl
.
ops
.
uvm_storage_to_cpu
(
x
.
untyped_storage
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment