Input read_CLI( int argc, char * argv[] ) { Input input; // defaults to max threads on the system input.nthreads = omp_get_num_procs(); // defaults to 355 (corresponding to H-M Large benchmark) input.n_nuclides = 355; // defaults to 10,000,000 input.lookups = 10000000; // defaults to H-M Large benchmark input.HM = LARGE; // defaults to 3000 resonancs (avg) per nuclide input.avg_n_poles = 1000; // defaults to 100 input.avg_n_windows = 100; // defaults to 4; input.numL = 4; // defaults to temperature dependence (Doppler broadening) input.doppler = 1; // Collect Raw Input for( int i = 1; i < argc; i++ ) { char * arg = argv[i]; // nthreads (-t) if( strcmp(arg, "-t") == 0 ) { if( ++i < argc ) input.nthreads = atoi(argv[i]); else print_CLI_error(); } // lookups (-l) else if( strcmp(arg, "-l") == 0 ) { if( ++i < argc ) input.lookups = atoi(argv[i]); else print_CLI_error(); } // nuclides (-n) else if( strcmp(arg, "-n") == 0 ) { if( ++i < argc ) input.n_nuclides = atoi(argv[i]); else print_CLI_error(); } // HM (-s) else if( strcmp(arg, "-s") == 0 ) { if( ++i < argc ) { if( strcmp(argv[i], "small") == 0 ) input.HM = SMALL; else if ( strcmp(argv[i], "large") == 0 ) input.HM = LARGE; else print_CLI_error(); } else print_CLI_error(); } // Doppler Broadening (Temperature Dependence) else if( strcmp(arg, "-d") == 0 ) { input.doppler = 0; } // Avg number of windows per nuclide (-w) else if( strcmp(arg, "-w") == 0 ) { if( ++i < argc ) input.avg_n_windows = atoi(argv[i]); else print_CLI_error(); } // Avg number of poles per nuclide (-p) else if( strcmp(arg, "-p") == 0 ) { if( ++i < argc ) input.avg_n_poles = atoi(argv[i]); else print_CLI_error(); } else print_CLI_error(); } // Validate Input // Validate nthreads if( input.nthreads < 1 ) print_CLI_error(); // Validate n_isotopes if( input.n_nuclides < 1 ) print_CLI_error(); // Validate lookups if( input.lookups < 1 ) print_CLI_error(); // Validate lookups if( input.avg_n_poles < 1 ) print_CLI_error(); // Validate lookups if( input.avg_n_windows < 1 ) print_CLI_error(); // Set HM size specific parameters // (defaults to large) if( input.HM == SMALL ) input.n_nuclides = 68; // Return input struct return input; }
// reads command line inputs and applies options void read_CLI( int argc, char * argv[], Input * input ) { // defaults to max threads on the system #ifdef OPENMP input->nthreads = omp_get_num_procs(); #else input->nthreads = 1; #endif // Collect Raw Input for( int i = 1; i < argc; i++ ) { char * arg = argv[i]; // nthreads (-t) if( strcmp(arg, "-t") == 0 ) { if( ++i < argc ) input->nthreads = atoi(argv[i]); else print_CLI_error(); } // segments (-s) else if( strcmp(arg, "-s") == 0 ) { if( ++i < argc ) input->segments = atoi(argv[i]); else print_CLI_error(); } // egroups (-e) else if( strcmp(arg, "-e") == 0 ) { if( ++i < argc ) input->egroups = atoi(argv[i]); else print_CLI_error(); } #ifdef PAPI // Add single PAPI event else if( strcmp(arg, "-p") == 0 ) { if( ++i < argc ){ input->papi_event_set = -1; strcpy(input->event_name, argv[i]); } else print_CLI_error(); } #endif else print_CLI_error(); } // Validate nthreads if( input->nthreads < 1 ) print_CLI_error(); }
Inputs read_CLI( int argc, char * argv[] ) { Inputs input; memset(&input, 0, sizeof(Inputs)); // defaults to max threads on the system input.nthreads = omp_get_num_procs(); // defaults to 355 (corresponding to H-M Large benchmark) input.n_isotopes = 355; // defaults to 11303 (corresponding to H-M Large benchmark) input.n_gridpoints = 11303; // defaults to 15,000,000 input.lookups = 15000000; // defaults to H-M Large benchmark input.HM = (char *) malloc( 6 * sizeof(char) ); strcpy(input.HM, "small"); /* input.HM[0] = 'l' ; input.HM[1] = 'a' ; input.HM[2] = 'r' ; input.HM[3] = 'g' ; input.HM[4] = 'e' ; input.HM[5] = '\0'; */ #ifdef __USE_AMD_OCL__ input.tloops = 1; input.run_cpu = false; #endif input.savegrids = false; input.restoregrids = false; strcpy(input.file_name, "grids"); // Check if user sets these int user_g = 0; // Collect Raw Input for( int i = 1; i < argc; i++ ) { char * arg = argv[i]; // nthreads (-t) if( strcmp(arg, "-t") == 0 ) { if( ++i < argc ) input.nthreads = atoi(argv[i]); else print_CLI_error(); } // n_gridpoints (-g) else if( strcmp(arg, "-g") == 0 ) { if( ++i < argc ) { user_g = 1; input.n_gridpoints = atoi(argv[i]); } else print_CLI_error(); } // lookups (-l) else if( strcmp(arg, "-l") == 0 ) { if( ++i < argc ) input.lookups = atoi(argv[i]); else print_CLI_error(); } // HM (-s) else if( strcmp(arg, "-s") == 0 ) { if( ++i < argc ) input.HM = argv[i]; else print_CLI_error(); } #ifdef __USE_AMD_OCL__ else if( strcmp(arg, "-k") == 0 ) { if( ++i < argc ) input.tloops = atoi(argv[i]); else print_CLI_error(); } else if( strcmp(arg, "-c") == 0 ) { input.run_cpu = true; } #endif else if( strcmp(arg, "-v") == 0 ) { input.savegrids = true; } else if( strcmp(arg, "-r") == 0 ) { input.restoregrids = true; } else if( strcmp(arg, "-f") == 0 ) { if( ++i < argc ) strcpy(input.file_name,argv[i]); else print_CLI_error(); } else print_CLI_error(); } if(input.savegrids) input.restoregrids = false; // Validate Input // Validate nthreads if( input.nthreads < 1 ) print_CLI_error(); // Validate n_isotopes if( input.n_isotopes < 1 ) print_CLI_error(); // Validate n_gridpoints if( input.n_gridpoints < 1 ) print_CLI_error(); // Validate lookups if( input.lookups < 1 ) print_CLI_error(); // Validate HM size if( strcasecmp(input.HM, "small") != 0 && strcasecmp(input.HM, "large") != 0 && strcasecmp(input.HM, "XL") != 0 && strcasecmp(input.HM, "XXL") != 0 ) print_CLI_error(); // Set HM size specific parameters // (defaults to large) if( strcasecmp(input.HM, "small") == 0 ) input.n_isotopes = 68; else if( strcasecmp(input.HM, "XL") == 0 && user_g == 0 ) input.n_gridpoints = 238847; // sized to make 120 GB XS data else if( strcasecmp(input.HM, "XXL") == 0 && user_g == 0 ) input.n_gridpoints = 238847 * 2.1; // 252 GB XS data // Return input struct return input; }
Inputs read_CLI( int argc, char * argv[] ) { Inputs input; // defaults to max threads on the system input.nthreads = omp_get_num_procs(); // defaults to 355 (corresponding to H-M Large benchmark) input.n_isotopes = 355; // defaults to 11303 (corresponding to H-M Large benchmark) input.n_gridpoints = 11303; // defaults to 15,000,000 input.lookups = 15000000; // defaults to H-M Large benchmark input.HM = (char *) malloc( 6 * sizeof(char) ); input.HM[0] = 'l' ; input.HM[1] = 'a' ; input.HM[2] = 'r' ; input.HM[3] = 'g' ; input.HM[4] = 'e' ; input.HM[5] = '\0'; // Check if user sets these int user_g = 0; // Collect Raw Input for( int i = 1; i < argc; i++ ) { char * arg = argv[i]; // nthreads (-t) if( strcmp(arg, "-t") == 0 ) { if( ++i < argc ) input.nthreads = atoi(argv[i]); else print_CLI_error(); } // n_gridpoints (-g) else if( strcmp(arg, "-g") == 0 ) { if( ++i < argc ) { user_g = 1; input.n_gridpoints = atol(argv[i]); } else print_CLI_error(); } // lookups (-l) else if( strcmp(arg, "-l") == 0 ) { if( ++i < argc ) input.lookups = atoi(argv[i]); else print_CLI_error(); } // HM (-s) else if( strcmp(arg, "-s") == 0 ) { if( ++i < argc ) input.HM = argv[i]; else print_CLI_error(); } else print_CLI_error(); } // Validate Input // Validate nthreads if( input.nthreads < 1 ) print_CLI_error(); // Validate n_isotopes if( input.n_isotopes < 1 ) print_CLI_error(); // Validate n_gridpoints if( input.n_gridpoints < 1 ) print_CLI_error(); // Validate lookups if( input.lookups < 1 ) print_CLI_error(); // Validate HM size if( strcasecmp(input.HM, "small") != 0 && strcasecmp(input.HM, "large") != 0 && strcasecmp(input.HM, "XL") != 0 && strcasecmp(input.HM, "XXL") != 0 ) print_CLI_error(); // Set HM size specific parameters // (defaults to large) if( strcasecmp(input.HM, "small") == 0 ) input.n_isotopes = 68; else if( strcasecmp(input.HM, "XL") == 0 && user_g == 0 ) input.n_gridpoints = 238847; // sized to make 120 GB XS data else if( strcasecmp(input.HM, "XXL") == 0 && user_g == 0 ) input.n_gridpoints = 238847 * 2.1; // 252 GB XS data // Return input struct return input; }