Index: /soft/giet_vm/applications/ocean/Makefile
===================================================================
--- /soft/giet_vm/applications/ocean/Makefile	(revision 812)
+++ /soft/giet_vm/applications/ocean/Makefile	(revision 813)
@@ -20,5 +20,5 @@
 INCLUDES = -I.  -I../..  -I../../giet_libs  -I../../giet_xml  
 
-LIB_DEPS = ../../build/libs/libuser.a
+LIB_DEPS = ../../build/libs/libuser.a  ../../build/libmath.a
 
 CFLAGS := -O2 -g -Wall -fomit-frame-pointer -mno-gpopt -fno-delete-null-pointer-checks 
@@ -28,5 +28,5 @@
 .PHONY: clean
 
-appli.elf: $(OBJS) $(APP_NAME).ld $(LIBS_DEPS)
+appli.elf: $(OBJS) $(APP_NAME).ld $(LIBS_DEPS) $(APP_NAME).py
 	$(LD) -o $@ -T $(APP_NAME).ld $(OBJS) $(LIBS)
 	$(DU) -D $@ > $@.txt
Index: /soft/giet_vm/applications/ocean/main.c
===================================================================
--- /soft/giet_vm/applications/ocean/main.c	(revision 812)
+++ /soft/giet_vm/applications/ocean/main.c	(revision 813)
@@ -15,32 +15,29 @@
 /*************************************************************************/
 
-/*************************************************************************/
-/*                                                                       */
-/*  SPLASH Ocean Code                                                    */
-/*                                                                       */
-/*  This application studies the role of eddy and boundary currents in   */
-/*  influencing large-scale ocean movements.  This implementation uses   */
-/*  dynamically allocated four-dimensional arrays for grid data storage. */
-/*                                                                       */
-/*  Main parameters are :                                                */
-/*                                                                       */
-/*     - M : Simulate MxM ocean. M must be (power of 2) +2.              */
-/*     - N : N = number of threads. N must be power of 4.                */
-/*     - E : E = error tolerance for iterative relaxation.               */
-/*     - R : R = distance between grid points in meters.                 */
-/*     - T : T = timestep in seconds.                                    */
-/*                                                                       */
-/*************************************************************************/
-
 ///////////////////////////////////////////////////////////////////////////
-// This is the porting of the SLASH Ocean application on the GIET-VM
-// operating system, for the TSAR manycores architecture.
-// Done by Alain greiner (march 2016).
+//  This is the port of the SPLASH OCEAN application on the GIET-VM
+//  operating system, for the TSAR manycores architecture.
+//  Done by Alain greiner (march 2016).
+//
+//  This application studies the role of eddy and boundary currents in  
+//  influencing large-scale ocean movements.  This implementation uses   
+//  dynamically allocated four-dimensional arrays for grid data storage,
+//  distributed in all clusters (one square sub-grid per thread).
+//  The two main parameters are :                                             
+//     - M : MxM define the grid size. M must be (power of 2) +2.            
+//     - N : N = number of threads. N must be power of 4.
+//  Other parameters are :
+//     - E : E = error tolerance for iterative relaxation.   
+//     - R : R = distance between grid points in meters.   
+//     - T : T = timestep in seconds.                    
 ///////////////////////////////////////////////////////////////////////////
 
+// parameters
 #define DEFAULT_M        258
 #define DEFAULT_E        1e-7
 #define DEFAULT_T    28800.0
 #define DEFAULT_R    20000.0
+
+// constants
 #define UP               0
 #define DOWN             1
@@ -51,5 +48,4 @@
 #define DOWNLEFT         6
 #define DOWNRIGHT        7
-#define PAGE_SIZE     4096
 #define MAX_THREADS   1024
 
@@ -167,4 +163,8 @@
     start_time = giet_proctime();
 
+    // allocate shared TTY & initialise tty_lock 
+    giet_tty_alloc( 1 );     
+    lock_init( &tty_lock);
+
     // compute number of threads : nprocs
     // as we want one thread per processor, it depends on the
@@ -191,22 +191,7 @@
                          "[OCEAN ERROR] mesh_y_size and mesh_y_size must be equal");
 
-    // check the ocean size : M*M grid / (M-2) mut be power of 2
-
     giet_pthread_assert( (im == 34)  || (im == 66)  || (im == 130) ||
                          (im == 258) || (im == 514) || (im == 1026),
                          "[OCEAN ERROR] grid side must be 34,66,130,258,514,1026");
-    
-    // initialise distributed heap
-    for ( x = 0 ; x < mesh_x_size ; x++ ) 
-    {
-        for ( y = 0 ; y < mesh_y_size ; y++ ) 
-        {
-            heap_init( x , y );
-        }
-    }
-
-    // allocate shared TTY & initialise tty_lock 
-    giet_tty_alloc( 1 );     
-    lock_init( &tty_lock);
 
     giet_tty_printf("\n[OCEAN] simulation with W-cycle multigrid solver\n"
@@ -215,5 +200,14 @@
                     mesh_x_size , mesh_y_size , procs_per_cluster, im , jm );
 
-    // initialise distributed barrier
+    // initialise distributed heap
+    for ( x = 0 ; x < mesh_x_size ; x++ ) 
+    {
+        for ( y = 0 ; y < mesh_y_size ; y++ ) 
+        {
+            heap_init( x , y );
+        }
+    }
+
+        // initialise distributed barrier
     sqt_barrier_init( &barrier , mesh_x_size , mesh_y_size , procs_per_cluster );
 
@@ -522,6 +516,6 @@
     char string[256];
 
-    snprintf( string , 256 , "/home/ocean_%d_%d_%d" , 
-              mesh_x_size , mesh_y_size , procs_per_cluster );
+    snprintf( string , 256 , "/home/ocean_%d_%d_%d_%d_d" , 
+              mesh_x_size , mesh_y_size , procs_per_cluster , DEFAULT_M , DEFAULT_M );
 
     // open instrumentation file
