MPI and global variables

前端 未结 3 1707
慢半拍i
慢半拍i 2021-01-03 04:36

I have to implement an MPI program. There are some global variables (4 arrays of float numbers and other 6 single float variables) which are first inizialized by the main pr

3条回答
  •  自闭症患者
    2021-01-03 04:50

    When MPI_Init() is called all processes are created by fork right?

    Wrong.

    MPI spawns multiple instances of your program. These instances are separate processes, each with its own memory space. Each process has its own copy of every variable, including globals. MPI_Init() only initializes the MPI environment so that other MPI functions can be called.

提交回复
热议问题