21 #if defined(HAVE_GETOPT_H)
33 "Matrix input (mandatory):\n"
34 " -0 --rsa : RSA/Matrix Market Fortran driver (only real)\n"
35 " -1 --hb : Harwell Boeing C driver\n"
36 " -2 --ijv : IJV coordinate C driver\n"
37 " -3 --mm : Matrix Market C driver\n"
38 " -4 --spm : SPM Matrix driver\n"
39 " -9 --lap : Generate a Laplacian (5-points stencil)\n"
40 " -x --xlap : Generate an extended Laplacian (9-points stencil)\n"
41 " -G --graph : SCOTCH Graph file\n"
43 "Architecture arguments:\n"
44 " -a --scatter : Scatter the spm when PaStiX is with MPI (default: 0)\n"
45 " 0: Replicate the spm, 1: Scatter the spm\n"
46 " -t --threads : Number of threads per node (default: -1 to use the number of cores available)\n"
47 " -g --gpus : Number of gpus per node (default: 0)\n"
48 " -s --sched : Set the default scheduler (default: 4)\n"
49 " 0: Sequential, 1: Static, 2: PaRSEC, 3: StarPU, 4: Dynamic\n"
51 "Optional arguments:\n"
52 " -f --fact : Choose factorization method (default: LU)\n"
53 " 0: Cholesky, 1: LDL^[th], 2: LU, 3:LL^t, 4:LDL^t\n"
54 " 3 and 4 are for complex matrices only\n"
55 " -c --check : Choose the level of check to perform (default: 1)\n"
56 " 0: None, 1: Backward error, 2: Backward and forward errors\n"
57 " -o --ord : Choose between ordering libraries (default: scotch)\n"
58 " scotch, ptscotch, metis, parmetis\n"
59 " -i --iparm <IPARM_ID> <value> : set any given integer parameter\n"
60 " -d --dparm <DPARM_ID> <value> : set any given floating parameter\n"
62 " -v --verbose[=lvl] : extra verbose output\n"
63 " -h --help : this message\n"
71 #define GETOPT_STRING "0:1:2:3:4:9:x:G:a:t:g:s:o:f:c:i:d:v::h"
73 #if defined(HAVE_GETOPT_LONG)
77 static struct option long_options[] =
79 {
"rsa", required_argument, 0,
'0'},
80 {
"hb", required_argument, 0,
'1'},
81 {
"ijv", required_argument, 0,
'2'},
82 {
"mm", required_argument, 0,
'3'},
83 {
"spm", required_argument, 0,
'4'},
84 {
"lap", required_argument, 0,
'9'},
85 {
"xlap", required_argument, 0,
'x'},
86 {
"graph", required_argument, 0,
'G'},
88 {
"scatter", required_argument, 0,
'a'},
89 {
"threads", required_argument, 0,
't'},
90 {
"gpus", required_argument, 0,
'g'},
91 {
"sched", required_argument, 0,
's'},
93 {
"ord", required_argument, 0,
'o'},
94 {
"fact", required_argument, 0,
'f'},
95 {
"check", required_argument, 0,
'c'},
96 {
"iparm", required_argument, 0,
'i'},
97 {
"dparm", required_argument, 0,
'd'},
99 {
"verbose", optional_argument, 0,
'v'},
100 {
"help", no_argument, 0,
'h'},
150 pastix_int_t *iparam,
double *dparam,
151 int *check,
int *scatter, spm_driver_t *driver,
char **filename )
163 #if defined(HAVE_GETOPT_LONG)
165 long_options, NULL );
173 fprintf(stderr,
"RSA driver is no longer supported and is replaced by the HB driver\n");
174 pastix_attr_fallthrough;
177 *driver = SpmDriverHB;
178 *filename = strdup( optarg );
182 *driver = SpmDriverIJV;
183 *filename = strdup( optarg );
187 *driver = SpmDriverMM;
188 *filename = strdup( optarg );
192 *driver = SpmDriverSPM;
193 *filename = strdup( optarg );
197 *driver = SpmDriverLaplacian;
198 *filename = strdup( optarg );
202 *driver = SpmDriverXLaplacian;
203 *filename = strdup( optarg );
207 *driver = SpmDriverGraph;
208 *filename = strdup( optarg );
212 int scattervalue = atoi( optarg );
213 if ( (scattervalue >= 0) && (scattervalue < 6) ) {
214 if ( scatter != NULL ) {
215 *scatter = scattervalue;
219 fprintf(stderr,
"\nInvalid value for scatter option: %s\n\n", optarg);
229 if (strncasecmp(optarg,
"scotch", 6) == 0)
233 else if (strncasecmp(optarg,
"metis", 5) == 0)
237 else if (strncasecmp(optarg,
"ptscotch", 8) == 0)
241 else if (strncasecmp(optarg,
"parmetis", 8) == 0)
245 else if (strncasecmp(optarg,
"personal", 8) == 0)
250 fprintf(stderr,
"\nInvalid value for ordering option: %s\n\n", optarg);
256 int factotype = atoi( optarg );
257 if ( (factotype >= 0) && (factotype <= 4)){
261 fprintf(stderr,
"\nInvalid value for factorization option: %s\n\n", optarg);
268 int checkvalue = atoi( optarg );
269 if ( (checkvalue >= 0) && (checkvalue < 6) ) {
270 if ( check != NULL ) {
275 fprintf(stderr,
"\nInvalid value for check option: %s\n\n", optarg);
282 int schedtype = atoi( optarg );
283 if ( (schedtype >= 0) && (schedtype <= 4) ){
287 fprintf(stderr,
"\nInvalid value for scheduler option: %s\n\n", optarg);
299 iparm_idx = parse_iparm( optarg );
301 fprintf(stderr,
"\n%s is not a correct iparm parameter\n\n", optarg );
306 iparm_val = parse_enums( argv[optind] );
307 if ( iparm_val == -1 ){
308 fprintf(stderr,
"\n%s is not a correct value for the iparm parameters\n\n", argv[optind] );
311 iparam[iparm_idx] = iparm_val;
321 dparm_idx = parse_dparm( optarg );
323 fprintf(stderr,
"\n%s is not a correct dparm parameter\n\n", optarg );
328 dparm_val = atof( argv[optind] );
329 dparam[dparm_idx] = dparm_val;
342 fprintf(stderr,
"\nOption %c is missing an argument\n\n", c );
static void pastix_usage(void)
Print default usage for PaStiX binaries.
#define GETOPT_STRING
Define the options and their requirement used by PaStiX.
BEGIN_C_DECLS enum pastix_iparm_e pastix_iparm_t
Integer parameters.
enum pastix_dparm_e pastix_dparm_t
Float parameters.
void pastixGetOptions(int argc, char **argv, pastix_int_t *iparam, double *dparam, int *check, int *scatter, spm_driver_t *driver, char **filename)
PaStiX helper function to read command line options in examples.