14 write(6,12)
'nelgt/nelgv/lelt:',nelgt,nelgv,lelt
15 write(6,12)
'lx1/lx2/lx3/lxd:',lx1,lx2,lx3,lxd
16 12
format(1x,a,4i12,/,/)
21 if(nio.eq.0)
write(6,
'(A)')
' partioning elements to MPI ranks'
29 IF (ifheat) nfldt = 2 + npscal
34 WRITE(6,1000) np,nelgt
35 1000
FORMAT(2x,
'ABORT: Too many processors (',i8
36 $ ,
') for to few elements (',i12,
').'
37 $ ,/,2x,
'ABORTING IN MAPELPR.')
44 if (nelt.gt.lelt)
then
45 call exitti(
'nelt > lelt, increase lelt!$',nelt)
48 DO 1200 ifield=mfield,nfldt
49 IF (iftmsh(ifield))
THEN
58 if (loglevel .gt. 2) ifverbm=.true.
64 write(6 ,1310) node-1,(lglel(ie),ie=1,n8)
65 if (nelt.GT.8)
write(6 ,1315) (lglel(ie),ie=9,nelt)
68 call csend(mtype,idum,4,inid,0)
69 call crecv(mtype,inelt,4)
72 1310
FORMAT(
' RANK',i6,
' IEG',8i8)
73 1315
FORMAT(
' ',6x,
' ',8i8)
76 call crecv(mtype,idum,4)
77 call csend(mtype,nelt,4,0,0)
78 if (loglevel .gt. 2)
then
80 write(6 ,1310) node-1,(lglel(ie),ie=1,n8)
81 if (nelt.GT.8)
write(6 ,1315) (lglel(ie),ie=9,nelt)
89 write(6,
'(A,g13.5,A,/)')
' done :: partioning ',dtmp,
' sec'
98 common /nekmpi/ nid,np,nekcomm,nekgroup,nekreal
106 write(6,1) nid,m,n,name6
107 1
format(//,3i6,
' Matrix:',2x,a6,/)
109 write(6,2) nid,name6,(u(i,j),j=1,n20)
111 2
format(i3,1x,a6,20i6)
132 parameter(mdw=2+2**ldim)
133 parameter(ndw=7*lx1*ly1*lz1*lelv/mdw)
134 common /scrns/ wk(mdw,ndw)
137 common /ivrtx/ vertex((2**ldim),lelt)
144 if(icalld.gt.0)
return
158 integer vertex(nlv,1)
161 common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
166 integer*8 eid8(lelt), vtx8(lelt*2**ldim)
168 common /scrcg/ xyz(ldim*lelt*2**ldim)
169 common /ctmp0/ eid8, vtx8, iwork
171 integer tt,cnt,nrank,ierr
173 integer opt_parrsb(3), opt_parmetis(10)
176 #if defined(PARRSB) || defined(PARMETIS)
180 do i = 1,mod(nelgt,np)
181 if (np-i.eq.nid) nelt = nelt + 1
187 call read_con(wk,
size(wk),neli,nvi,nelgti,nelgvi)
189 $
call exitti(
'Number of vertices do not match!$',nv)
190 if (nelgti .ne. nelgt)
191 $
call exitti(
'nelgt for mesh/con differs!$',0)
192 if (nelgvi .ne. nelgv)
193 $
call exitti(
'nelgt for mesh/con differs!$',0)
195 $
call exitti(
'neli > lelt!$',neli)
202 if (wk(ii+1) .le. nelgv)
then
205 call icopy48(vtx8((j-1)*nlv+1),wk(ii+2),nlv)
223 call fpartmesh(eid8,vtx8,xyz,lelt,nel,nlv,nekcomm,
224 $ meshpartitioner,ierr)
225 call err_chk(ierr,
'partMesh fluid failed!$')
230 if (nelv .gt. lelv) ierr = 1
231 call err_chk(ierr,
'nelv > lelv!$')
236 call isort(lglel,iwork,nelv)
238 call icopy84(vertex(1,i),vtx8((iwork(i)-1)*nlv+1),nlv)
243 if (nelgt.ne.nelgv)
then
247 if (wk(ii+1) .gt. nelgv)
then
250 call icopy48(vtx8((j-1)*nlv+1),wk(ii+2),nlv)
268 call fpartmesh(eid8,vtx8,xyz,lelt,nel,nlv,nekcomm,
269 $ meshpartitioner,ierr)
270 call err_chk(ierr,
'partMesh solid failed!$')
274 if (nelt .gt. lelt) ierr = 1
275 call err_chk(ierr,
'nelt > lelt!$')
278 lglel(nelv+i) = eid8(i)
280 call isort(lglel(nelv+1),iwork,nel)
282 call icopy84(vertex(1,nelv+i),vtx8((iwork(i)-1)*nlv+1),nlv)
289 if (ieg.lt.1 .or. ieg.gt.nelgt)
290 $
call exitti(
'invalid ieg!$',ieg)
301 npass = 1 + nelgt/lelt
316 call exitti(
'DPROCMAP requires PARRSB or PARMETIS!$',0)
318 call read_map(vertex,nlv,wk,mdw,ndw)
324 if(nid.eq.0)
write(6,*)
''
325 call icopy48(vtx8,vertex,nelt*nlv)
326 call printpartstat(vtx8,nelt,nlv,nekcomm)
339 logical ifbswap,if_byte_swap_test
343 character*1 confle1(132)
344 equivalence(confle,confle1)
350 integer*8 offs, offs0
360 lfname =
ltrunc(reafle,132) - 4
361 call blank (confle,132)
362 call chcopy(confle,reafle,lfname)
363 call chcopy(confle1(lfname+1),
'.con',4)
364 inquire(
file=confle, exist=ifcon)
367 call chcopy(confle1(lfname+1),
'.co2',4)
368 inquire(
file=confle, exist=ifco2)
371 if(.not.ifcon .and. .not.ifco2) ierr = 1
373 call bcast(confle,sizeof(confle))
374 if(nid.eq.0)
write(6,
'(A,A)')
' reading ', confle
375 call err_chk(ierr,
' Cannot find con file!$')
376 call bcast(ifco2,lsize)
383 if(ierr.ne.0)
goto 100
385 call blank(hdr,sizeof(hdr))
387 if(ierr.ne.0)
goto 100
389 read (hdr,*) version,nelgti,nelgvi,nv
393 if(ierr.ne.0)
goto 100
394 ifbswap = if_byte_swap_test(test,ierr)
395 if(ierr.ne.0)
goto 100
398 call bcast(nelgti,sizeof(nelgti))
399 call bcast(nelgvi,sizeof(nelgvi))
400 call bcast(nv,sizeof(nv))
401 call bcast(ifbswap,sizeof(ifbswap))
403 if (ifco2 .and. ifmpiio)
then
406 offs0 = sizeof(hdr) + sizeof(test)
409 do i = 1,mod(nelgti,np)
410 if (np-i.eq.nid) nelr = nelr + 1
412 call lim_chk(nelr*(nv+1),nwk,
'nelr ',
'nwk ',
'read_con ')
415 offs = offs0 + int(nelbr,8)*(nv+1)*isize
419 call err_chk(ierr,
' Error while reading con file!$')
423 call exitti(
'reader only support co2 for now$',0)
429 call err_chk(ierr,
'Error opening or reading con header$')
450 common /ctmp0/ iwork(lelt)
461 IF (
gllnid(ieg).EQ.nid)
THEN
465 if (ieg.le.nelgv) nelv = iel
471 npass = 1 + nelgt/lelt
476 if (m.gt.0)
call igop(
gllel(k),iwork,
'+ ',m)
485 if (mid.eq.nid) lglel(ie)=ieg
497 integer vertex(nlv,1)
500 logical ifbswap,if_byte_swap_test
503 character*1 mapfle1(132)
504 equivalence(mapfle,mapfle1)
518 lfname =
ltrunc(reafle,132) - 4
519 call blank (mapfle,132)
520 call chcopy(mapfle,reafle,lfname)
521 call chcopy(mapfle1(lfname+1),
'.map',4)
522 inquire(
file=mapfle, exist=ifmap)
525 call chcopy(mapfle1(lfname+1),
'.ma2',4)
526 inquire(
file=mapfle, exist=ifma2)
529 if(.not.ifmap .and. .not.ifma2) ierr = 1
531 if(nid.eq.0)
write(6,
'(A,A)')
' Reading ', mapfle
532 call err_chk(ierr,
' Cannot find map file!$')
533 call bcast(ifma2,lsize)
539 if(ierr.ne.0)
goto 100
543 if(ierr.ne.0)
goto 100
545 read (hdr,1) version,neli,nnzi
549 if(ierr.ne.0)
goto 100
550 ifbswap = if_byte_swap_test(test,ierr)
551 if(ierr.ne.0)
goto 100
553 open(unit=80,
file=mapfle,status=
'old',err=100)
554 read(80,*,err=100) neli,nnzi
558 call bcast(neli, isize)
560 npass = 1 + (neli/ndw)
561 if (npass.gt.np)
then
562 if (nid.eq.0)
write(6,*) npass,np,neli,ndw,
'Error get_vert_map'
567 if (nid.gt.0.and.nid.lt.npass) msg_id=
irecv(nid,wk,len)
573 eg1 = min(eg0+ndw,neli)
576 nwds = (eg1 - eg0)*(mdw-1)
578 if (ierr.ne.0)
goto 200
583 jj = (m-1)*(mdw-1) + 1
584 call icopy(itmp20,wk(jj,1),mdw-1)
585 call icopy(wk(1,m),itmp20 ,mdw-1)
592 read(80,*,err=200) (wk(k,m),k=1,mdw-1)
603 if (ipass.lt.npass)
call csend(ipass,wk,len,ipass,0)
614 elseif (nid.lt.npass)
then
628 if (
gllnid(eg).eq.nid)
then
629 if (eg.le.nelgv) nelv=nelv+1
630 if (eg.le.nelgt) nelt=nelt+1
638 ntuple_sum =
iglsum(ntuple,1)
639 if (ntuple_sum .ne. nelgt)
then
640 if (nid.eq.0)
write(6,*)
'Error invalid tuple sum!'
650 call fgslib_crystal_ituple_transfer(cr_h,wk,mdw,ntuple,ndw,key)
654 call fgslib_crystal_ituple_sort(cr_h,wk,mdw,nelt,key,nkey)
657 if (ntuple.ne.nelt)
then
658 write(6,*) nid,ntuple,nelv,nelt,nelgt,
' NELT FAIL'
659 write(6,*)
'Check that .map file and .rea file agree'
663 call icopy(vertex(1,e),wk(2,e),nlv)
672 $
write(6,*) nid,ntuple,nelv,nelt,nelgt,
' NELT FB'
682 call err_chk(ierr,
'Error opening or reading map header$')
685 call err_chk(ierr,
'Error while reading map file$')
692 integer gllnid(1),iunsort(1),nelgt,np
698 if (np2.eq.np.and.nelgv.eq.nelgt)
then
700 npstar =
ivlmax(gllnid,nelgt)+1
703 gllnid(eg) = gllnid(eg)/nnpstr
708 elseif (np2.eq.np)
then
711 npstar = max(np,
ivlmax(gllnid,nelgv)+1)
714 gllnid(eg) = gllnid(eg)/nnpstr
719 npstar = max(np,
ivlmax(gllnid(nelgv+1),nelgs)+1)
722 gllnid(eg) = gllnid(eg)/nnpstr
727 elseif (nelgv.ne.nelgt)
then
729 $ (
'Conjugate heat transfer requires P=power of 2.$',np)
748 call isort(gllnid,iunsort,nelgt)
subroutine byte_open_mpi(fnamei, mpi_fh, ifro, ierr)
subroutine byte_read_mpi(buf, icount, iorank, mpi_fh, ierr)
subroutine byte_close_mpi(mpi_fh, ierr)
subroutine byte_set_view(ioff_in, mpi_fh)
function igl_running_sum(in)
subroutine crecv(mtype, buf, lenm)
subroutine igop(x, w, op, n)
subroutine exitti(stringi, idata)
subroutine csend(mtype, buf, len, jnid, jpid)
subroutine bcast(buf, len)
function irecv(msgtag, x, len)
subroutine err_chk(ierr, string)
real *8 function dnekclock()
real *8 function dnekclock_sync()
subroutine lim_chk(n, m, avar5, lvar5, sub_name10)
integer function gllel(ieg)
subroutine dprocmapinit()
integer function gllnid(ieg)
subroutine dprocmapput(ibuf, lbuf, ioff, ieg)
subroutine read_con(wk, nwk, nelr, nv, nelgti, nelgvi)
subroutine outmati(u, m, n, name6)
subroutine set_proc_map()
subroutine assign_gllnid(gllnid, iunsort, nelgt, nelgv, np)
subroutine read_map(vertex, nlv, wk, mdw, ndw)
subroutine get_vert_map(vertex, nlv, wk, mdw, ndw)
subroutine icopy(a, b, n)
subroutine isort(a, ind, n)
subroutine icopy84(a, b, n)
subroutine iswapt_ip(x, p, n)
function ltrunc(string, l)
integer function ivlmax(vec, n)
subroutine chcopy(a, b, n)
subroutine icopy48(a, b, n)
subroutine read_re2_hdr(ifbswap, ifverbose)
subroutine readp_re2_mesh(ifbswap, ifdistri)