TABLE OF CONTENTS


ABINIT/m_xpapi [ Modules ]

[ Top ] [ Modules ]

NAME

 m_xpapi

FUNCTION

  Thin wrapper for the PAPI library.

COPYRIGHT

 Copyright (C) 2009-2018 ABINIT group (MG,DC)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .


m_xpapi/xpapi_flops [ Functions ]

[ Top ] [ m_xpapi ] [ Functions ]

NAME

  xpapi_flops

FUNCTION

   PAPI High Level: Simplified call to get Mflops/s, real and processor time

OUTPUT

  real_time -- total realtime since the first PAPI_flops() call
  proc_time -- total process time since the first PAPI_flops() call
  flops -- total floating point instructions or operations since the first call
  mflops -- Mflop/s achieved since the previous call
  check = exit status

PARENTS

      m_time

CHILDREN

      papif_is_initialized,papif_perror

SOURCE

229 subroutine xpapi_flops(real_time,proc_time,flops,mflops,check)
230 
231 
232 !This section has been created automatically by the script Abilint (TD).
233 !Do not modify the following lines by hand.
234 #undef ABI_FUNC
235 #define ABI_FUNC 'xpapi_flops'
236 !End of the abilint section
237 
238  implicit none
239 
240 !Arguments-------------------------
241  integer(C_INT),intent(out) :: check
242  integer(C_LONG_LONG),intent(out) :: flops
243  real(C_FLOAT),intent(out) :: real_time,proc_time,mflops
244 
245 ! *************************************************************************
246 
247 #ifdef HAVE_PAPI
248  call PAPIf_flops(real_time, proc_time, flops, mflops, check)
249 #endif
250 
251 end subroutine xpapi_flops

m_xpapi/xpapi_handle_error [ Functions ]

[ Top ] [ m_xpapi ] [ Functions ]

NAME

  xpapi_handle_error

FUNCTION

PARENTS

CHILDREN

      papif_is_initialized,papif_perror

SOURCE

306 subroutine xpapi_handle_error(check,err_msg,file,line)
307 
308 
309 !This section has been created automatically by the script Abilint (TD).
310 !Do not modify the following lines by hand.
311 #undef ABI_FUNC
312 #define ABI_FUNC 'xpapi_handle_error'
313 !End of the abilint section
314 
315  implicit none
316 
317 !Arguments ------------------------------------
318 !scalars
319  integer(C_INT),intent(in) :: check
320  integer,optional,intent(in) :: line
321  character(len=*),intent(in) :: err_msg
322  character(len=*),optional,intent(in) :: file
323 
324 !Local variables-------------------------------
325  integer :: f90line
326  character(len=10) :: lnum
327  character(len=500) :: f90name
328  character(len=500) :: my_msg
329 #ifdef HAVE_PAPI
330  integer(C_INT) :: ierr,ans
331  character(len=PAPI_MAX_STR_LEN) :: papi_errstr
332 #endif
333 
334 ! *************************************************************************
335 
336  if (PRESENT(line)) then
337    f90line=line
338  else
339    f90line=0
340  end if
341  write(lnum,'(i0)')f90line
342 
343  if (PRESENT(file)) then
344    !f90name = basename(file)
345    f90name = file
346  else
347    f90name='Subroutine Unknown'
348  end if
349 
350  my_msg=TRIM(f90name)//":"//TRIM(lnum)//":"
351 
352 #ifdef HAVE_PAPI
353  if (check /= PAPI_OK) then
354    write(std_out,*) " Error in papi library at: "//TRIM(my_msg)
355    write(std_out,*) " User message: "//TRIM(err_msg)
356    call PAPIF_is_initialized(ans)
357    if (ans == PAPI_LOW_LEVEL_INITED) then
358      call papif_perror(check,papi_errstr,ierr)
359      write(std_out,*) 'Error code: ',TRIM(papi_errstr)
360    else
361      write(std_out,*) "Papi library is not initialized!"
362    end if
363  end if
364  MSG_ERROR("Fatal error")
365 #else
366  ABI_UNUSED(err_msg)
367  if (.FALSE.) write(std_out,*) check
368 #endif
369 
370 end subroutine xpapi_handle_error

m_xpapi/xpapi_init [ Functions ]

[ Top ] [ m_xpapi ] [ Functions ]

NAME

  xpapi_init

FUNCTION

  initialize the PAPI library. It must be called before any low level PAPI functions can be used.
  If your application is making use of threads PAPI_thread_init (3) also be called prior to making
  any calls to the library other than PAPI_library_init().

PARENTS

      abinit

CHILDREN

      papif_is_initialized,papif_perror

SOURCE

 64 subroutine xpapi_init()
 65 
 66 
 67 !This section has been created automatically by the script Abilint (TD).
 68 !Do not modify the following lines by hand.
 69 #undef ABI_FUNC
 70 #define ABI_FUNC 'xpapi_init'
 71 !End of the abilint section
 72 
 73  implicit none
 74 
 75 #ifdef HAVE_PAPI
 76 !Local variables-------------------------------
 77  character(len=PAPI_MAX_STR_LEN) :: papi_errstr
 78  integer(C_INT) :: check
 79  real(C_FLOAT) :: real_time,proc_time,mflops
 80  integer(C_LONG_LONG) :: flpops
 81 
 82 ! *************************************************************************
 83 
 84  check = PAPI_VER_CURRENT
 85  call PAPIf_library_init(check)
 86 
 87  if ( check /= PAPI_VER_CURRENT .and. check >0 ) then
 88    MSG_WARNING(" PAPI library version mismatch!")
 89  end if
 90  !ABI_CHECK(check>=0," PAPI Initialization error!")
 91  !XPAPI_CHECK(check," PAPI Initialization error!")
 92 
 93 !#ifdef HAVE_OPENMP
 94  !call PAPIf_thread_init(pthread_self, check)
 95  !XPAPI_CHECK(check>=0," PAPIf_thread_init")
 96 !#endif
 97 
 98 ! First pass. Set up counters to monitor PAPI_FP_OPS and PAPI_TOT_CYC events and start the counters
 99 ! Subsequent calls will read the counters and return total real time,
