From 7ab2c11a5f68cae04b38eeaa558d3871248b0c09 Mon Sep 17 00:00:00 2001
From: Jean-Matthieu Etancelin <jean-matthieu.etancelin@imag.fr>
Date: Wed, 20 Feb 2013 15:41:32 +0000
Subject: [PATCH] Add OpenCL source files

---
 HySoP/hysop/__init__.py                        | 18 +++++++++++++++---
 HySoP/hysop/operator/remeshing.py              |  4 ++--
 HySoP/hysop/operator/transport_d.py            |  4 ++--
 .../particular_solvers/gpu_src/copy_2D_opt2.cl |  2 +-
 HySoP/setup.py.in                              |  4 +++-
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/HySoP/hysop/__init__.py b/HySoP/hysop/__init__.py
index 63f9a5f7d..8bf0ee72e 100644
--- a/HySoP/hysop/__init__.py
+++ b/HySoP/hysop/__init__.py
@@ -46,19 +46,31 @@ Obstacle = obstacle.obstacle.Obstacle
 Obstacle_d = obstacle.obstacle_d.Obstacle_d
 
 ## Operators
+import operator.advec_scales
+import operator.diffusion
+import operator.penalization
+import operator.poisson
+import operator.stretching
 import operator.transport
 import operator.velocity
-import operator.stretching
-import operator.penalization
+Advec_scales = operator.advec_scales.Advec_scales
+Diffusion = operator.diffusion.Diffusion
 Penalization = operator.penalization.Penalization
+Poisson = operator.poisson.Poisson
+Stretching = operator.stretching.Stretching
 Transport = operator.transport.Transport
 Velocity = operator.velocity.Velocity
-Stretching = operator.stretching.Stretching
+
 
 ## Problem
 import problem.problem
 Problem = problem.problem.Problem
 
+
+## Forces
+import physics.compute_forces
+Compute_forces = physics.compute_forces.Compute_forces
+
 ## Solver
 import particular_solvers.basic
 import particular_solvers.gpu
diff --git a/HySoP/hysop/operator/remeshing.py b/HySoP/hysop/operator/remeshing.py
index 53baa23ec..d56db6df3 100644
--- a/HySoP/hysop/operator/remeshing.py
+++ b/HySoP/hysop/operator/remeshing.py
@@ -37,7 +37,7 @@ class Remeshing(DiscreteOperator):
         ## Compute time detailed per directions
         self.compute_time = [0., 0., 0.]
         self.name = "remeshing"
-        self.call_number = 0
+        self.call_number = [0, 0, 0]
 
     def apply(self, t, dt, splittingDirection):
         """
@@ -53,7 +53,7 @@ class Remeshing(DiscreteOperator):
         @li 2. Profile timings of OpenCL kernels.
         """
         c_time = 0.
-        self.call_number += 1
+        self.call_number[splittingDirection] += 1
         if self.numMethod is not None:
             ## Launching kernel
             evt = self.numMethod.launch(self.ppos.gpu_data,
diff --git a/HySoP/hysop/operator/transport_d.py b/HySoP/hysop/operator/transport_d.py
index 1b4e6d7e3..2c3cf92c6 100644
--- a/HySoP/hysop/operator/transport_d.py
+++ b/HySoP/hysop/operator/transport_d.py
@@ -48,7 +48,7 @@ class Transport_d(DiscreteOperator):
         ## Compute time for transposition detailed per directions
         self.compute_time_swap = [0., 0., 0.]
         self.name = "advection"
-        self.call_number = 0
+        self.call_number = [0, 0, 0]
 
     def apply(self, t, dt, splittingDirection):
         """
@@ -67,7 +67,7 @@ class Transport_d(DiscreteOperator):
         @li 3. Profile timings of OpenCL kernels.
         """
         c_time, c_time_init = 0., 0.
-        self.call_number += 1
+        self.call_number[splittingDirection] += 1
         if self.numMethod is not None and self.init_transpose is not None and self.init_copy is not None:
             # Particle init
             if (self.old_splitting_direction == splittingDirection) or self.old_splitting_direction is None:
diff --git a/HySoP/hysop/particular_solvers/gpu_src/copy_2D_opt2.cl b/HySoP/hysop/particular_solvers/gpu_src/copy_2D_opt2.cl
index 4cff9b8e2..7c2f3a950 100644
--- a/HySoP/hysop/particular_solvers/gpu_src/copy_2D_opt2.cl
+++ b/HySoP/hysop/particular_solvers/gpu_src/copy_2D_opt2.cl
@@ -5,7 +5,7 @@ __kernel void copy(__global const float* in,
   uint xIndex = (get_group_id(0) * TILE_DIM_COPY + get_local_id(0)*2);
   uint yIndex = get_group_id(1) * TILE_DIM_COPY + get_local_id(1);
   uint index = xIndex + yIndex * WIDTH;
-  float x,y,z,w;
+  float x,y;
 
   for(uint i=0; i<TILE_DIM_COPY; i+=BLOCK_ROWS_COPY)
     {
diff --git a/HySoP/setup.py.in b/HySoP/setup.py.in
index d1d67d9c3..a46bf9088 100644
--- a/HySoP/setup.py.in
+++ b/HySoP/setup.py.in
@@ -98,7 +98,9 @@ config = Configuration(name=name,
       package_dir={'': '@CMAKE_SOURCE_DIR@'},
       ext_modules=ext_modules,
       packages=packages,
-      data_files=[('./parmepy/particular_solvers', ['@CMAKE_SOURCE_DIR@/parmepy/particular_solvers/gpu_src.cl'])]
+      data_files=[('./parmepy/particular_solvers/gpu_src',
+                   ['@CMAKE_SOURCE_DIR@/parmepy/particular_solvers/gpu_src/' + cl_file
+                    for cl_file in os.listdir('@CMAKE_SOURCE_DIR@/parmepy/particular_solvers/gpu_src/')])]
 )
 
 setup(**config.todict())
-- 
GitLab