diff --git a/hysop/codegen/base/codegen.py b/hysop/codegen/base/codegen.py
index 57684d9bb7ff846f94df8cfcc005a3c66896ca34..9f7074b2e1b15499c1bea7a300b0acdb8a1ed7fc 100644
--- a/hysop/codegen/base/codegen.py
+++ b/hysop/codegen/base/codegen.py
@@ -7,7 +7,7 @@ import itertools as it
 
 import pyopencl as cl
 
-from base.utils import WriteOnceDict, VarDict
+from hysop.codegen.base.utils import WriteOnceDict, VarDict
 
 class CodeGenerator(object):
 
diff --git a/hysop/codegen/base/function_codegen.py b/hysop/codegen/base/function_codegen.py
index 9e44bf24d4d34d468b8bca4bdaad56451f5baab2..9745fa31f6d1d19eed1fafff80ae5eb52dda82ee 100644
--- a/hysop/codegen/base/function_codegen.py
+++ b/hysop/codegen/base/function_codegen.py
@@ -2,11 +2,11 @@
 import pyopencl as cl
 from contextlib import contextmanager
 
-from base.codegen        import CodeGenerator
-from base.opencl_codegen import OpenClCodeGenerator
-from base.utils     import ArgDict
-from base.types     import TypeGen, OpenClTypeGen
-from base.variables import CodegenVariable, CodegenVectorClBuiltin, CodegenVectorClBuiltinFunc
+from hysop.codegen.base.codegen        import CodeGenerator
+from hysop.codegen.base.opencl_codegen import OpenClCodeGenerator
+from hysop.codegen.base.utils     import ArgDict
+from hysop.codegen.base.types     import TypeGen, OpenClTypeGen
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin, CodegenVectorClBuiltinFunc
 
 class FunctionBase(object):
     
diff --git a/hysop/codegen/base/kernel_codegen.py b/hysop/codegen/base/kernel_codegen.py
index 8e4de660ebf7d5810b01461474ecc60b779b9a99..c6b13213dc54453a4f67bbf7e29eb1a19d4da29a 100644
--- a/hysop/codegen/base/kernel_codegen.py
+++ b/hysop/codegen/base/kernel_codegen.py
@@ -2,11 +2,11 @@
 from contextlib import contextmanager
 import pyopencl as cl
 
