| 108 | } |
| 109 | |
| 110 | void parallel_mh_async::initialize(PartitionConfig & working_config, graph_access & G) { |
| 111 | // each PE performs a partitioning |
| 112 | // estimate the runtime of a partitioner call |
| 113 | // calculate the poolsize and async Bcast the poolsize. |
| 114 | // recv. has to be sync |
| 115 | Individuum first_one; |
| 116 | m_t.restart(); |
| 117 | if( !working_config.mh_easy_construction) { |
| 118 | m_island->createIndividuum( working_config, G, first_one, true); |
| 119 | } else { |
| 120 | construct_partition cp; |
| 121 | cp.createIndividuum( working_config, G, first_one, true); |
| 122 | std::cout << "created with objective " << first_one.objective << std::endl; |
| 123 | } |
| 124 | |
| 125 | double time_spend = m_t.elapsed(); |
| 126 | m_island->insert(G, first_one); |
| 127 | |
| 128 | //compute S and Bcast |
| 129 | int population_size = 1; |
| 130 | double fraction = working_config.mh_initial_population_fraction; |
| 131 | int POPSIZE_TAG = 10; |
| 132 | |
| 133 | if( m_rank == ROOT ) { |
| 134 | double fraction_to_spend_for_IP = (double)m_time_limit / fraction; |
| 135 | population_size = ceil(fraction_to_spend_for_IP / time_spend); |
| 136 | |
| 137 | for( int target = 1; target < m_size; target++) { |
| 138 | MPI_Request rq; |
| 139 | MPI_Isend(&population_size, 1, MPI_INT, target, POPSIZE_TAG, m_communicator, &rq); |
| 140 | } |
| 141 | } else { |
| 142 | MPI_Status rst; |
| 143 | MPI_Recv(&population_size, 1, MPI_INT, ROOT, POPSIZE_TAG, m_communicator, &rst); |
| 144 | } |
| 145 | |
| 146 | MPI_Barrier(MPI_COMM_WORLD); |
| 147 | |
| 148 | population_size = std::max(3, population_size); |
| 149 | if(working_config.mh_easy_construction) { |
| 150 | population_size = std::min(50, population_size); |
| 151 | } else { |
| 152 | population_size = std::min(100, population_size); |
| 153 | } |
| 154 | std::cout << "poolsize = " << population_size << std::endl; |
| 155 | |
| 156 | //set S |
| 157 | m_island->set_pool_size(population_size); |
| 158 | working_config.mh_pool_size = population_size; |
| 159 | |
| 160 | } |
| 161 | |
| 162 | EdgeWeight parallel_mh_async::collect_best_partitioning(graph_access & G, const PartitionConfig & config) { |
| 163 | //perform partitioning locally |
nothing calls this directly
no test coverage detected