Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
fortran函数中MPI_ALLREDUCE上的断点_Fortran_Mpi - Fatal编程技术网

fortran函数中MPI_ALLREDUCE上的断点

fortran函数中MPI_ALLREDUCE上的断点,fortran,mpi,Fortran,Mpi,我正在编写调用返回实数(8)的函数的代码。我希望将这个程序与MPI并行,因此所有进程都在调用函数,这就是我使用MPI_ALLREDUCE的原因。问题是,当我启动程序时,它调用MPI_ALLREDUCE上的断点,而不提供任何其他信息。有人能说出原因吗?功能代码: real(8) function distanse(X,Y,ArrX,ArrY,pointsCount,procSize,rank) real(8),intent(in) :: X,Y,ArrX(:),ArrY(:) intege

我正在编写调用返回实数(8)的函数的代码。我希望将这个程序与MPI并行,因此所有进程都在调用函数,这就是我使用MPI_ALLREDUCE的原因。问题是,当我启动程序时,它调用MPI_ALLREDUCE上的断点,而不提供任何其他信息。有人能说出原因吗?功能代码:

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

“它调用断点”是什么意思?你是在调试模式下从ide调用的吗?我想他是说代码崩溃了。请显示完整错误以及编译错误的方式。检查错误变量的内容。如果
procSize
MPI\u COMM\u WORLD
的大小,则
start\u i
看起来可疑。但这不应该是根本原因。请用a编辑您的问题,并解释您是如何开始工作的。