int main(int argc, char** argv) { MPI_Init(&argc, &argv); Communicator world; if(world.size() == 1) { std::cerr << ">1 process please." << std::endl; return 1; } if(world.rank() == 0) { int dim_num = 6; int dim_partition_size = 2; int number_of_partitions = 8; int size = world.size() - 1; IntegratorMain::Root root; root.main(dim_num, dim_partition_size, number_of_partitions, size); MPI_Finalize(); return 0; } else { int it_max = 5; double tol = 0.000001; int dim_num = 6; int dim_partition_size = 2; int number_of_partitions = 8; int size = world.size() - 1; int i = world.rank() - 1; std::cout << "Createing Peer(" << i << "," << size << ")" << std::endl; IntegratorMain::Peer peer(i, size); peer.main(it_max, tol, dim_num, dim_partition_size, number_of_partitions); MPI_Finalize(); return 0; } }
int main(int argc, char** argv) { MPI_Init(&argc, &argv); int dim_num = 6; int dim_partition_size = 2; int number_of_partitions = 8; Communicator world; int size = world.size() - 1; IntegratorMain::Root root; root.main(dim_num, dim_partition_size, number_of_partitions, size); MPI_Finalize(); return 0; }
// ------------------------------------------------------------- // petscStorageType // ------------------------------------------------------------- /// inline MatType petscStorageType(const Communicator& comm, const Matrix::StorageType& gtype) { int nproc(comm.size()); MatType result; switch (new_type) { case (Matrix::Dense): if (nproc > 1) { new_mat_type = MATMPIDENSE; } else { new_mat_type = MATSEQDENSE; } break; case (Matrix::Sparse): if (nproc > 1) { new_mat_type = MATMPIAIJ; } else { new_mat_type = MATSEQAIJ; } break; default: BOOST_ASSERT(false); } }