26 integer(kind=ip_intwp_p),
parameter ::
mpart = 100
30 character(len=ic_lvar2):: partname
31 type(mct_gsmap) :: gsmap
32 integer(kind=ip_i4_p) :: gsize
33 integer(kind=ip_i4_p) :: lsize
34 integer(kind=ip_i4_p) :: nx
35 integer(kind=ip_i4_p) :: ny
36 character(len=ic_lvar) :: gridname
37 integer(kind=ip_i4_p) :: mpicom
38 integer(kind=ip_i4_p) :: npes
39 integer(kind=ip_i4_p) :: rank
40 type(mct_gsmap) :: pgsmap
42 integer(kind=ip_i4_p) :: ig_size
43 integer(kind=ip_i4_p),
pointer :: kparal(:)
78 INTEGER(kind=ip_intwp_p) ,
intent(out) :: id_part
79 INTEGER(kind=ip_intwp_p),
DIMENSION(:),
intent(in) :: kparal
80 INTEGER(kind=ip_intwp_p),
optional ,
intent(out) :: kinfo
81 INTEGER(kind=ip_intwp_p),
optional ,
intent(in) :: ig_size
82 character(len=*) ,
optional ,
intent(in) :: name
84 integer(kind=ip_intwp_p) :: n
85 character(len=*),
parameter :: subname =
'(oasis_def_partition)' 106 write(
nulprt,*) subname,
estr,
'increase mpart in mod_oasis_part.F90' 112 if (
present(name))
then 114 write(
nulprt,*) subname,
estr,
'part name too long = ',trim(name)
124 if (
present(ig_size))
then 145 integer(kind=ip_intwp_p) :: m,n,k,p,nsegs,numel,taskid
146 INTEGER(kind=ip_intwp_p) :: icpl,ierr,ilen
147 integer(kind=ip_intwp_p),
pointer :: start(:),length(:)
148 integer(kind=ip_intwp_p),
pointer :: kparal(:)
149 integer(kind=ip_intwp_p) :: ig_size
150 integer(kind=ip_intwp_p) :: pcnt
152 character(len=ic_lvar2),
pointer :: pname0(:),pname(:)
153 logical,
parameter :: local_timers_on = .false.
154 character(len=*),
parameter :: subname =
'(oasis_part_setup)' 159 if (local_timers_on)
then 183 if (local_timers_on)
then 229 allocate(start(nsegs),length(nsegs))
233 if (length(1) == 0) numel = 0
236 allocate(start(nsegs),length(nsegs))
240 if (length(1) == 0) numel = 0
243 allocate(start(nsegs),length(nsegs))
252 allocate(start(nsegs),length(nsegs))
255 ilen = kparal((n-1)*2 + 4)
258 start(numel) = kparal((n-1)*2 + 3) + 1
264 allocate(start(nsegs),length(nsegs))
269 start(nsegs) = kparal(k)
274 if (kparal(k)-kparal(k-1) == 1)
then 275 length(nsegs) = length(nsegs) + 1
278 start(nsegs) = kparal(k)
290 WRITE(
nulprt,*) subname,
' Nsegs before calling mct_gsmap_init :',nsegs
291 WRITE(
nulprt,*) subname,
' Numel before calling mct_gsmap_init :',numel
303 if (ig_size > 0)
then 313 if (numel > 0) icpl = 1
318 if (ig_size > 0)
then 319 call mct_gsmap_init(
prism_part(m)%pgsmap,start,length,0, &
322 call mct_gsmap_init(
prism_part(m)%pgsmap,start,length,0, &
337 deallocate(start,length)
366 character(len=*),
parameter :: subname =
'(oasis_part_zero)' 371 s_prism_part%partname = trim(
cspval)
372 s_prism_part%gsize = -1
373 s_prism_part%lsize = -1
376 s_prism_part%gridname = trim(
cspval)
377 s_prism_part%mpicom = mpi_comm_null
378 s_prism_part%npes = -1
379 s_prism_part%rank = -1
380 s_prism_part%ig_size = -1
394 integer(ip_i4_p) ,
intent(in) :: npart
396 character(len=*),
parameter :: subname =
'(oasis_part_write)' 402 write(
nulprt,*) subname,
' partnm = ',trim(s_prism_part%partname)
403 write(
nulprt,*) subname,
' npart = ',npart
404 write(
nulprt,*) subname,
' mpicom = ',s_prism_part%mpicom
405 write(
nulprt,*) subname,
' npes = ',s_prism_part%npes
406 write(
nulprt,*) subname,
' rank = ',s_prism_part%rank
407 write(
nulprt,*) subname,
' compid = ',s_prism_part%gsmap%comp_id
408 write(
nulprt,*) subname,
' ngseg = ',s_prism_part%gsmap%ngseg
409 write(
nulprt,*) subname,
' gsize = ',s_prism_part%gsmap%gsize
410 if (s_prism_part%gsmap%ngseg > 10)
then 412 WRITE(
nulprt,*) subname,
' start = ',s_prism_part%gsmap%start(1:10)
413 WRITE(
nulprt,*) subname,
' length = ',s_prism_part%gsmap%length(1:10)
414 WRITE(
nulprt,*) subname,
' pe_loc = ',s_prism_part%gsmap%pe_loc(1:10)
416 IF (s_prism_part%mpicom /= mpi_comm_null)
THEN 417 WRITE(
nulprt,*) subname,
' pstart = ',s_prism_part%pgsmap%start(1:10)
418 WRITE(
nulprt,*) subname,
' plength= ',s_prism_part%pgsmap%length(1:10)
419 WRITE(
nulprt,*) subname,
' ppe_loc= ',s_prism_part%pgsmap%pe_loc(1:10)
423 WRITE(
nulprt,*) subname,
' start = ',s_prism_part%gsmap%start
424 WRITE(
nulprt,*) subname,
' length = ',s_prism_part%gsmap%length
425 WRITE(
nulprt,*) subname,
' pe_loc = ',s_prism_part%gsmap%pe_loc
427 IF (s_prism_part%mpicom /= mpi_comm_null)
THEN 428 WRITE(
nulprt,*) subname,
' pstart = ',s_prism_part%pgsmap%start
429 WRITE(
nulprt,*) subname,
' plength= ',s_prism_part%pgsmap%length
430 WRITE(
nulprt,*) subname,
' ppe_loc= ',s_prism_part%pgsmap%pe_loc
443 SUBROUTINE oasis_part_create(id_part,TYPE,gsize,nx,ny,gridname,gscomm,mpicom,gridID)
447 integer(ip_i4_p),
intent(out) :: id_part
448 character(len=*),
intent(in) ::
type 449 integer(ip_i4_p),
intent(in) :: gsize
450 integer(ip_i4_p),
intent(in) :: nx
451 integer(ip_i4_p),
intent(in) :: ny
452 character(len=*),
intent(in) :: gridname
453 integer(ip_i4_p),
intent(in) :: gscomm
454 integer(ip_i4_p),
intent(in) :: mpicom
455 integer(ip_i4_p),
optional :: gridID(:)
457 integer(ip_i4_p) :: gsrank
458 integer(ip_i4_p) :: gssize
459 integer(ip_i4_p) :: numel
460 integer(ip_i4_p),
pointer :: start(:),length(:)
461 integer(ip_i4_p),
pointer :: llist(:),glist(:)
462 integer(ip_i4_p) :: pts
463 integer(ip_i4_p) :: found,foundall
464 integer(ip_i4_p) :: n
465 integer(ip_i4_p) :: ierr
466 character(len=*),
parameter :: subname =
'(oasis_part_create)' 471 if (gscomm /= mpi_comm_null)
then 472 call mpi_comm_rank(gscomm,gsrank,ierr)
473 call mpi_comm_size(gscomm,gssize,ierr)
480 write(
nulprt,*) subname,
' called with ',gsize,nx,ny,trim(gridname)
481 write(
nulprt,*) subname,
' local ',gsrank,gssize
484 if ((
type ==
'decomp_wghtfile' .and. .not.present(gridid)) .or. &
485 (
type /=
'decomp_wghtfile' .and. present(gridid)))
then 486 write(
nulprt,*) subname,
estr,
'decomp_wghtfile and gridID arguments inconsistent ',trim(type)
500 trim(
prism_part(n)%gridname) == trim(gridname) .and. &
514 call oasis_mpi_min(found,foundall,mpicom,string=subname//
' found',all=.true.)
515 if (foundall == 1)
then 544 allocate(start(1),length(1))
549 if (trim(type) ==
'decomp_1d')
then 551 if (gsrank >= 0)
then 553 length(1) = gsize/gssize
554 pts = gsize - length(1)*gssize
555 if (gsrank < pts) length(1) = length(1) + 1
556 start(1) = gsize/gssize*(gsrank) + min(gsrank,pts) + 1
560 write(
nulprt,*) subname,trim(type),numel,start,length,pts
563 elseif (trim(type) ==
'decomp_wghtfile')
then 564 allocate(llist(gsize),glist(gsize))
567 if (gsrank >= 0)
then 569 write(
nulprt,*) subname,
' wgts1 ',
size(gridid)
570 write(
nulprt,*) subname,
' gridID ',minval(gridid),maxval(gridid)
572 do n = 1,
size(gridid)
573 if (gridid(n) > 0 .and. gridid(n) <= gsize)
then 575 llist(gridid(n)) = gsrank
589 call oasis_mpi_max(llist,glist,gscomm,string=trim(subname)//
' glist',all=.true.)
592 deallocate(start,length)
593 allocate(start(numel),length(numel))
598 if (glist(n) == gsrank)
then 600 if (numel >
size(gridid))
then 601 write(
nulprt,*) subname,
estr,
'numel error ',numel,
size(gridid)
612 write(
nulprt,*) subname,trim(type),numel
617 write(
nulprt,*) subname,
estr,
'type argument unknown = ',trim(type)
626 if (gsrank >= 0)
then 630 deallocate(start,length)
integer(kind=ip_intwp_p), parameter clim_box
integer(kind=ip_intwp_p), parameter clim_sizex
Provides a common location for several OASIS variables.
integer(kind=ip_intwp_p), parameter clim_offset
integer(kind=ip_intwp_p), parameter oasis_ok
subroutine, public oasis_part_create(id_part, TYPE, gsize, nx, ny, gridname, gscomm, mpicom, gridID)
Create a new partition internally, needed for mapping.
Generic overloaded interface into MPI max reduction.
type(prism_part_type), dimension(mpart), public prism_part
list of defined partitions
integer(kind=ip_intwp_p) nulprt
subroutine oasis_part_write(s_prism_part, npart)
Print parition information.
subroutine, public oasis_abort(id_compid, cd_routine, cd_message, file, line, rcode)
OASIS abort method, publically available to users.
subroutine, public oasis_def_partition(id_part, kparal, kinfo, ig_size, name)
The OASIS user interface to define partitions.
integer(kind=ip_i4_p) compid
character(len= *), parameter cspval
integer(kind=ip_intwp_p) part_name_cnt
used to define partition names internally
integer(kind=ip_intwp_p), parameter clim_orange
Provides a generic and simpler interface into MPI calls for OASIS.
integer(kind=ip_intwp_p), parameter clim_points
integer(kind=ip_intwp_p), parameter mpart
maximum number of partitions allowed
integer(kind=ip_i4_p) mpi_root_local
subroutine, public oasis_debug_enter(string)
Used when a subroutine is entered, write info to log file at some debug level.
Generic overloaded interface into MPI min reduction.
subroutine, public oasis_mpi_reducelists(linp1, comm, cntout, lout1, callstr, fastcheck, fastcheckout, linp2, lout2, spval2, linp3, lout3, spval3, linp4, lout4, spval4)
Custom method for reducing MPI lists across pes for OASIS.
OASIS partition data and methods.
integer(kind=ip_intwp_p), parameter clim_strategy
Defines parameters for OASIS.
character(len=ic_lvar) compnm
subroutine, public oasis_timer_start(timer_label, barrier)
Start a timer.
integer(kind=ip_i4_p) oasis_debug
subroutine, public oasis_timer_stop(timer_label)
Stop a timer.
character(len= *), parameter, public estr
integer(kind=ip_i4_p) mpi_comm_local
integer(kind=ip_intwp_p), parameter clim_ldx
subroutine, public oasis_part_setup()
Synchronize partitions across all tasks, called at oasis enddef.
integer(kind=ip_intwp_p), parameter clim_sizey
integer(kind=ip_intwp_p), parameter clim_segments
integer(kind=ip_intwp_p), parameter clim_serial
integer(kind=ip_intwp_p), public prism_npart
number of partitions defined
integer(kind=ip_intwp_p), parameter clim_apple
subroutine, public oasis_flush(nu)
Flushes output to file.
Performance timer methods.
integer(kind=ip_intwp_p), parameter clim_length
subroutine oasis_part_zero(s_prism_part)
Zero partition information.
subroutine, public oasis_debug_exit(string)
Used when a subroutine is exited, write info to log file at some debug level.
Partition (decomposition) data for variables.