int Zoltan_Oct_Set_Param( char *name, /* name of variable */ char *val /* value of variable */ ) { int status; PARAM_UTYPE result; /* value returned from Zoltan_Check_Param */ int index; /* index returned from Zoltan_Check_Param */ status = Zoltan_Check_Param(name, val, OCT_params, &result, &index); return(status); }
int Zoltan_Set_Machine_Param( char *name, /* name of variable */ char *val) /* value of variable */ { int status; PARAM_UTYPE result; /* value returned from Check_Param */ int index; /* index returned from Check_Param */ status = Zoltan_Check_Param(name, val, Mach_params, &result, &index); return(status); }
int Zoltan_Set_Timer_Param( const char *name, /* input: name of variable */ const char *val, /* input: value of variable */ int *timer) /* output: timer type */ { PARAM_UTYPE result; /* value returned from Check_Param */ int index; /* index returned from Check_Param */ int status; PARAM_VARS Timer_params[] = { { "TIMER", NULL, "STRING", 0 }, { NULL, NULL, NULL, 0 } }; char *yo = "Zoltan_Set_Timer_Param"; (*timer) = ZOLTAN_TIME_WALL; /* default timer value */ status = Zoltan_Check_Param(name, val, Timer_params, &result, &index); if (status == 0 && index == 0) { if (!strcmp(result.sval, "WALL")) (*timer) = ZOLTAN_TIME_WALL; else if (strcmp(result.sval, "CPU")==0) { (*timer) = ZOLTAN_TIME_CPU; } else if (strcmp(result.sval, "USER")==0){ #ifndef NO_TIMES (*timer) = ZOLTAN_TIME_USER; #else ZOLTAN_PRINT_WARN(-1, yo, "User time not available;" " CPU clock time will be used instead."); (*timer) = ZOLTAN_TIME_CPU; #endif } else{ char msg[256]; sprintf(msg, "Unknown timer option %s.", result.sval); ZOLTAN_PRINT_WARN(-1, yo, msg); status = 2; /* Illegal parameter */ } } return(status); }
int Zoltan_Random_Set_Param( char *name, /* name of variable */ char *val) /* value of variable */ { int status, index; PARAM_UTYPE result; double f; status = Zoltan_Check_Param(name, val, Random_params, &result, &index); if (status == 0){ /* OK so far, do sanity check of parameter values */ if (strcmp(name, "RANDOM_MOVE_FRACTION") == 0){ f = atof(val); if ((f < 0.0) || (f > 1.0)) status = 2; } } return(status); }
int Zoltan_Set_Key_Param( ZZ *zz, /* Zoltan structure */ const char *name, /* name of variable */ const char *val, /* value of variable */ int idx /* index of vector param, -1 if scalar */ ) { char *yo = "Zoltan_Set_Key_Param"; char msg[256]; int status; /* return code */ PARAM_UTYPE result; /* value returned from Check_Param */ int index; /* index returned from Check_Param */ int tmp; int export, import; status = Zoltan_Check_Param(name, val, Key_params, &result, &index); if (status == 0) { switch (index) { case 0: /* Imbalance_Tol */ if (result.def) result.fval = ZOLTAN_LB_IMBALANCE_TOL_DEF; if (result.fval < 1.0) { sprintf(msg, "Invalid Imbalance_Tol value (%g) " "being set to %g.", result.fval, ZOLTAN_LB_IMBALANCE_TOL_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.fval = ZOLTAN_LB_IMBALANCE_TOL_DEF; } if (idx > zz->Obj_Weight_Dim){ sprintf(msg, "Imbalance_Tol index %d > Obj_Weight_Dim = %d\n", idx, zz->Obj_Weight_Dim); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); } else if (idx < -1){ sprintf(msg, "Invalid Imbalance_Tol index %d\n", idx); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); } else if (idx == -1){ /* Set all entries to the same value. */ for (idx=0; idx<zz->LB.Imb_Tol_Len; idx++) zz->LB.Imbalance_Tol[idx] = result.fval; } else zz->LB.Imbalance_Tol[idx] = result.fval; status = 3; /* Don't add to Params field of ZZ */ break; case 1: /* Help_Migrate */ if (result.def) result.ival = ZOLTAN_AUTO_MIGRATE_DEF; zz->Migrate.Auto_Migrate = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 2: /* Object weight dim. */ if (result.def) result.ival = ZOLTAN_OBJ_WEIGHT_DEF; if (result.ival < 0) { sprintf(msg, "Invalid Obj_Weight_Dim value (%d) " "being set to %d.", result.ival, ZOLTAN_OBJ_WEIGHT_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_OBJ_WEIGHT_DEF; } zz->Obj_Weight_Dim = result.ival; if (zz->Obj_Weight_Dim > zz->LB.Imb_Tol_Len){ /* Resize and reallocate Imb_Tol. */ zz->LB.Imb_Tol_Len += 10; zz->LB.Imbalance_Tol = (float *) ZOLTAN_REALLOC(zz->LB.Imbalance_Tol, zz->LB.Imb_Tol_Len * sizeof(float)); } status = 3; /* Don't add to Params field of ZZ */ break; case 3: /* Edge weight dim. */ case 13: if (result.def) result.ival = ZOLTAN_EDGE_WEIGHT_DEF; if (result.ival < 0) { sprintf(msg, "Invalid Edge_Weight_Dim value (%d) " "being set to %d.", result.ival, ZOLTAN_EDGE_WEIGHT_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_EDGE_WEIGHT_DEF; } zz->Edge_Weight_Dim = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 4: /* Debug level */ if (result.def) result.ival = ZOLTAN_DEBUG_LEVEL_DEF; if (result.ival < 0) { sprintf(msg, "Invalid Debug_Level value (%d) " "being set to %d.", result.ival, ZOLTAN_DEBUG_LEVEL_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_DEBUG_LEVEL_DEF; } zz->Debug_Level = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 5: /* Debug processor */ if (result.def) result.ival = ZOLTAN_DEBUG_PROC_DEF; if (result.ival < 0 || result.ival > zz->Num_Proc) { sprintf(msg, "Invalid Debug_Processor value (%d) " "being set to %d.", result.ival, ZOLTAN_DEBUG_PROC_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_DEBUG_PROC_DEF; } zz->Debug_Proc = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 6: /* Deterministic flag */ if (result.def) result.ival = ZOLTAN_DETERMINISTIC_DEF; if (result.ival < 0) { sprintf(msg, "Invalid Deterministic value (%d) " "being set to %d.", result.ival, ZOLTAN_DETERMINISTIC_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_DETERMINISTIC_DEF; } zz->Deterministic = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 7: /* Timer */ status = Zoltan_Set_Timer_Param(name, val, &tmp); zz->Timer = tmp; Zoltan_Timer_ChangeFlag(zz->ZTime, zz->Timer); if (status==0) status = 3; /* Don't add to Params field of ZZ */ break; case 8: /* Num_GID_Entries */ if (result.def) result.ival = ZOLTAN_NUM_ID_ENTRIES_DEF; if (result.ival < 1) { sprintf(msg, "Invalid Num_GID_Entries value (%d); " "being set to %d.", result.ival, ZOLTAN_NUM_ID_ENTRIES_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_NUM_ID_ENTRIES_DEF; } zz->Num_GID = result.ival; status = 3; break; case 9: /* Num_LID_Entries */ if (result.def) result.ival = ZOLTAN_NUM_ID_ENTRIES_DEF; if (result.ival < 0) { sprintf(msg, "Invalid Num_LID_Entries value (%d); " "being set to %d.", result.ival, ZOLTAN_NUM_ID_ENTRIES_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_NUM_ID_ENTRIES_DEF; } zz->Num_LID = result.ival; status = 3; break; case 10: /* LB.Return_Lists */ export = (strstr(result.sval, "EXPORT") != NULL); import = (strstr(result.sval, "IMPORT") != NULL); if ((export && import) || (strcmp(result.sval, "ALL") == 0)) { tmp = ZOLTAN_LB_ALL_LISTS; /* export AND import lists */ status = 3; } else if (import){ tmp = ZOLTAN_LB_IMPORT_LISTS; /* import lists */ status = 3; } else if (export){ tmp = ZOLTAN_LB_EXPORT_LISTS; /* export lists */ status = 3; } else if (strstr(result.sval, "PART")!=NULL) { /* list of every object's part assignment */ tmp = ZOLTAN_LB_COMPLETE_EXPORT_LISTS; status = 3; } else if (strcmp(result.sval, "NONE")==0) { tmp = ZOLTAN_LB_NO_LISTS; /* no lists */ status = 3; } else if (strcmp(result.sval, "CANDIDATE_LISTS")==0) { tmp = ZOLTAN_LB_CANDIDATE_LISTS; /* candidates needed in matching */ status = 3; } else{ tmp = ZOLTAN_LB_RETURN_LISTS_DEF; sprintf(msg, "Unknown return_lists option %s.", result.sval); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); status = 2; /* Illegal parameter */ } zz->LB.Return_Lists = tmp; break; case 11: /* LB_Method */ if (result.def) strcpy(result.sval, "RCB"); status = Zoltan_LB_Set_LB_Method(zz,result.sval); if (status == ZOLTAN_OK) status = 3; break; case 12: /* Tflops Special flag */ if (result.def) result.ival = ZOLTAN_TFLOPS_SPECIAL_DEF; if (result.ival < 0) { sprintf(msg, "Invalid Tflops Special value (%d) " "being set to %d.", result.ival, ZOLTAN_TFLOPS_SPECIAL_DEF); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = ZOLTAN_TFLOPS_SPECIAL_DEF; } zz->Tflops_Special = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 14: /* Num_Global_Parts */ case 15: if (result.def) result.ival = zz->Num_Proc; if (result.ival < 1) { sprintf(msg, "Invalid Num_Global_Parts value (%d); " "being set to %d.", result.ival,zz->Num_Proc); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = zz->Num_Proc; } zz->LB.Num_Global_Parts_Param = result.ival; status = 3; break; case 16: /* Num_Local_Parts */ case 17: if (result.def) result.ival = -1; if (result.ival < -1) { sprintf(msg, "Invalid Num_Local_Parts value (%d); " "being set to %d.", result.ival,-1); ZOLTAN_PRINT_WARN(zz->Proc, yo, msg); result.ival = -1; } zz->LB.Num_Local_Parts_Param = result.ival; status = 3; break; case 18: /* Migrate_Only_Proc_Changes */ if (result.def) result.ival = ZOLTAN_MIGRATE_ONLY_PROC_CHANGES_DEF; zz->Migrate.Only_Proc_Changes = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 19: /* LB.Remap */ if (result.def) result.ival = 0; zz->LB.Remap_Flag = result.ival; status = 3; /* Don't add to Params field of ZZ */ break; case 20: /* Seed */ if (result.def) result.ival = Zoltan_Seed(); zz->Seed = result.ival; Zoltan_Srand(result.ival, NULL); status = 3; break; case 21: /* LB_APPROACH */ if (result.def) strcpy(result.sval, ZOLTAN_LB_APPROACH_DEF); strcpy(zz->LB.Approach, result.sval); status = 3; break; } /* end switch (index) */