- Timestamp:
- Feb 4, 2016, 5:05:56 PM (9 years ago)
- Location:
- soft/giet_vm/applications
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/shell/shell.c
r772 r775 44 44 static void cmd_time(int argc, char** argv) 45 45 { 46 giet_tty_printf(" %d\n", giet_proctime());46 giet_tty_printf(" cycle = %d\n", giet_proctime()); 47 47 } 48 48 … … 50 50 static void cmd_ls(int argc, char** argv) 51 51 { 52 int fd; 53 fat_dirent_t entry; 54 55 if (argc < 2) 56 { 57 giet_tty_printf(" usage : %s <pathname>\n", argv[0]); 58 return; 59 } 60 61 fd = giet_fat_opendir(argv[1]); 52 int fd; 53 int rec; 54 char* pathname; 55 fat_dirent_t entry; 56 57 if (argc == 2) 58 { 59 rec = 0; 60 pathname = argv[1]; 61 } 62 else if ( (argc == 3) && (strcmp( argv[1] , "-r" ) == 0) ) 63 { 64 rec = 1; 65 pathname = argv[2]; 66 67 giet_tty_printf(" error : recursive mode not supported yet\n"); 68 return; 69 } 70 else 71 { 72 giet_tty_printf(" usage : ls [-r] pathname\n"); 73 return; 74 } 75 76 fd = giet_fat_opendir( pathname ); 62 77 63 78 if (fd < 0) … … 84 99 if (argc < 2) 85 100 { 86 giet_tty_printf(" usage : %s <path>\n", argv[0]);101 giet_tty_printf(" usage : mkdir pathname\n"); 87 102 return; 88 103 } … … 101 116 if (argc < 3) 102 117 { 103 giet_tty_printf(" usage : %s <src> <dst>\n", argv[0]);118 giet_tty_printf(" usage : cp src_pathname dst_pathname>\n"); 104 119 return; 105 120 } … … 141 156 if (info.is_dir) 142 157 { 143 giet_tty_printf(" error : %s is a directory\n", argv[2] ); // TODO158 giet_tty_printf(" error : %s is a directory\n", argv[2] ); // TODO 144 159 goto exit; 145 160 } … … 150 165 int len = (size - i < 1024 ? size - i : 1024); 151 166 int wlen; 152 153 giet_tty_printf("\rwrite %d/%d (%d%%)", i, size, 100*i/size);154 167 155 168 len = giet_fat_read(src_fd, &buf, len); … … 162 175 i += len; 163 176 } 164 giet_tty_printf("\n");165 177 166 178 exit: … … 176 188 if (argc < 2) 177 189 { 178 giet_tty_printf(" usage : %s <file>\n", argv[0]);190 giet_tty_printf(" usage : rm pathname\n"); 179 191 return; 180 192 } … … 193 205 if (argc < 2) 194 206 { 195 giet_tty_printf(" usage : %s <pathname>\n", argv[0]);207 giet_tty_printf(" usage : rmdir pathname\n"); 196 208 return; 197 209 } … … 209 221 if (argc < 3) 210 222 { 211 giet_tty_printf(" usage : %s <src> <dst>\n", argv[0]);223 giet_tty_printf(" usage : %s src_pathname dst_pathname\n", argv[0]); 212 224 return; 213 225 } … … 225 237 if (argc < 2) 226 238 { 227 giet_tty_printf(" usage : %s <vspace_name>\n", argv[0]);239 giet_tty_printf(" usage : %s vspace_name\n", argv[0]); 228 240 return; 229 241 } … … 241 253 if (argc < 2) 242 254 { 243 giet_tty_printf(" usage : %s <vspace_name>\n", argv[0]);255 giet_tty_printf(" usage : %s vspace_name\n", argv[0]); 244 256 return; 245 257 } … … 274 286 if (argc < 3) 275 287 { 276 giet_tty_printf(" usage : %s <vspace_name> <thread_name>\n", argv[0] );288 giet_tty_printf(" usage : %s vspace_name thread_name\n", argv[0] ); 277 289 return; 278 290 } … … 286 298 if (argc < 3) 287 299 { 288 giet_tty_printf(" usage : %s <vspace_name> <thread_name>\n", argv[0] );300 giet_tty_printf(" usage : %s vspace_name thread_name\n", argv[0] ); 289 301 return; 290 302 } … … 298 310 if (argc < 3) 299 311 { 300 giet_tty_printf(" usage : %s <vspace_name> <thread_name>\n", argv[0] );312 giet_tty_printf(" usage : %s vspace_name thread_name\n", argv[0] ); 301 313 return; 302 314 } … … 308 320 static void cmd_cat(int argc, char** argv) 309 321 { 310 if (argc <2)311 { 312 giet_tty_printf(" usage : %s <path_name> \n", argv[0]);322 if (argc != 2) 323 { 324 giet_tty_printf(" usage : cat pathname \n"); 313 325 return; 314 326 } … … 358 370 } 359 371 360 /*361 // allocate a temporary buffer for the file362 heap_init( x , y );363 buf = (char*)malloc( size );364 if( buf == NULL )365 {366 giet_tty_printf(" error : cannot allocate buffer with size = %d\n", size );367 goto exit;368 }369 // load the file370 len = giet_fat_read( fd , buf , size );371 if ( len != size )372 {373 giet_tty_printf(" error : cannot load file %s / size = %d / len = %d\n",374 argv[1] , size , len );375 goto exit;376 }377 */378 372 // set terminating '0' 379 373 buf[size] = 0; … … 387 381 } 388 382 383 /////////////////////////////////////////// 384 static void cmd_dump(int argc, char** argv) 385 { 386 if ((argc == 2) && (strcmp( argv[1] , "-bs" ) == 0)) 387 { 388 giet_fat_dump( DUMP_BS , NULL , 0 ); 389 } 390 else if ((argc == 2) && (strcmp( argv[1] , "-fs" ) == 0)) 391 { 392 giet_fat_dump( DUMP_FS , NULL , 0 ); 393 } 394 else if ((argc == 3) && (strcmp( argv[1] , "-fat" ) == 0)) 395 { 396 giet_fat_dump( DUMP_FAT , NULL , atoi( argv[2] ) ); 397 } 398 else if ((argc == 4) && (strcmp( argv[1] , "-file" ) == 0)) 399 { 400 giet_fat_dump( DUMP_FILE , argv[2] , atoi( argv[3] ) ); 401 } 402 else if ((argc == 4) && (strcmp( argv[1] , "-dir" ) == 0)) 403 { 404 giet_fat_dump( DUMP_DIR , argv[2] , atoi( argv[3] ) ); 405 } 406 else 407 { 408 giet_tty_printf(" usage : dump [-bs] [-fs] [-fat block] " 409 "[-file pathname block] [-dir pathname block]\n"); 410 return; 411 } 412 } 413 414 389 415 //////////////////////////////////////////////////////////////////// 390 416 struct command_t cmd[] = … … 393 419 { "context", "display a thread context", cmd_context }, 394 420 { "cp", "replicate a file in file system", cmd_cp }, 421 { "dump", "display content of disk sector", cmd_dump }, 395 422 { "exec", "start an application", cmd_exec }, 396 423 { "help", "list available commands", cmd_help }, -
soft/giet_vm/applications/transpose/transpose.c
r772 r775 47 47 #define PROCS_MAX 4 // max number of procs per cluster 48 48 #define CLUSTER_MAX (X_MAX * Y_MAX) // max number of clusters 49 #define IMAGE_SIZE 256// default image size50 #define INPUT_FILE_PATH "/misc/ lena_256.raw"// default input file pathname51 #define OUTPUT_FILE_PATH "/home/ lena_transposed.raw"// default output file pathname49 #define IMAGE_SIZE 128 // default image size 50 #define INPUT_FILE_PATH "/misc/images_128.raw" // default input file pathname 51 #define OUTPUT_FILE_PATH "/home/trsp_128.raw" // default output file pathname 52 52 #define INTERACTIVE 0 // interactive capture of filenames 53 #define VERBOSE 1// print comments on TTY53 #define VERBOSE 0 // print comments on TTY 54 54 55 55 … … 126 126 if ( p_id == 0 ) 127 127 { 128 // map buf_in and buf_out128 // map buf_in 129 129 unsigned int length = npixels / nclusters; 130 130 unsigned int offset = length * cluster_id; … … 144 144 145 145 if ( VERBOSE ) 146 printf("\n@@@ Thread[%d,%d,%d] call mmap for input file\n" 147 " length = %x / offset = %x / buf_in = %x\n", 148 x_id , y_id , p_id , length , offset , buf_in[cluster_id] ); 149 146 { 147 printf("\n@@@ Thread[%d,%d,%d] call mmap for input file\n" 148 " length = %x / offset = %x / buf_in = %x\n", 149 x_id , y_id , p_id , length , offset , buf_in[cluster_id] ); 150 } 151 152 // map buf_out 150 153 buf_out[cluster_id] = giet_fat_mmap( NULL, 151 154 length, … … 154 157 fd_out, 155 158 offset ); 159 156 160 if ( buf_out[cluster_id] == NULL ) 157 161 { … … 162 166 163 167 if ( VERBOSE ) 164 printf("\n@@@ Thread[%d,%d,%d] call mmap for output file\n" 165 " length = %x / offset = %x / buf_out = %x\n", 166 x_id , y_id , p_id , length , offset , buf_out[cluster_id] ); 168 { 169 printf("\n@@@ Thread[%d,%d,%d] call mmap for output file\n" 170 " length = %x / offset = %x / buf_out = %x\n", 171 x_id , y_id , p_id , length , offset , buf_out[cluster_id] ); 172 } 167 173 168 174 } … … 275 281 unsigned int max_disp_ended = 0; 276 282 283 char string[64]; 284 285 snprintf( string , 64 , "/home/transpose_%d_%d_%d" , x_size , y_size , nprocs ); 286 277 287 // open instrumentation file 278 unsigned int fd = giet_fat_open( "/home/transpose.inst" , O_CREAT);288 unsigned int fd = giet_fat_open( string , O_CREATE ); 279 289 if ( fd < 0 ) 280 290 { 281 printf("\n[TRANSPOSE ERROR] main cannot open file transpose.inst\n");291 printf("\n[TRANSPOSE ERROR] cannot open instrumentation file %s\n", string ); 282 292 giet_pthread_exit( NULL ); 283 293 } … … 305 315 } 306 316 307 printf("\n ---------------- Instrumentation Results ---------------------\n"); 308 309 printf(" - MMAP_START : min = %d / max = %d / med = %d / delta = %d\n", 317 giet_tty_printf( "\n ------ %s ------\n" , string ); 318 giet_fat_fprintf( fd , "\n ------ %s ------\n" , string ); 319 320 giet_tty_printf( " - MMAP_START : min = %d / max = %d / med = %d / delta = %d\n", 310 321 min_load_start, max_load_start, (min_load_start+max_load_start)/2, 311 max_load_start-min_load_start); 322 max_load_start-min_load_start ); 323 312 324 giet_fat_fprintf( fd , " - MMAP_START : min = %d / max = %d / med = %d / delta = %d\n", 313 325 min_load_start, max_load_start, (min_load_start+max_load_start)/2, 314 max_load_start-min_load_start );315 316 printf(" - MMAP_END : min = %d / max = %d / med = %d / delta = %d\n",326 max_load_start-min_load_start ); 327 328 giet_tty_printf( " - MMAP_END : min = %d / max = %d / med = %d / delta = %d\n", 317 329 min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2, 318 max_load_ended-min_load_ended); 330 max_load_ended-min_load_ended ); 331 319 332 giet_fat_fprintf( fd , " - MMAP_END : min = %d / max = %d / med = %d / delta = %d\n", 320 333 min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2, 321 max_load_ended-min_load_ended );322 323 printf(" - TRSP_START : min = %d / max = %d / med = %d / delta = %d\n",334 max_load_ended-min_load_ended ); 335 336 giet_tty_printf( " - TRSP_START : min = %d / max = %d / med = %d / delta = %d\n", 324 337 min_trsp_start, max_trsp_start, (min_trsp_start+max_trsp_start)/2, 325 max_trsp_start-min_trsp_start); 338 max_trsp_start-min_trsp_start ); 339 326 340 giet_fat_fprintf( fd , " - TRSP_START : min = %d / max = %d / med = %d / delta = %d\n", 327 341 min_trsp_start, max_trsp_start, (min_trsp_start+max_trsp_start)/2, 328 max_trsp_start-min_trsp_start );329 330 printf(" - TRSP_END : min = %d / max = %d / med = %d / delta = %d\n",342 max_trsp_start-min_trsp_start ); 343 344 giet_tty_printf( " - TRSP_END : min = %d / max = %d / med = %d / delta = %d\n", 331 345 min_trsp_ended, max_trsp_ended, (min_trsp_ended+max_trsp_ended)/2, 332 max_trsp_ended-min_trsp_ended); 346 max_trsp_ended-min_trsp_ended ); 347 333 348 giet_fat_fprintf( fd , " - TRSP_END : min = %d / max = %d / med = %d / delta = %d\n", 334 349 min_trsp_ended, max_trsp_ended, (min_trsp_ended+max_trsp_ended)/2, 335 max_trsp_ended-min_trsp_ended );336 337 printf(" - DISP_START : min = %d / max = %d / med = %d / delta = %d\n",350 max_trsp_ended-min_trsp_ended ); 351 352 giet_tty_printf( " - DISP_START : min = %d / max = %d / med = %d / delta = %d\n", 338 353 min_disp_start, max_disp_start, (min_disp_start+max_disp_start)/2, 339 max_disp_start-min_disp_start); 354 max_disp_start-min_disp_start ); 355 340 356 giet_fat_fprintf( fd , " - DISP_START : min = %d / max = %d / med = %d / delta = %d\n", 341 357 min_disp_start, max_disp_start, (min_disp_start+max_disp_start)/2, 342 max_disp_start-min_disp_start );343 344 printf(" - DISP_END : min = %d / max = %d / med = %d / delta = %d\n",358 max_disp_start-min_disp_start ); 359 360 giet_tty_printf( " - DISP_END : min = %d / max = %d / med = %d / delta = %d\n", 345 361 min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2, 346 max_disp_ended-min_disp_ended); 362 max_disp_ended-min_disp_ended ); 363 347 364 giet_fat_fprintf( fd , " - DISP_END : min = %d / max = %d / med = %d / delta = %d\n", 348 365 min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2, 349 max_disp_ended-min_disp_ended );366 max_disp_ended-min_disp_ended ); 350 367 351 368 giet_fat_close( fd ); … … 453 470 } 454 471 455 fd_out = giet_fat_open( output_file_name , O_CREAT ); // create if required472 fd_out = giet_fat_open( output_file_name , O_CREATE ); // create if required 456 473 if ( fd_out < 0 ) 457 474 { -
soft/giet_vm/applications/transpose/transpose.py
r764 r775 50 50 51 51 # create vspace 52 vspace = mapping.addVspace( name = 'transpose', startname = 'trsp_data', active = True )52 vspace = mapping.addVspace( name = 'transpose', startname = 'trsp_data', active = False ) 53 53 54 54 # data vseg : shared (only in cluster[0,0])
Note: See TracChangeset
for help on using the changeset viewer.