-from base.opencl_codegen   import OpenClCodeGenerator
-from base.function_codegen import FunctionBase
-from base.utils     import VarDict, ArgDict, WriteOnceDict
-from base.types     import OpenClTypeGen
-from base.variables import CodegenVariable, CodegenVectorClBuiltin, CodegenVectorClBuiltinFunc
+from hysop.codegen.base.opencl_codegen   import OpenClCodeGenerator
+from hysop.codegen.base.function_codegen import FunctionBase
+from hysop.codegen.base.utils     import VarDict, ArgDict, WriteOnceDict
+from hysop.codegen.base.types     import OpenClTypeGen
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin, CodegenVectorClBuiltinFunc
 
 class KernelBase(FunctionBase):
     def __init__(self, kname, vec_type_hint=None, 
diff --git a/hysop/codegen/base/opencl_codegen.py b/hysop/codegen/base/opencl_codegen.py
index b12d7a2353e442fa5baef337bb7e6628df9f81c3..c5f12f045589488d7b021c8fb3a7c3e06236c785 100644
--- a/hysop/codegen/base/opencl_codegen.py
+++ b/hysop/codegen/base/opencl_codegen.py
@@ -2,10 +2,10 @@
 import pyopencl as cl
 from contextlib import contextmanager
 
-from base.codegen   import CodeGenerator
-from base.types     import OpenClTypeGen
-from base.utils     import VarDict
-from base.variables import CodegenVariable, CodegenVectorClBuiltin, CodegenVectorClBuiltinFunc
+from hysop.codegen.base.codegen   import CodeGenerator
+from hysop.codegen.base.types     import OpenClTypeGen
+from hysop.codegen.base.utils     import VarDict
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin, CodegenVectorClBuiltinFunc
 
 class OpenClCodeGenerator(CodeGenerator):
     default_keywords = {
diff --git a/hysop/codegen/base/struct_codegen.py b/hysop/codegen/base/struct_codegen.py
index 8607822f0d439fdf17ac20f2f9a2bb1830a44014..adbb2807c8483a42fd22d87c673373bb3be1b4fb 100644
--- a/hysop/codegen/base/struct_codegen.py
+++ b/hysop/codegen/base/struct_codegen.py
@@ -5,9 +5,9 @@ import pyopencl.tools
 import numpy as np
 import re
 
-from base.types     import np_dtype
-from base.codegen   import CodeGenerator
-from base.variables import VarDict, CodegenVariable, CodegenVector, CodegenStruct, CodegenVectorClBuiltin
+from hysop.codegen.base.types     import np_dtype
+from hysop.codegen.base.codegen   import CodeGenerator
+from hysop.codegen.base.variables import VarDict, CodegenVariable, CodegenVector, CodegenStruct, CodegenVectorClBuiltin
 
 class StructCodeGenerator(CodeGenerator):
     def __init__(self,name,numpy_dtype,typegen,
diff --git a/hysop/codegen/base/variables.py b/hysop/codegen/base/variables.py
index 0ff7180fe24b70abd4cf887eba92acf216c3b7c4..953391c2893847fcc7239f881344a88b44575ac9 100644
--- a/hysop/codegen/base/variables.py
+++ b/hysop/codegen/base/variables.py
@@ -1,9 +1,9 @@
     
 import re
 
-import base.types
-from base.utils import VarDict
-from base.types import OpenClTypeGen
+import hysop.codegen.base.types
+from hysop.codegen.base.utils import VarDict
+from hysop.codegen.base.types import OpenClTypeGen
 
 class CodegenVariable(object):
     def __init__(self,name,dtype,typegen,
diff --git a/hysop/codegen/functions/apply_stencil.py b/hysop/codegen/functions/apply_stencil.py
index 3db6b6c5e398864124f45835fc19f11a57e0e5aa..78d20a128d1b5122e5fa7b79e1c57879c70ef7c0 100644
--- a/hysop/codegen/functions/apply_stencil.py
+++ b/hysop/codegen/functions/apply_stencil.py
@@ -1,11 +1,11 @@
 
-from base.opencl_codegen   import OpenClCodeGenerator
-from base.function_codegen import OpenClFunctionCodeGenerator
-from base.variables import CodegenVariable, CodegenVectorClBuiltin
-from base.types     import OpenClTypeGen
-from base.utils     import ArgDict
+from hysop.codegen.base.opencl_codegen   import OpenClCodeGenerator
+from hysop.codegen.base.function_codegen import OpenClFunctionCodeGenerator
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin
+from hysop.codegen.base.types     import OpenClTypeGen
+from hysop.codegen.base.utils     import ArgDict
 
-from maths.stencil.stencil import Stencil
+from hysop.codegen.maths.stencil.stencil import Stencil
 
 class ApplyStencilFunction(OpenClFunctionCodeGenerator):
     
diff --git a/hysop/codegen/functions/cache_load.py b/hysop/codegen/functions/cache_load.py
index b9067ae5f9d4740b2d792b435d0079ef6eb9b989..7c994a8eb12d69ff0180cd4c38cd7c3d6e545f0a 100644
--- a/hysop/codegen/functions/cache_load.py
+++ b/hysop/codegen/functions/cache_load.py
@@ -2,13 +2,13 @@
 import contextlib
 from contextlib import contextmanager
 
-from base.opencl_codegen import OpenClCodeGenerator
-from base.function_codegen import FunctionCodeGenerator
-from base.variables import CodegenVariable, CodegenVectorClBuiltin
-from base.types     import OpenClTypeGen
-from base.utils     import ArgDict
+from hysop.codegen.base.opencl_codegen import OpenClCodeGenerator
+from hysop.codegen.base.function_codegen import FunctionCodeGenerator
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin
+from hysop.codegen.base.types     import OpenClTypeGen
+from hysop.codegen.base.utils     import ArgDict
 
-from functions.compute_index import ComputeIndexFunction
+from hysop.codegen.functions.compute_index import ComputeIndexFunction
 
 class CacheLoadFunction(FunctionCodeGenerator):
     
diff --git a/hysop/codegen/functions/compute_index.py b/hysop/codegen/functions/compute_index.py
index 6d3a1b7e05c0812ae3589f3ca741d44277632785..3047d60646ecc765252b527f5655aaf14b1adf6e 100644
--- a/hysop/codegen/functions/compute_index.py
+++ b/hysop/codegen/functions/compute_index.py
@@ -1,10 +1,10 @@
 
 
-from base.opencl_codegen   import OpenClCodeGenerator
-from base.function_codegen import OpenClFunctionCodeGenerator
-from base.variables import CodegenVariable, CodegenVectorClBuiltin
-from base.types     import OpenClTypeGen
-from base.utils     import ArgDict
+from hysop.codegen.base.opencl_codegen   import OpenClCodeGenerator
+from hysop.codegen.base.function_codegen import OpenClFunctionCodeGenerator
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin
+from hysop.codegen.base.types     import OpenClTypeGen
+from hysop.codegen.base.utils     import ArgDict
 
 class ComputeIndexFunction(OpenClFunctionCodeGenerator):
     
diff --git a/hysop/codegen/functions/empty.py b/hysop/codegen/functions/empty.py
index 49b7f79939c8de0b8f0d1c113f1e5c315f37de95..7b55956928d319353be881a05c9fa9f0654778a1 100644
--- a/hysop/codegen/functions/empty.py
+++ b/hysop/codegen/functions/empty.py
@@ -1,9 +1,9 @@
 
-from base.codegen          import CodeGenerator
-from base.function_codegen import FunctionCodeGenerator
-from base.variables import CodegenVariable
-from base.types     import TypeGen
-from base.utils     import ArgDict
+from hysop.codegen.base.codegen          import CodeGenerator
+from hysop.codegen.base.function_codegen import FunctionCodeGenerator
+from hysop.codegen.base.variables import CodegenVariable
+from hysop.codegen.base.types     import TypeGen
+from hysop.codegen.base.utils     import ArgDict
 
 class EmptyFunction(FunctionCodeGenerator):
     
diff --git a/hysop/codegen/functions/gradient.py b/hysop/codegen/functions/gradient.py
index abcdae1aa67c43b9c811e3e8596114632579beec..132f1ab97be772f22ef4d7cad5493fe8fe73b84b 100644
--- a/hysop/codegen/functions/gradient.py
+++ b/hysop/codegen/functions/gradient.py
@@ -1,17 +1,17 @@
 
 import numpy as np
 
-from base.opencl_codegen   import OpenClCodeGenerator
-from base.function_codegen import OpenClFunctionCodeGenerator
-from base.variables import CodegenVariable, CodegenVectorClBuiltin
-from base.types     import OpenClTypeGen
-from base.utils     import ArgDict
+from hysop.codegen.base.opencl_codegen   import OpenClCodeGenerator
+from hysop.codegen.base.function_codegen import OpenClFunctionCodeGenerator
+from hysop.codegen.base.variables import CodegenVariable, CodegenVectorClBuiltin
+from hysop.codegen.base.types     import OpenClTypeGen
+from hysop.codegen.base.utils     import ArgDict
 
-from maths.stencil.stencil import Stencil1D, Stencil
+from hysop.codegen.maths.stencil.stencil import Stencil1D, Stencil
 
-from functions.compute_index import ComputeIndexFunction
-from functions.cache_load    import CacheLoadFunction
-from functions.apply_stencil import ApplyStencilFunction
+from hysop.codegen.functions.compute_index import ComputeIndexFunction
+from hysop.codegen.functions.cache_load    import CacheLoadFunction
+from hysop.codegen.functions.apply_stencil import ApplyStencilFunction
 
 class GradientFunction(OpenClFunctionCodeGenerator):
     
diff --git a/hysop/codegen/kernels/empty.py b/hysop/codegen/kernels/empty.py
index c1611327bbf65aec16734f56be761d5937b09158..70b5f3d5b7d6d35bfbb082457e808028502604e0 100644
--- a/hysop/codegen/kernels/empty.py
+++ b/hysop/codegen/kernels/empty.py
@@ -1,8 +1,8 @@
 
-from base.variables      import CodegenVectorClBuiltin
-from base.kernel_codegen import KernelCodeGenerator
-from base.types          import OpenClTypeGen
-from base.utils          import ArgDict
+from hysop.codegen.base.variables      import CodegenVectorClBuiltin
+from hysop.codegen.base.kernel_codegen import KernelCodeGenerator
+from hysop.codegen.base.types          import OpenClTypeGen
+from hysop.codegen.base.utils          import ArgDict
 
 class EmptyKernel(KernelCodeGenerator):
     
diff --git a/hysop/codegen/kernels/stretching.py b/hysop/codegen/kernels/stretching.py
index 77fd9662c5a1630ddcc893caeb4422a5f923f1f5..b88b5360e21cc78736de4aead7debc0da7a52c30 100644
--- a/hysop/codegen/kernels/stretching.py
+++ b/hysop/codegen/kernels/stretching.py
@@ -2,26 +2,26 @@
 import operator
 import numpy as np
 
-from base.opencl_codegen import OpenClCodeGenerator
-from base.kernel_codegen import KernelCodeGenerator
-from base.variables      import CodegenVariable, CodegenVectorClBuiltin
-from base.types          import OpenClTypeGen
-from base.utils          import WriteOnceDict, ArgDict
+from hysop.codegen.base.opencl_codegen import OpenClCodeGenerator
+from hysop.codegen.base.kernel_codegen import KernelCodeGenerator
+from hysop.codegen.base.variables      import CodegenVariable, CodegenVectorClBuiltin
+from hysop.codegen.base.types          import OpenClTypeGen
+from hysop.codegen.base.utils          import WriteOnceDict, ArgDict
 
-from structs.mesh_info       import MeshInfoStruct
+from hysop.codegen.structs.mesh_info       import MeshInfoStruct
 
-from functions.compute_index import ComputeIndexFunction
-from functions.gradient      import GradientFunction
+from hysop.codegen.functions.compute_index import ComputeIndexFunction
+from hysop.codegen.functions.gradient      import GradientFunction
 
 class CachedStretchingKernel(KernelCodeGenerator):
     
     def __init__(self, typegen, work_dim, order=2,
-                       cached=True,
                        ftype=None,
                        device=None,context=None, 
                        known_vars = None,
                        symbolic_mode=True):
-
+        
+        cached = True
         ftype = ftype if ftype is not None else typegen.fbtype
 
         kernel_reqs = self.build_requirements(typegen,work_dim, order, cached)
diff --git a/hysop/codegen/maths/runge_kutta/runge_kutta.py b/hysop/codegen/maths/runge_kutta/runge_kutta.py
index d76767d61a98066776cda113803014c3eef98b4e..8f01365bfbc030e14f78207b39a20ebf44aaf37b 100644
--- a/hysop/codegen/maths/runge_kutta/runge_kutta.py
+++ b/hysop/codegen/maths/runge_kutta/runge_kutta.py
@@ -1,6 +1,6 @@
 
 import numpy as np
-from runge_kutta_coeffs import Itype,Qtype,rk_params, available_methods
+from hysop.codegen.runge_kutta_coeffs import Itype,Qtype,rk_params, available_methods
 
 
 # default methods to dump rational and integers expression to string
diff --git a/hysop/codegen/structs/mesh_info.py b/hysop/codegen/structs/mesh_info.py
index 055fb5392ec2d330ff3e6fc9656ef07928074f12..b525d4214993cda78e7dbed44e90942eb0878df2 100644
--- a/hysop/codegen/structs/mesh_info.py
+++ b/hysop/codegen/structs/mesh_info.py
@@ -1,7 +1,7 @@
 
 import numpy as np
-from base.struct_codegen import StructCodeGenerator
-from base.types  import OpenClTypeGen
+from hysop.codegen.base.struct_codegen import StructCodeGenerator
+from hysop.codegen.base.types  import OpenClTypeGen
 
 class MeshInfoStruct(StructCodeGenerator):
     def __init__(self, typegen, typedef=None, device=None,context=None):
diff --git a/hysop/gpu/gpu_stretching.py b/hysop/gpu/gpu_stretching.py
index a99847653509698d860199a51b56fcd37807fb23..7695c72be7f8571f8caca8d54e2a401179db6086 100644
--- a/hysop/gpu/gpu_stretching.py
+++ b/hysop/gpu/gpu_stretching.py
@@ -20,6 +20,8 @@ from hysop.numerics.odesolvers          import Euler, RK2, RK3, RK4
 from hysop.numerics.finite_differences  import FDC2, FDC4
 from hysop.operator.discrete.stretching import Conservative, GradUW
 
+from hysop.codegen.kernels.stretching import CachedStretchingKernel
+
 class GPUStretching(DiscreteOperator, GPUOperator):
 
     _supported_time_integrators        = [Euler]
@@ -106,18 +108,31 @@ class GPUStretching(DiscreteOperator, GPUOperator):
             raise NotImplementedError(msg)
 
     def _gen_cl_src(self):
-        print 'gen_cl_src!'
-
         topo = self.velocity.topology
+
+        shape = npw.ones(4, dtype=int)
+        shape[:self.dim] = topo.mesh.resolution
+        
         mesh_step = npw.ones(4, dtype=self.gpu_precision)
         mesh_step[:self.dim] = self._reorderVect(topo.mesh.space_step)
-        shape = topo.mesh.resolution
         
-        print 'shape:\t',shape
-        print 'mesh_step:\t',mesh_step
-        codegen = ""
+        typegen    = self.typegen
+        work_dim   = self.dim 
+        symbolic_mode = True
+        known_vars = {}
+
+        codegen = CachedStretchingKernel(typegen=typegen,
+                work_dim=work_dim,
+                order=order,
+                device=self.device, 
+                context=self.context,
+                known_vars=known_vars,
+                symbolic_mode=symbolic_mode)
+
+        src = codegen.__str__()
+        print src
+        sys.exit(1)
 
-        src = ""#codegen.__str__()
         gwi = (8,8,8)
         lwi = None
 
@@ -125,25 +140,23 @@ class GPUStretching(DiscreteOperator, GPUOperator):
         prg = self.cl_env.build_raw_src(src, build_options)
         
         kernels = {}
-        kernels['stretching'] = KernelLauncher(
-            prg.stretching, self.cl_env.queue, gwi, lwi)
-        #kernels['copy'] = KernelLauncher(cl.enqueue_copy, self.cl_env.queue)
+        kernels['copy'] = KernelLauncher(cl.enqueue_copy, self.cl_env.queue)
+        kernels['stretching'] = KernelLauncher(prg.stretching, self.cl_env.queue, 
+                gwi, lwi)
         self.kernels = kernels
 
-    def _compute_stretching(self, simulation):
-        pass
-        #wait_evt = self.field.events
-        #d_evt = self.num_diffusion(
-            #self.field.gpu_data[0],
-            #self.field_tmp,
-            #self.gpu_precision(self.viscosity * simulation.time_step),
-            #self._mesh_size,
-            #wait_for=wait_evt)
-        #c_evt = self.copy.launch_sizes_in_args(
-            #self.field.gpu_data[0], self.field_tmp, wait_for=[d_evt])
-        #c_evt = cl.enqueue_copy(self.cl_env.queue, self.field.gpu_data[0],
-                                #self.field_tmp, wait_for=[d_evt])
-        #self.field.events.append(c_evt)
+    def _compute_stretching(self, simulation, to_gpu=True, to_host=True):
+        if to_gpu:
+            for field in self.input:
+                field.to_device()
+        
+        input_events  = [evt for input in self.input for evt in input.events]
+        kernel_args    = self.velocity.gpu_data + self.vorticity.gpu_data + 
+        stretching_evt = self.kernels['stretching'](*kernel_args, wait_for=copy_events)
+        
+        if to_host:
+            for field in self.variables:
+                field.to_host()
 
     def apply(self, simulation):
         self._compute(simulation)