C++
c plus plus
倪氏小峰
这个作者很懒,什么都没留下…
展开
-
MPI实现并行快排2^n个进程
// 并行快排 2的n次方个进程 // n = 4, 8, 16时为什么问题,n再大时,数据量要改大点,不然有问题 // 至于为什么,不知道,有空再看 #include <iostream> #include <algorithm> #include <time.h> #include <mpi.h> using namespace std; const int TOTAL_SIZE = 2000; int original[TOTAL_SIZE], s原创 2021-12-22 13:14:59 · 196 阅读 · 0 评论 -
MPI 实现并行快排
主从模式,0号进程是主人,1-4号进程是工人 // 4 个进程的快速排序 // 运行时输入 mpiexec -n 5 name #include <iostream> #include <algorithm> #include <time.h> #include <mpi.h> using namespace std; const int TOTAL_SIZE = 1000; int original[TOTAL_SIZE], sorted[TOTAL_S原创 2021-12-22 13:10:38 · 1192 阅读 · 0 评论