From c59e6d4a1d3a4b2a2e54b9d62cae57ca1da190dd Mon Sep 17 00:00:00 2001 From: Robert Ricci Date: Thu, 12 Nov 2015 21:14:58 -0700 Subject: [PATCH] Experimental PACK_TIGHT compile time option When set, the goal is to pack vnodes as tightly as possible - that is, to penalize wasted slots in assignments. One downside is that this will tend to make really lopsided mappings: eg. if you have 50 slots per pnode, and 51 vodes, you will end up mapping 50 to one and 1 to the other. The other downside is that I have not yet thought about how to balance this with link weights. --- assign/score.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assign/score.cc b/assign/score.cc index 2c3f4fd5d..901f22df9 100644 --- a/assign/score.cc +++ b/assign/score.cc @@ -1066,6 +1066,11 @@ void remove_node(vvertex vv) // we prefer to equally fill the minimum number of pnodes SSUB(SCORE_PNODE * (powf(1+ ((tr->get_current_load()+1) * 1.0)/tr->get_max_load(),2))); SADD(SCORE_PNODE * (powf(1+ tr->get_current_load() * 1.0/tr->get_max_load(),2))); +#endif +#ifdef PACK_TIGHT + // Inverse of LOAD_BALANCE + SSUB(SCORE_PNODE * (powf(((tr->get_max_load() - (tr->get_current_load()+1)) * 1.0)/tr->get_max_load(),0.5))); + SADD(SCORE_PNODE * (powf((tr->get_max_load() - tr->get_current_load()) * 1.0/tr->get_max_load(),0.5))); #endif if (pnode->total_load == 0) { // If the pnode is now free, we need to do some cleanup @@ -1466,6 +1471,10 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed, bool skip SSUB(SCORE_PNODE * (powf(1 + ((tr->get_current_load()-1) * 1.0)/tr->get_max_load(),2))); SADD(SCORE_PNODE * (powf(1 + ((tr->get_current_load()) * 1.0)/tr->get_max_load(),2))); #endif +#ifdef PACK_TIGHT + SSUB(SCORE_PNODE * (powf(((tr->get_max_load() - (tr->get_current_load()-1)) * 1.0)/tr->get_max_load(),0.5))); + SADD(SCORE_PNODE * (powf(((tr->get_max_load() - tr->get_current_load()) * 1.0)/tr->get_max_load(),0.5))); +#endif // node no longer unassigned SSUB(SCORE_UNASSIGNED); -- GitLab