Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
c08f77bf
Unverified
Commit
c08f77bf
authored
Nov 23, 2023
by
czkkkkkk
Committed by
GitHub
Nov 23, 2023
Browse files
[BUGFIX] Fix the lazy device copy issue of DGL node/edge features. (#6564)
parent
5e78e070
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
python/dgl/heterograph.py
python/dgl/heterograph.py
+18
-0
No files found.
python/dgl/heterograph.py
View file @
c08f77bf
...
...
@@ -5661,6 +5661,9 @@ class DGLGraph(object):
If the graph is already on the specified device, the function directly returns it.
Otherwise, it returns a cloned graph on the specified device.
Note that data of node and edge features are not moved to the specified
device before being accessed or `materialize_data()` is called.
Parameters
----------
device : Framework-specific device context object
...
...
@@ -5752,6 +5755,21 @@ class DGLGraph(object):
"""
return
self
.
to
(
F
.
cpu
())
def
materialize_data
(
self
):
"""Materialize the graph data on the current device.
This method is a no-op if the graph data is already materialized.
Returns
-------
DGLGraph
The graph on the current device.
"""
for
frame
in
itertools
.
chain
(
self
.
_node_frames
,
self
.
_edge_frames
):
for
col
in
frame
.
_columns
.
values
():
col
.
data
# pylint: disable=pointless-statement
return
self
def
pin_memory_
(
self
):
"""Pin the graph structure and node/edge data to the page-locked memory for
GPU zero-copy access.
...
...
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