KTH framework for Nek5000 toolboxes; testing version  0.0.1
map2.f
Go to the documentation of this file.
1 c-----------------------------------------------------------------------
2  subroutine mapelpr()
3  include 'SIZE'
4  include 'INPUT'
5  include 'PARALLEL'
6  include 'SCRCT'
7  include 'SOLN'
8  include 'TSTEP'
9  include 'CTIMER'
10 c
11  logical ifverbm
12 c
13  if (nio.eq.0) then
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,/,/)
17  write(6,*)
18  endif
19 
20  etime0 = dnekclock_sync()
21  if(nio.eq.0) write(6,'(A)') ' partioning elements to MPI ranks'
22 
23  mfield=2
24  IF (ifflow) mfield=1
25  IF (ifmvbd) mfield=0
26 
27 c Set up TEMPORARY value for NFIELD - NFLDT
28  nfldt = 1
29  IF (ifheat) nfldt = 2 + npscal
30 c
31 c Distributed memory processor mapping
32  IF (np.GT.nelgt) THEN
33  IF(nid.EQ.0) THEN
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.')
38  ENDIF
39  call exitt
40  ENDIF
41 
42  call set_proc_map()
43 
44  if (nelt.gt.lelt) then
45  call exitti('nelt > lelt, increase lelt!$',nelt)
46  endif
47 
48  DO 1200 ifield=mfield,nfldt
49  IF (iftmsh(ifield)) THEN
50  nelg(ifield) = nelgt
51  ELSE
52  nelg(ifield) = nelgv
53  ENDIF
54  1200 CONTINUE
55 
56 C Output the processor-element map:
57  ifverbm=.false.
58  if (loglevel .gt. 2) ifverbm=.true.
59 
60  if(ifverbm) then
61  idum = 1
62  if(nid.eq.0) then
63  n8 = min(8,nelt)
64  write(6 ,1310) node-1,(lglel(ie),ie=1,n8)
65  if (nelt.GT.8) write(6 ,1315) (lglel(ie),ie=9,nelt)
66  DO inid=1,np-1
67  mtype = inid
68  call csend(mtype,idum,4,inid,0) ! handshake
69  call crecv(mtype,inelt,4) ! nelt of other cpus
70  n8 = min(8,inelt)
71  ENDDO
72  1310 FORMAT(' RANK',i6,' IEG',8i8)
73  1315 FORMAT(' ',6x,' ',8i8)
74  else
75  mtype = nid
76  call crecv(mtype,idum,4) ! hand-shake
77  call csend(mtype,nelt,4,0,0) ! nelt
78  if (loglevel .gt. 2) then
79  n8 = min(8,nelt)
80  write(6 ,1310) node-1,(lglel(ie),ie=1,n8)
81  if (nelt.GT.8) write(6 ,1315) (lglel(ie),ie=9,nelt)
82  endif
83  endif
84  endif
85 
86  dtmp = dnekclock_sync() - etime0
87  if(nio.eq.0) then
88  write(6,*) ' '
89  write(6,'(A,g13.5,A,/)') ' done :: partioning ',dtmp,' sec'
90  endif
91 
92  return
93  end
94 c-----------------------------------------------------------------------
95  subroutine outmati(u,m,n,name6)
96  integer u(m,n)
97  character*6 name6
98  common /nekmpi/ nid,np,nekcomm,nekgroup,nekreal
99 c
100 c Print out copies of a global matrix
101 c
102  do mid=0,np-1
103  call nekgsync
104  if (mid.eq.nid) then
105  n20 = min(n,20)
106  write(6,1) nid,m,n,name6
107  1 format(//,3i6,' Matrix:',2x,a6,/)
108  do i=1,m
109  write(6,2) nid,name6,(u(i,j),j=1,n20)
110  enddo
111  2 format(i3,1x,a6,20i6)
112  endif
113  call nekgsync
114  enddo
115  return
116  end
117 c-----------------------------------------------------------------------
118  subroutine get_map
119 
120  call get_vert
121 
122  return
123  end
124 c-----------------------------------------------------------------------
125  subroutine get_vert
126 c
127 c Distribute and assign partitions using the .map file
128 c
129  include 'SIZE'
130  include 'TOTAL'
131 
132  parameter(mdw=2+2**ldim)
133  parameter(ndw=7*lx1*ly1*lz1*lelv/mdw)
134  common /scrns/ wk(mdw,ndw)
135  integer wk
136 
137  common /ivrtx/ vertex((2**ldim),lelt)
138  integer vertex
139 
140  integer icalld
141  save icalld
142  data icalld /0/
143 
144  if(icalld.gt.0) return
145  icalld = 1
146 
147  nv = 2**ldim
148  call get_vert_map(vertex,nv,wk,mdw,ndw)
149 
150  return
151  end
152 c-----------------------------------------------------------------------
153  subroutine get_vert_map(vertex,nlv,wk,mdw,ndw)
154 
155  include 'SIZE'
156  include 'TOTAL'
157 
158  integer vertex(nlv,1)
159  integer wk(mdw*ndw)
160 
161  common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
162 
163  integer ibuf(2)
164  integer hrsb
165 
166  integer*8 eid8(lelt), vtx8(lelt*2**ldim)
167  integer iwork(lelt)
168  common /scrcg/ xyz(ldim*lelt*2**ldim)
169  common /ctmp0/ eid8, vtx8, iwork
170 
171  integer tt,cnt,nrank,ierr
172 
173  integer opt_parrsb(3), opt_parmetis(10)
174  logical ifbswap
175 
176 #if defined(PARRSB) || defined(PARMETIS)
177  ! read vertex coordinates
178  call read_re2_hdr(ifbswap, .false.)
179  nelt = nelgt/np
180  do i = 1,mod(nelgt,np)
181  if (np-i.eq.nid) nelt = nelt + 1
182  enddo
183  call byte_open_mpi(re2fle,fh_re2,.true.,ierr)
184  call readp_re2_mesh(ifbswap, .false.)
185  call byte_close_mpi(fh_re2,ierr)
186 
187  call read_con(wk,size(wk),neli,nvi,nelgti,nelgvi)
188  if (nvi .ne. nlv)
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)
194  if (neli .gt. lelt)
195  $ call exitti('neli > lelt!$',neli)
196 
197 c fluid elements
198  j = 0
199  ii = 0
200  cnt= 0
201  do i = 1,neli
202  if (wk(ii+1) .le. nelgv) then
203  j = j + 1
204  eid8(j) = wk(ii+1)
205  call icopy48(vtx8((j-1)*nlv+1),wk(ii+2),nlv)
206 
207  do tt=1,nlv
208  xyz(cnt+1)=xc(tt,i)
209  xyz(cnt+2)=yc(tt,i)
210  if(ldim.eq.3) then
211  xyz(cnt+3)=zc(tt,i)
212  cnt=cnt+3
213  else
214  cnt=cnt+2
215  endif
216  enddo
217  endif
218  ii = ii + (nlv+1)
219  enddo
220  neliv = j
221 
222  nel = neliv
223  call fpartmesh(eid8,vtx8,xyz,lelt,nel,nlv,nekcomm,
224  $ meshpartitioner,ierr)
225  call err_chk(ierr,'partMesh fluid failed!$')
226 
227  nelv = nel
228  nelt = nelv
229  ierr = 0
230  if (nelv .gt. lelv) ierr = 1
231  call err_chk(ierr,'nelv > lelv!$')
232 
233  do i = 1,nelv
234  lglel(i) = eid8(i)
235  enddo
236  call isort(lglel,iwork,nelv)
237  do i = 1,nelv
238  call icopy84(vertex(1,i),vtx8((iwork(i)-1)*nlv+1),nlv)
239  enddo
240 
241  cnt=0
242 c solid elements
243  if (nelgt.ne.nelgv) then
244  j = 0
245  ii = 0
246  do i = 1,neli
247  if (wk(ii+1) .gt. nelgv) then
248  j = j + 1
249  eid8(j) = wk(ii+1)
250  call icopy48(vtx8((j-1)*nlv+1),wk(ii+2),nlv)
251 
252  do tt=1,nlv
253  xyz(cnt+1)=xc(tt,i)
254  xyz(cnt+2)=yc(tt,i)
255  if(ldim.eq.3) then
256  xyz(cnt+3)=zc(tt,i)
257  cnt=cnt+3
258  else
259  cnt=cnt+2
260  endif
261  enddo
262  endif
263  ii = ii + (nlv+1)
264  enddo
265  nelit = j
266 
267  nel = nelit
268  call fpartmesh(eid8,vtx8,xyz,lelt,nel,nlv,nekcomm,
269  $ meshpartitioner,ierr)
270  call err_chk(ierr,'partMesh solid failed!$')
271 
272  nelt = nelv + nel
273  ierr = 0
274  if (nelt .gt. lelt) ierr = 1
275  call err_chk(ierr,'nelt > lelt!$')
276 
277  do i = 1,nel
278  lglel(nelv+i) = eid8(i)
279  enddo
280  call isort(lglel(nelv+1),iwork,nel) ! sort locally by global element id
281  do i = 1,nel
282  call icopy84(vertex(1,nelv+i),vtx8((iwork(i)-1)*nlv+1),nlv)
283  enddo
284  endif
285 
286 #ifdef DPROCMAP
287  do i = 1,nelt
288  ieg = lglel(i)
289  if (ieg.lt.1 .or. ieg.gt.nelgt)
290  $ call exitti('invalid ieg!$',ieg)
291  ibuf(1) = i
292  ibuf(2) = nid
293  call dprocmapput(ibuf,2,0,ieg)
294  enddo
295 #else
296  call izero(gllnid,nelgt)
297  do i = 1,nelt
298  ieg = lglel(i)
299  gllnid(ieg) = nid
300  enddo
301  npass = 1 + nelgt/lelt
302  k=1
303  do ipass = 1,npass
304  m = nelgt - k + 1
305  m = min(m,lelt)
306  if (m.gt.0) call igop(gllnid(k),iwork,'+ ',m)
307  k = k+m
308  enddo
309 #endif
310 
311 
312 #else
313 
314 
315 #ifdef DPROCMAP
316  call exitti('DPROCMAP requires PARRSB or PARMETIS!$',0)
317 #else
318  call read_map(vertex,nlv,wk,mdw,ndw)
319 #endif
320 
321 
322 #endif
323 
324  if(nid.eq.0) write(6,*) ''
325  call icopy48(vtx8,vertex,nelt*nlv)
326  call printpartstat(vtx8,nelt,nlv,nekcomm)
327 
328  return
329  end
330 c-----------------------------------------------------------------------
331  subroutine read_con(wk,nwk,nelr,nv,nelgti,nelgvi)
332 
333  include 'SIZE'
334  include 'INPUT'
335  include 'PARALLEL'
336 
337  integer wk(nwk)
338 
339  logical ifbswap,if_byte_swap_test
340  logical ifco2, ifcon
341 
342  character*132 confle
343  character*1 confle1(132)
344  equivalence(confle,confle1)
345 
346  character*132 hdr
347  character*5 version
348  real*4 test
349 
350  integer*8 offs, offs0
351 
352  ierr = 0
353  ifco2 = .false.
354  ifmpiio = .true.
355 #ifdef NOMPIIO
356  ifmpiio = .false.
357 #endif
358 
359  if (nid.eq.0) then
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)
365 
366  if (.not.ifcon) then
367  call chcopy(confle1(lfname+1),'.co2',4)
368  inquire(file=confle, exist=ifco2)
369  endif
370 
371  if(.not.ifcon .and. .not.ifco2) ierr = 1
372  endif
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)
377  ierr = 0
378 
379  ! read header
380  if (nid.eq.0) then
381  if (ifco2) then
382  call byte_open(confle,ierr)
383  if(ierr.ne.0) goto 100
384 
385  call blank(hdr,sizeof(hdr))
386  call byte_read(hdr,sizeof(hdr)/4,ierr)
387  if(ierr.ne.0) goto 100
388 
389  read (hdr,*) version,nelgti,nelgvi,nv
390 c 1 format(a5,2i12,i2)
391 
392  call byte_read(test,1,ierr)
393  if(ierr.ne.0) goto 100
394  ifbswap = if_byte_swap_test(test,ierr)
395  if(ierr.ne.0) goto 100
396  endif
397  endif
398  call bcast(nelgti,sizeof(nelgti))
399  call bcast(nelgvi,sizeof(nelgvi))
400  call bcast(nv,sizeof(nv))
401  call bcast(ifbswap,sizeof(ifbswap))
402 
403  if (ifco2 .and. ifmpiio) then
404  if (nid.eq.0) call byte_close(ierr)
405  call byte_open_mpi(confle,ifh,.true.,ierr)
406  offs0 = sizeof(hdr) + sizeof(test)
407 
408  nelr = nelgti/np
409  do i = 1,mod(nelgti,np)
410  if (np-i.eq.nid) nelr = nelr + 1
411  enddo
412  call lim_chk(nelr*(nv+1),nwk,'nelr ','nwk ','read_con ')
413 
414  nelbr = igl_running_sum(nelr) - nelr
415  offs = offs0 + int(nelbr,8)*(nv+1)*isize
416 
417  call byte_set_view(offs,ifh)
418  call byte_read_mpi(wk,(nv+1)*nelr,-1,ifh,ierr)
419  call err_chk(ierr,' Error while reading con file!$')
420  call byte_close_mpi(ifh,ierr)
421  if (ifbswap) call byte_reverse(wk,(nv+1)*nelr,ierr)
422  else
423  call exitti('reader only support co2 for now$',0)
424  endif
425 
426  return
427 
428  100 continue
429  call err_chk(ierr,'Error opening or reading con header$')
430 
431  return
432  end
433 c-----------------------------------------------------------------------
434 
435 #ifndef DPROCMAP
436 
437 c-----------------------------------------------------------------------
438  subroutine set_proc_map()
439 C
440 C Compute element to processor distribution according to (weighted)
441 C physical distribution in an attempt to minimize exposed number of
442 C element interfaces.
443 C
444  include 'SIZE'
445  include 'INPUT'
446  include 'PARALLEL'
447  include 'SOLN'
448  include 'SCRCT'
449  include 'TSTEP'
450  common /ctmp0/ iwork(lelt)
451 
452  real*8 dnekclock,t0
453 
454  t0 = dnekclock()
455  call get_map
456 
457 c compute global to local map (no processor info)
458  iel=0
459  CALL izero(gllel,nelgt)
460  DO ieg=1,nelgt
461  IF (gllnid(ieg).EQ.nid) THEN
462  iel = iel + 1
463  gllel(ieg)=iel
464  nelt = iel
465  if (ieg.le.nelgv) nelv = iel
466  ENDIF
467 c write(6,*) 'map2 ieg:',ieg,nelv,nelt,nelgv,nelgt
468  ENDDO
469 
470 c dist. global to local map to all processors
471  npass = 1 + nelgt/lelt
472  k=1
473  do ipass = 1,npass
474  m = nelgt - k + 1
475  m = min(m,lelt)
476  if (m.gt.0) call igop(gllel(k),iwork,'+ ',m)
477  k = k+m
478  enddo
479 
480 c compute local to global map
481 c (i.e. returns global element number given local index and proc id)
482  do ieg=1,nelgt
483  mid =gllnid(ieg)
484  ie =gllel(ieg)
485  if (mid.eq.nid) lglel(ie)=ieg
486  enddo
487 
488  return
489  end
490 c-----------------------------------------------------------------------
491  subroutine read_map(vertex,nlv,wk,mdw,ndw)
492 
493  include 'SIZE'
494  include 'INPUT'
495  include 'PARALLEL'
496 
497  integer vertex(nlv,1)
498  integer wk(mdw,ndw)
499 
500  logical ifbswap,if_byte_swap_test
501 
502  character*132 mapfle
503  character*1 mapfle1(132)
504  equivalence(mapfle,mapfle1)
505 
506  character*132 hdr
507  character*5 version
508  real*4 test
509 
510  logical ifma2,ifmap
511  integer e,eg,eg0,eg1
512  integer itmp20(20)
513 
514  ierr = 0
515  ifma2 = .false.
516 
517  if (nid.eq.0) then
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)
523 
524  if (.not.ifmap) then
525  call chcopy(mapfle1(lfname+1),'.ma2',4)
526  inquire(file=mapfle, exist=ifma2)
527  endif
528 
529  if(.not.ifmap .and. .not.ifma2) ierr = 1
530  endif
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)
534  ierr = 0
535 
536  if (nid.eq.0) then
537  if (ifma2) then
538  call byte_open(mapfle,ierr)
539  if(ierr.ne.0) goto 100
540 
541  call blank(hdr,132)
542  call byte_read(hdr,132/4,ierr)
543  if(ierr.ne.0) goto 100
544 
545  read (hdr,1) version,neli,nnzi
546  1 format(a5,2i12)
547 
548  call byte_read(test,1,ierr)
549  if(ierr.ne.0) goto 100
550  ifbswap = if_byte_swap_test(test,ierr)
551  if(ierr.ne.0) goto 100
552  else
553  open(unit=80,file=mapfle,status='old',err=100)
554  read(80,*,err=100) neli,nnzi
555  endif
556  endif
557 
558  call bcast(neli, isize)
559 
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'
563  call exitt
564  endif
565 
566  len = 4*mdw*ndw
567  if (nid.gt.0.and.nid.lt.npass) msg_id=irecv(nid,wk,len)
568  call nekgsync
569 
570  if (nid.eq.0) then
571  eg0 = 0
572  do ipass=1,npass
573  eg1 = min(eg0+ndw,neli)
574 
575  if (ifma2) then
576  nwds = (eg1 - eg0)*(mdw-1)
577  call byte_read(wk,nwds,ierr)
578  if (ierr.ne.0) goto 200
579  if (ifbswap) call byte_reverse(wk,nwds,ierr)
580 
581  m = eg1 - eg0
582  do eg=eg1,eg0+1,-1 ! reshuffle array
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)
586  m = m - 1
587  enddo
588  else
589  m = 0
590  do eg=eg0+1,eg1
591  m = m + 1
592  read(80,*,err=200) (wk(k,m),k=1,mdw-1)
593  enddo
594  endif
595 
596  m = 0
597  do eg=eg0+1,eg1
598  m = m + 1
599  gllnid(eg) = wk(1,m) ! must still be divided
600  wk(mdw,m) = eg
601  enddo
602 
603  if (ipass.lt.npass) call csend(ipass,wk,len,ipass,0) !send to ipass
604  eg0 = eg1
605  enddo
606 
607  ntuple = m
608 
609  if (ifma2) then
610  call byte_close(ierr)
611  else
612  close(80)
613  endif
614  elseif (nid.lt.npass) then
615  call msgwait(msg_id)
616  ntuple = ndw
617  else
618  ntuple = 0
619  endif
620 
621  lng = isize*neli
622  call bcast(gllnid,lng)
623  call assign_gllnid(gllnid,gllel,nelgt,nelgv,np) ! gllel is used as scratch
624 
625  nelt=0 ! Count number of elements on this processor
626  nelv=0
627  do eg=1,neli
628  if (gllnid(eg).eq.nid) then
629  if (eg.le.nelgv) nelv=nelv+1
630  if (eg.le.nelgt) nelt=nelt+1
631  endif
632  enddo
633 
634 c if (np.le.64) write(6,*) nid,nelv,nelt,nelgv,nelgt,' NELV'
635 
636 c NOW: crystal route vertex by processor id
637 
638  ntuple_sum = iglsum(ntuple,1)
639  if (ntuple_sum .ne. nelgt) then
640  if (nid.eq.0) write(6,*) 'Error invalid tuple sum!'
641  call exitt
642  endif
643 
644  do i=1,ntuple
645  eg=wk(mdw,i)
646  wk(1,i)=gllnid(eg) ! processor id for element eg
647  enddo
648 
649  key = 1 ! processor id is in wk(1,:)
650  call fgslib_crystal_ituple_transfer(cr_h,wk,mdw,ntuple,ndw,key)
651 
652  key = mdw ! Sort tuple list by eg
653  nkey = 1
654  call fgslib_crystal_ituple_sort(cr_h,wk,mdw,nelt,key,nkey)
655 
656  iflag = 0
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'
660  iflag=1
661  else
662  do e=1,nelt
663  call icopy(vertex(1,e),wk(2,e),nlv)
664  enddo
665  endif
666 
667  iflag = iglmax(iflag,1)
668  if (iflag.gt.0) then
669  do mid=0,np-1
670  call nekgsync
671  if (mid.eq.nid)
672  $ write(6,*) nid,ntuple,nelv,nelt,nelgt,' NELT FB'
673  call nekgsync
674  enddo
675  call nekgsync
676  call exitt
677  endif
678 
679  return
680 
681  100 continue
682  call err_chk(ierr,'Error opening or reading map header$')
683 
684  200 continue
685  call err_chk(ierr,'Error while reading map file$')
686 
687  return
688  end
689 c-----------------------------------------------------------------------
690  subroutine assign_gllnid(gllnid,iunsort,nelgt,nelgv,np)
691 c
692  integer gllnid(1),iunsort(1),nelgt,np
693  integer e,eg
694 
695 
696  log2p = log2(np)
697  np2 = 2**log2p
698  if (np2.eq.np.and.nelgv.eq.nelgt) then ! std power of 2 case
699 
700  npstar = ivlmax(gllnid,nelgt)+1
701  nnpstr = npstar/np
702  do eg=1,nelgt
703  gllnid(eg) = gllnid(eg)/nnpstr
704  enddo
705 
706  return
707 
708  elseif (np2.eq.np) then ! std power of 2 case, conjugate heat xfer
709 
710 c Assign fluid elements
711  npstar = max(np,ivlmax(gllnid,nelgv)+1)
712  nnpstr = npstar/np
713  do eg=1,nelgv
714  gllnid(eg) = gllnid(eg)/nnpstr
715  enddo
716 
717 c Assign solid elements
718  nelgs = nelgt-nelgv ! number of solid elements
719  npstar = max(np,ivlmax(gllnid(nelgv+1),nelgs)+1)
720  nnpstr = npstar/np
721  do eg=nelgv+1,nelgt
722  gllnid(eg) = gllnid(eg)/nnpstr
723  enddo
724 
725  return
726 
727  elseif (nelgv.ne.nelgt) then
728  call exitti
729  $ ('Conjugate heat transfer requires P=power of 2.$',np)
730  endif
731 
732 
733 c Below is the code for P a non-power of two:
734 
735 c Split the sorted gllnid array (read from .map file)
736 c into np contiguous partitions.
737 
738 c To load balance the partitions in case of mod(nelgt,np)>0
739 c add 1 contiguous entry out of the sorted list to NODE_i
740 c where i = np-mod(nelgt,np) ... np
741 
742 
743  nel = nelgt/np ! number of elements per processor
744  nmod = mod(nelgt,np) ! bounded between 1 ... np-1
745  npp = np - nmod ! how many paritions of size nel
746 
747  ! sort gllnid
748  call isort(gllnid,iunsort,nelgt)
749 
750  ! setup partitions of size nel
751  k = 0
752  do ip = 0,npp-1
753  do e = 1,nel
754  k = k + 1
755  gllnid(k) = ip
756  enddo
757  enddo
758  ! setup partitions of size nel+1
759  if(nmod.gt.0) then
760  do ip = npp,np-1
761  do e = 1,nel+1
762  k = k + 1
763  gllnid(k) = ip
764  enddo
765  enddo
766  endif
767 
768  ! unddo sorting to restore initial ordering by
769  ! global element number
770  call iswapt_ip(gllnid,iunsort,nelgt)
771 
772  return
773  end
774 c-----------------------------------------------------------------------
775 
776 #else
777 
778 c-----------------------------------------------------------------------
779  subroutine set_proc_map()
780 C
781 C Compute element to processor distribution according to (weighted)
782 C physical distribution in an attempt to minimize exposed number of
783 C element interfaces.
784 C
785  include 'SIZE'
786  include 'INPUT'
787 
788  call dprocmapinit()
789  call get_map()
790 
791  return
792  end
793 c-----------------------------------------------------------------------
794 
795 #endif
#define byte_open
Definition: byte.c:35
#define byte_reverse
Definition: byte.c:33
void exitt()
Definition: comm_mpi.f:604
#define byte_close
Definition: byte.c:36
#define byte_read
Definition: byte.c:38
subroutine byte_open_mpi(fnamei, mpi_fh, ifro, ierr)
Definition: byte_mpi.f:13
subroutine byte_read_mpi(buf, icount, iorank, mpi_fh, ierr)
Definition: byte_mpi.f:48
subroutine byte_close_mpi(mpi_fh, ierr)
Definition: byte_mpi.f:84
subroutine byte_set_view(ioff_in, mpi_fh)
Definition: byte_mpi.f:97
function igl_running_sum(in)
Definition: comm_mpi.f:700
subroutine crecv(mtype, buf, lenm)
Definition: comm_mpi.f:313
subroutine igop(x, w, op, n)
Definition: comm_mpi.f:247
subroutine msgwait(imsg)
Definition: comm_mpi.f:489
subroutine nekgsync()
Definition: comm_mpi.f:502
subroutine exitti(stringi, idata)
Definition: comm_mpi.f:535
subroutine csend(mtype, buf, len, jnid, jpid)
Definition: comm_mpi.f:303
subroutine bcast(buf, len)
Definition: comm_mpi.f:431
function irecv(msgtag, x, len)
Definition: comm_mpi.f:471
subroutine err_chk(ierr, string)
Definition: comm_mpi.f:558
real *8 function dnekclock()
Definition: comm_mpi.f:393
real *8 function dnekclock_sync()
Definition: comm_mpi.f:401
subroutine lim_chk(n, m, avar5, lvar5, sub_name10)
Definition: convect.f:454
integer function gllel(ieg)
Definition: dprocmap.f:183
subroutine dprocmapinit()
Definition: dprocmap.f:11
integer function gllnid(ieg)
Definition: dprocmap.f:161
subroutine dprocmapput(ibuf, lbuf, ioff, ieg)
Definition: dprocmap.f:40
subroutine mapelpr()
Definition: map2.f:3
subroutine read_con(wk, nwk, nelr, nv, nelgti, nelgvi)
Definition: map2.f:332
subroutine get_map
Definition: map2.f:119
subroutine get_vert
Definition: map2.f:126
subroutine outmati(u, m, n, name6)
Definition: map2.f:96
subroutine set_proc_map()
Definition: map2.f:439
subroutine assign_gllnid(gllnid, iunsort, nelgt, nelgv, np)
Definition: map2.f:691
subroutine read_map(vertex, nlv, wk, mdw, ndw)
Definition: map2.f:492
subroutine get_vert_map(vertex, nlv, wk, mdw, ndw)
Definition: map2.f:154
subroutine icopy(a, b, n)
Definition: math.f:289
function iglsum(a, n)
Definition: math.f:926
subroutine isort(a, ind, n)
Definition: math.f:1273
subroutine icopy84(a, b, n)
Definition: math.f:11
subroutine iswapt_ip(x, p, n)
Definition: math.f:1414
subroutine blank(A, N)
Definition: math.f:19
integer function log2(k)
Definition: math.f:527
function iglmax(a, n)
Definition: math.f:913
subroutine izero(a, n)
Definition: math.f:215
function ltrunc(string, l)
Definition: math.f:494
integer function ivlmax(vec, n)
Definition: math.f:382
subroutine chcopy(a, b, n)
Definition: math.f:281
subroutine icopy48(a, b, n)
Definition: math.f:3
subroutine read_re2_hdr(ifbswap, ifverbose)
Definition: reader_re2.f:772
subroutine readp_re2_mesh(ifbswap, ifdistri)
Definition: reader_re2.f:69