- Timestamp:
- Jan 19, 2016, 1:19:14 PM (9 years ago)
- Location:
- soft/giet_vm/applications/transpose
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/transpose/transpose.c
r712 r764 4 4 // author : Alain Greiner 5 5 /////////////////////////////////////////////////////////////////////////////////////// 6 // This multi-threaded aplication transposes a raw image (one pbyte per pixel). 6 // This multi-threaded aplication read a raw image (one byte per pixel) 7 // stored on disk, transpose it, display the result on the frame buffer, 8 // and store the transposed image on disk. 9 // The input image can be interactively selected if the INTERACTIVE flag is set. 7 10 // It can run on a multi-processors, multi-clusters architecture, with one thread 8 11 // per processor, and uses the POSIX threads API. 9 // It does not use the CMA to display the result image. 12 // It uses the giet_fat_mmap() to directly access the input and output files 13 // in the kernel files cache. It does not use the CMA to display the result image. 10 14 // 11 15 // The main() function can be launched on any processor P[x,y,l]. … … 15 19 // when the parallel execution is completed. 16 20 // 17 // The input and output buffers containing the image are distributed in clusters. 18 // 19 // The execute() function read a set of lines from an input file on disk, 20 // to the local buffer buf_in[x][y], transpose it, write the result to a remote buffer 21 // buf_out[x'][y'], display the content of the local buffer buf_out[x][y] to the 22 // frame buffer, and store it on disk to another output file. 21 // The buf_in[x,y] and buf_out[put buffers containing the direct ans transposed images 22 // are distributed in clusters: 23 // In each cluster[x,y], the thread running on processor P[x,y,0] uses the giet_fat_mmap() 24 // function to map the buf_in[x,y] and buf_out[x,y] buffers containing a set of lines. 25 // Then, all threads in cluster[x,y] read pixels from the local buf_in[x,y] buffer, and 26 // write the pixels to the remote buf_out[x,y] buffers. Finally, each thread display 27 // a part of the transposed image to the frame buffer. 23 28 // 24 29 // - The image size must fit the frame buffer size. … … 26 31 // - The number of clusters must be a power of 2 no larger than 256. 27 32 // - The number of processors per cluster must be a power of 2 no larger than 4. 33 // - The number of clusters cannot be larger than (image_size * image_size) / 4096, 34 // because the size of buf_in[x,y] and buf_out[x,y] must be multiple of 4096. 35 // 36 // The transpose_rw.c file contains a variant that use the giet_fat_read() 37 // and giet_fat_write() system calls, to access the files. 28 38 /////////////////////////////////////////////////////////////////////////////////////// 29 39 … … 33 43 #include "malloc.h" 34 44 35 #define BLOCK_SIZE 512 // block size on disk 36 #define X_MAX 16 // max number of clusters in row 37 #define Y_MAX 16 // max number of clusters in column 38 #define PROCS_MAX 4 // max number of procs per cluster 39 #define CLUSTER_MAX (X_MAX * Y_MAX) // max number of clusters 40 #define IMAGE_SIZE 256 // default image size 41 #define INPUT_FILE_PATH "/misc/lena_256.raw" // default input file pathname 42 #define OUTPUT_FILE_PATH "/home/lena_transposed.raw" // default output file pathname 45 #define BLOCK_SIZE 512 // block size on disk 46 #define X_MAX 16 // max number of clusters in row 47 #define Y_MAX 16 // max number of clusters in column 48 #define PROCS_MAX 4 // max number of procs per cluster 49 #define CLUSTER_MAX (X_MAX * Y_MAX) // max number of clusters 50 #define IMAGE_SIZE 256 // default image size 51 #define INPUT_FILE_PATH "/misc/lena_256.raw" // default input file pathname 52 #define OUTPUT_FILE_PATH "/home/lena_transposed.raw" // default output file pathname 53 #define INTERACTIVE 0 // interactive capture of filenames 54 #define VERBOSE 0 // print comments on TTY 55 43 56 44 57 // macro to use a shared TTY … … 52 65 53 66 // instrumentation counters for each processor in each cluster 54 unsigned int LOAD_START[X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}};55 unsigned int LOAD_END [X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}};67 unsigned int MMAP_START[X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}}; 68 unsigned int MMAP_END [X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}}; 56 69 unsigned int TRSP_START[X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}}; 57 70 unsigned int TRSP_END [X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}}; 58 71 unsigned int DISP_START[X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}}; 59 72 unsigned int DISP_END [X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}}; 60 unsigned int STOR_START[X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}};61 unsigned int STOR_END [X_MAX][Y_MAX][PROCS_MAX] = {{{ 0 }}};62 73 63 74 // arrays of pointers on distributed buffers … … 66 77 unsigned char* buf_out[CLUSTER_MAX]; 67 78 68 // checksum variables69 unsigned check_line_before[1024];70 unsigned check_line_after[1024];71 72 79 // lock protecting shared TTY 73 80 user_lock_t tty_lock; … … 80 87 char output_file_name[256]; 81 88 unsigned int image_size; 89 90 // input & output file descriptors 91 int fd_in; 92 int fd_out; 82 93 83 94 //////////////////////////////////////////// … … 105 116 unsigned int nthreads = x_size * y_size * nprocs; // number of threads 106 117 unsigned int npixels = image_size * image_size; // pixels per image 107 int fd_in = 0; // initial file descriptor108 int fd_out = 0; // output file descriptor109 118 unsigned int cluster_id = (x_id * y_size) + y_id; // "continuous" index 110 unsigned int thread_id = (cluster_id * nprocs) + p_id; // "continuous" threadindex119 unsigned int thread_id = (cluster_id * nprocs) + p_id; // "continuous" index 111 120 112 121 // parallel load of image: 113 // allocate buf_in and buf_out distributed buffers (one buf_in & one buf_out per cluster). 114 // open input and output files, and load the relevant lines in local buf_in. 115 // only thread running on processor[x,y,0] does it. 116 117 LOAD_START[x_id][y_id][p_id] = giet_proctime(); 122 // thread running on processor[x,y,0] 123 // map input & output files in buf_in & buf_out buffers. 124 125 MMAP_START[x_id][y_id][p_id] = giet_proctime(); 118 126 119 127 if ( p_id == 0 ) 120 128 { 121 buf_in[cluster_id] = remote_malloc( npixels/nclusters, x_id, y_id ); 122 buf_out[cluster_id] = remote_malloc( npixels/nclusters, x_id, y_id ); 123 124 if ( (x_id==0) && (y_id==0) ) 125 { 126 printf("\n[TRANSPOSE] Proc [%d,%d,%d] completes buffer allocation at cycle %d\n", 127 x_id, y_id, p_id, giet_proctime() ); 128 } 129 130 // open input file 131 fd_in = giet_fat_open( input_file_name , O_RDONLY ); // read_only 132 if ( fd_in < 0 ) 133 { 134 printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d] cannot open file %s\n", 135 x_id , y_id , p_id , input_file_name ); 136 giet_pthread_exit(" open() failure"); 137 } 138 else if ( (x_id==0) && (y_id==0) ) 139 { 140 printf("\n[TRANSPOSE] Proc [0,0,0] open file %s / fd = %d\n", 141 input_file_name , fd_in ); 142 } 143 144 // open output file 145 fd_out = giet_fat_open( output_file_name , O_CREATE ); // create if required 146 if ( fd_out < 0 ) 147 { 148 printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d] cannot open file %s\n", 149 x_id , y_id , p_id , output_file_name ); 150 giet_pthread_exit(" open() failure"); 151 } 152 else if ( (x_id==0) && (y_id==0) ) 153 { 154 printf("\n[TRANSPOSE] Proc [0,0,0] open file %s / fd = %d\n", 155 output_file_name , fd_out ); 156 } 157 158 159 unsigned int offset = ((npixels*cluster_id)/nclusters); 160 if ( giet_fat_lseek( fd_in, 161 offset, 162 SEEK_SET ) != offset ) 163 { 164 printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d] cannot seek fd = %d\n", 165 x_id , y_id , p_id , fd_in ); 166 giet_pthread_exit(" seek() failure"); 167 } 168 169 unsigned int pixels = npixels / nclusters; 170 if ( giet_fat_read( fd_in, 171 buf_in[cluster_id], 172 pixels ) != pixels ) 173 { 174 printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d] cannot read fd = %d\n", 175 x_id , y_id , p_id , fd_in ); 176 giet_pthread_exit(" read() failure"); 177 } 178 179 if ( (x_id==0) && (y_id==0) ) 180 { 181 printf("\n[TRANSPOSE] Proc [%d,%d,%d] completes load at cycle %d\n", 182 x_id, y_id, p_id, giet_proctime() ); 183 } 184 } 185 186 LOAD_END[x_id][y_id][p_id] = giet_proctime(); 129 // map buf_in and buf_out 130 unsigned int length = npixels / nclusters; 131 unsigned int offset = length * cluster_id; 132 133 buf_in[cluster_id] = giet_fat_mmap( NULL, 134 length, 135 MAP_PROT_READ, 136 MAP_SHARED, 137 fd_in, 138 offset ); 139 if ( buf_in[cluster_id] == NULL ) 140 { 141 printf("\n[TRANSPOSE ERROR] Thread[%d,%d,%d] cannot map input file\n", 142 x_id , y_id , p_id ); 143 giet_pthread_exit( NULL ); 144 } 145 146 if TRANSPOSE_DEBUG 147 printf("\n@@@ Thread[%d,%d,%d] call mmap : length = %x / offset = %x / buf_in = %x\n", 148 x_id , y_id , p_id , length , offset , buf_in[cluster_id] ); 149 150 buf_out[cluster_id] = giet_fat_mmap( NULL, 151 length, 152 MAP_PROT_WRITE, 153 MAP_SHARED, 154 fd_out, 155 offset ); 156 if ( buf_out[cluster_id] == NULL ) 157 { 158 printf("\n[TRANSPOSE ERROR] Thread[%d,%d,%d] cannot map output file\n", 159 x_id , y_id , p_id ); 160 giet_pthread_exit( NULL ); 161 } 162 163 if TRANSPOSE_DEBUG 164 printf("\n@@@ Thread[%d,%d,%d] call mmap : length = %x / offset = %x / buf_out = %x\n", 165 x_id , y_id , p_id , length , offset , buf_out[cluster_id] ); 166 167 } 168 169 MMAP_END[x_id][y_id][p_id] = giet_proctime(); 187 170 188 171 ///////////////////////////// … … 212 195 for ( l = first ; l < last ; l++ ) 213 196 { 214 check_line_before[l] = 0;215 216 197 // in each iteration we transfer one byte 217 198 for ( p = 0 ; p < image_size ; p++ ) … … 222 203 byte = buf_in[src_cluster][src_index]; 223 204 224 // compute checksum225 check_line_before[l] = check_line_before[l] + byte;226 227 205 // write one byte to remote buf_out 228 206 dst_cluster = p / nlc; … … 234 212 if ( (p_id == 0) && (x_id==0) && (y_id==0) ) 235 213 { 236 printf("\n[TRANSPOSE] proc[%d,%d,%d] completes transpose at cycle %d\n",214 printf("\n[TRANSPOSE] Thread[%d,%d,%d] completes transpose at cycle %d\n", 237 215 x_id, y_id, p_id, giet_proctime() ); 238 216 } … … 257 235 if ( (x_id==0) && (y_id==0) && (p_id==0) ) 258 236 { 259 printf("\n[TRANSPOSE] Proc[%d,%d,%d] completes display at cycle %d\n",237 printf("\n[TRANSPOSE] Thread[%d,%d,%d] completes display at cycle %d\n", 260 238 x_id, y_id, p_id, giet_proctime() ); 261 239 } … … 267 245 ///////////////////////////// 268 246 269 // parallel store : buf_out buffers to disk 270 // only thread running on processor(x,y,0) does it 271 272 STOR_START[x_id][y_id][p_id] = giet_proctime(); 273 274 if ( p_id == 0 ) 275 { 276 unsigned int offset = ((npixels*cluster_id)/nclusters); 277 if ( giet_fat_lseek( fd_out, 278 offset, 279 SEEK_SET ) != offset ) 280 { 281 printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d] cannot seek fr = %d\n", 282 x_id , y_id , p_id , fd_out ); 283 giet_pthread_exit(" seek() failure"); 284 } 285 286 unsigned int pixels = npixels / nclusters; 287 if ( giet_fat_write( fd_out, 288 buf_out[cluster_id], 289 pixels ) != pixels ) 290 { 291 printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d] cannot write fd = %d\n", 292 x_id , y_id , p_id , fd_out ); 293 giet_pthread_exit(" write() failure"); 294 } 295 296 if ( (x_id==0) && (y_id==0) ) 297 { 298 printf("\n[TRANSPOSE] Proc [%d,%d,%d] completes store at cycle %d\n", 299 x_id, y_id, p_id, giet_proctime() ); 300 } 301 } 302 303 STOR_END[x_id][y_id][p_id] = giet_proctime(); 304 305 // In each cluster, only thread running on Processor[x,y,0] releases 306 // the distributed buffers and close the file descriptors. 307 308 if ( p_id==0 ) 309 { 310 free( buf_in[cluster_id] ); 311 free( buf_out[cluster_id] ); 312 313 giet_fat_close( fd_in ); 314 giet_fat_close( fd_out ); 315 } 316 247 // all threads, but thread[0,0,0], suicide 317 248 if ( (x_id != 0) || (y_id != 0) || (p_id != 0) ) 318 249 giet_pthread_exit( "completed" ); … … 342 273 unsigned int min_disp_ended = 0xFFFFFFFF; 343 274 unsigned int max_disp_ended = 0; 344 unsigned int min_stor_start = 0xFFFFFFFF;345 unsigned int max_stor_start = 0;346 unsigned int min_stor_ended = 0xFFFFFFFF;347 unsigned int max_stor_ended = 0;348 275 349 276 for (x = 0; x < x_size; x++) … … 353 280 for ( l = 0 ; l < nprocs ; l++ ) 354 281 { 355 if ( LOAD_START[x][y][l] < min_load_start) min_load_start = LOAD_START[x][y][l];356 if ( LOAD_START[x][y][l] > max_load_start) max_load_start = LOAD_START[x][y][l];357 if ( LOAD_END[x][y][l] < min_load_ended) min_load_ended = LOAD_END[x][y][l];358 if ( LOAD_END[x][y][l] > max_load_ended) max_load_ended = LOAD_END[x][y][l];282 if (MMAP_START[x][y][l] < min_load_start) min_load_start = MMAP_START[x][y][l]; 283 if (MMAP_START[x][y][l] > max_load_start) max_load_start = MMAP_START[x][y][l]; 284 if (MMAP_END[x][y][l] < min_load_ended) min_load_ended = MMAP_END[x][y][l]; 285 if (MMAP_END[x][y][l] > max_load_ended) max_load_ended = MMAP_END[x][y][l]; 359 286 if (TRSP_START[x][y][l] < min_trsp_start) min_trsp_start = TRSP_START[x][y][l]; 360 287 if (TRSP_START[x][y][l] > max_trsp_start) max_trsp_start = TRSP_START[x][y][l]; … … 365 292 if (DISP_END[x][y][l] < min_disp_ended) min_disp_ended = DISP_END[x][y][l]; 366 293 if (DISP_END[x][y][l] > max_disp_ended) max_disp_ended = DISP_END[x][y][l]; 367 if (STOR_START[x][y][l] < min_stor_start) min_stor_start = STOR_START[x][y][l];368 if (STOR_START[x][y][l] > max_stor_start) max_stor_start = STOR_START[x][y][l];369 if (STOR_END[x][y][l] < min_stor_ended) min_stor_ended = STOR_END[x][y][l];370 if (STOR_END[x][y][l] > max_stor_ended) max_stor_ended = STOR_END[x][y][l];371 294 } 372 295 } … … 375 298 printf("\n ---------------- Instrumentation Results ---------------------\n"); 376 299 377 printf(" - LOAD_START : min = %d / max = %d / med = %d / delta = %d\n",300 printf(" - MMAP_START : min = %d / max = %d / med = %d / delta = %d\n", 378 301 min_load_start, max_load_start, (min_load_start+max_load_start)/2, 379 302 max_load_start-min_load_start); 380 303 381 printf(" - LOAD_END : min = %d / max = %d / med = %d / delta = %d\n",304 printf(" - MMAP_END : min = %d / max = %d / med = %d / delta = %d\n", 382 305 min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2, 383 306 max_load_ended-min_load_ended); … … 398 321 min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2, 399 322 max_disp_ended-min_disp_ended); 400 401 printf(" - STOR_START : min = %d / max = %d / med = %d / delta = %d\n",402 min_stor_start, max_stor_start, (min_stor_start+max_stor_start)/2,403 max_stor_start-min_stor_start);404 405 printf(" - STOR_END : min = %d / max = %d / med = %d / delta = %d\n",406 min_stor_ended, max_stor_ended, (min_stor_ended+max_stor_ended)/2,407 max_stor_ended-min_stor_ended);408 323 409 324 } // end instrument() … … 422 337 unsigned int y_id; // y cluster coordinate 423 338 unsigned int p_id; // local processor index 424 425 339 giet_proc_xyp( &x_id , &y_id , &p_id ); 426 340 … … 429 343 unsigned int y_size; // number of clusters in a column 430 344 unsigned int nprocs; // number of processors per cluster 431 432 345 giet_procs_number( &x_size , &y_size , &nprocs ); 433 346 … … 436 349 437 350 giet_pthread_assert( ((x_size == 1) || (x_size == 2) || (x_size == 4) || 438 (x_size == 8) || (x_size == 16)),351 (x_size == 8) || (x_size == 16)), 439 352 "[TRANSPOSE ERROR] x_size must be 1,2,4,8,16"); 440 353 441 354 giet_pthread_assert( ((y_size == 1) || (y_size == 2) || (y_size == 4) || 442 (y_size == 8) || (y_size == 16)),355 (y_size == 8) || (y_size == 16)), 443 356 "[TRANSPOSE ERROR] y_size must be 1,2,4,8,16"); 444 357 … … 456 369 giet_fbf_size( &width , &height ); 457 370 458 // enter interactive part if required459 371 printf("\n[TRANSPOSE] start at cycle %d on %d cores / FBF = %d * %d pixels\n", 460 372 giet_proctime(), nthreads , width , height ); 461 373 462 // input_file_name, output_file_name, and size acquisition 463 printf("\n[TRANSPOSE] enter path for input file / default is : %s\n> ", INPUT_FILE_PATH ); 464 giet_tty_gets( input_file_name , 256 ); 465 printf("\n"); 466 467 if ( strcmp( input_file_name , "" ) == 0 ) strcpy( input_file_name , INPUT_FILE_PATH ); 468 469 printf("\n[TRANSPOSE] enter path for output file / default is : %s\n> ", OUTPUT_FILE_PATH ); 470 giet_tty_gets( output_file_name , 256 ); 471 printf("\n"); 472 473 if ( strcmp( output_file_name , "" ) == 0 ) strcpy( output_file_name , OUTPUT_FILE_PATH ); 474 475 printf("\n[TRANSPOSE] enter image size / default is : %d\n> ", IMAGE_SIZE ); 476 giet_tty_getw( &image_size ); 477 printf("\n"); 478 479 if ( image_size == 0 ) image_size = IMAGE_SIZE; 480 374 if ( INTERACTIVE ) // input_file_name, output_file_name, and size acquisition 375 { 376 printf("\n[TRANSPOSE] enter path for input file / default is : %s\n> ", INPUT_FILE_PATH ); 377 giet_tty_gets( input_file_name , 256 ); 378 printf("\n"); 379 if ( strcmp( input_file_name , "" ) == 0 ) strcpy( input_file_name , INPUT_FILE_PATH ); 380 381 printf("\n[TRANSPOSE] enter path for output file / default is : %s\n> ", OUTPUT_FILE_PATH ); 382 giet_tty_gets( output_file_name , 256 ); 383 printf("\n"); 384 if ( strcmp( output_file_name , "" ) == 0 ) strcpy( output_file_name , OUTPUT_FILE_PATH ); 385 386 printf("\n[TRANSPOSE] enter image size / default is : %d\n> ", IMAGE_SIZE ); 387 giet_tty_getw( &image_size ); 388 printf("\n"); 389 if ( image_size == 0 ) image_size = IMAGE_SIZE; 390 } 391 else 392 { 393 strcpy( input_file_name , INPUT_FILE_PATH ); 394 strcpy( output_file_name , OUTPUT_FILE_PATH ); 395 image_size = IMAGE_SIZE; 396 } 397 398 // check image size / number of clusters 399 giet_pthread_assert( ((((image_size * image_size) / (x_size * y_size)) & 0xFFF) == 0) , 400 "[TRANSPOSE ERROR] pixels per cluster must be multiple of 4096"); 401 481 402 printf("\n[TRANSPOSE] input = %s / output = %s / size = %d\n", 482 403 input_file_name, output_file_name, image_size ); 483 404 484 giet_pthread_assert( (nprocs * x_size * y_size <= image_size ),485 "[TRANSPOSE ERROR] number of threads larger than number of lines");486 487 405 // distributed heap initialisation 488 406 for ( x = 0 ; x < x_size ; x++ ) … … 494 412 } 495 413 414 // open input and output files 415 fd_in = giet_fat_open( input_file_name , O_RDONLY ); // read_only 416 if ( fd_in < 0 ) 417 { 418 printf("\n[TRANSPOSE ERROR] main cannot open file %s\n", input_file_name ); 419 giet_pthread_exit( NULL ); 420 } 421 else 422 { 423 printf("\n[TRANSPOSE] main open file %s / fd = %d\n", input_file_name , fd_in ); 424 } 425 426 fd_out = giet_fat_open( output_file_name , O_CREATE ); // create if required 427 if ( fd_out < 0 ) 428 { 429 printf("\n[TRANSPOSE ERROR] main cannot open file %s\n", output_file_name ); 430 giet_pthread_exit(" open() failure"); 431 } 432 else 433 { 434 printf("\n[TRANSPOSE] main open file %s / fd = %d\n", output_file_name , fd_out ); 435 } 436 496 437 // allocate thread[] array 497 438 pthread_t* thread = malloc( nthreads * sizeof(pthread_t) ); … … 501 442 502 443 // Initialisation completed 503 printf("\n[TRANSPOSE] initialisation completed at cycle %d\n", giet_proctime());444 printf("\n[TRANSPOSE] main completes initialisation\n"); 504 445 505 446 // launch other threads to run execute() function … … 537 478 instrument( x_size , y_size , nprocs ); 538 479 480 // close input and output files 481 giet_fat_close( fd_in ); 482 giet_fat_close( fd_out ); 483 484 // suicide 539 485 giet_pthread_exit( "completed" ); 540 486 -
soft/giet_vm/applications/transpose/transpose.py
r708 r764 35 35 # define vsegs base & size 36 36 code_base = 0x10000000 37 code_size = 0x00010000 # 64 Kbytes (per cluster)37 code_size = 0x00010000 # 64 Kbytes (256 Mbytes max) 38 38 39 39 data_base = 0x20000000 40 data_size = 0x00010000 # 64 Kbytes (non replicated) 40 data_size = 0x00010000 # 64 Kbytes (256 Mbytes max) 41 42 mmap_base = 0x30000000 43 mmap_size = 0x10000000 # 256 Mbytes (non mapped) 41 44 42 45 stack_base = 0x40000000 43 stack_size = 0x00010000 # 64 Kbytes (per thread)46 stack_size = 0x00010000 # 64 Kbytes per thread (64 Mbytes max) 44 47 45 48 heap_base = 0x60000000 46 heap_size = 0x00200000 # 2 Mbytes (per cluster)49 heap_size = 0x00200000 # 2 Mbytes per cluster (512 Mbytes max) 47 50 48 51 # create vspace 49 vspace = mapping.addVspace( name = 'transpose', startname = 'trsp_data', active = False )52 vspace = mapping.addVspace( name = 'transpose', startname = 'trsp_data', active = True ) 50 53 51 54 # data vseg : shared (only in cluster[0,0]) … … 54 57 binpath = 'bin/transpose/appli.elf', 55 58 local = False ) 59 60 # mmap vseg : non mapped in physical memory 61 mapping.addVseg( vspace, 'trsp_mmap', mmap_base , mmap_size, 62 'C_WU', vtype = 'MMAP', local = False ) 56 63 57 64 # code vsegs : local (one copy in each cluster) … … 75 82 proc_id = (((x * y_size) + y) * nprocs) + p 76 83 base = stack_base + (proc_id * stack_size) 77 84 size = stack_size - 4096 78 85 mapping.addVseg( vspace, 'trsp_stack_%d_%d_%d' % (x,y,p), 79 base , stack_size, 'C_WU', vtype = 'BUFFER',86 base , size , 'C_WU', vtype = 'BUFFER', 80 87 x = x , y = y , pseg = 'RAM', 81 local = True , big = True)88 local = True ) 82 89 83 90 # heap vsegs: distributed non local (all heap vsegs can be accessed by all tasks)
Note: See TracChangeset
for help on using the changeset viewer.