28 integer :: pe, shmem_my_pe
59 logical,
optional :: print_flag
129 subroutine memcpy_r8( lhs, rhs, dim, nelems, lhs_stride, rhs_stride )
132 integer,
intent(in) :: dim
133 real(kind=8),
dimension(0:dim-1),
intent(in) :: rhs
134 real(kind=8),
dimension(0:dim-1),
intent(out) :: lhs
135 integer,
intent(in),
optional :: nelems, lhs_stride, rhs_stride
142 if(
PRESENT(nelems) )
then 145 if(
PRESENT(lhs_stride) )ls = lhs_stride
146 if(
PRESENT(rhs_stride) )rs = rhs_stride
148 if( ls.EQ.1 .AND. rs.EQ.1 )
then 150 call shmem_get( lhs(0), rhs(0), n, pe )
152 lhs(0:n-1) = rhs(0:n-1)
156 call shmem_iget( lhs(0), rhs(0), ls, rs, n, pe )
158 lhs(0:n*ls-1:ls) = rhs(0:n*rs-1:rs)
166 integer,
intent(in) :: dim, nelems, lhs_stride
167 real(kind=8),
dimension(0:dim-1),
intent(in) :: rhs
168 real(kind=8),
dimension(0:dim-1),
intent(out) :: lhs
169 integer,
intent(in),
dimension(nelems) :: rhs_indx
172 real(kind=8),
dimension(nelems) :: tmp
174 if( lhs_stride.EQ.1 )
then 175 call shmem_ixget( lhs(0), rhs(0), rhs_indx, nelems, pe )
177 call shmem_ixget( tmp, rhs(0), rhs_indx, nelems, pe )
178 call shmem_iget( lhs(0), tmp, lhs_stride, 1, nelems, pe )
181 lhs(0:nelems*lhs_stride-1:lhs_stride) = rhs(rhs_indx(1:nelems))
188 integer,
intent(in) :: dim, nelems, rhs_stride
189 real(kind=8),
dimension(0:dim-1),
intent(in) :: rhs
190 real(kind=8),
dimension(0:dim-1),
intent(out) :: lhs
191 integer,
intent(in),
dimension(nelems) :: lhs_indx
194 real(kind=8),
dimension(nelems) :: tmp
196 if( rhs_stride.EQ.1 )
then 197 call shmem_ixput( lhs(0), rhs(0), lhs_indx, nelems, pe )
199 call shmem_iget( tmp, rhs(0), rhs_stride, 1, nelems, pe )
200 call shmem_ixput( lhs(0), tmp, lhs_indx, nelems, pe )
204 lhs(lhs_indx(1:nelems)) = rhs(0:nelems*rhs_stride-1:rhs_stride)
211 integer,
intent(in) :: dim, nelems
212 real(kind=8),
dimension(0:dim-1),
intent(in) :: rhs
213 real(kind=8),
dimension(0:dim-1),
intent(out) :: lhs
214 integer,
intent(in),
dimension(nelems) :: lhs_indx, rhs_indx
217 real(kind=8),
dimension(nelems) :: tmp
219 call shmem_ixget( tmp, rhs(0), rhs_indx, nelems, pe )
220 call shmem_ixput( lhs(0), tmp, lhs_indx, nelems, pe )
223 lhs(lhs_indx(1:nelems)) = rhs(rhs_indx(1:nelems))
229 integer function hplen( hpalloc, hplargest, hpshrink, hpgrow, hpfirst, hplast )
232 integer,
intent(out),
optional :: hpalloc, hplargest, hpshrink, hpgrow, hpfirst, hplast
236 if(
present(hpalloc ) )hpalloc = ihpstat( 4)
237 if(
present(hplargest) )hplargest = ihpstat(10)
238 if(
present(hpshrink ) )hpshrink = ihpstat(11)
239 if(
present(hpgrow ) )hpgrow = ihpstat(12)
240 if(
present(hpfirst ) )hpfirst = ihpstat(13)
241 if(
present(hplast ) )hplast = ihpstat(14)
247 integer function stklen( stkhiwm, stknumber, stktotal, stkmost, stkgrew, stkgtimes )
249 integer,
optional,
intent(out) :: stkhiwm, stknumber, stktotal, stkmost, stkgrew, stkgtimes
254 if(
present(stkhiwm ) )stkhiwm = istat(2)
255 if(
present(stknumber) )stknumber = istat(3)
256 if(
present(stktotal ) )stktotal = istat(4)
257 if(
present(stkmost ) )stkmost = istat(5)
258 if(
present(stkgrew ) )stkgrew = istat(6)
259 if(
present(stkgtimes) )stkgtimes = istat(7)
262 #endif /* _CRAYT90 */ 267 real,
intent(in) :: a
275 real,
intent(in) :: a
283 character(len=*),
intent(in) :: text
284 integer,
intent(in),
optional :: unit
285 logical,
intent(in),
optional :: always
286 real :: m, mmin, mmax, mavg, mstd
291 character(len=8) :: walldate
292 character(len=10) :: walltime
293 character(len=5) :: wallzone
294 integer :: wallvalues(8)
296 if(
PRESENT(always) )
then 297 if( .NOT.always )
return 301 mu = stderr();
if(
PRESENT(unit) )mu = unit
302 #if defined(__sgi) || defined(__aix) || defined(__SX) || defined(__APPLE__) 309 mavg = m;
call mpp_sum(mavg); mavg = mavg/mpp_npes()
310 mstd = (m-mavg)**2;
call mpp_sum(mstd); mstd = sqrt( mstd/mpp_npes() )
311 if( mpp_pe().EQ.mpp_root_pe() )
then 312 call date_and_time(walldate, walltime, wallzone, wallvalues)
313 write( mu,
'(a84,4es11.3)' ) trim(walldate)//
' '//trim(walltime)//&
314 ': Memuse(MB) at '//trim(text)//
'=', mmin, mmax, mstd, mavg
323 use mpp_io_mod,
only : mpp_open, mpp_close, mpp_ascii, mpp_rdonly, &
324 mpp_sequential, mpp_single
326 real,
intent(out) :: memuse
332 character(len=32) :: file_name =
'/proc/self/status' 333 character(len=32) :: string
334 integer,
save :: mem_unit = -1
340 if(mem_unit == -1)
then 341 call mpp_open ( mem_unit, file_name, &
342 form=mpp_ascii, action=mpp_rdonly, &
343 access=mpp_sequential, threading=mpp_single )
348 do;
read (mem_unit,
'(a)', end=10)
string 349 if ( index(
string,
'VmHWM:' ) == 1 )
then 356 multiplier = 1.0/1024.
359 10 memuse = memuse * multiplier
subroutine, public print_memuse_stats(text, unit, always)
integer(kind=8) function, public get_l1_cache_line(a)
integer(kind=8) l1_cache_size
subroutine memcpy_r8(lhs, rhs, dim, nelems, lhs_stride, rhs_stride)
integer(kind=8) l1_cache_line_size
integer(kind=8) l2_cache_line_size
subroutine, public memutils_init(print_flag)
integer(kind=8) l2_associativity
integer(kind=8) function, public get_l2_cache_line(a)
logical memutils_initialized
integer(kind=8) l1_associativity
subroutine memcpy_r8_scatter(lhs, rhs, dim, nelems, lhs_indx, rhs_stride)
subroutine mem_dump(memuse)
integer(kind=8) l2_cache_size
subroutine memcpy_r8_gather(lhs, rhs, dim, nelems, lhs_stride, rhs_indx)
logical, private print_memory_usage
subroutine memcpy_r8_gather_scatter(lhs, rhs, dim, nelems, lhs_indx, rhs_indx)