(git:d18deda)
Loading...
Searching...
No Matches
machine Module Reference

Machine interface based on Fortran 2003 and POSIX. More...

Data Types

interface  m_cpuid_static
 Target architecture or instruction set extension according to compiler target flags. More...
 
interface  m_omp_trace_issues
 Trace OpenMP constructs if ennvironment variable CP2K_OMP_TRACE=1. More...
 

Functions/Subroutines

subroutine, public m_flush (lunit)
 flushes units if the &GLOBAL flag is set accordingly
 
real(kind=dp) function, public m_walltime ()
 returns time from a real-time clock, protected against rolling early/easily
 
subroutine, public m_cpuinfo (model_name)
 reads /proc/cpuinfo if it exists (i.e. Linux) to return relevant info
 
pure integer function, public m_cpuid ()
 Target architecture or instruction set extension according to CPU-check at runtime.
 
pure character(len=default_string_length) function, public m_cpuid_name (cpuid)
 Determine name of target architecture for a given CPUID.
 
pure integer function, public m_cpuid_vlen (cpuid, typesize)
 Determine vector-length for a given CPUID.
 
real(kind=dp) function, public m_energy ()
 returns the energy used since some time in the past. The precise meaning depends on the infrastructure is available. In the cray_pm_energy case, this is the energy used by the node in kJ.
 
subroutine, public m_datum (cal_date)
 returns a datum in human readable format using a standard Fortran routine
 
subroutine, public m_abort ()
 Can be used to get a nice core.
 
integer function, public m_procrun (pid)
 Returns if a process is running on the local machine 1 if yes and 0 if not.
 
subroutine, public m_memory (mem)
 Returns the total amount of memory [bytes] in use, if known, zero otherwise.
 
subroutine, public m_memory_details (memtotal, memfree, buffers, cached, slab, sreclaimable, memlikelyfree)
 get more detailed memory info, all units are bytes. the only 'useful' option is MemLikelyFree which is an estimate of remaining memory assumed to give info like /proc/meminfo while MeMLikelyFree is the amount of memory we're likely to be able to allocate, but not necessarily in one chunk zero means not available...
 
subroutine, public m_hostnm (hname)
 ...
 
subroutine, public m_getcwd (curdir)
 ...
 
subroutine, public m_chdir (dir, ierror)
 ...
 
subroutine, public m_getpid (pid)
 ...
 
subroutine, public m_mov (source, target)
 ...
 
subroutine, public m_getlog (user)
 ...
 
subroutine, public m_omp_get_stacksize (omp_stacksize)
 Retrieve environment variable OMP_STACKSIZE.
 

Variables

integer, parameter, public default_output_unit = output_unit
 
integer, parameter, public default_input_unit = input_unit
 
integer, parameter, public machine_cpu_generic = CP_MACHINE_CPU_GENERIC
 
integer, parameter, public machine_x86_sse4 = CP_MACHINE_X86_SSE4
 
integer, parameter, public machine_x86_avx = CP_MACHINE_X86_AVX
 
integer, parameter, public machine_x86_avx2 = CP_MACHINE_X86_AVX2
 
integer, parameter, public machine_x86_avx512 = CP_MACHINE_X86_AVX512
 
integer, parameter, public machine_x86 = MACHINE_X86_AVX512
 
integer, parameter, public machine_arm_arch64 = CP_MACHINE_ARM_ARCH64
 
integer, parameter, public machine_arm_sve128 = CP_MACHINE_ARM_SVE128
 
integer, parameter, public machine_arm_sve256 = CP_MACHINE_ARM_SVE256
 
integer, parameter, public machine_arm_sve512 = CP_MACHINE_ARM_SVE512
 
integer, parameter, public machine_arm = MACHINE_ARM_SVE512
 
integer, parameter, public machine_cpu_unknown = CP_MACHINE_UNKNOWN
 
logical, save, public flush_should_flush = .TRUE.
 
integer(kind=int_8), save, public m_memory_max = 0
 

Detailed Description

Machine interface based on Fortran 2003 and POSIX.

History
JGH (05.07.2001) : added G95 interface
  • m_flush added (12.06.2002,MK)
  • Missing print_memory added (24.09.2002,MK)
  • Migrate to generic implementation based on F2003 + POSIX (2014, Ole Schuett)
