I cant continue after Scanf in MPICH2

126 Views Asked by At

So I have a program which divides an array to equal arrays for slave machines. Im basicly using MPI_Scatter to do it. I have also a variable which decides what process will happen to these arrays. (like <0 - Sum> <1 - Min> <2 - Avg> <3 - Max>) So in my code in master section i have to take a number from user and send it to slaves. But after scanf program is just hanging. I am using vs 2015 and MPIEXEC wrapper.

if (MASTER == rank) //MASTER
    {
        printf("Yapilacak islem(0: Sum, 1: Min, 2: Avg, 3: Max): ");
        fflush(stdout);
        scanf_s("%d", &opID);

        ...

        for (int to = 1; to < size; to++)
        {
            MPI_Send(&opID, 1, MPI_INT, to, tag, MPI_COMM_WORLD);
        }
    }


    else //SLAVES
    {
        MPI_Recv(&opID, 1, MPI_INT, MASTER, tag, MPI_COMM_WORLD, &status);
    }

So after i enter a number it does not continue. Picture at the below.

MPIEXEC wrapper

0

There are 0 best solutions below