Changeset 295 for soft/giet_vm/gameoflife/main.c
- Timestamp:
- Mar 26, 2014, 6:44:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/gameoflife/main.c
r263 r295 20 20 21 21 giet_barrier_t barriers[2]; 22 23 unsigned int init_ok = 1; 22 24 23 25 #define NEW 0 … … 80 82 } 81 83 84 ////////////////////////////////////////////////////// 82 85 void compute_new_gen(size_t base_line, size_t nb_line) 83 86 { 84 87 size_t x,y; 85 for (y = base_line; y < base_line + nb_line; y++){ 86 for(x = 0; x < WIDTH ; x++) { 88 for (y = base_line; y < base_line + nb_line; y++) 89 { 90 for(x = 0; x < WIDTH ; x++) 91 { 87 92 world[NEW][y][x] = compute_cell(x,y); 88 93 } … … 90 95 } 91 96 97 //////////////////////////////////////////////////// 92 98 void display_world(size_t base_line, size_t nb_line) 93 99 { … … 100 106 } 101 107 102 if (giet_fb_sync_write(base_line * WIDTH , &world[NEW][base_line][0], nb_line * WIDTH)) 103 { 104 PRINTF("Echec fb_sync_write\n"); 105 giet_exit(); 106 } 107 // TODO COLOR ! 108 /*if (giet_fb_sync_write(base_line * WIDTH + WIDTH*HEIGHT , &world_yuv[base_line][0], nb_line * WIDTH)) 109 { 110 PRINTF("Echec fb_sync_write\n"); 111 giet_exit(); 112 }*/ 108 giet_fb_sync_write( base_line * WIDTH , 109 &world[NEW][base_line][0], 110 nb_line * WIDTH); 113 111 } 114 112 113 ///////////////////////////////////////////////////// 115 114 void grow_old_world(size_t base_line, size_t nb_line) 116 115 { 117 116 size_t x,y; 118 for (y = base_line; y < base_line + nb_line; y++){ 119 for(x = 0; x < WIDTH ; x++) { 117 for (y = base_line; y < base_line + nb_line; y++) 118 { 119 for(x = 0; x < WIDTH ; x++) 120 { 120 121 world[OLD][y][x] = world[NEW][y][x]; 121 122 } 122 123 } 123 124 } 124 125 126 125 127 126 //////////////////////////////////////// … … 131 130 unsigned int nlocal_procs = NB_PROCS_MAX; // processors per cluster 132 131 unsigned int nclusters = X_SIZE*Y_SIZE; // number of clusters 133 unsigned int local_id = proc_id % nlocal_procs; // local processor id134 unsigned int cluster_id = proc_id / nlocal_procs; // cluster id135 132 unsigned int nglobal_procs = nclusters * nlocal_procs; // number of tasks 136 133 size_t i; … … 142 139 143 140 // barriers initialization 144 barrier_init(&barriers[0], nglobal_procs); 145 barrier_init(&barriers[1], nglobal_procs); 141 if ( proc_id == 0 ) 142 { 143 barrier_init(&barriers[0], nglobal_procs); 144 barrier_init(&barriers[1], nglobal_procs); 145 146 init_ok = 0; 147 } 148 else 149 { 150 while ( init_ok == 1 ); 151 } 152 146 153 init_world(base_line, nb_line); 147 154
Note: See TracChangeset
for help on using the changeset viewer.