Author
APSI, JGH, Ole Schuett

Function/Subroutine Documentation

◆ m_flush()

subroutine, public machine::m_flush ( integer, intent(in)  lunit)

flushes units if the &GLOBAL flag is set accordingly

Parameters
lunit...
History
10.2008 created [Joost VandeVondele]
Note
flushing might degrade performance significantly (30% and more)

Definition at line 129 of file machine.F.

◆ m_walltime()

real(kind=dp) function, public machine::m_walltime

returns time from a real-time clock, protected against rolling early/easily

Returns
...
History
03.2006 created [Joost VandeVondele]
Note
same implementation for all machines. might still roll, if not called multiple times per count_max/count_rate

Definition at line 146 of file machine.F.

◆ m_cpuinfo()

subroutine, public machine::m_cpuinfo ( character(len=default_string_length), intent(out)  model_name)

reads /proc/cpuinfo if it exists (i.e. Linux) to return relevant info

Parameters
model_nameas obtained from the 'model name' field, UNKNOWN otherwise

Definition at line 160 of file machine.F.

Here is the caller graph for this function:

◆ m_cpuid()

pure integer function, public machine::m_cpuid

Target architecture or instruction set extension according to CPU-check at runtime.

Returns
cpuid according to MACHINE_* integer-parameter.
History
04.2019 created [Hans Pabst] 09.2024 update+arm [Hans Pabst]

Definition at line 193 of file machine.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m_cpuid_name()

pure character(len=default_string_length) function, public machine::m_cpuid_name ( integer, intent(in), optional  cpuid)

Determine name of target architecture for a given CPUID.

Parameters
cpuidinteger value (MACHINE_*)
Returns
short name of ISA extension.
History
06.2019 created [Hans Pabst] 09.2024 update+arm [Hans Pabst]

Definition at line 231 of file machine.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m_cpuid_vlen()

pure integer function, public machine::m_cpuid_vlen ( integer, intent(in), optional  cpuid,
integer, intent(in), optional  typesize 
)

Determine vector-length for a given CPUID.

Parameters
cpuidinteger value (MACHINE_*)
typesizenumber of bytes of scalar type
Returns
vector-length in number of elements.
History
12.2024 created [Hans Pabst]

Definition at line 275 of file machine.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m_energy()

real(kind=dp) function, public machine::m_energy

returns the energy used since some time in the past. The precise meaning depends on the infrastructure is available. In the cray_pm_energy case, this is the energy used by the node in kJ.

Returns
...
History
09.2013 created [Joost VandeVondele, Ole Schuett]

Definition at line 326 of file machine.F.

Here is the caller graph for this function:

◆ m_datum()

subroutine, public machine::m_datum ( character(len=*), intent(out)  cal_date)

returns a datum in human readable format using a standard Fortran routine

Parameters
cal_date...
History
10.2009 created [Joost VandeVondele]

Definition at line 377 of file machine.F.

Here is the caller graph for this function:

◆ m_abort()

subroutine, public machine::m_abort

Can be used to get a nice core.

Definition at line 391 of file machine.F.

Here is the caller graph for this function:

◆ m_procrun()

integer function, public machine::m_procrun ( integer, intent(in)  pid)

Returns if a process is running on the local machine 1 if yes and 0 if not.

Parameters
pid...
Returns
...

Definition at line 406 of file machine.F.

Here is the caller graph for this function:

◆ m_memory()

subroutine, public machine::m_memory ( integer(kind=int_8), intent(out), optional  mem)

Returns the total amount of memory [bytes] in use, if known, zero otherwise.

Parameters
mem...

Definition at line 439 of file machine.F.

Here is the caller graph for this function:

◆ m_memory_details()

subroutine, public machine::m_memory_details ( integer(kind=int_8), optional  memtotal,
integer(kind=int_8), optional  memfree,
integer(kind=int_8), optional  buffers,
integer(kind=int_8), optional  cached,
integer(kind=int_8), optional  slab,
integer(kind=int_8), optional  sreclaimable,
integer(kind=int_8), optional  memlikelyfree 
)

get more detailed memory info, all units are bytes. the only 'useful' option is MemLikelyFree which is an estimate of remaining memory assumed to give info like /proc/meminfo while MeMLikelyFree is the amount of memory we're likely to be able to allocate, but not necessarily in one chunk zero means not available...