100 ! total process time, total floting point instructions or operations
101 ! since the start of the mesurement and the Mflop/s rate since latests call to PAPI_flops
102  call PAPIf_flops(real_time, proc_time, flpops, mflops, check)
103  XPAPI_CHECK(check,"Problem in PAPIf_flops")
104 
105 #endif
106 
107 end subroutine xpapi_init

m_xpapi/xpapi_show_info [ Functions ]

[ Top ] [ m_xpapi ] [ Functions ]

NAME

  xpapi_show_info

FUNCTION

INPUTS

  [unit]=unit number for writing. The named constant dev_null defined in defs_basis can be used to avoid any printing.
         Default = std_out
  [mode_paral]= --optional argument--
   'COLL' if all procs are calling the routine with the same message to be written once only. Default.
   'PERS' if the procs are calling the routine with different messages each to be written,
          or if one proc is calling the routine: DEFAULT = "COLL"

PARENTS

      abinit

CHILDREN

      papif_is_initialized,papif_perror

SOURCE

134 subroutine xpapi_show_info(unit,mode_paral)
135 
136 
137 !This section has been created automatically by the script Abilint (TD).
138 !Do not modify the following lines by hand.
139 #undef ABI_FUNC
140 #define ABI_FUNC 'xpapi_show_info'
141 !End of the abilint section
142 
143  implicit none
144 
145 !Arguments-------------------------
146  integer,optional,intent(in) :: unit
147  character(len=*),optional,intent(in) :: mode_paral
148 
149 !Local variables-------------------
150 #ifdef HAVE_PAPI
151  integer :: unt
152  integer(C_INT) :: num_hwcntrs,ncpu,nnodes,totalcpus,vendor,model
153  real(C_FLOAT) :: revision,mhz
154  character(len=PAPI_MAX_STR_LEN) :: vendor_string,model_string
155  character(len=500) :: msg,my_mode
156 #endif
157 
158 ! *************************************************************************
159 
160 #ifdef HAVE_PAPI
161  unt = std_out;    if (PRESENT(unit)) unt = unit
162  my_mode = "COLL"; if (PRESENT(mode_paral)) my_mode = mode_paral
163 
164  call PAPIf_num_counters(num_hwcntrs)
165  if (num_hwcntrs  < 0) then
166    MSG_WARNING(" The installation does not support PAPI")
167  end if
168 
169  if (num_hwcntrs == 0) then
170    msg = " The installation supports PAPI, but this machine does not provide hardware counters."
171    MSG_WARNING(msg)
172  end if
173 
174  call PAPIF_get_hardware_info (ncpu,nnodes,totalcpus,vendor,vendor_string,model,model_string,revision,mhz)
175 
176  write(msg,"(a,i0)")" PAPI Version ",PAPI_VER_CURRENT
177  call wrtout(unt,msg,my_mode)
178  write(msg,"(a,i0)")" Number of hardware counters: ",num_hwcntrs
179  call wrtout(unt,msg,my_mode)
180  write(msg,"(a,i0)")" Number of CPUs in an SMP Node: ",ncpu
181  call wrtout(unt,msg,my_mode)
182  write(msg,"(a,i0)")" Number of nodes in the entire system: ",nnodes
183  call wrtout(unt,msg,my_mode)
184  write(msg,"(a,i0)")" Total number of CPUs in the entire system: ",totalcpus
185  call wrtout(unt,msg,my_mode)
186  !write(msg,"(a,i0)")" Vendor id number of CPU: ",vendor
187  !call wrtout(unt,msg,my_mode)
188  !write(msg,"(a)")   " Vendor id string of CPU: "//TRIM(vendor_string)
189  !call wrtout(unt,msg,my_mode)
190  !write(msg,"(a,i0)")" Model number of CPU: ",model
191  !call wrtout(unt,msg,my_mode)
192  write(msg,"(a)")   " Model string of CPU: "//TRIM(model_string)
193  !call wrtout(unt,msg,my_mode)
194  !write(msg,"(a,f5.1)")" Revision number of CPU: ",revision
195  !write(msg,"(a,f8.2")" Cycle time of this CPU; *may* be an estimate generated at init time with a quick timing routine",mhz
196 
197 #else
198  ABI_UNUSED(mode_paral)
199  ABI_UNUSED(unit)
200 #endif
201 
202 end subroutine xpapi_show_info

m_xpapi/xpapi_shutdown [ Functions ]

[ Top ] [ m_xpapi ] [ Functions ]

NAME

  xpapi_shutdown

FUNCTION

   exit function used by the PAPI Library to free resources and shut down when certain error conditions arise.

PARENTS

      abinit

CHILDREN

      papif_is_initialized,papif_perror

SOURCE

271 subroutine xpapi_shutdown()
272 
273 
274 !This section has been created automatically by the script Abilint (TD).
275 !Do not modify the following lines by hand.
276 #undef ABI_FUNC
277 #define ABI_FUNC 'xpapi_shutdown'
278 !End of the abilint section
279 
280  implicit none
281 
282 ! *************************************************************************
283 
284 #ifdef HAVE_PAPI
285  call PAPIf_shutdown()
286 #endif
287 
288 end subroutine xpapi_shutdown