Skip to content
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

Remove temporary variable for CudaDeviceSynchronize #20

Open
wants to merge 11 commits into
base: cuda_main_temp
Choose a base branch
from
Open
6 changes: 3 additions & 3 deletions pyccel/ast/cudaext.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from .datatypes import (dtype_and_precision_registry as dtype_registry,
default_precision, datatype, NativeInteger,
NativeFloat, NativeComplex, NativeBool, str_dtype,
NativeFloat, NativeComplex, NativeBool, NativeVoid, str_dtype,
NativeNumeric)

from .internals import PyccelInternalFunction, Slice, max_precision, get_final_precision
Expand Down Expand Up @@ -147,8 +147,8 @@ def __init__(self):
#...
self._shape = None
self._rank = 0
self._dtype = NativeInteger()
self._precision = None
self._dtype = NativeVoid()
self._precision = 0
self._order = None
super().__init__()

Expand Down
3 changes: 2 additions & 1 deletion pyccel/codegen/printing/ccode.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
('int',8) : 'int64_t',
('int',2) : 'int16_t',
('int',1) : 'int8_t',
('bool',4) : 'bool'}
('bool',4) : 'bool',
('void',0) : 'void',}

ndarray_type_registry = {
('float',8) : 'nd_double',
Expand Down
2 changes: 1 addition & 1 deletion pyccel/codegen/printing/ccudacode.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def copy_CudaArray_Data(self, expr):
return '%s%s\n' % (dummy_array, cpy_data)

def _print_CudaSynchronize(self, expr):
return 'cudaDeviceSynchronize()'
return 'cudaDeviceSynchronize();\n'

def _print_CudaInternalVar(self, expr):
var_name = type(expr).__name__
Expand Down
2 changes: 2 additions & 0 deletions pyccel/parser/semantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2642,6 +2642,8 @@ def _visit_Assign(self, expr, **settings):
bounding_box=(self._current_fst_node.lineno, self._current_fst_node.col_offset),
severity='error')
return None
if lhs is PyccelSymbol and lhs.is_temp and rhs.dtype is NativeVoid():
return rhs
lhs = self._assign_lhs_variable(lhs, d_var, rhs, new_expressions, isinstance(expr, AugAssign), **settings)
elif isinstance(lhs, PythonTuple):
n = len(lhs)
Expand Down
4 changes: 4 additions & 0 deletions tests/internal/scripts/ccuda/cuda_synchronize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from pyccel import cuda

if __name__ == '__main__':
cuda.synchronize()