Index: soft/giet_vm/applications/transpose/transpose.py
===================================================================
--- soft/giet_vm/applications/transpose/transpose.py	(revision 457)
+++ soft/giet_vm/applications/transpose/transpose.py	(revision 502)
@@ -3,20 +3,26 @@
 from mapping import *
 
-######################################################################################
+##################################################################################
 #   file   : transpose.py  (for the transpose application)
 #   date   : may 2014
 #   author : Alain Greiner
-#######################################################################################
+##################################################################################
 #  This file describes the mapping of the multi-threaded "transpose" 
 #  application on a multi-clusters, multi-processors architecture.
 #  This include both the mapping of virtual segments on the clusters,
 #  and the mapping of tasks on processors.
+#  There is one task per processor.
+#  The mapping of virtual segments is the following:
+#    - There is one shared data vseg in cluster[0][0]
+#    - The code vsegs are replicated on all clusters containing processors.
+#    - There is one heap vseg per cluster containing processors.
+#    - The stacks vsegs are distibuted on all clusters containing processors.
 #  This mapping uses 5 platform parameters, (obtained from the "mapping" argument)
-#  - x_size    : number of clusters in a row
-#  - y_size    : number of clusters in a column
-#  - x_width   : number of bits coding x coordinate
-#  - y_width   : number of bits coding y coordinate
-#  - nprocs    : number of processors per cluster
-####################################################################################
+#    - x_size    : number of clusters in a row
+#    - y_size    : number of clusters in a column
+#    - x_width   : number of bits coding x coordinate
+#    - y_width   : number of bits coding y coordinate
+#    - nprocs    : number of processors per cluster
+##################################################################################
 
 #########################
@@ -54,38 +60,52 @@
     for x in xrange (x_size):
         for y in xrange (y_size):
-            mapping.addVseg( vspace, 'trsp_code_%d_%d' %(x,y), code_base , code_size,
-                             'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM', 
-                             binpath = 'build/transpose/transpose.elf',
-                             local = True )
+            cluster_id = (x * y_size) + y
+            if ( mapping.clusters[cluster_id].procs ):
 
-    # stacks vsegs: local (one stack per processor => nprocs stacks per cluster)            
-    for x in xrange (x_size):
-        for y in xrange (y_size):
-            for p in xrange( nprocs ):
-                proc_id = (((x * y_size) + y) * nprocs) + p
-                size    = (stack_size / nprocs) & 0xFFFFF000
-                base    = stack_base + (proc_id * size)
-                mapping.addVseg( vspace, 'trsp_stack_%d_%d_%d' % (x,y,p), base, size,
-                                 'C_WU', vtype = 'BUFFER', x = x , y = y , pseg = 'RAM',
-                                 local = True, big = True )
+                mapping.addVseg( vspace, 'trsp_code_%d_%d' %(x,y), 
+                                 code_base , code_size,
+                                 'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM', 
+                                 binpath = 'build/transpose/transpose.elf',
+                                 local = True )
 
-    # heap vsegs: distributed but non local (all heap vsegs can be accessed by all tasks)
+    # stacks vsegs: local (one stack per processor => nprocs stacks per cluster)
     for x in xrange (x_size):
         for y in xrange (y_size):
             cluster_id = (x * y_size) + y
-            size  = heap_size
-            base  = heap_base + (cluster_id * size)
-            mapping.addVseg( vspace, 'trsp_heap_%d_%d' % (x,y), base, size, 
-                             'C_WU', vtype = 'BUFFER', x = x, y = y, pseg = 'RAM',
-                             local = False, big = True )
+            if ( mapping.clusters[cluster_id].procs ):
+                for p in xrange( nprocs ):
+                    proc_id = (((x * y_size) + y) * nprocs) + p
+                    size    = (stack_size / nprocs) & 0xFFFFF000
+                    base    = stack_base + (proc_id * size)
+
+                    mapping.addVseg( vspace, 'trsp_stack_%d_%d_%d' % (x,y,p), 
+                                     base, size, 'C_WU', vtype = 'BUFFER', 
+                                     x = x , y = y , pseg = 'RAM',
+                                     local = True, big = True )
+
+    # heap vsegs: distributed non local (all heap vsegs can be accessed by all tasks)
+    for x in xrange (x_size):
+        for y in xrange (y_size):
+            cluster_id = (x * y_size) + y
+            if ( mapping.clusters[cluster_id].procs ):
+                size  = heap_size
+                base  = heap_base + (cluster_id * size)
+
+                mapping.addVseg( vspace, 'trsp_heap_%d_%d' % (x,y), base, size, 
+                                 'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM',
+                                 local = False, big = True )
 
     # distributed tasks / one task per processor
     for x in xrange (x_size):
         for y in xrange (y_size):
-            for p in xrange( nprocs ):
-                trdid = (((x * y_size) + y) * nprocs) + p
-                mapping.addTask( vspace, 'trsp_%d_%d_%d' % (x,y,p), trdid, x, y, p,
-                                 'trsp_stack_%d_%d_%d' % (x,y,p),
-                                 'trsp_heap_%d_%d' % (x,y), 0 )
+            cluster_id = (x * y_size) + y
+            if ( mapping.clusters[cluster_id].procs ):
+                for p in xrange( nprocs ):
+                    trdid = (((x * y_size) + y) * nprocs) + p
+
+                    mapping.addTask( vspace, 'trsp_%d_%d_%d' % (x,y,p),
+                                     trdid, x, y, p,
+                                     'trsp_stack_%d_%d_%d' % (x,y,p),
+                                     'trsp_heap_%d_%d' % (x,y), 0 )
 
     # extend mapping name
@@ -94,5 +114,5 @@
     return vspace  # useful for test
             
-################################ test ######################################################
+################################ test ##################################################
 
 if __name__ == '__main__':
