Log In | Get Help   
Home My Page Projects Code Snippets Project Openings UPC Operations Microbenchmarking Suite
Summary Activity Tracker Lists Docs News SCM Files
[uoms] Annotation of /trunk/uoms/src/init.upc
[uoms] / trunk / uoms / src / init.upc Repository:
ViewVC logotype

Annotation of /trunk/uoms/src/init.upc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (view) (download)

1 : dalvarez 1 /*****************************************************************************/
2 :     /* */
3 :     /* Copyright (c) 2008, 2009, 2010 */
4 :     /* Computer Architecture Group (CAG) */
5 :     /* University of A Coruña, Spain */
6 :     /* (http://gac.des.udc.es) */
7 :     /* Galicia Supercomputing Center (CESGA) */
8 :     /* (http://www.cesga.es) */
9 :     /* Hewlett-Packard Spain (HP) */
10 :     /* (http://www.hp.es) */
11 :     /* */
12 :     /* This file is part of UPC Operations Microbenchmarking Suite (UOMS). */
13 :     /* */
14 :     /* UOMS is free software: you can redistribute it and/or modify */
15 :     /* it under the terms of the GNU Lesser General Public License as published */
16 :     /* by the Free Software Foundation, either version 3 of the License, or */
17 :     /* (at your option) any later version. */
18 :     /* */
19 :     /* UOMS is distributed in the hope that it will be useful, */
20 :     /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 :     /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 :     /* GNU Lesser General Public License for more details. */
23 :     /* */
24 :     /* You should have received a copy of the GNU Lesser General Public License */
25 :     /* along with UOMS. If not, see <http://www.gnu.org/licenses/>. */
26 :     /* */
27 :     /*****************************************************************************/
28 :    
29 :     /*****************************************************************************/
30 :     /* */
31 :     /* FUNDING: This development has been funded by Hewlett-Packard Spain */
32 :     /* */
33 :     /* Project Name: */
34 :     /* UPCHACO (2008-2011) */
35 :     /* Subproject: */
36 :     /* Improving UPC Usability and Performance in Constellation Systems: */
37 :     /* Implementation/Extensions of UPC Libraries. */
38 :     /* (UPCPU­Project -> UPC Performance and Usability Project) */
39 :     /* */
40 :     /*****************************************************************************/
41 :    
42 :     /*****************************************************************************
43 :    
44 :     For further documentation, see
45 :    
46 :     [1] Files under doc/
47 :    
48 :     ******************************************************************************/
49 :    
50 :     #include <stdio.h>
51 :     #include <stdlib.h>
52 :     #include <math.h>
53 :     #include <errno.h>
54 :     #include <string.h>
55 :     #include <upc_collective.h>
56 :     #include "defines.h"
57 :     #include "headers.h"
58 :    
59 :     #define roundtoint(x) ((x)>=0?(int)((x)+0.5):(int)((x)-0.5))
60 :    
61 :     extern char * valid_bms[NUM_BMS];
62 :     extern upc_op_t reduce_op;
63 :    
64 :     long maxsize, minsize;
65 :    
66 :     /*
67 :     Set benchmarks names
68 :     */
69 :     void set_bms_names(){
70 :     valid_bms[BARRIER] = "upc_barrier";
71 :     valid_bms[BROADCAST] = "upc_all_broadcast";
72 :     valid_bms[SCATTER] = "upc_all_scatter";
73 :     valid_bms[GATHER] = "upc_all_gather";
74 :     valid_bms[GATHERALL] = "upc_all_gather_all";
75 :     valid_bms[EXCHANGE] = "upc_all_exchange";
76 :     valid_bms[PERMUTE] = "upc_all_permute";
77 :     valid_bms[MEMGET] = "upc_memget";
78 :     valid_bms[MEMPUT] = "upc_memput";
79 :     valid_bms[MEMCPY] = "upc_memcpy";
80 :     valid_bms[LMEMGET] = "local_upc_memget";
81 :     valid_bms[LMEMPUT] = "local_upc_memput";
82 :     valid_bms[LMEMCPY] = "local_upc_memcpy";
83 :     valid_bms[SMEMCPY] = "memcpy";
84 :     valid_bms[MEMMOVE] = "memmove";
85 :     valid_bms[ALLALLOC] = "upc_all_alloc";
86 :     valid_bms[FREE] = "upc_free";
87 :     valid_bms[REDUCE_C] = "upc_all_reduceC";
88 :     valid_bms[PREFIX_REDUCE_C] = "upc_all_prefix_reduceC";
89 :     valid_bms[REDUCE_UC] = "upc_all_reduceUC";
90 :     valid_bms[PREFIX_REDUCE_UC] = "upc_all_prefix_reduceUC";
91 :     valid_bms[REDUCE_S] = "upc_all_reduceS";
92 :     valid_bms[PREFIX_REDUCE_S] = "upc_all_prefix_reduceS";
93 :     valid_bms[REDUCE_US] = "upc_all_reduceUS";
94 :     valid_bms[PREFIX_REDUCE_US] = "upc_all_prefix_reduceUS";
95 :     valid_bms[REDUCE_I] = "upc_all_reduceI";
96 :     valid_bms[PREFIX_REDUCE_I] = "upc_all_prefix_reduceI";
97 :     valid_bms[REDUCE_UI] = "upc_all_reduceUI";
98 :     valid_bms[PREFIX_REDUCE_UI] = "upc_all_prefix_reduceUI";
99 :     valid_bms[REDUCE_L] = "upc_all_reduceL";
100 :     valid_bms[PREFIX_REDUCE_L] = "upc_all_prefix_reduceL";
101 :     valid_bms[REDUCE_UL] = "upc_all_reduceUL";
102 :     valid_bms[PREFIX_REDUCE_UL] = "upc_all_prefix_reduceUL";
103 :     valid_bms[REDUCE_F] = "upc_all_reduceF";
104 :     valid_bms[PREFIX_REDUCE_F] = "upc_all_prefix_reduceF";
105 :     valid_bms[REDUCE_D] = "upc_all_reduceD";
106 :     valid_bms[PREFIX_REDUCE_D] = "upc_all_prefix_reduceD";
107 :     valid_bms[REDUCE_LD] = "upc_all_reduceLD";
108 :     valid_bms[PREFIX_REDUCE_LD] = "upc_all_prefix_reduceLD";
109 :     #ifdef ASYNC_MEM_TEST
110 : dalvarez 7 valid_bms[AMEMGET] = "upc_memget_async";
111 :     valid_bms[AMEMPUT] = "upc_memput_async";
112 :     valid_bms[AMEMCPY] = "upc_memcpy_async";
113 :     valid_bms[ALMEMGET] = "local_upc_memget_async";
114 :     valid_bms[ALMEMPUT] = "local_upc_memput_async";
115 :     valid_bms[ALMEMCPY] = "local_upc_memcpy_async";
116 : dalvarez 1 #endif
117 : dalvarez 7 #ifdef ASYNCI_MEM_TEST
118 :     valid_bms[AIMEMGET] = "upc_memget_asynci";
119 :     valid_bms[AIMEMPUT] = "upc_memput_asynci";
120 :     valid_bms[AIMEMCPY] = "upc_memcpy_asynci";
121 :     valid_bms[AILMEMGET] = "local_upc_memget_asynci";
122 :     valid_bms[AILMEMPUT] = "local_upc_memput_asynci";
123 :     valid_bms[AILMEMCPY] = "local_upc_memcpy_asynci";
124 :     #endif
125 : dalvarez 1 }
126 :    
127 :     /*
128 :     Set min size
129 :     */
130 :     int set_min_size(char *size){
131 :     if(size[0] >= '0' && size[0] <= '9'){
132 :     errno = 0;
133 :     minsize = strtol(size,NULL,10);
134 :     if(errno != 0){
135 :     if(MYTHREAD == 0){
136 :     fprintf(stderr,"*** minsize (%s) not valid: ",size);
137 :     perror(NULL);
138 :     }
139 :     return -1;
140 :     }
141 :     }
142 :     else{
143 :     if(MYTHREAD == 0){
144 :     fprintf(stderr,"*** minsize (%s) not valid",size);
145 :     }
146 :     return -1;
147 :     }
148 :     return 0;
149 :     }
150 :    
151 :     /*
152 :     Set max size
153 :     */
154 :     int set_max_size(char *size){
155 :     if(size[0] >= '0' && size[0] <= '9'){
156 :     errno = 0;
157 :     maxsize = strtol(size,NULL,10);
158 :     if(errno != 0){
159 :     if(MYTHREAD == 0){
160 :     fprintf(stderr,"*** maxsize (%s) not valid: ",size);
161 :     perror(NULL);
162 :     }
163 :     return -1;
164 :     }
165 :     }
166 :     else{
167 :     if(MYTHREAD == 0){
168 :     fprintf(stderr,"*** maxsize (%s) not valid",size);
169 :     }
170 :     return -1;
171 :     }
172 :     return 0;
173 :     }
174 :    
175 :     /*
176 :     Set reduce operation
177 :     */
178 :     int set_reduce_op(char *operation){
179 :     extern char *char_reduce_op;
180 :    
181 :     if(strcmp(operation,"UPC_ADD") == 0){
182 :     reduce_op = UPC_ADD;
183 :     char_reduce_op = operation;
184 :     }
185 :     else if(strcmp(operation,"UPC_MULT") == 0){
186 :     reduce_op = UPC_MULT;
187 :     char_reduce_op = operation;
188 :     }
189 :     else if(strcmp(operation,"UPC_AND") == 0){
190 :     reduce_op = UPC_AND;
191 :     char_reduce_op = operation;
192 :     }
193 :     else if(strcmp(operation,"UPC_OR") == 0){
194 :     reduce_op = UPC_OR;
195 :     char_reduce_op = operation;
196 :     }
197 :     else if(strcmp(operation,"UPC_XOR") == 0){
198 :     reduce_op = UPC_XOR;
199 :     char_reduce_op = operation;
200 :     }
201 :     else if(strcmp(operation,"UPC_LOGAND") == 0){
202 :     reduce_op = UPC_LOGAND;
203 :     char_reduce_op = operation;
204 :     }
205 :     else if(strcmp(operation,"UPC_LOGOR") == 0){
206 :     reduce_op = UPC_LOGOR;
207 :     char_reduce_op = operation;
208 :     }
209 :     else if(strcmp(operation,"UPC_MIN") == 0){
210 :     reduce_op = UPC_MIN;
211 :     char_reduce_op = operation;
212 :     }
213 :     else if(strcmp(operation,"UPC_MAX") == 0){
214 :     reduce_op = UPC_MAX;
215 :     char_reduce_op = operation;
216 :     }
217 :     else{
218 :     return -1;
219 :     }
220 :     return 0;
221 :     }
222 :    
223 :     /*
224 :     Set synchronization mode
225 :     */
226 :     int set_sync_mode(char *mode){
227 :     extern upc_flag_t sync_mode;
228 :     extern char * char_sync_mode;
229 :    
230 :     if(strcmp(mode,"UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC") == 0){
231 :     sync_mode = UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC;
232 :     char_sync_mode = mode;
233 :     }
234 :     else if(strcmp(mode,"UPC_IN_ALLSYNC|UPC_OUT_MYSYNC") == 0){
235 :     sync_mode = UPC_IN_ALLSYNC|UPC_OUT_MYSYNC;
236 :     char_sync_mode = mode;
237 :     }
238 :     else if(strcmp(mode,"UPC_IN_ALLSYNC|UPC_OUT_NOSYNC") == 0){
239 :     sync_mode = UPC_IN_ALLSYNC|UPC_OUT_NOSYNC;
240 :     char_sync_mode = mode;
241 :     }
242 :     else if(strcmp(mode,"UPC_IN_MYSYNC|UPC_OUT_ALLSYNC") == 0){
243 :     sync_mode = UPC_IN_MYSYNC|UPC_OUT_ALLSYNC;
244 :     char_sync_mode = mode;
245 :     }
246 :     else if(strcmp(mode,"UPC_IN_MYSYNC|UPC_OUT_MYSYNC") == 0){
247 :     sync_mode = UPC_IN_MYSYNC|UPC_OUT_MYSYNC;
248 :     char_sync_mode = mode;
249 :     }
250 :     else if(strcmp(mode,"UPC_IN_MYSYNC|UPC_OUT_NOSYNC") == 0){
251 :     sync_mode = UPC_IN_MYSYNC|UPC_OUT_NOSYNC;
252 :     char_sync_mode = mode;
253 :     }
254 :     else if(strcmp(mode,"UPC_IN_NOSYNC|UPC_OUT_ALLSYNC") == 0){
255 :     sync_mode = UPC_IN_NOSYNC|UPC_OUT_ALLSYNC;
256 :     char_sync_mode = mode;
257 :     }
258 :     else if(strcmp(mode,"UPC_IN_NOSYNC|UPC_OUT_MYSYNC") == 0){
259 :     sync_mode = UPC_IN_NOSYNC|UPC_OUT_MYSYNC;
260 :     char_sync_mode = mode;
261 :     }
262 :     else if(strcmp(mode,"UPC_IN_NOSYNC|UPC_OUT_NOSYNC") == 0){
263 :     sync_mode = UPC_IN_NOSYNC|UPC_OUT_NOSYNC;
264 :     char_sync_mode = mode;
265 :     }
266 :     else{
267 :     return -1;
268 :     }
269 :     return 0;
270 :     }
271 :    
272 :     /*
273 :     Set benchmark list
274 :     */
275 :     void set_bms(int alternative_bm_list, char *bm_file){
276 :     extern int *bm_list;
277 :     extern int num_bms;
278 :     FILE *fd;
279 :    
280 :     /*
281 :     Default procedure
282 :     */
283 :     if(alternative_bm_list == 0){
284 :     num_bms = NUM_BMS;
285 :     errno = 0;
286 :     bm_list = malloc(num_bms*sizeof(int));
287 :     if(errno != 0){
288 :     if(MYTHREAD == 0){
289 :     fprintf(stderr,"*** Unable to allocate %ld bytes for benchmark list storing: ",num_bms*sizeof(int));
290 :     perror(NULL);
291 :     }
292 :     upc_barrier;
293 :     exit(-1);
294 :     }
295 :    
296 :     int j = 0;
297 :     for(int i = 0; i < num_bms; i++){
298 :     if(reduce_op == UPC_AND || reduce_op == UPC_OR || reduce_op == UPC_XOR){
299 :     if(i == REDUCE_F || i == PREFIX_REDUCE_F || i == REDUCE_D || i == PREFIX_REDUCE_D || i == REDUCE_LD || i == PREFIX_REDUCE_LD){
300 :     continue;
301 :     }
302 :     }
303 :     bm_list[j] = i;
304 :     j++;
305 :     }
306 :    
307 :     }
308 :    
309 :     /*
310 :     User defined
311 :     */
312 :     else{
313 :     if(bm_file == NULL){
314 :     if(MYTHREAD == 0){
315 :     fprintf(stderr,"Unexpected error when parsing the benchmarks list file\n");
316 :     }
317 :     upc_barrier;
318 :     exit(-1);
319 :     }
320 :    
321 :     errno = 0;
322 :     fd = fopen(bm_file,"r");
323 :     if(errno != 0){
324 :     if(MYTHREAD == 0){
325 :     fprintf(stderr,"*** Error opening file %s: ",bm_file);
326 :     perror(NULL);
327 :     }
328 :     upc_barrier;
329 :     exit(-1);
330 :     }
331 :    
332 :     char curbm[30];
333 :    
334 :     /*
335 :     Two phases: one for get the number of benchmarks and the other to actually store them
336 :     */
337 :     while (!feof(fd) && fgets(curbm, 30, fd)) {
338 :     for(int i = 0; i < 30; i++){
339 :     if(curbm[i] == '\n' || curbm[i] == ' '){
340 :     curbm[i] = '\0';
341 :     }
342 :     }
343 :     for(int i = 0; i < NUM_BMS; i++){
344 :     if(strcmp(curbm,valid_bms[i]) == 0){
345 :     num_bms++;
346 :     }
347 :     }
348 :     }
349 :     errno = 0;
350 :     rewind(fd);
351 :     if(errno != 0){
352 :     if(MYTHREAD == 0){
353 :     fprintf(stderr,"*** Error reading file %s: ",bm_file);
354 :     perror(NULL);
355 :     }
356 :     upc_barrier;
357 :     exit(-1);
358 :     }
359 :     errno = 0;
360 :     bm_list = malloc(num_bms*sizeof(int));
361 :     if(errno != 0){
362 :     if(MYTHREAD == 0){
363 :     fprintf(stderr,"*** Unable to allocate %ld bytes for benchmark list storing: ",num_bms*sizeof(int));
364 :     perror(NULL);
365 :     }
366 :     upc_barrier;
367 :     exit(-1);
368 :     }
369 :     int i = 0;
370 :     while (!feof(fd) && fgets(curbm, 30, fd)) {
371 : dalvarez 7 for(int j = 0; j < 30; j++){
372 :     if(curbm[j] == '\n' || curbm[j] == ' '){
373 :     curbm[j] = '\0';
374 : dalvarez 1 }
375 :     }
376 :     for(int j = 0; j < NUM_BMS; j++){
377 :     errno = 0;
378 :     if(strcmp(curbm,valid_bms[j]) == 0){
379 :     if(errno != 0){
380 :     if(MYTHREAD == 0){
381 :     fprintf(stderr,"*** Error parsing %s in file %s: ",curbm,bm_file);
382 :     perror(NULL);
383 :     }
384 :     upc_barrier;
385 :     exit(-1);
386 :     }
387 :     bm_list[i] = j;
388 :     i++;
389 :     }
390 :     }
391 :     }
392 :    
393 :     fclose(fd);
394 :    
395 :     }
396 :    
397 :     if(num_bms < 1){
398 :     if(MYTHREAD == 0)
399 :     fprintf(stderr,"*** No valid benchmarks specified\n");
400 :     exit(-1);
401 :     }
402 :    
403 :     }
404 :    
405 :     /*
406 :     Set problem sizes
407 :     */
408 :     void set_sizes(int alternative_sizes, char *sizes_file){
409 :     extern long *sizes;
410 :     extern int num_sizes;
411 :     FILE *fd;
412 :    
413 :     /*
414 :     Default procedure
415 :     */
416 :     if(alternative_sizes == 0){
417 :     num_sizes = roundtoint(log2((double)maxsize)) - roundtoint(log2((double)minsize)) + 1;
418 :     errno = 0;
419 :     sizes = malloc(num_sizes*sizeof(long));
420 :     if(errno != 0){
421 :     if(MYTHREAD == 0){
422 :     fprintf(stderr,"*** Unable to allocate %ld bytes for message sizes storing: ",num_sizes*sizeof(int));
423 :     perror(NULL);
424 :     }
425 :     upc_barrier;
426 :     exit(-1);
427 :     }
428 :    
429 :     sizes[0] = minsize;
430 :    
431 :     for(int i = 1; i < num_sizes; i++){
432 :     sizes[i] = sizes[i-1]*2;
433 :     }
434 :    
435 :     if(sizes[num_sizes-1] > maxsize){
436 :     num_sizes--; //We waste sizeof(long) bytes, but probably we can afford it
437 :     }
438 :    
439 :     }
440 :    
441 :     /*
442 :     User defined
443 :     */
444 :     else{
445 :     if(sizes_file == NULL){
446 :     if(MYTHREAD == 0){
447 :     fprintf(stderr,"Unexpected error when parsing the problem sizes file\n");
448 :     }
449 :     upc_barrier;
450 :     exit(-1);
451 :     }
452 :    
453 :     errno = 0;
454 :     fd = fopen(sizes_file,"r");
455 :     if(errno != 0){
456 :     if(MYTHREAD == 0){
457 :     fprintf(stderr,"*** Error opening file %s: ",sizes_file);
458 :     perror(NULL);
459 :     }
460 :     upc_barrier;
461 :     exit(-1);
462 :     }
463 :    
464 :     char cursize[20];
465 :    
466 :     /*
467 :     Two phases: one for get the number of sizes and the other to actually store them
468 :     */
469 :     while (!feof(fd) && fgets(cursize, 20, fd)) {
470 :     if(cursize[0] >= '0' && cursize[0] <= '9'){
471 :     errno = 0;
472 : dalvarez 7 strtol(cursize,NULL,10);
473 : dalvarez 1 if(errno != 0){
474 :     if(MYTHREAD == 0){
475 :     fprintf(stderr,"*** Error parsing %s in file %s: ",cursize,sizes_file);
476 :     perror(NULL);
477 :     }
478 :     upc_barrier;
479 :     exit(-1);
480 :     }
481 :     num_sizes++;
482 :     }
483 :     else{ /* Silently ignores other lines */
484 :     continue;
485 :     }
486 :     }
487 :     errno = 0;
488 :     rewind(fd);
489 :     if(errno != 0){
490 :     if(MYTHREAD == 0){
491 :     fprintf(stderr,"*** Error reading file %s: ",sizes_file);
492 :     perror(NULL);
493 :     }
494 :     upc_barrier;
495 :     exit(-1);
496 :     }
497 :     errno = 0;
498 :     sizes = malloc(num_sizes*sizeof(long));
499 :     if(errno != 0){
500 :     if(MYTHREAD == 0){
501 :     fprintf(stderr,"*** Unable to allocate %ld bytes for message sizes storing: ",num_sizes*sizeof(int));
502 :     perror(NULL);
503 :     }
504 :     upc_barrier;
505 :     exit(-1);
506 :     }
507 :     int i = 0;
508 :     while (!feof(fd) && fgets(cursize, 20, fd)) {
509 :     if(cursize[0] >= '0' && cursize[0] <= '9'){
510 :     errno = 0;
511 :     sizes[i] = strtol(cursize,NULL,10);
512 :     if(errno != 0){
513 :     if(MYTHREAD == 0){
514 :     fprintf(stderr,"*** Error parsing %s in file %s: ",cursize,sizes_file);
515 :     perror(NULL);
516 :     }
517 :     upc_barrier;
518 :     exit(-1);
519 :     }
520 :     i++;
521 :     }
522 :     else{ /* Silently ignores other lines */
523 :     continue;
524 :     }
525 :     }
526 :    
527 :     fclose(fd);
528 :    
529 :     }
530 :    
531 :     if(num_sizes < 1){
532 :     if(MYTHREAD == 0)
533 :     fprintf(stderr,"*** No block sizes specified\n");
534 :     exit(-1);
535 :     }
536 :    
537 :     }
538 :    
539 :     // Init functions. E.g., initialize permutation array
540 :     void UOMS_init(){
541 :    
542 :     int i;
543 :     extern shared int perm[THREADS]; //for permutation
544 :    
545 :     //set the permutation array
546 :     if ( MYTHREAD == 0 )
547 :     {
548 :     for (i=0; i<THREADS; ++i)
549 :     perm[i] = i;
550 :     for (i=THREADS-1; i>0; --i)
551 :     {
552 :     int j = ((int)rand() >> 3) % i;
553 :     int tmp = perm[i];
554 :     perm[i] = perm[j];
555 :     perm[j] = tmp;
556 :     }
557 :     }
558 :     }
559 :    
560 :     void init(int argc, char **argv){
561 :     extern FILE *unit;
562 :     extern int cache_invalidation;
563 :     extern int warmup;
564 :     char *sizes_file = NULL;
565 :     char *output_file = NULL;
566 :     char *bm_file = NULL;
567 :     int alternative_output_file = 0;
568 :     int alternative_sizes = 0;
569 :     int alternative_bm_list = 0;
570 :     minsize = MINSIZE;
571 :     maxsize = MAXSIZE;
572 :    
573 :     warmup = 0; // Defaults to off
574 :    
575 :     set_bms_names();
576 :    
577 :     /*
578 :     Command line arguments parsing
579 :     */
580 :     for(int i = 1; i < argc; i++){
581 :     if(strcmp(argv[i],"-off_cache") == 0){
582 :     cache_invalidation = 1;
583 :     }
584 :     else if(strcmp(argv[i],"-msglen") == 0){
585 :     i++;
586 :     if(i == argc){
587 :     if(MYTHREAD == 0)
588 :     print_usage(argv[0]);
589 :     exit(-1);
590 :     }
591 :     else{
592 :     alternative_sizes = 1;
593 :     sizes_file = argv[i];
594 :     }
595 :     }
596 :     else if(strcmp(argv[i],"-input") == 0){
597 :     i++;
598 :     if(i == argc){
599 :     if(MYTHREAD == 0)
600 :     print_usage(argv[0]);
601 :     upc_barrier;
602 :     exit(-1);
603 :     }
604 :     else{
605 :     alternative_bm_list = 1;
606 :     bm_file = argv[i];
607 :     }
608 :     }
609 :     else if(strcmp(argv[i],"-reduce_op") == 0){
610 :     i++;
611 :     if(i == argc){
612 :     if(MYTHREAD == 0)
613 :     print_usage(argv[0]);
614 :     exit(-1);
615 :     }
616 :     else{
617 :     if(set_reduce_op(argv[i]) != 0){
618 :     if(MYTHREAD == 0)
619 :     print_usage(argv[0]);
620 :     exit(-1);
621 :     }
622 :     }
623 :     }
624 :     else if(strcmp(argv[i],"-sync_mode") == 0){
625 :     i++;
626 :     if(i == argc){
627 :     if(MYTHREAD == 0)
628 :     print_usage(argv[0]);
629 :     exit(-1);
630 :     }
631 :     else{
632 :     if(set_sync_mode(argv[i]) != 0){
633 :     if(MYTHREAD == 0)
634 :     print_usage(argv[0]);
635 :     exit(-1);
636 :     }
637 :     }
638 :     }
639 :     else if(strcmp(argv[i],"-minsize") == 0){
640 :     i++;
641 :     if(i == argc){
642 :     if(MYTHREAD == 0)
643 :     print_usage(argv[0]);
644 :     exit(-1);
645 :     }
646 :     else{
647 :     if(set_min_size(argv[i]) != 0){
648 :     if(MYTHREAD == 0)
649 :     print_usage(argv[0]);
650 :     exit(-1);
651 :     }
652 :     }
653 :     }
654 :     else if(strcmp(argv[i],"-maxsize") == 0){
655 :     i++;
656 :     if(i == argc){
657 :     if(MYTHREAD == 0)
658 :     print_usage(argv[0]);
659 :     exit(-1);
660 :     }
661 :     else{
662 :     if(set_max_size(argv[i]) != 0){
663 :     if(MYTHREAD == 0)
664 :     print_usage(argv[0]);
665 :     exit(-1);
666 :     }
667 :     }
668 :     }
669 :     else if(strcmp(argv[i],"-warmup") == 0){
670 :     warmup = 1;
671 :     }
672 :     else if(strcmp(argv[i],"-help") == 0){
673 :     if(MYTHREAD == 0)
674 :     print_usage(argv[0]);
675 :     upc_barrier;
676 :     exit(-1);
677 :     }
678 :     else if(strcmp(argv[i],"-version") == 0){
679 :     if(MYTHREAD == 0)
680 :     print_version();
681 :     upc_barrier;
682 :     exit(-1);
683 :     }
684 :     else{
685 :     if(i == argc-1 && argv[i][0] != '-' ){
686 :     alternative_output_file = 1;
687 :     output_file = argv[i];
688 :     }
689 :     else{
690 :     if(MYTHREAD == 0){
691 :     printf("Unrecognized option ignored: %s\n",argv[i]);
692 :     }
693 :     }
694 :     }
695 :     }
696 :    
697 :     /*
698 :     Optional files checking and parsing
699 :     */
700 :     set_sizes(alternative_sizes,sizes_file);
701 :     set_bms(alternative_bm_list,bm_file);
702 :    
703 :     /*
704 :     Optional output file
705 :     */
706 :     if(alternative_output_file){
707 :     errno = 0;
708 :     unit = fopen(output_file,"w");
709 :     if(errno != 0){
710 :     if(MYTHREAD == 0){
711 :     fprintf(stderr,"*** Error creating or truncating file %s: ",output_file);
712 :     perror(NULL);
713 :     }
714 :     upc_barrier;
715 :     exit(-1);
716 :     }
717 :     }
718 :     else{
719 :     unit = stdout;
720 :     }
721 :     UOMS_init();
722 :     }

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge