| 106 | } |
| 107 | |
| 108 | void |
| 109 | DistributionMapping::Initialize () |
| 110 | { |
| 111 | if (initialized) { return; } |
| 112 | // |
| 113 | // Set defaults here!!! |
| 114 | // |
| 115 | verbose = 0; |
| 116 | sfc_threshold = 0; |
| 117 | max_efficiency = 0.9_rt; |
| 118 | node_size = 0; |
| 119 | flag_verbose_mapper = 0; |
| 120 | |
| 121 | ParmParse pp("DistributionMapping"); |
| 122 | |
| 123 | if (! pp.query("verbose", "v", verbose)) { |
| 124 | pp.add("verbose", verbose); |
| 125 | } |
| 126 | pp.query("efficiency", max_efficiency); |
| 127 | pp.query("sfc_threshold", sfc_threshold); |
| 128 | pp.query("node_size", node_size); |
| 129 | pp.query("verbose_mapper", flag_verbose_mapper); |
| 130 | |
| 131 | std::string theStrategy("SFC"); |
| 132 | |
| 133 | if (pp.query("strategy", theStrategy)) |
| 134 | { |
| 135 | if (theStrategy == "ROUNDROBIN") |
| 136 | { |
| 137 | strategy(ROUNDROBIN); |
| 138 | } |
| 139 | else if (theStrategy == "KNAPSACK") |
| 140 | { |
| 141 | strategy(KNAPSACK); |
| 142 | } |
| 143 | else if (theStrategy == "SFC") |
| 144 | { |
| 145 | strategy(SFC); |
| 146 | } |
| 147 | else if (theStrategy == "RRSFC") |
| 148 | { |
| 149 | strategy(RRSFC); |
| 150 | } |
| 151 | else |
| 152 | { |
| 153 | std::string msg("Unknown strategy: "); |
| 154 | msg += theStrategy; |
| 155 | amrex::Warning(msg.c_str()); |
| 156 | } |
| 157 | } |
| 158 | else |
| 159 | { |
| 160 | strategy(m_Strategy); // default |
| 161 | } |
| 162 | |
| 163 | amrex::ExecOnFinalize(DistributionMapping::Finalize); |
| 164 | |
| 165 | initialized = true; |