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 1 - (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 :     valid_bms[AMEMGET] = "upc_memget_asynci";
111 :     valid_bms[AMEMPUT] = "upc_memput_asynci";
112 :     valid_bms[AMEMCPY] = "upc_memcpy_asynci";
113 :     valid_bms[ALMEMGET] = "local_upc_memget_asynci";
114 :     valid_bms[ALMEMPUT] = "local_upc_memput_asynci";
115 :     valid_bms[ALMEMCPY] = "local_upc_memcpy_asynci";
116 :     #endif
117 :     }
118 :    
119 :     /*
120 :     Set min size
121 :     */
122 :     int set_min_size(char *size){
123 :     if(size[0] >= '0' && size[0] <= '9'){
124 :     errno = 0;
125 :     minsize = strtol(size,NULL,10);
126 :     if(errno != 0){
127 :     if(MYTHREAD == 0){
128 :     fprintf(stderr,"*** minsize (%s) not valid: ",size);
129 :     perror(NULL);
130 :     }
131 :     return -1;
132 :     }
133 :     }
134 :     else{
135 :     if(MYTHREAD == 0){
136 :     fprintf(stderr,"*** minsize (%s) not valid",size);
137 :     }
138 :     return -1;
139 :     }
140 :     return 0;
141 :     }
142 :    
143 :     /*
144 :     Set max size
145 :     */
146 :     int set_max_size(char *size){
147 :     if(size[0] >= '0' && size[0] <= '9'){
148 :     errno = 0;
149 :     maxsize = strtol(size,NULL,10);
150 :     if(errno != 0){
151 :     if(MYTHREAD == 0){
152 :     fprintf(stderr,"*** maxsize (%s) not valid: ",size);
153 :     perror(NULL);
154 :     }
155 :     return -1;
156 :     }
157 :     }
158 :     else{
159 :     if(MYTHREAD == 0){
160 :     fprintf(stderr,"*** maxsize (%s) not valid",size);
161 :     }
162 :     return -1;
163 :     }
164 :     return 0;
165 :     }
166 :    
167 :     /*
168 :     Set reduce operation
169 :     */
170 :     int set_reduce_op(char *operation){
171 :     extern char *char_reduce_op;
172 :    
173 :     if(strcmp(operation,"UPC_ADD") == 0){
174 :     reduce_op = UPC_ADD;
175 :     char_reduce_op = operation;
176 :     }
177 :     else if(strcmp(operation,"UPC_MULT") == 0){
178 :     reduce_op = UPC_MULT;
179 :     char_reduce_op = operation;
180 :     }
181 :     else if(strcmp(operation,"UPC_AND") == 0){
182 :     reduce_op = UPC_AND;
183 :     char_reduce_op = operation;
184 :     }
185 :     else if(strcmp(operation,"UPC_OR") == 0){
186 :     reduce_op = UPC_OR;
187 :     char_reduce_op = operation;
188 :     }
189 :     else if(strcmp(operation,"UPC_XOR") == 0){
190 :     reduce_op = UPC_XOR;
191 :     char_reduce_op = operation;
192 :     }
193 :     else if(strcmp(operation,"UPC_LOGAND") == 0){
194 :     reduce_op = UPC_LOGAND;
195 :     char_reduce_op = operation;
196 :     }
197 :     else if(strcmp(operation,"UPC_LOGOR") == 0){
198 :     reduce_op = UPC_LOGOR;
199 :     char_reduce_op = operation;
200 :     }
201 :     else if(strcmp(operation,"UPC_MIN") == 0){
202 :     reduce_op = UPC_MIN;
203 :     char_reduce_op = operation;
204 :     }
205 :     else if(strcmp(operation,"UPC_MAX") == 0){
206 :     reduce_op = UPC_MAX;
207 :     char_reduce_op = operation;
208 :     }
209 :     else{
210 :     return -1;
211 :     }
212 :     return 0;
213 :     }
214 :    
215 :     /*
216 :     Set synchronization mode
217 :     */
218 :     int set_sync_mode(char *mode){
219 :     extern upc_flag_t sync_mode;
220 :     extern char * char_sync_mode;
221 :    
222 :     if(strcmp(mode,"UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC") == 0){
223 :     sync_mode = UPC_IN_ALLSYNC|UPC_OUT_ALLSYNC;
224 :     char_sync_mode = mode;
225 :     }
226 :     else if(strcmp(mode,"UPC_IN_ALLSYNC|UPC_OUT_MYSYNC") == 0){
227 :     sync_mode = UPC_IN_ALLSYNC|UPC_OUT_MYSYNC;
228 :     char_sync_mode = mode;
229 :     }
230 :     else if(strcmp(mode,"UPC_IN_ALLSYNC|UPC_OUT_NOSYNC") == 0){
231 :     sync_mode = UPC_IN_ALLSYNC|UPC_OUT_NOSYNC;
232 :     char_sync_mode = mode;
233 :     }
234 :     else if(strcmp(mode,"UPC_IN_MYSYNC|UPC_OUT_ALLSYNC") == 0){
235 :     sync_mode = UPC_IN_MYSYNC|UPC_OUT_ALLSYNC;
236 :     char_sync_mode = mode;
237 :     }
238 :     else if(strcmp(mode,"UPC_IN_MYSYNC|UPC_OUT_MYSYNC") == 0){
239 :     sync_mode = UPC_IN_MYSYNC|UPC_OUT_MYSYNC;
240 :     char_sync_mode = mode;
241 :     }
242 :     else if(strcmp(mode,"UPC_IN_MYSYNC|UPC_OUT_NOSYNC") == 0){
243 :     sync_mode = UPC_IN_MYSYNC|UPC_OUT_NOSYNC;
244 :     char_sync_mode = mode;
245 :     }
246 :     else if(strcmp(mode,"UPC_IN_NOSYNC|UPC_OUT_ALLSYNC") == 0){
247 :     sync_mode = UPC_IN_NOSYNC|UPC_OUT_ALLSYNC;
248 :     char_sync_mode = mode;
249 :     }
250 :     else if(strcmp(mode,"UPC_IN_NOSYNC|UPC_OUT_MYSYNC") == 0){
251 :     sync_mode = UPC_IN_NOSYNC|UPC_OUT_MYSYNC;
252 :     char_sync_mode = mode;
253 :     }
254 :     else if(strcmp(mode,"UPC_IN_NOSYNC|UPC_OUT_NOSYNC") == 0){
255 :     sync_mode = UPC_IN_NOSYNC|UPC_OUT_NOSYNC;
256 :     char_sync_mode = mode;
257 :     }
258 :     else{
259 :     return -1;
260 :     }
261 :     return 0;
262 :     }
263 :    
264 :     /*
265 :     Set benchmark list
266 :     */
267 :     void set_bms(int alternative_bm_list, char *bm_file){
268 :     extern int *bm_list;
269 :     extern int num_bms;
270 :     FILE *fd;
271 :    
272 :     /*
273 :     Default procedure
274 :     */
275 :     if(alternative_bm_list == 0){
276 :     num_bms = NUM_BMS;
277 :     errno = 0;
278 :     bm_list = malloc(num_bms*sizeof(int));
279 :     if(errno != 0){
280 :     if(MYTHREAD == 0){
281 :     fprintf(stderr,"*** Unable to allocate %ld bytes for benchmark list storing: ",num_bms*sizeof(int));
282 :     perror(NULL);
283 :     }
284 :     upc_barrier;
285 :     exit(-1);
286 :     }
287 :    
288 :     int j = 0;
289 :     for(int i = 0; i < num_bms; i++){
290 :     if(reduce_op == UPC_AND || reduce_op == UPC_OR || reduce_op == UPC_XOR){
291 :     if(i == REDUCE_F || i == PREFIX_REDUCE_F || i == REDUCE_D || i == PREFIX_REDUCE_D || i == REDUCE_LD || i == PREFIX_REDUCE_LD){
292 :     continue;
293 :     }
294 :     }
295 :     bm_list[j] = i;
296 :     j++;
297 :     }
298 :    
299 :     }
300 :    
301 :     /*
302 :     User defined
303 :     */
304 :     else{
305 :     if(bm_file == NULL){
306 :     if(MYTHREAD == 0){
307 :     fprintf(stderr,"Unexpected error when parsing the benchmarks list file\n");
308 :     }
309 :     upc_barrier;
310 :     exit(-1);
311 :     }
312 :    
313 :     errno = 0;
314 :     fd = fopen(bm_file,"r");
315 :     if(errno != 0){
316 :     if(MYTHREAD == 0){
317 :     fprintf(stderr,"*** Error opening file %s: ",bm_file);
318 :     perror(NULL);
319 :     }
320 :     upc_barrier;
321 :     exit(-1);
322 :     }
323 :    
324 :     char curbm[30];
325 :    
326 :     /*
327 :     Two phases: one for get the number of benchmarks and the other to actually store them
328 :     */
329 :     while (!feof(fd) && fgets(curbm, 30, fd)) {
330 :     for(int i = 0; i < 30; i++){
331 :     if(curbm[i] == '\n' || curbm[i] == ' '){
332 :     curbm[i] = '\0';
333 :     }
334 :     }
335 :     for(int i = 0; i < NUM_BMS; i++){
336 :     if(strcmp(curbm,valid_bms[i]) == 0){
337 :     num_bms++;
338 :     }
339 :     }
340 :     }
341 :     errno = 0;
342 :     rewind(fd);
343 :     if(errno != 0){
344 :     if(MYTHREAD == 0){
345 :     fprintf(stderr,"*** Error reading file %s: ",bm_file);
346 :     perror(NULL);
347 :     }
348 :     upc_barrier;
349 :     exit(-1);
350 :     }
351 :     errno = 0;
352 :     bm_list = malloc(num_bms*sizeof(int));
353 :     if(errno != 0){
354 :     if(MYTHREAD == 0){
355 :     fprintf(stderr,"*** Unable to allocate %ld bytes for benchmark list storing: ",num_bms*sizeof(int));
356 :     perror(NULL);
357 :     }
358 :     upc_barrier;
359 :     exit(-1);
360 :     }
361 :     int i = 0;
362 :     while (!feof(fd) && fgets(curbm, 30, fd)) {
363 :     for(int i = 0; i < 30; i++){
364 :     if(curbm[i] == '\n' || curbm[i] == ' '){
365 :     curbm[i] = '\0';
366 :     }
367 :     }
368 :     for(int j = 0; j < NUM_BMS; j++){
369 :     errno = 0;
370 :     if(strcmp(curbm,valid_bms[j]) == 0){
371 :     if(errno != 0){
372 :     if(MYTHREAD == 0){
373 :     fprintf(stderr,"*** Error parsing %s in file %s: ",curbm,bm_file);
374 :     perror(NULL);
375 :     }
376 :     upc_barrier;
377 :     exit(-1);
378 :     }
379 :     bm_list[i] = j;
380 :     i++;
381 :     }
382 :     }
383 :     }
384 :    
385 :     fclose(fd);
386 :    
387 :     }
388 :    
389 :     if(num_bms < 1){
390 :     if(MYTHREAD == 0)
391 :     fprintf(stderr,"*** No valid benchmarks specified\n");
392 :     exit(-1);
393 :     }
394 :    
395 :     }
396 :    
397 :     /*
398 :     Set problem sizes
399 :     */
400 :     void set_sizes(int alternative_sizes, char *sizes_file){
401 :     extern long *sizes;
402 :     extern int num_sizes;
403 :     FILE *fd;
404 :    
405 :     /*
406 :     Default procedure
407 :     */
408 :     if(alternative_sizes == 0){
409 :     num_sizes = roundtoint(log2((double)maxsize)) - roundtoint(log2((double)minsize)) + 1;
410 :     errno = 0;
411 :     sizes = malloc(num_sizes*sizeof(long));
412 :     if(errno != 0){
413 :     if(MYTHREAD == 0){
414 :     fprintf(stderr,"*** Unable to allocate %ld bytes for message sizes storing: ",num_sizes*sizeof(int));
415 :     perror(NULL);
416 :     }
417 :     upc_barrier;
418 :     exit(-1);
419 :     }
420 :    
421 :     sizes[0] = minsize;
422 :    
423 :     for(int i = 1; i < num_sizes; i++){
424 :     sizes[i] = sizes[i-1]*2;
425 :     }
426 :    
427 :     if(sizes[num_sizes-1] > maxsize){
428 :     num_sizes--; //We waste sizeof(long) bytes, but probably we can afford it
429 :     }
430 :    
431 :     }
432 :    
433 :     /*
434 :     User defined
435 :     */
436 :     else{
437 :     if(sizes_file == NULL){
438 :     if(MYTHREAD == 0){
439 :     fprintf(stderr,"Unexpected error when parsing the problem sizes file\n");
440 :     }
441 :     upc_barrier;
442 :     exit(-1);
443 :     }
444 :    
445 :     errno = 0;
446 :     fd = fopen(sizes_file,"r");
447 :     if(errno != 0){
448 :     if(MYTHREAD == 0){
449 :     fprintf(stderr,"*** Error opening file %s: ",sizes_file);
450 :     perror(NULL);
451 :     }
452 :     upc_barrier;
453 :     exit(-1);
454 :     }
455 :    
456 :     char cursize[20];
457 :    
458 :     /*
459 :     Two phases: one for get the number of sizes and the other to actually store them
460 :     */
461 :     while (!feof(fd) && fgets(cursize, 20, fd)) {
462 :     if(cursize[0] >= '0' && cursize[0] <= '9'){
463 :     errno = 0;
464 :     long dummy = strtol(cursize,NULL,10);
465 :     if(errno != 0){
466 :     if(MYTHREAD == 0){
467 :     fprintf(stderr,"*** Error parsing %s in file %s: ",cursize,sizes_file);
468 :     perror(NULL);
469 :     }
470 :     upc_barrier;
471 :     exit(-1);
472 :     }
473 :     num_sizes++;
474 :     }
475 :     else{ /* Silently ignores other lines */
476 :     continue;
477 :     }
478 :     }
479 :     errno = 0;
480 :     rewind(fd);
481 :     if(errno != 0){
482 :     if(MYTHREAD == 0){
483 :     fprintf(stderr,"*** Error reading file %s: ",sizes_file);
484 :     perror(NULL);
485 :     }
486 :     upc_barrier;
487 :     exit(-1);
488 :     }
489 :     errno = 0;
490 :     sizes = malloc(num_sizes*sizeof(long));
491 :     if(errno != 0){
492 :     if(MYTHREAD == 0){
493 :     fprintf(stderr,"*** Unable to allocate %ld bytes for message sizes storing: ",num_sizes*sizeof(int));
494 :     perror(NULL);
495 :     }
496 :     upc_barrier;
497 :     exit(-1);
498 :     }
499 :     int i = 0;
500 :     while (!feof(fd) && fgets(cursize, 20, fd)) {
501 :     if(cursize[0] >= '0' && cursize[0] <= '9'){
502 :     errno = 0;
503 :     sizes[i] = strtol(cursize,NULL,10);
504 :     if(errno != 0){
505 :     if(MYTHREAD == 0){
506 :     fprintf(stderr,"*** Error parsing %s in file %s: ",cursize,sizes_file);
507 :     perror(NULL);
508 :     }
509 :     upc_barrier;
510 :     exit(-1);
511 :     }
512 :     i++;
513 :     }
514 :     else{ /* Silently ignores other lines */
515 :     continue;
516 :     }
517 :     }
518 :    
519 :     fclose(fd);
520 :    
521 :     }
522 :    
523 :     if(num_sizes < 1){
524 :     if(MYTHREAD == 0)
525 :     fprintf(stderr,"*** No block sizes specified\n");
526 :     exit(-1);
527 :     }
528 :    
529 :     }
530 :    
531 :     // Init functions. E.g., initialize permutation array
532 :     void UOMS_init(){
533 :    
534 :     int i;
535 :     extern shared int perm[THREADS]; //for permutation
536 :    
537 :     //set the permutation array
538 :     if ( MYTHREAD == 0 )
539 :     {
540 :     for (i=0; i<THREADS; ++i)
541 :     perm[i] = i;
542 :     for (i=THREADS-1; i>0; --i)
543 :     {
544 :     int j = ((int)rand() >> 3) % i;
545 :     int tmp = perm[i];
546 :     perm[i] = perm[j];
547 :     perm[j] = tmp;
548 :     }
549 :     }
550 :     }
551 :    
552 :     void init(int argc, char **argv){
553 :     extern FILE *unit;
554 :     extern int cache_invalidation;
555 :     extern int warmup;
556 :     char *sizes_file = NULL;
557 :     char *output_file = NULL;
558 :     char *bm_file = NULL;
559 :     int alternative_output_file = 0;
560 :     int alternative_sizes = 0;
561 :     int alternative_bm_list = 0;
562 :     minsize = MINSIZE;
563 :     maxsize = MAXSIZE;
564 :    
565 :     warmup = 0; // Defaults to off
566 :    
567 :     set_bms_names();
568 :    
569 :     /*
570 :     Command line arguments parsing
571 :     */
572 :     for(int i = 1; i < argc; i++){
573 :     if(strcmp(argv[i],"-off_cache") == 0){
574 :     cache_invalidation = 1;
575 :     }
576 :     else if(strcmp(argv[i],"-msglen") == 0){
577 :     i++;
578 :     if(i == argc){
579 :     if(MYTHREAD == 0)
580 :     print_usage(argv[0]);
581 :     exit(-1);
582 :     }
583 :     else{
584 :     alternative_sizes = 1;
585 :     sizes_file = argv[i];
586 :     }
587 :     }
588 :     else if(strcmp(argv[i],"-input") == 0){
589 :     i++;
590 :     if(i == argc){
591 :     if(MYTHREAD == 0)
592 :     print_usage(argv[0]);
593 :     upc_barrier;
594 :     exit(-1);
595 :     }
596 :     else{
597 :     alternative_bm_list = 1;
598 :     bm_file = argv[i];
599 :     }
600 :     }
601 :     else if(strcmp(argv[i],"-reduce_op") == 0){
602 :     i++;
603 :     if(i == argc){
604 :     if(MYTHREAD == 0)
605 :     print_usage(argv[0]);
606 :     exit(-1);
607 :     }
608 :     else{
609 :     if(set_reduce_op(argv[i]) != 0){
610 :     if(MYTHREAD == 0)
611 :     print_usage(argv[0]);
612 :     exit(-1);
613 :     }
614 :     }
615 :     }
616 :     else if(strcmp(argv[i],"-sync_mode") == 0){
617 :     i++;
618 :     if(i == argc){
619 :     if(MYTHREAD == 0)
620 :     print_usage(argv[0]);
621 :     exit(-1);
622 :     }
623 :     else{
624 :     if(set_sync_mode(argv[i]) != 0){
625 :     if(MYTHREAD == 0)
626 :     print_usage(argv[0]);
627 :     exit(-1);
628 :     }
629 :     }
630 :     }
631 :     else if(strcmp(argv[i],"-minsize") == 0){
632 :     i++;
633 :     if(i == argc){
634 :     if(MYTHREAD == 0)
635 :     print_usage(argv[0]);
636 :     exit(-1);
637 :     }
638 :     else{
639 :     if(set_min_size(argv[i]) != 0){
640 :     if(MYTHREAD == 0)
641 :     print_usage(argv[0]);
642 :     exit(-1);
643 :     }
644 :     }
645 :     }
646 :     else if(strcmp(argv[i],"-maxsize") == 0){
647 :     i++;
648 :     if(i == argc){
649 :     if(MYTHREAD == 0)
650 :     print_usage(argv[0]);
651 :     exit(-1);
652 :     }
653 :     else{
654 :     if(set_max_size(argv[i]) != 0){
655 :     if(MYTHREAD == 0)
656 :     print_usage(argv[0]);
657 :     exit(-1);
658 :     }
659 :     }
660 :     }
661 :     else if(strcmp(argv[i],"-warmup") == 0){
662 :     warmup = 1;
663 :     }
664 :     else if(strcmp(argv[i],"-help") == 0){
665 :     if(MYTHREAD == 0)
666 :     print_usage(argv[0]);
667 :     upc_barrier;
668 :     exit(-1);
669 :     }
670 :     else if(strcmp(argv[i],"-version") == 0){
671 :     if(MYTHREAD == 0)
672 :     print_version();
673 :     upc_barrier;
674 :     exit(-1);
675 :     }
676 :     else{
677 :     if(i == argc-1 && argv[i][0] != '-' ){
678 :     alternative_output_file = 1;
679 :     output_file = argv[i];
680 :     }
681 :     else{
682 :     if(MYTHREAD == 0){
683 :     printf("Unrecognized option ignored: %s\n",argv[i]);
684 :     }
685 :     }
686 :     }
687 :     }
688 :    
689 :     /*
690 :     Optional files checking and parsing
691 :     */
692 :     set_sizes(alternative_sizes,sizes_file);
693 :     set_bms(alternative_bm_list,bm_file);
694 :    
695 :     /*
696 :     Optional output file
697 :     */
698 :     if(alternative_output_file){
699 :     errno = 0;
700 :     unit = fopen(output_file,"w");
701 :     if(errno != 0){
702 :     if(MYTHREAD == 0){
703 :     fprintf(stderr,"*** Error creating or truncating file %s: ",output_file);
704 :     perror(NULL);
705 :     }
706 :     upc_barrier;
707 :     exit(-1);
708 :     }
709 :     }
710 :     else{
711 :     unit = stdout;
712 :     }
713 :     UOMS_init();
714 :     }

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

Powered By FusionForge