本文整理汇总了C++中Communicator::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Communicator::size方法的具体用法?C++ Communicator::size怎么用?C++ Communicator::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Communicator
的用法示例。
在下文中一共展示了Communicator::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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;
}
}
示例2: main
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;
}
示例3: nproc
// -------------------------------------------------------------
// 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);
}
}