Commit 7c46a9a1 authored by Robert Ricci's avatar Robert Ricci

New convention for assign - debugging information goes to stderr,

everything else goes to stdout. This will hopefully make things a bit
simpler by avoiding funny buffering issues for programs like
assign_wrapper that want to redirect assign's stdout.
parent 759c8c83
......@@ -302,13 +302,13 @@ void anneal(bool scoring_selftest, double scale_neighborhood)
for (name_name_map::iterator fixed_it=fixed_nodes.begin();
fixed_it!=fixed_nodes.end();++fixed_it) {
if (vname2vertex.find((*fixed_it).first) == vname2vertex.end()) {
cerr << "Fixed node: " << (*fixed_it).first <<
cout << "Fixed node: " << (*fixed_it).first <<
"does not exist." << endl;
exit(2);
}
vvertex vv = vname2vertex[(*fixed_it).first];
if (pname2vertex.find((*fixed_it).second) == pname2vertex.end()) {
cerr << "Fixed node: " << (*fixed_it).second <<
cout << "Fixed node: " << (*fixed_it).second <<
" not available." << endl;
exit(2);
}
......@@ -316,11 +316,11 @@ void anneal(bool scoring_selftest, double scale_neighborhood)
tb_vnode *vn = get(vvertex_pmap,vv);
tb_pnode *pn = get(pvertex_pmap,pv);
if (vn->vclass != NULL) {
cerr << "Can not have fixed nodes be in a vclass!.\n";
cout << "Can not have fixed nodes be in a vclass!.\n";
exit(2);
}
if (add_node(vv,pv,false,false) == 1) {
cerr << "Fixed node: Could not map " << vn->name <<
cout << "Fixed node: Could not map " << vn->name <<
" to " << pn->name << endl;
exit(2);
}
......@@ -494,7 +494,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood)
if (choice >= 0) {
vv = virtual_nodes[choice];
} else {
cerr << "**** Error, unable to find any non-fixed nodes" << endl;
cout << "**** Error, unable to find any non-fixed nodes" << endl;
goto DONE;
}
}
......@@ -979,7 +979,7 @@ NOTQUITEDONE:
// Check to make sure that our 'clean' solution scores the same as
// the initial score - if not, that indicates a bug
if (!compare_scores(get_score(),initial_score)) {
cerr << "*** WARNING: 'Clean' score does not match initial score" <<
cout << "*** WARNING: 'Clean' score does not match initial score" <<
endl << " This indicates a bug - contact the operators" <<
endl << " (initial score: " << initial_score <<
", current score: " << get_score() << ")" << endl;
......@@ -988,7 +988,7 @@ NOTQUITEDONE:
pclass_list::iterator pit = pclasses.begin();
for (;pit != pclasses.end();pit++) {
if ((*pit)->used_members != 0) {
cerr << (*pit)->name << " is " << (*pit)->used_members
cout << (*pit)->name << " is " << (*pit)->used_members
<< "% used" << endl;
}
}
......
......@@ -131,7 +131,7 @@ void read_physical_topology(char *filename)
ifstream ptopfile;
ptopfile.open(filename);
if (!ptopfile.is_open()) {
cerr << "Unable to open ptop file " << filename << endl;
cout << "Unable to open ptop file " << filename << endl;
exit(2);
}
cout << "Physical Graph: " << parse_ptop(PG,SG,ptopfile) << endl;
......@@ -240,7 +240,7 @@ void read_virtual_topology(char *filename)
ifstream topfile;
topfile.open(filename);
if (!topfile.is_open()) {
cerr << "Unable to open top file " << filename << endl;
cout << "Unable to open top file " << filename << endl;
exit(2);
}
cout << "Virtual Graph: " << parse_top(VG,topfile) << endl;
......@@ -297,23 +297,23 @@ void prune_unusable_pclasses() {
void print_help()
{
cerr << "assign [options] ptopfile topfile [config params]" << endl;
cerr << "Options: " << endl;
cout << "assign [options] ptopfile topfile [config params]" << endl;
cout << "Options: " << endl;
#ifdef TIME_TERMINATE
cerr << " -l <time> - Limit runtime." << endl;
cout << " -l <time> - Limit runtime." << endl;
#endif
cerr << " -s <seed> - Set the seed." << endl;
cerr << " -v <viz> - Produce graphviz files with given prefix." <<
cout << " -s <seed> - Set the seed." << endl;
cout << " -v <viz> - Produce graphviz files with given prefix." <<
endl;
cerr << " -r - Don't allow trivial links." << endl;
cerr << " -p - Disable pclasses." << endl;
cerr << " -d - Enable dynamic pclasses." << endl;
cout << " -r - Don't allow trivial links." << endl;
cout << " -p - Disable pclasses." << endl;
cout << " -d - Enable dynamic pclasses." << endl;
#ifdef PER_VNODE_TT
cerr << " -P - Prune unusable pclasses." << endl;
cout << " -P - Prune unusable pclasses." << endl;
#endif
cerr << " -T - Doing some scoring self-testing." << endl;
cerr << " -H <float> - Try <float> times harder." << endl;
cerr << " -o - Allow overloaded pnodes to be considered." << endl;
cout << " -T - Doing some scoring self-testing." << endl;
cout << " -H <float> - Try <float> times harder." << endl;
cout << " -o - Allow overloaded pnodes to be considered." << endl;
exit(2);
}
......@@ -559,7 +559,7 @@ int mapping_precheck() {
// Signal handler - add a convneint way to kill assign and make it return an
// unretryable error
void exit_unretryable(int signal) {
cerr << "Killed with signal " << signal << " - exiting!" << endl;
cout << "Killed with signal " << signal << " - exiting!" << endl;
_exit(2);
}
......@@ -722,11 +722,11 @@ int main(int argc,char **argv)
#endif
if ((!compare_scores(get_score(),absbest)) || (violated > absbestviolated)) {
cerr << "Internal error: Invalid migration assumptions." << endl;
cerr << "score:" << get_score() << " absbest:" << absbest <<
cout << "Internal error: Invalid migration assumptions." << endl;
cout << "score:" << get_score() << " absbest:" << absbest <<
" violated:" << violated << " absbestviolated:" <<
absbestviolated << endl;
cerr << " Contact calfeld" << endl;
cout << " Contact calfeld" << endl;
}
cout << " BEST SCORE: " << get_score() << " in " << iters <<
......
......@@ -31,8 +31,8 @@ using namespace boost;
extern name_pvertex_map pname2vertex;
extern name_count_map ptypes;
#define ptop_error(s) errors++;cerr << "PTOP:" << line << ": " << s << endl
#define ptop_error_noline(s) errors++;cerr << "PTOP: " << s << endl
#define ptop_error(s) errors++;cout << "PTOP:" << line << ": " << s << endl
#define ptop_error_noline(s) errors++;cout << "PTOP: " << s << endl
// Used to do late binding of subnode names to pnodes, so that we're no
// dependant on their ordering in the ptop file, which can be annoying to get
......
......@@ -34,8 +34,8 @@ extern name_count_map vtypes;
extern name_list_map vclasses;
extern vvertex_vector virtual_nodes;
#define top_error(s) errors++;cerr << "TOP:" << line << ": " << s << endl
#define top_error_noline(s) errors++;cerr << "TOP: " << s << endl
#define top_error(s) errors++;cout << "TOP:" << line << ": " << s << endl
#define top_error_noline(s) errors++;cout << "TOP: " << s << endl
// Used to do late binding of subnode names to vnodes, so that we're no
// dependant on their ordering in the top file, which can be annoying to get
......
......@@ -538,7 +538,7 @@ void score_link_info(vedge ve, tb_pnode *src_pnode, tb_pnode *dst_pnode, tb_vnod
break;
#endif
case tb_link_info::LINK_UNKNOWN:
cerr << "Internal error: Should not be here either." << endl;
cout << "Internal error: Should not be here either." << endl;
exit(1);
break;
}
......@@ -1543,7 +1543,7 @@ double fd_score(tb_vnode *vnode,tb_pnode *pnode,int &fd_violated,
break;
default:
// Global features are required to have some kind of type
cerr << "Bad global feature " << (*feature_it).first << endl;
cout << "Bad global feature " << (*feature_it).first << endl;
exit(2);
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment