-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiler: Unified Memory Allocator #2023
base: master
Are you sure you want to change the base?
Changes from 10 commits
0befd4e
db87362
ef1f368
ca806b3
50cd534
539254c
ddb5991
d337ac8
6511b06
ce12f56
3ce03ba
f4231e2
c4444a1
f3f90c1
41838ae
241e444
e724ffb
9379b31
7814a46
6df7a06
76dcdb1
6ad6611
92ba35c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import pytest | ||
import numpy as np | ||
import cupy as cp | ||
|
||
from devito import (Grid, Function, TimeFunction, SparseTimeFunction, Dimension, # noqa | ||
Eq, Operator, ALLOC_GUARD, ALLOC_FLAT, configuration, switchconfig) | ||
Eq, Operator, ALLOC_GUARD, ALLOC_FLAT, ALLOC_CUPY, configuration, switchconfig) | ||
from devito.data import LEFT, RIGHT, Decomposition, loc_data_idx, convert_index | ||
from devito.tools import as_tuple | ||
from devito.types import Scalar | ||
|
@@ -206,6 +207,26 @@ def test_indexing_into_sparse(self): | |
sf.data[1:-1, 0] = np.arange(8) | ||
assert np.all(sf.data[1:-1, 0] == np.arange(8)) | ||
|
||
def test_uma_allocation(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the PR with this change |
||
""" | ||
Test Unified Memory allocation. | ||
""" | ||
nt = 5 | ||
grid = Grid(shape=(4, 4, 4)) | ||
|
||
u = Function(name='u', grid=grid, allocator=ALLOC_CUPY ) | ||
u.data[:] = 5 | ||
address = u.data.ctypes.data | ||
pointerAttr = cp.cuda.runtime.pointerGetAttributes(address) | ||
assert pointerAttr.devicePointer == pointerAttr.hostPointer | ||
|
||
v = TimeFunction(name='v', grid=grid, save=nt, allocator=ALLOC_CUPY ) | ||
v.data[:] = 5 | ||
address = v.data.ctypes.data | ||
pointerAttr = cp.cuda.runtime.pointerGetAttributes(address) | ||
assert pointerAttr.devicePointer == pointerAttr.hostPointer | ||
|
||
|
||
|
||
class TestLocDataIDX(object): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be added somehow to the test requirements and this step should be decoratred with a
skipif(device)