Skip to content

Commit

Permalink
Merge Pull Request #4214 from trilinos/Trilinos/zoltan2_smallMJChanges
Browse files Browse the repository at this point in the history
Automatically Merged using Trilinos Pull Request AutoTester
PR Title: Zoltan2:  Corrected variable types in MJ
PR Author: kddevin
  • Loading branch information
trilinos-autotester authored Jan 18, 2019
2 parents 72efa87 + 0c080ed commit 28ff0df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
#define ZOLTAN2_ABS(x) ((x) >= 0 ? (x) : -(x))
//imbalance calculation. Wreal / Wexpected - 1
#define imbalanceOf(Wachieved, totalW, expectedRatio) \
(Wachieved) / ((totalW) * (expectedRatio)) - 1
double(Wachieved) / double((totalW) * (expectedRatio)) - 1
#define imbalanceOf2(Wachieved, wExpected) \
(Wachieved) / (wExpected) - 1
double(Wachieved) / double(wExpected) - 1


#define ZOLTAN2_ALGMULTIJAGGED_SWAP(a,b,temp) temp=(a);(a)=(b);(b)=temp;
Expand Down Expand Up @@ -580,7 +580,7 @@ class AlgMJ
int check_migrate_avoid_migration_option; //whether to migrate=1, avoid migrate=2, or leave decision to MJ=0
int migration_type; // when doing the migration, 0 will aim for perfect load-imbalance,
//1 - will aim for minimized number of messages with possibly bad load-imbalance
mj_scalar_t minimum_migration_imbalance; //when MJ decides whether to migrate, the minimum imbalance for migration.
double minimum_migration_imbalance; //when MJ decides whether to migrate, the minimum imbalance for migration.
int num_threads; //num threads

mj_part_t total_num_cut ; //how many cuts will be totally
Expand Down Expand Up @@ -817,7 +817,7 @@ class AlgMJ
*/
void mj_1D_part(
mj_scalar_t *mj_current_dim_coords,
mj_scalar_t imbalanceTolerance,
double imbalanceTolerance,
mj_part_t current_work_part,
mj_part_t current_concurrent_num_parts,
mj_scalar_t *current_cut_coordinates,
Expand Down Expand Up @@ -905,7 +905,7 @@ class AlgMJ
const mj_scalar_t &max_coordinate,
const mj_scalar_t &min_coordinate,
const mj_scalar_t &global_total_weight,
const mj_scalar_t &used_imbalance_tolerance,
const double &used_imbalance_tolerance,
mj_scalar_t * current_global_part_weights,
const mj_scalar_t * current_local_part_weights,
const mj_scalar_t *current_part_target_weights,
Expand Down Expand Up @@ -1312,7 +1312,7 @@ class AlgMJ
bool distribute_points_on_cut_lines_,
int max_concurrent_part_calculation_,
int check_migrate_avoid_migration_option_,
mj_scalar_t minimum_migration_imbalance_, int migration_type_ = 0);
double minimum_migration_imbalance_, int migration_type_ = 0);
/*! \brief Function call, if the part boxes are intended to be kept.
*
*/
Expand Down Expand Up @@ -1737,7 +1737,7 @@ void AlgMJ<mj_scalar_t, mj_lno_t, mj_gno_t, mj_part_t>::sequential_task_partitio
}

//used imbalance, it is always 0, as it is difficult to estimate a range.
mj_scalar_t used_imbalance = 0;
double used_imbalance = 0;


