Skip to content

Commit 48dd011

Browse files
authored
Merge pull request #4 from jsquyres/pr/fix-normalmodes-with-openmpi
parmetis_interface: use the Fortran API entry point
2 parents f64cc67 + 17fde7b commit 48dd011

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/mod_geometry.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ subroutine pnm_apply_parmetis()
688688
real(C_float), allocatable, dimension(:) :: tpwgts,ubvec
689689

690690
integer :: i,j
691-
integer(C_int64_t) :: comm
691+
integer(C_int) :: comm
692692

693693
if (unstrM%nproc.ge.2) then
694694
if (unstrM%fsexist) then
@@ -791,7 +791,7 @@ subroutine pnm_p2_parmetis()
791791
real(C_float), allocatable, dimension(:) :: tpwgts,ubvec
792792

793793
integer :: i,j,nct
794-
integer(c_int64_t) :: comm
794+
integer(c_int) :: comm
795795

796796

797797
if (unstrM%nproc.ge.2) then

src/parmetis_interface.f90

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@ module parmetis_interface
9797
!end interface
9898

9999

100+
! This is a bit of a hack, but it is necessary to invoke the Fortran
101+
! API entry point for ParMETIS so that MPI handles are converted
102+
! properly. Hence, use the C symbol name parmetis_v3_partmeshkway
103+
! (not the C ParMETIS API entry point ParMETIS_V3_PartMeshKway).
100104
interface
101105
integer(C_INT) function ParMETIS_V3_PartMeshKway(elmdist,eptr,eind,&
102106
elmwgt,wgtflag,numflag,ncon,ncommonnodes,nparts,tpwgts,ubvec,&
103-
opts,edgecut,part,comm) bind(C,name="ParMETIS_V3_PartMeshKway")
107+
opts,edgecut,part,comm) bind(C,name="parmetis_v3_partmeshkway")
104108
use, intrinsic :: ISO_C_BINDING
105109
implicit none
106110
integer(C_INT) :: wgtflag,numflag,ncon,comm,&
@@ -166,13 +170,16 @@ end function ParMETIS_V3_PartMeshKway
166170
!end interface
167171

168172

173+
! Similar to above, be sure to use the Fortran API entry point for
174+
! ParMETIS, not the C API entry point.
169175
interface
170176
integer(C_int64_t) function ParMETIS_V3_PartKway(vtxdist,xadj,adjncy,&
171177
vwgt,adjwgt,wgtflag,numflag,ncon,nparts,tpwgts,ubvec,&
172-
opts,edgecut,part,comm) bind(C,name="ParMETIS_V3_PartKway")
178+
opts,edgecut,part,comm) bind(C,name="parmetis_v3_partkway")
173179
use, intrinsic :: ISO_C_BINDING
174180
implicit none
175-
integer(C_int64_t) :: wgtflag,numflag,ncon,comm,&
181+
integer(C_INT) :: comm
182+
integer(C_int64_t) :: wgtflag,numflag,ncon,&
176183
nparts,edgecut
177184
integer(C_int64_t), dimension(*) :: vtxdist,xadj,adjncy,vwgt
178185
type(C_PTR), value :: adjwgt

0 commit comments

Comments
 (0)