MPI_Gather gives seg fault in the most basic code

后端 未结 2 1752
迷失自我
迷失自我 2020-12-04 03:31

I am working on a much bigger program where I struggle with MPI_Gather.

I wrote a minimal example code, see below.

 program test
  use MPI
  integer          


        
2条回答
  •  Happy的楠姐
    2020-12-04 03:38

    You have forgotten to add the return error code to the call to MPI_Gather as the last argument. The value of the return code is being written to an unmapped address.

    It should read

    call MPI_Gather(send, 1, MPI_DOUBLE_PRECISION, &
                    recv, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
    

    ifort catches this at the compilation stage. It looks like your compiler (gfortran?) doesn't

提交回复
热议问题