资源简介
基于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程序
相关资源
- 触摸屏TPC7063E与S7 300 PLC之间MPI通信实
- 西安电子科技大学 并行计算 霍红卫
- Exact Conditions of Blow-up and Global Existen
- doneex xcell compiler 2.1.2.9绿色汉化版(
- 山东大学编译原理PL/0语言 compiler实验
- 基于Spark的PSO并行计算
- 整理最全资料:并行计算大作业:矩
- 三维可压缩流场MPI+OpenMP混合并行算法
- Wind River Diab Compiler for PowerPC
- 一种并行计算通信优化策略
- MPI和CUDA在多层快速多极子中的应用
- 论文研究 - 开放性试验研究Yokukansan
- FFT并行MPI实现
- Design_compiler经典教程
- 龙书《编译原理》(Compilers:Principle
- 有限元结构分析并行计算.pdf
- 高性能并行计算.zip
- Writing A Compiler In Go.pdf
- R并行编程实战
- DFT Compiler Scan User Guide Version E-2010.12
- 并行计算——结构·算法·编程修订版
- synopsys公司的Design Compiler license生成工
- 中科院课程 高性能并行计算课件,程
- 综合与Design Compiler
- Design Compiler student guide-学习手册
- OpenCV 1.0.0 patch for ffmpeg errors
- 中科大并行计算经典课件
- 《GPU高性能计算之CUDA》书中源代码
- 陈国良并行计算机体系结构
- delphi反编译工具 Decompiler v1.1.0.194
评论
共有 条评论