diff --git a/pyccel/ast/cudaext.py b/pyccel/ast/cudaext.py index 63b837be9d..052ebd432b 100644 --- a/pyccel/ast/cudaext.py +++ b/pyccel/ast/cudaext.py @@ -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 @@ -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__() diff --git a/pyccel/codegen/printing/ccode.py b/pyccel/codegen/printing/ccode.py index b8e66fb7bd..b906c467c8 100644 --- a/pyccel/codegen/printing/ccode.py +++ b/pyccel/codegen/printing/ccode.py @@ -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', diff --git a/pyccel/codegen/printing/ccudacode.py b/pyccel/codegen/printing/ccudacode.py index 2d6ac5ad43..795822486a 100644 --- a/pyccel/codegen/printing/ccudacode.py +++ b/pyccel/codegen/printing/ccudacode.py @@ -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__ diff --git a/pyccel/parser/semantic.py b/pyccel/parser/semantic.py index d69a880955..df3715d75c 100644 --- a/pyccel/parser/semantic.py +++ b/pyccel/parser/semantic.py @@ -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) diff --git a/tests/internal/scripts/ccuda/cuda_synchronize.py b/tests/internal/scripts/ccuda/cuda_synchronize.py new file mode 100644 index 0000000000..bc95e56668 --- /dev/null +++ b/tests/internal/scripts/ccuda/cuda_synchronize.py @@ -0,0 +1,4 @@ +from pyccel import cuda + +if __name__ == '__main__': + cuda.synchronize()