// Determine cut lines for k parts here.
Expand Down Expand Up @@ -2814,7 +2814,7 @@ template <typename mj_scalar_t, typename mj_lno_t, typename mj_gno_t,
typename mj_part_t>
void AlgMJ<mj_scalar_t, mj_lno_t, mj_gno_t, mj_part_t>::mj_1D_part(
mj_scalar_t *mj_current_dim_coords,
mj_scalar_t used_imbalance_tolerance,
double used_imbalance_tolerance,
mj_part_t current_work_part,
mj_part_t current_concurrent_num_parts,
mj_scalar_t *current_cut_coordinates,
Expand Down Expand Up @@ -3713,7 +3713,7 @@ void AlgMJ<mj_scalar_t, mj_lno_t, mj_gno_t, mj_part_t>::mj_get_new_cut_coordinat
const mj_scalar_t &max_coordinate,
const mj_scalar_t &min_coordinate,
const mj_scalar_t &global_total_weight,
const mj_scalar_t &used_imbalance_tolerance,
const double &used_imbalance_tolerance,
mj_scalar_t * current_global_part_weights,
const mj_scalar_t * current_local_part_weights,
const mj_scalar_t *current_part_target_weights,
Expand All @@ -3735,7 +3735,7 @@ void AlgMJ<mj_scalar_t, mj_lno_t, mj_gno_t, mj_part_t>::mj_get_new_cut_coordinat
//expected weight for part.
mj_scalar_t expected_weight_in_part = 0;
//imbalance for the left and right side of the cut.
mj_scalar_t imbalance_on_left = 0, imbalance_on_right = 0;
double imbalance_on_left = 0, imbalance_on_right = 0;


#ifdef HAVE_ZOLTAN2_OMP
Expand Down Expand Up @@ -5914,7 +5914,7 @@ void AlgMJ<mj_scalar_t, mj_lno_t, mj_gno_t, mj_part_t>::set_partitioning_paramet
bool distribute_points_on_cut_lines_,
int max_concurrent_part_calculation_,
int check_migrate_avoid_migration_option_,
mj_scalar_t minimum_migration_imbalance_,
double minimum_migration_imbalance_,
int migration_type_ ){
this->distribute_points_on_cut_lines = distribute_points_on_cut_lines_;
this->max_concurrent_part_calculation = max_concurrent_part_calculation_;
Expand Down Expand Up @@ -6293,7 +6293,7 @@ void AlgMJ<mj_scalar_t, mj_lno_t, mj_gno_t, mj_part_t>::multi_jagged_part(

//used imbalance, it is always 0, as it is difficult to
//estimate a range.
mj_scalar_t used_imbalance = 0;
double used_imbalance = 0;


// Determine cut lines for all concurrent parts parts here.
Expand Down Expand Up @@ -6542,7 +6542,7 @@ class Zoltan2_AlgMJ : public Algorithm<Adapter>
int check_migrate_avoid_migration_option; //whether to migrate=1, avoid migrate=2, or leave decision to MJ=0
int migration_type; // when doing the migration, 0 will aim for perfect load-imbalance,
//1 for minimized messages
mj_scalar_t minimum_migration_imbalance; //when MJ decides whether to migrate, the minimum imbalance for migration.
double minimum_migration_imbalance; //when MJ decides whether to migrate, the minimum imbalance for migration.
bool mj_keep_part_boxes; //if the boxes need to be kept.

int num_threads;
Expand Down
22 changes: 16 additions & 6 deletions packages/zoltan2/test/partition/MultiJaggedTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,8 @@ int GeometricGenInterface(RCP<const Teuchos::Comm<int> > &comm,
int migration_doMigration_type,
bool test_boxes,
bool rectilinear,
int mj_premigration_option
int mj_premigration_option,
int mj_premigration_coordinate_cutoff
)
{
int ierr = 0;
Expand Down Expand Up @@ -654,6 +655,10 @@ int GeometricGenInterface(RCP<const Teuchos::Comm<int> > &comm,
if(imbalance > 1)
params->set("imbalance_tolerance", double(imbalance));
params->set("mj_premigration_option", mj_premigration_option);
if (mj_premigration_coordinate_cutoff > 0){
params->set("mj_premigration_coordinate_count",
mj_premigration_coordinate_cutoff);
}

if(pqParts != "")
params->set("mj_parts", pqParts);
Expand Down Expand Up @@ -783,7 +788,8 @@ int testFromDataFile(
double (migration_imbalance_cut_off));
}
if (mj_premigration_coordinate_cutoff > 0){
params->set("mj_premigration_coordinate_count", mj_premigration_coordinate_cutoff);
params->set("mj_premigration_coordinate_count",
mj_premigration_coordinate_cutoff);
}

Zoltan2::PartitioningProblem<inputAdapter_t> *problem;
Expand Down Expand Up @@ -1333,7 +1339,8 @@ int main(int narg, char *arg[])
migration_processor_assignment_type,
migration_doMigration_type,
test_boxes,
rectilinear, mj_premigration_option, mj_premigration_coordinate_cutoff);
rectilinear,
mj_premigration_option, mj_premigration_coordinate_cutoff);
}
catch(std::string s){
if(tcomm->getRank() == 0){
Expand All @@ -1360,7 +1367,8 @@ int main(int narg, char *arg[])
migration_all_to_all_type,
migration_imbalance_cut_off,
migration_processor_assignment_type,
migration_doMigration_type, test_boxes, rectilinear, mj_premigration_option, mj_premigration_coordinate_cutoff);
migration_doMigration_type, test_boxes, rectilinear,
mj_premigration_option, mj_premigration_coordinate_cutoff);
break;
#ifdef hopper_separate_test
case 1:
Expand All @@ -1370,7 +1378,8 @@ int main(int narg, char *arg[])
migration_all_to_all_type,
migration_imbalance_cut_off,
migration_processor_assignment_type,
migration_doMigration_type, test_boxes, rectilinear, mj_premigration_option);
migration_doMigration_type, test_boxes, rectilinear,
mj_premigration_option);
break;
#endif
default:
Expand All @@ -1380,7 +1389,8 @@ int main(int narg, char *arg[])
migration_all_to_all_type,
migration_imbalance_cut_off,
migration_processor_assignment_type,
migration_doMigration_type, test_boxes, rectilinear, mj_premigration_option);
migration_doMigration_type, test_boxes, rectilinear,
mj_premigration_option, mj_premigration_coordinate_cutoff);
break;
}

Expand Down

0 comments on commit 28ff0df

Please sign in to comment.