Skip to content
Snippets Groups Projects
Commit d0f3c5e0 authored by Jean-Matthieu Etancelin's avatar Jean-Matthieu Etancelin Committed by Franck Pérignon
Browse files

Fiw gpu transfer. Fix f2py parameters avoiding some array copy.

parent cb0c758d
No related branches found
No related tags found
No related merge requests found
...@@ -104,10 +104,10 @@ class DataTransfer(Computational): ...@@ -104,10 +104,10 @@ class DataTransfer(Computational):
self._ghosts_synchro = None self._ghosts_synchro = None
# This function is needed only in a toDevice transfer and if the target operator needs ghosts # This function is needed only in a toDevice transfer and if the target operator needs ghosts
if self._transfer == self._apply_toDevice: if self._transfer == self._apply_toDevice:
d_target = self._target.discreteOperator d_target = self._target.discrete_op
# Test for advection operator # Test for advection operator
if self._target._is_discretized and d_target is None: if self._target._is_discretized and d_target is None:
d_target = self._target.advec_dir[0].discreteOperator d_target = self._target.advec_dir[0].discrete_op
if d_target._synchronize is not None and d_target._synchronize: if d_target._synchronize is not None and d_target._synchronize:
self._ghosts_synchro = UpdateGhostsFull( self._ghosts_synchro = UpdateGhostsFull(
self._d_var[0].topology, self._d_var[0].topology,
......
...@@ -4,11 +4,12 @@ ...@@ -4,11 +4,12 @@
Interface common to all continuous operators. Interface common to all continuous operators.
""" """
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from parmepy.constants import debug from parmepy.constants import debug, PARMES_INTEGER
from parmepy.operator.continuous import Operator from parmepy.operator.continuous import Operator
from parmepy.mpi.topology import Cartesian from parmepy.mpi.topology import Cartesian
from parmepy.tools.parameters import Discretization from parmepy.tools.parameters import Discretization
from parmepy.tools.profiler import profile from parmepy.tools.profiler import profile
import parmepy.tools.numpywrappers as npw
class Computational(Operator): class Computational(Operator):
...@@ -221,20 +222,18 @@ class Computational(Operator): ...@@ -221,20 +222,18 @@ class Computational(Operator):
""" """
if self._is_discretized: if self._is_discretized:
return return
build_topos = self._check_variables() build_topos = self._check_variables()
assert self._single_topo, 'All fields must use the same topology.' assert self._single_topo, 'All fields must use the same topology.'
# Get local mesh parameters from fftw # Get local mesh parameters from fftw
comm = self._mpis.comm comm = self._mpis.comm
from parmepy.f2py import fftw2py from parmepy.f2py import fftw2py
if build_topos: if build_topos:
# In that case, self._discretization must be # In that case, self._discretization must be
# a Discretization object, used for all fields. # a Discretization object, used for all fields.
# We use it to initialize scales solver # We use it to initialize scales solver
msg = 'Wrong type for parameter discretization (at init).' msg = 'Wrong type for parameter discretization (at init).'
assert isinstance(self._discretization, Discretization), msg assert isinstance(self._discretization, Discretization), msg
resolution = self._discretization.resolution resolution = npw.asintarray(self._discretization.resolution)
localres, global_start = fftw2py.init_fftw_solver( localres, global_start = fftw2py.init_fftw_solver(
resolution, self.domain.length, comm=comm.py2f()) resolution, self.domain.length, comm=comm.py2f())
# Create the parmes topo (plane, cut through ZDIR) # Create the parmes topo (plane, cut through ZDIR)
...@@ -258,7 +257,7 @@ class Computational(Operator): ...@@ -258,7 +257,7 @@ class Computational(Operator):
else: else:
assert topo.shape[-1] == self._mpis.comm.Get_size(), msg assert topo.shape[-1] == self._mpis.comm.Get_size(), msg
resolution = topo.mesh.discretization.resolution resolution = npw.asintarray(topo.mesh.discretization.resolution)
localres, global_start = fftw2py.init_fftw_solver( localres, global_start = fftw2py.init_fftw_solver(
resolution, self.domain.length, comm=comm.py2f()) resolution, self.domain.length, comm=comm.py2f())
......
...@@ -55,7 +55,7 @@ class Discretization(namedtuple("Discretization", ['resolution', 'ghosts'])): ...@@ -55,7 +55,7 @@ class Discretization(namedtuple("Discretization", ['resolution', 'ghosts'])):
def __new__(cls, resolution, ghosts=None): def __new__(cls, resolution, ghosts=None):
resolution = npw.asdimarray(resolution) resolution = npw.asdimarray(resolution)
if ghosts is not None: if ghosts is not None:
ghosts = npw.asdimarray(ghosts) ghosts = npw.asintarray(ghosts)
msg = 'Dimensions of resolution and ghosts parameters' msg = 'Dimensions of resolution and ghosts parameters'
msg += ' are not complient.' msg += ' are not complient.'
assert ghosts.size == resolution.size, msg assert ghosts.size == resolution.size, msg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment