Fortran 用户定义通信器上的MPI减少
目前我正在用Fortran编写MPI代码。在使用Fortran 用户定义通信器上的MPI减少,fortran,mpi,openmpi,Fortran,Mpi,Openmpi,目前我正在用Fortran编写MPI代码。在使用mpi\u cart\u create然后mpi\u group\u excl创建一个包含一半节点的新组后,我试图使用此通信器执行缩减,但显然我做错了什么 使用代码 call MPI_cart_create(MPI_comm_world, 2, dims, (/.false.,.false./), reorder, comm_cart, ierr) if (ierr/=0) stop 'Error with MPI_cart_create' ca
mpi\u cart\u create
然后mpi\u group\u excl
创建一个包含一半节点的新组后,我试图使用此通信器执行缩减,但显然我做错了什么
使用代码
call MPI_cart_create(MPI_comm_world, 2, dims, (/.false.,.false./), reorder, comm_cart, ierr)
if (ierr/=0) stop 'Error with MPI_cart_create'
call MPI_group_excl(group_world, dims(2), excl_a, division_comm_a, ierr)
if (ierr/=0) stop 'Error with MPI_group_excl - division_comm_a'
call MPI_group_excl(group_world, dims(2), excl_b, division_comm_b, ierr)
if (ierr/=0) stop 'Error with MPI_group_excl - division_comm_b'
if (div_a_rank .gt. 0) then
call MPI_reduce(division_a(1), division_a(1), L_outer_y, MPI_DOUBLE_PRECISION, MPI_SUM, &
& 0, division_comm_a, ierr)
if (ierr/=0) stop 'Error with MPI_reduce on division_comm_a'
end if
我得到的错误是:
*** An error occurred in MPI_Reduce
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_ARG: invalid argument of some other kind
*** MPI_ERRORS_ARE_FATAL: your MPI job will now abort
在回答之后,我使用了MPI\u comm\u create\u group,但是我仍然得到了答案
*** An error occurred in MPI_Reduce
*** reported by process [140046521663489,140045998620672]
*** on communicator MPI_COMM_WORLD
*** MPI_ERR_ARG: invalid argument of some other kind
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
*** and potentially your MPI job)
问题是你在混合群体和沟通者。在MPI中,组只是进程的逻辑集合。它不能用来交流
如果要从新组中创建新的通讯器,应使用功能
MPI\u COMM\u create\u group
。您可以将新组传递到该函数中,以创建一个新的通信器,用于简化操作。我已创建了新的通信器,但MPI简化操作仍有错误。您可能有不同的问题。你应该把它作为一个单独的问题发布。我已经重新设置了新错误的格式,但我也同意Wesley Bland的观点,如果你把它拿出来,问一个新问题(显示新代码),可能会更好。我还改变了一些措辞:若你们对我写的不满意,请回退。