Changeset 502 for soft/giet_vm/applications/classif/classif.py
- Timestamp:
- Feb 8, 2015, 9:20:45 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/classif/classif.py
r488 r502 3 3 from mapping import * 4 4 5 ################################################################################### ###5 ################################################################################### 6 6 # file : classif.py 7 7 # date : november 2014 8 8 # author : Alain Greiner 9 ################################################################################### ####9 ################################################################################### 10 10 # This file describes the mapping of the multi-threaded "classif" 11 11 # application on a multi-clusters, multi-processors architecture. 12 12 # The mapping of tasks on processors is the following: 13 # - one "load" task per cluster, 14 # - one "store" task per cluster, 15 # - (nprocs-2) "analyse" task per cluster. 16 # The mapping of virtual segments on the clusters is the following: 17 # - The code vsegs are replicated on all clusters. 13 # - one "load" task per cluster containing processors, 14 # - one "store" task per cluster containing processors, 15 # - (nprocs-2) "analyse" task per cluster containing processors. 16 # The mapping of virtual segments is the following: 18 17 # - There is one shared data vseg in cluster[0][0] 19 # - There is one heap vseg per cluster. 20 # - The stacks vsegs are distibuted on all clusters. 18 # - The code vsegs are replicated on all clusters containing processors. 19 # - There is one heap vseg per cluster containing processors. 20 # - The stacks vsegs are distibuted on all clusters containing processors. 21 21 # This mapping uses 5 platform parameters, (obtained from the "mapping" argument) 22 22 # - x_size : number of clusters in a row … … 28 28 # WARNING: The target architecture cannot contain less 29 29 # than 3 processors per cluster. 30 ################################################################################## ##30 ################################################################################## 31 31 32 32 ######################### … … 49 49 50 50 heap_base = 0x30000000 51 heap_size = 0x000 08000 # 32Kbytes (per cluster)51 heap_size = 0x00040000 # 256 Kbytes (per cluster) 52 52 53 53 stack_base = 0x40000000 … … 63 63 local = False ) 64 64 65 # heap _x_y vsegs : shared / one per cluster65 # heap vsegs : shared (one per cluster) 66 66 for x in xrange (x_size): 67 67 for y in xrange (y_size): 68 base = heap_base + ( (4*x + y) * heap_size ) 68 cluster_id = (x * y_size) + y 69 if ( mapping.clusters[cluster_id].procs ): 70 size = heap_size 71 base = heap_base + (cluster_id * size) 69 72 70 mapping.addVseg( vspace, 'classif_heap_%d_%d' %(x,y), base , heap_size,71 'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM',72 local = False )73 mapping.addVseg( vspace, 'classif_heap_%d_%d' %(x,y), base , size, 74 'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM', 75 local = False ) 73 76 74 77 # code vsegs : local (one copy in each cluster) 75 78 for x in xrange (x_size): 76 79 for y in xrange (y_size): 80 cluster_id = (x * y_size) + y 81 if ( mapping.clusters[cluster_id].procs ): 77 82 78 mapping.addVseg( vspace, 'classif_code_%d_%d' %(x,y), code_base , code_size, 79 'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM', 80 binpath = 'build/classif/classif.elf', 81 local = True ) 83 mapping.addVseg( vspace, 'classif_code_%d_%d' %(x,y), 84 code_base , code_size, 85 'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM', 86 binpath = 'build/classif/classif.elf', 87 local = True ) 82 88 83 # stacks vsegs: local (one stack per processor => nprocs stacks per cluster) 89 # stacks vsegs: local (one stack per processor => nprocs stacks per cluster) 84 90 for x in xrange (x_size): 85 91 for y in xrange (y_size): 86 for p in xrange( nprocs ): 87 proc_id = (((x * y_size) + y) * nprocs) + p 88 size = (stack_size / nprocs) & 0xFFFFF000 89 base = stack_base + (proc_id * size) 92 cluster_id = (x * y_size) + y 93 if ( mapping.clusters[cluster_id].procs ): 94 for p in xrange( nprocs ): 95 proc_id = (((x * y_size) + y) * nprocs) + p 96 size = (stack_size / nprocs) & 0xFFFFF000 97 base = stack_base + (proc_id * size) 90 98 91 mapping.addVseg( vspace, 'classif_stack_%d_%d_%d' % (x,y,p), base, size, 92 'C_WU', vtype = 'BUFFER', x = x , y = y , pseg = 'RAM', 93 local = True, big = True ) 99 mapping.addVseg( vspace, 'classif_stack_%d_%d_%d' % (x,y,p), 100 base, size, 'C_WU', vtype = 'BUFFER', 101 x = x , y = y , pseg = 'RAM', 102 local = True, big = True ) 94 103 95 104 # distributed tasks / one task per processor 96 105 for x in xrange (x_size): 97 106 for y in xrange (y_size): 98 for p in xrange( nprocs ): 99 trdid = (((x * y_size) + y) * nprocs) + p 100 if ( p== 0 ): # task load 101 task_index = 0 102 task_name = 'load_%d_%d_%d' %(x,y,p) 103 elif ( p== 1 ): # task store 104 task_index = 1 105 task_name = 'store_%d_%d_%d' %(x,y,p) 106 else : # task analyse 107 task_index = 2 108 task_name = 'analyse_%d_%d_%d' % (x,y,p) 107 cluster_id = (x * y_size) + y 108 if ( mapping.clusters[cluster_id].procs ): 109 for p in xrange( nprocs ): 110 trdid = (((x * y_size) + y) * nprocs) + p 111 if ( p== 0 ): # task load 112 task_index = 0 113 task_name = 'load_%d_%d_%d' %(x,y,p) 114 elif ( p== 1 ): # task store 115 task_index = 1 116 task_name = 'store_%d_%d_%d' %(x,y,p) 117 else : # task analyse 118 task_index = 2 119 task_name = 'analyse_%d_%d_%d' % (x,y,p) 109 120 110 mapping.addTask( vspace, task_name, trdid, x, y, p,111 'classif_stack_%d_%d_%d' % (x,y,p),112 'classif_heap_%d_%d' % (x,y),113 task_index )121 mapping.addTask( vspace, task_name, trdid, x, y, p, 122 'classif_stack_%d_%d_%d' % (x,y,p), 123 'classif_heap_%d_%d' % (x,y), 124 task_index ) 114 125 115 126 # extend mapping name … … 118 129 return vspace # useful for test 119 130 120 ################################ test ################################################ ######131 ################################ test ################################################ 121 132 122 133 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.