Skip to content

Commit ba66b48

Browse files
committed
work in progress
1 parent 37289f9 commit ba66b48

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

pyccel/codegen/printing/cucode.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,8 @@ def _print_ModuleHeader(self, expr):
139139
function_declaration,
140140
"#endif // {name.upper()}_H\n"))
141141
def _print_Allocate(self, expr):
142-
self.add_import('cuda_ndarrays')
143-
free_code = ''
144-
145-
146-
#free the array if its already allocated and checking if its not null if the status is unknown
147-
# if (expr.status == 'unknown'):
148-
# free_code = 'if (%s.shape != NULL)\n' % self._print(expr.variable.name)
149-
# free_code += "{{\n{}}}\n".format(self._print(Deallocate(expr.variable)))
150-
# elif (expr.status == 'allocated'):
151-
# free_code += self._print(Deallocate(expr.variable))
152-
142+
143+
self.add_import(c_imports['cuda_ndarrays'])
153144
alloc_code = f"{self._print(expr.variable)} = cuda_array_create();\n"
154145
return f'{alloc_code}'
155146
# print(shape)

pyccel/codegen/utilities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
# The compile object folder will be in the pyccel dirpath
3737
internal_libs = {
3838
"ndarrays" : ("ndarrays", CompileObj("ndarrays.c",folder="ndarrays")),
39+
"cuda_ndarrays": ("cuda_ndarrays", CompileObj("cuda_ndarrays.cu",folder="ndarrays")),
3940
"pyc_math_f90" : ("math", CompileObj("pyc_math_f90.f90",folder="math")),
4041
"pyc_math_c" : ("math", CompileObj("pyc_math_c.c",folder="math")),
4142
"cwrapper" : ("cwrapper", CompileObj("cwrapper.c",folder="cwrapper", accelerators=('python',))),

0 commit comments

Comments
 (0)