vec_slave.c

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· C语言 代码 · 共 36 行

C
36
字号
#include "p4.h"#include "sr_user.h"    slave()	{    int nslaves;    int done;    int type, from, size;    int next;    int my_id;    char *incoming;        my_id = p4_get_my_id();    nslaves = p4_num_total_ids() - 1;        if (my_id == nslaves)        next = 0;    else	next = my_id + 1;        done = FALSE;    while (!done)    {	type = -1;	from = -1;	incoming = NULL;	p4_recv(&type,&from, &incoming, &size);	p4_sendx(type, next, incoming, size, P4INT);	if (type == END)	    done = TRUE;	p4_msg_free(incoming);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?