Skip to content

Commit b414d62

Browse files
committed
work in progress
1 parent 96c3f29 commit b414d62

File tree

4 files changed

+5
-43
lines changed

4 files changed

+5
-43
lines changed

pyccel/ast/cudatypes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def __init__(self, dtype, rank, order, memory_location):
4242
self._memory_location = memory_location
4343
super().__init__()
4444

45+
@property
46+
def memory_location(self):
47+
return self._memory_location
48+
4549
@lru_cache
4650
def __add__(self, other):
4751
test_type = np.zeros(1, dtype = pyccel_type_to_original_type[self.element_type])

pyccel/ast/variable.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ class Variable(TypedAstNode):
5656
'stack' if memory should be allocated on the stack, represents stack arrays and scalars.
5757
'alias' if object allows access to memory stored in another variable.
5858
59-
memory_location: str, default: 'host'
60-
'host' the variable can only be accessed by the CPU.
61-
'device' the variable can only be accessed by the GPU.
62-
'managed' the variable can be accessed by CPU and GPU and is being managed by the Cuda API (memory transfer is being done implicitly).
63-
6459
is_const : bool, default: False
6560
Indicates if object is a const argument of a function.
6661
@@ -147,10 +142,6 @@ def __init__(
147142
raise ValueError("memory_handling must be 'heap', 'stack' or 'alias'")
148143
self._memory_handling = memory_handling
149144

150-
if memory_location not in ('host', 'device', 'managed'):
151-
raise ValueError("memory_location must be 'host', 'device' or 'managed'")
152-
self._memory_location = memory_location
153-
154145
if not isinstance(is_const, bool):
155146
raise TypeError('is_const must be a boolean.')
156147
self._is_const = is_const
@@ -333,36 +324,6 @@ def cls_base(self):
333324
"""
334325
return self._cls_base
335326

336-
@property
337-
def memory_location(self):
338-
""" Indicates whether a Variable has a dynamic size
339-
"""
340-
return self._memory_location
341-
342-
@memory_location.setter
343-
def memory_location(self, memory_location):
344-
if memory_location not in ('host', 'device', 'managed'):
345-
raise ValueError("memory_location must be 'host', 'device' or 'managed'")
346-
self._memory_location = memory_location
347-
348-
@property
349-
def on_host(self):
350-
""" Indicates if memory is only accessible by the CPU
351-
"""
352-
return self.memory_location == 'host'
353-
354-
@property
355-
def on_device(self):
356-
""" Indicates if memory is only accessible by the GPU
357-
"""
358-
return self.memory_location == 'device'
359-
360-
@property
361-
def is_managed(self):
362-
""" Indicates if memory is being managed by CUDA API
363-
"""
364-
return self.memory_location == 'managed'
365-
366327
@property
367328
def is_const(self):
368329
"""

pyccel/codegen/printing/cucode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def _print_Allocate(self, expr):
157157
raise NotImplementedError(f"Don't know how to index {variable.class_type} type")
158158
shape_Assign = "int64_t shape_Assign [] = {" + shape + "};\n"
159159
is_view = 'false' if variable.on_heap else 'true'
160-
memory_location = expr.variable.memory_location
160+
memory_location = variable.class_type.memory_location
161161
if memory_location in ('device', 'host'):
162162
memory_location = 'allocateMemoryOn' + str(memory_location).capitalize()
163163
else:

pyccel/stdlib/cuda_ndarrays/cuda_ndarrays.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ typedef enum e_types
2020

2121
enum e_memory_locations
2222
{
23-
managedMemory,
2423
allocateMemoryOnHost,
2524
allocateMemoryOnDevice
2625
};
@@ -39,8 +38,6 @@ typedef struct s_cuda_ndarray
3938
/* shape 'size of each dimension' */
4039
int64_t *shape;
4140
/* strides 'number of elements to skip to get the next element' */
42-
int64_t *strides;
43-
/* type of the array elements */
4441
t_types type;
4542
/* type size of the array elements */
4643
int32_t type_size;

0 commit comments

Comments
 (0)