资源简介
实用与linux版,并行运算,稳定版本,希望对大家有所帮助。
代码片段和文件信息
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2001 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include
#include “mpi.h“
int main( int argc char *argv[] )
{
MPI_Comm intercomm;
char str[10];
int err rank;
MPI_Init(&argc &argv);
MPI_Comm_rank(MPI_COMM_WORLD &rank);
MPI_Comm_get_parent(&intercomm);
if (rank == 3){
err = MPI_Send(“hi“ 3 MPI_CHAR 3 0 intercomm);
err = MPI_Recv(str 4 MPI_CHAR 3 0 intercomm MPI_STATUS_IGNORE);
printf(“Child received from parent: %s\n“ str);
fflush(stdout);
}
MPI_Finalize();
return 0;
}
- 上一篇:中科大数据库实验
- 下一篇:VHDL 16位CPU
评论
共有 条评论