diff --git a/keops/python_engine/formulas/maths/TensorDot.py b/keops/python_engine/formulas/maths/TensorDot.py index ec6406ba8..5046f3562 100644 --- a/keops/python_engine/formulas/maths/TensorDot.py +++ b/keops/python_engine/formulas/maths/TensorDot.py @@ -1,7 +1,7 @@ import numpy as np from keops.python_engine.formulas.Operation import Operation - +from keops.python_engine.utils.code_gen_utils import use_pragma_unroll #################################### ###### Tensor Dot Product ##### @@ -152,11 +152,11 @@ def Op(self, out, table, arg0, arg1): return f""" #if C_CONTIGUOUS // row major - #pragma unroll + {use_pragma_unroll()} for (int i = 0; i < {out.dim}; i++) {out.id}[i] = ({out.dtype})(0.0f); - #pragma unroll + {use_pragma_unroll()} {str_code} #else // column major diff --git a/keops/python_engine/formulas/reductions/KMin_ArgKMin_Reduction.py b/keops/python_engine/formulas/reductions/KMin_ArgKMin_Reduction.py index 9944a9a72..e81de3ed9 100644 --- a/keops/python_engine/formulas/reductions/KMin_ArgKMin_Reduction.py +++ b/keops/python_engine/formulas/reductions/KMin_ArgKMin_Reduction.py @@ -7,6 +7,7 @@ new_c_varname, c_if, c_array, + use_pragma_unroll ) from keops.python_engine.formulas.reductions.Reduction import Reduction @@ -79,10 +80,10 @@ def ReducePairShort(self, acc, xi, ind): {{ {xik.declare()} {l.declare()} - #pragma unroll + {use_pragma_unroll()} for(int {k.id}=0; {k.id}<{fdim}; {k.id}++) {{ {xik.assign(xi[k])} - #pragma unroll + {use_pragma_unroll()} for({l.id}={(k+(K-1)*2*fdim).id}; {l.id}>={k.id} && {(xik