I'm trying to perform a MPI_Reduce operation but I'm getting following errors:
Caught signal 11 (Segmentation fault: invalid permissions for mapped object at address 0x533ea5)
==== backtrace (tid: 105696) ====
0 0x000000000004b7f1 mpi_reduce_() ???:0
1 0x0000000000533edf itrdrv_() *Some address*/itrdrv.f:1072
=================================
*** Process received signal ***
Signal: Segmentation fault (11)
Signal code: (-6)
The snippet of the code is shown below:
include "mpif.h"
include "auxmpi.h"
real*8, dimension(2,4) :: wtforce
real*8, dimension(4) :: tanf
real*8, dimension(4) :: normf
real*8, dimension(4) :: torque
real*8, dimension(4) :: thrust
real*8, dimension(4) :: pow_wt
real*8, dimension(4) :: thr_wt
normf = 0.0d0
tanf = 0.0d0
torque = 0.0d0
thrust = 0.0d0
pow_wt = 0.0d0
thr_wt = 0.0d0
call Solflow(.....,wtforce)
do i = 1, 4
normf(i) = wtforce(1,i)
tanf(i) = wtforce(2,i)
end do
write(*,*) "Tangent Force, for Rank ",myrank," =",tanf(1)
call MPI_REDUCE(tanf(1),torque(1),1,MPI_DOUBLE_PRECISION,
& MPI_SUM,0, MPI_COMM_WORLD)
if(myrank==0) then
pow_wt(1) = torque(1)*2.285714285714d0
write(*,*) "Power on top right rotor = ",pow_wt(1)
end if
The write statement just before the MPI_Reduce function shows correct values. What am I doing wrong with the Reduce function?