From d0f3c5e08c9e97e629ec7b80729f022980b608b0 Mon Sep 17 00:00:00 2001
From: Jean-Matthieu Etancelin <jean-matthieu.etancelin@univ-reims.fr>
Date: Mon, 3 Nov 2014 14:59:44 +0100
Subject: [PATCH] Fiw gpu transfer. Fix f2py parameters avoiding some array
 copy.

---
 HySoP/hysop/gpu/gpu_transfer.py       | 4 ++--
 HySoP/hysop/operator/computational.py | 9 ++++-----
 HySoP/hysop/tools/parameters.py       | 2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/HySoP/hysop/gpu/gpu_transfer.py b/HySoP/hysop/gpu/gpu_transfer.py
index f414db944..aed0d9937 100644
--- a/HySoP/hysop/gpu/gpu_transfer.py
+++ b/HySoP/hysop/gpu/gpu_transfer.py
@@ -104,10 +104,10 @@ class DataTransfer(Computational):
         self._ghosts_synchro = None
         # This function is needed only in a toDevice transfer and if the target operator needs ghosts
         if self._transfer == self._apply_toDevice:
-            d_target = self._target.discreteOperator
+            d_target = self._target.discrete_op
             # Test for advection operator
             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:
                 self._ghosts_synchro = UpdateGhostsFull(
                     self._d_var[0].topology, 
diff --git a/HySoP/hysop/operator/computational.py b/HySoP/hysop/operator/computational.py
index 8004405ba..86655b96f 100644
--- a/HySoP/hysop/operator/computational.py
+++ b/HySoP/hysop/operator/computational.py
@@ -4,11 +4,12 @@
 Interface common to all continuous operators.
 """
 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.mpi.topology import Cartesian
 from parmepy.tools.parameters import Discretization
 from parmepy.tools.profiler import profile
+import parmepy.tools.numpywrappers as npw
 
 
 class Computational(Operator):
@@ -221,20 +222,18 @@ class Computational(Operator):
         """
         if self._is_discretized:
             return
-
         build_topos = self._check_variables()
         assert self._single_topo, 'All fields must use the same topology.'
         # Get local mesh parameters from fftw
         comm = self._mpis.comm
         from parmepy.f2py import fftw2py
-
         if build_topos:
             # In that case, self._discretization must be
             # a Discretization object, used for all fields.
             # We use it to initialize scales solver
             msg = 'Wrong type for parameter discretization (at init).'
             assert isinstance(self._discretization, Discretization), msg
-            resolution = self._discretization.resolution
+            resolution = npw.asintarray(self._discretization.resolution)
             localres, global_start = fftw2py.init_fftw_solver(
                 resolution, self.domain.length, comm=comm.py2f())
             # Create the parmes topo (plane, cut through ZDIR)
@@ -258,7 +257,7 @@ class Computational(Operator):
             else:
                 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(
                 resolution, self.domain.length, comm=comm.py2f())
diff --git a/HySoP/hysop/tools/parameters.py b/HySoP/hysop/tools/parameters.py
index 22ad231e5..53db939b5 100644
--- a/HySoP/hysop/tools/parameters.py
+++ b/HySoP/hysop/tools/parameters.py
@@ -55,7 +55,7 @@ class Discretization(namedtuple("Discretization", ['resolution', 'ghosts'])):
     def __new__(cls, resolution, ghosts=None):
         resolution = npw.asdimarray(resolution)
         if ghosts is not None:
-            ghosts = npw.asdimarray(ghosts)
+            ghosts = npw.asintarray(ghosts)
             msg = 'Dimensions of resolution and ghosts parameters'
             msg += ' are not complient.'
             assert ghosts.size == resolution.size, msg
-- 
GitLab