首页 > 解决方案 > Breakpoint on MPI_ALLREDUCE in fortran function

问题描述

I'm working on code that calls a function which returns real(8). I wish to parallelize this program with MPI, so funcion is calling by all processes, thats why I'm using MPI_ALLREDUCE. The problem is when I launch the program, it calls breakpoint on MPI_ALLREDUCE with no additional info. Can anyone suggest the reason of this? Function code:

real(8) function distanse(X,Y,ArrX,ArrY,pointsCount,procSize,rank)
  real(8),intent(in) :: X,Y,ArrX(:),ArrY(:)
  integer,intent(in) :: pointsCount
  integer,intent(in out) :: procSize, rank

  real(8) d,local_dmin,global_dmin
  integer i,start_i,end_i,count_i,ierror

  interface
     real(8) function distOtr(X,Y,X1,Y1,X2,Y2)
       real(8),intent(in) :: X,Y,X1,Y1,X2,Y2
     end function distOtr
  end interface

  local_dmin = 10000
  start_i = 1+rank*procSize;
  count_i = pointsCount/procSize
  end_i = start_i+count_i-1
  if (end_i.LT.pointsCount+1) then
     if (pointsCount-end_i.LT.count_i) end_i = pointsCount
     do i=start_i,end_i-1,1
        d = distOtr(X,Y,ArrX(i),ArrY(i),ArrX(i+1),ArrY(i+1))
        if (d.LT.local_dmin) local_dmin = d
     end do
  endif

  call MPI_ALLREDUCE(local_dmin, global_dmin, 1, MPI_REAL8, MPI_MIN, MPI_COMM_WORLD, ierror)
  distanse = global_dmin
end function distanse

标签: fortranmpi

解决方案


推荐阅读