![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MPI并行程序设计
日出前的千夜
半路出家小萌新
展开
-
mpi并行程序设计:快速输出1~10000内的所有素数
原理:将1~10000的数轮流分配给各个进程检查是否为素数,并返回给主进程输出。 代码: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <mpi.h> /* For MPI functions, etc */ #include <math.h> void Read_n(int* n_p, int my_rank, int comm_sz, MPI原创 2020-10-09 16:55:59 · 742 阅读 · 0 评论 -
mpi并行程序设计:快速计算两个多项式的乘积
#include <stdio.h> #include <stdlib.h> #include <mpi.h> void Read_vector(double *vector, int n, int my_rank, MPI_Comm comm); void Read_n(int *n, int my_rank, MPI_Comm comm); void Parallel_poly_mult(double *poly_x, int dim_x, double *pol原创 2020-10-09 17:05:13 · 340 阅读 · 0 评论