0

我尝试运行以下代码但出现错误。错误是 *CreateGraphNodal 的内存分配失败:nptr。

program test
  implicit none
  integer, parameter   :: nels=2, nnds=6, npel=4
  integer              :: eptr(nels+1), nodes(nels*npel), epart(nels), npart(nnds), n
  integer, pointer     :: vwgt=>null(), vsize=>null(), mopts=>null()
  real(8), pointer     :: tpwgts=>null()
  eptr=(/0,4,8/)
  nodes=(/0,1,2,3,1,4,5,2/) ! Element 1 has nodes 0 1 2 3
                            ! Element 2 has nodes 1 4 5 2
  call METIS_PartMeshNodal(nels,nnds,eptr,nodes,vwgt,vsize,2,tpwgts,mopts,n,epart,npart) 
  print*, npart; print*, epart
end program test

运行代码时,我收到此错误:

    fobeidat@envenio05:~/Metis/metis-5.1.0/graphs$ gfortran test.f90 libmetis.a 
fobeidat@envenio05:~/Metis/metis-5.1.0/graphs$ ./a.out
   Current memory used:           0 bytes
   Maximum memory used:           0 bytes
***Memory allocation failed for CreateGraphNodal: nptr. Requested size: 68719476792 bytes
           0           0           0           0   659590448       32767
           0           0
4

0 回答 0