• 大小: 1.74MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-16
  • 语言: 其他
  • 标签: 并行计算  

资源简介

MPI与OpenMP的一些并行计算代码和实验报告

资源截图

代码片段和文件信息

#include
#include“mpi.h“

int main(int argc char** argv)
{
        int taskid ntasks;
        int ierr;
        MPI_Init(&argc &argv);
        MPI_Comm_rank(MPI_COMM_WORLD &taskid);
        MPI_Comm_size(MPI_COMM_WORLD &ntasks);

        if(taskid == 0) { printf(“\n\n“); }
        ierr = MPI_Barrier(MPI_COMM_WORLD);
        if(taskid == 0) { printf(“一“); fflush(stdout);}
        if(taskid == 1) { printf(“二“); fflush(stdout);}
        if(taskid == 2) { printf(“三“); fflush(stdout);}
        if(taskid == 3) { printf(“四“); fflush(stdout);}

        ierr = MPI_Barrier(MPI_COMM_WORLD);
        if(taskid == 0) { printf(“ (无序)\n“); fflush(stdout);}
        if(taskid == 0) { printf(“一“); fflush(stdout);}
        ierr = MPI_Barrier(MPI_COMM_WORLD);

        if(taskid == 1) { printf(“二“); fflush(stdout);}
        ierr = MPI_Barrier(MPI_COMM_WORLD);

        if(taskid == 2) { printf(“三“); fflush(stdout);}
        ierr = MPI_Barrier(MPI_COMM_WORLD);

        if(taskid == 3) { printf(“四“); fflush(stdout);}
        ierr = MPI_Barrier(MPI_COMM_WORLD);

        if(taskid == 0) { printf(“ (有序)\n\n“);}
        MPI_Finalize();
        return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    2001000  2016-12-20 19:06  源程序\MPI\a.txt

     文件    2001000  2016-12-20 19:07  源程序\MPI\b.txt

     文件       1183  2016-12-23 22:22  源程序\MPI\barrier.c

     文件       2956  2016-12-25 20:25  源程序\MPI\jacobi.c

     文件        472  2016-12-20 15:03  源程序\MPI\MPI_hello.c

     文件        977  2016-12-21 16:58  源程序\MPI\MPI_pi.c

     文件    3890362  2016-12-24 12:41  源程序\MPI\num.txt

     文件       5204  2016-12-24 12:05  源程序\MPI\sort.c

     文件        224  2016-12-24 12:40  源程序\MPI\创建num.c

     文件        212  2016-12-18 20:48  源程序\MPI\创建矩阵.c

     文件       3827  2016-12-23 22:41  源程序\MPI\矩阵乘.c

     文件        393  2016-12-19 21:38  源程序\openmp\mphello.c

     文件        432  2016-12-19 16:23  源程序\openmp\积分求pi.c

     文件        834  2016-12-24 13:32  源程序\openmp\蒙特卡洛求pi.c

     文件     356352  2016-12-25 17:10  MPI实验报告.doc

     文件     138752  2016-12-25 20:20  OpenMP多线程编程实验.doc

    ..AD...         0  2016-12-26 14:02  源程序\MPI

    ..AD...         0  2016-12-26 14:02  源程序\openmp

    ..AD...         0  2016-12-26 14:02  源程序

----------- ---------  ---------- -----  ----

              8404180                    19


评论

共有 条评论