小编卡门山*_*迪亚戈的帖子

MPI_Send(99):无效标签,值为-1

我遇到问题"MPI_Send(99):无效标签,值为-1",而我使用VS2013和MPIEXEC.exe运行以下代码.逻辑很简单,只是线程0将令牌发送给其他工作线程,然后工作线程将令牌再次重置为0.

#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
    int myid;
    int numprocs;
    int token;
    MPI_Status  status;

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &myid);

    if (numprocs == 1) {
        printf("The number of processes for this exercise must be greater than 1!\n");
    }
    else if (myid == 0) {
        /* Master process */
        int sdrID;
        int activeWorkers;

        /* set the number of activeWorkers */
        //...
        activeWorkers = 3;
            /* while there are any active workers */
            while (activeWorkers) …
Run Code Online (Sandbox Code Playgroud)

c mpi

1
推荐指数
1
解决办法
1660
查看次数

标签 统计

c ×1

mpi ×1