diff --git a/src/struphy/feec/psydac_derham.py b/src/struphy/feec/psydac_derham.py index 7394b5b10..dfdb34e4c 100644 --- a/src/struphy/feec/psydac_derham.py +++ b/src/struphy/feec/psydac_derham.py @@ -2326,7 +2326,8 @@ def __init__( if xp.get_backend() == "cupy" and np.any((degree < 1) | (degree > 8)): raise ValueError("CUDA spline degrees must be between 1 and 8.") pn = xp.asarray(degree) - knots = tuple(xp.ascontiguousarray(t, dtype=float) for t in derham.V0fem.knots) + # the knots are host arrays; cupy.ascontiguousarray does not take NumPy arrays, xp.asarray copies them + knots = tuple(xp.asarray(np.ascontiguousarray(t, dtype=float)) for t in derham.V0fem.knots) starts = (self.starts,) if isinstance(self._vector_stencil, StencilVector) else self.starts kinds = derham.spline_attributes[self.space_key].spline_types_pyccel self._args_eval = tuple( diff --git a/src/struphy/pic/sorting.py b/src/struphy/pic/sorting.py index 2d331d6c1..74db8c182 100644 --- a/src/struphy/pic/sorting.py +++ b/src/struphy/pic/sorting.py @@ -1,4 +1,5 @@ import logging +import math from typing import TYPE_CHECKING import cunumpy as xp @@ -226,7 +227,7 @@ def _set_boxes(self): n_particles = self._markers_shape[0] n_mkr = int(n_particles / n_box_in) + 1 n_cols = round( - n_mkr * (1 + 1 / xp.sqrt(n_mkr) + self._box_bufsize), + n_mkr * (1 + 1 / math.sqrt(n_mkr) + self._box_bufsize), ) # cartesian boxes (extra last row stores holes/outside particles)