Parameters
MemTotal...
MemFree...
Buffers...
Cached...
Slab...
SReclaimable...
MemLikelyFree...

Definition at line 509 of file machine.F.

Here is the caller graph for this function:

◆ m_hostnm()

subroutine, public machine::m_hostnm ( character(len=*), intent(out)  hname)

...

Parameters
hname...

Definition at line 579 of file machine.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m_getcwd()

subroutine, public machine::m_getcwd ( character(len=*), intent(out)  curdir)

...

Parameters
curdir...

Definition at line 612 of file machine.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m_chdir()

subroutine, public machine::m_chdir ( character(len=*), intent(in)  dir,
integer, intent(out)  ierror 
)

...

Parameters
dir...
ierror...

Definition at line 641 of file machine.F.

Here is the caller graph for this function:

◆ m_getpid()

subroutine, public machine::m_getpid ( integer, intent(out)  pid)

...

Parameters
pid...

Definition at line 660 of file machine.F.

Here is the caller graph for this function:

◆ m_mov()

subroutine, public machine::m_mov ( character(len=*), intent(in)  source,
character(len=*), intent(in)  target 
)

...

Parameters
source...
TARGET...

Definition at line 700 of file machine.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m_getlog()

subroutine, public machine::m_getlog ( character(len=*), intent(out)  user)

...

Parameters
user...

Definition at line 737 of file machine.F.

Here is the caller graph for this function:

◆ m_omp_get_stacksize()

subroutine, public machine::m_omp_get_stacksize ( character(len=*), intent(out)  omp_stacksize)

Retrieve environment variable OMP_STACKSIZE.

Parameters
omp_stacksizeValue of OMP_STACKSIZE

Definition at line 761 of file machine.F.

Here is the caller graph for this function:

Variable Documentation

◆ default_output_unit

integer, parameter, public machine::default_output_unit = output_unit

Definition at line 53 of file machine.F.

◆ default_input_unit

integer, parameter, public machine::default_input_unit = input_unit

Definition at line 53 of file machine.F.

◆ machine_cpu_generic

integer, parameter, public machine::machine_cpu_generic = CP_MACHINE_CPU_GENERIC

Definition at line 63 of file machine.F.

◆ machine_x86_sse4

integer, parameter, public machine::machine_x86_sse4 = CP_MACHINE_X86_SSE4

Definition at line 63 of file machine.F.

◆ machine_x86_avx

integer, parameter, public machine::machine_x86_avx = CP_MACHINE_X86_AVX

Definition at line 63 of file machine.F.

◆ machine_x86_avx2

integer, parameter, public machine::machine_x86_avx2 = CP_MACHINE_X86_AVX2

Definition at line 63 of file machine.F.

◆ machine_x86_avx512

integer, parameter, public machine::machine_x86_avx512 = CP_MACHINE_X86_AVX512

Definition at line 63 of file machine.F.

◆ machine_x86

integer, parameter, public machine::machine_x86 = MACHINE_X86_AVX512

Definition at line 63 of file machine.F.

◆ machine_arm_arch64

integer, parameter, public machine::machine_arm_arch64 = CP_MACHINE_ARM_ARCH64

Definition at line 63 of file machine.F.

◆ machine_arm_sve128

integer, parameter, public machine::machine_arm_sve128 = CP_MACHINE_ARM_SVE128

Definition at line 63 of file machine.F.

◆ machine_arm_sve256

integer, parameter, public machine::machine_arm_sve256 = CP_MACHINE_ARM_SVE256

Definition at line 63 of file machine.F.

◆ machine_arm_sve512

integer, parameter, public machine::machine_arm_sve512 = CP_MACHINE_ARM_SVE512

Definition at line 63 of file machine.F.

◆ machine_arm

integer, parameter, public machine::machine_arm = MACHINE_ARM_SVE512

Definition at line 63 of file machine.F.

◆ machine_cpu_unknown

integer, parameter, public machine::machine_cpu_unknown = CP_MACHINE_UNKNOWN

Definition at line 63 of file machine.F.

◆ flush_should_flush

logical, save, public machine::flush_should_flush = .TRUE.

Definition at line 115 of file machine.F.

◆ m_memory_max

integer(kind=int_8), save, public machine::m_memory_max = 0

Definition at line 117 of file machine.F.