I am developing a Fortran 90 program and am linking it with METIS libraries. I am using GNU Fortran 4.8.5 and METIS 5.1.0. I compile my Fortran program with:
-fdefault-real-8 -fdefault-integer-8
options, and when building METIS I specified:
#define IDXTYPEWIDTH 64
and
#define REALTYPEWIDTH 64
hence the length of both integers and reals should fit. When I compile and run the following program:
program Test_Metis
implicit none
integer :: nvtxs, & ! number of vertices
ncons, & ! number of connections
nparts = 2 ! requested number of partitions
integer, pointer :: vwgt =>null(), & ! weights of the vertices
vsize =>null(), & ! size of the vertices
adjwgt=>null(), & ! weights of the edges
mopts =>null(), & ! array of options
objval=>null() ! stores edgecut or comm. volume
real, pointer :: tpwgts=>null(), & ! desired weight for each partition
ubvec =>null() !
integer, allocatable :: xadj (:), & ! variabes for ...
adjncy(:), & ! ... compressed row storage
part (:) ! partition of the grid
nvtxs = 15
ncons = 22
allocate(xadj (nvtxs+1))
allocate(adjncy(ncons*2))
allocate(part (nvtxs))
xadj = (/ 0, 2, 5, 8, 11, 13, 16, 20, &
24, 28, 31, 33, 36, 39, 42, 44/)
adjncy=(/ 1, 5, 0, 2, 6, 1, 3, 7, 2, 4, 8, &
3, 9, 0, 6, 10, 1, 5, 7, 11, 2, 6, &
8, 12, 3, 7, 9, 13, 4, 8, 14, 5, 11, &
6, 10, 12, 7, 11, 13, 8, 12, 14, 9, 13/)
call METIS_PartGraphRecursive(nvtxs, & ! (in), int
ncons, & ! (in), int
xadj, & ! (in), int(:)
adjncy, & ! (in), int(:)
vwgt, & ! (in), int(:)
vsize, & ! (in), int(:)
adjwgt, & ! (in), int(:)
nparts, & ! (in), int(:)
tpwgts, & ! (in), real(:)
ubvec, & ! (in), real(:)
mopts, & ! (in), int(:)
objval, & ! (out) int(:)
part) ! (out) int(:)
end program
I get a segmentation fault. (I took adjacency from the METIS manual, that should be pretty basic.)
Can anyone help me out with this issue?
This is the minimum needed to make a call to METIS from Fortran: