资源简介
基于MPI并行计算的高斯消元法程序,一个课程设计的任务。
代码片段和文件信息
#include
#include
#include“mpi.h“
#include“stdio.h“
#include
const int rows = 3; /*the rows of matrix*/
const int cols = 3; /*the cols of matrix*/
int main(int argc char **argv)
{
int ijkmyidnumprocsanstag;
double A[rows][cols]B[cols]X[rows]AB[rows][cols+1];
int masterpro;
double buf[cols+1];
double starttimeendtime;
double tmptotaltime;
srand((unsigned int)time(NULL));
MPI_Status status;
masterpro = 0;
MPI_Init(&argc&argv);
MPI_Comm_rank(MPI_COMM_WORLD&myid);
MPI_Comm_size(MPI_COMM_WORLD&numprocs);
if (myid==0)
{
starttime = MPI_Wtime();
printf(“please input xishu“);
for(i=0;i
{
for(j=0;j
{
scanf(“%lf“&A[i][j]);
}
}
printf(“please input changshu“);
for(i=0;i
{
scanf(“%lf“&B[i]);
}
for (i=0;i
{
AB[i][cols]=B[i];
for(j=0;j
AB[i][j]=A[i][j];
}
printf(“zengguang\n“);
for(i=0;i
{
for(j=0;j
printf(“%.2f “AB[i][j]);
printf(“\n“);
}
}
int x;
double coe;
for(x=0;x
{
MPI_Bcast(&AB[x][0]cols+1MPI_DOUBLE0MPI_COMM_WORLD);
if(myid==0)
{
for(i=1;i
{
for(k=x+1+i;k
MPI_Send(&AB[k][0]cols+1MPI_DOUBLEi0MPI_COMM_WORLD);
}
for(k=x+1;k
{
coe=AB[k][x]/AB[x][x];
for(j=x;j
{
AB[k][j]-=AB[x][j]*coe;
}
}
for(i=1;i
{
for(k=x+1+i;k
{
MPI_Recv(&AB[k][0]cols+1MPI_DOUBLEi1MPI_COMM_WORLD&status);
}
}
- 上一篇:人工智能论文合集
- 下一篇:基于28027的GPIO程序
相关资源
- 编译原理语法树的实现
- DesignEmpire 公司模板
- 基于impinj的RFID的RSSI测距
- impinjSDK工作手册
- 代码+报告 MPIOpenMP混合编程解决N-Bod
- LU 分解,给出采用行连续划分方式下
- 并行计算大作业:矩阵乘法报告
- 天津大学计算机学院并行计算mpi矩阵
- TCC(Tiny C Compiler)0.9.26源码 原版和
- 天津大学《并行计算》实验指南
- 如何在超算中心使用fluent做并行计算
- 枚举排序的并行算法MPI程序实现
- Writing A Compiler In Go
- NUMECA并行计算教程
- protues中AMPIRE12864液晶数据手册及程序
- 矩阵相乘cannon算法的mpi实现
- MPI实现nbody
- nVIDIA Cg Compiler 2.0 Source
- MPI时间函数的测试
- compiler gcc5.h
- BinCompiler
- 缺少compiler-gcc5.h文件
- 实现快速排序MPI并行计算
- 并行计算_mpi编程手册完整版.pdf
- 并行计算八皇后,N皇后
- Fortran_C_NETCDF_MPI_tests.tar
- CPU GPU协同并行计算
- pthread多线程计算pi
- 旅行商问题并行实现
- Microsoft ACPI Source Language (ASL) Compi
评论
共有 条评论