Why does MPI_Init accept pointers to argc and argv?

后端 未结 5 895
深忆病人
深忆病人 2021-01-01 11:12

this is how we use MPI_Init function

int main(int argc, char **argv)
{
    MPI_Init(&argc, &argv);
…
}

why does MPI_Init use pointe

5条回答
  •  佛祖请我去吃肉
    2021-01-01 11:50

    I'm not an expert but I believe the simple answer is that each node that you're working with is working with its own copy of the code. Passing these arguments allows each of the nodes to have access to argc and argv even though they were not passed them through the command line interface. The original or master node that calls MPI_Init is passed these arguments. MPI_Init allows the other nodes to access them as well.

提交回复
热议问题