LLVM OpenMP 20.0.0git
Classes | Macros | Typedefs | Functions | Variables
z_Linux_util.cpp File Reference
#include "kmp.h"
#include "kmp_affinity.h"
#include "kmp_i18n.h"
#include "kmp_io.h"
#include "kmp_itt.h"
#include "kmp_lock.h"
#include "kmp_stats.h"
#include "kmp_str.h"
#include "kmp_wait_release.h"
#include "kmp_wrapper_getpid.h"
#include <alloca.h>
#include <math.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/times.h>
#include <unistd.h>
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>

Go to the source code of this file.

Classes

struct  kmp_sys_timer
 

Macros

#define TIMEVAL_TO_TIMESPEC(tv, ts)
 
#define TS2NS(timespec)    (((timespec).tv_sec * (long int)1e9) + (timespec).tv_nsec)
 

Typedefs

typedef void(* microtask_t0) (int *, int *)
 
typedef void(* microtask_t1) (int *, int *, void *)
 
typedef void(* microtask_t2) (int *, int *, void *, void *)
 
typedef void(* microtask_t3) (int *, int *, void *, void *, void *)
 
typedef void(* microtask_t4) (int *, int *, void *, void *, void *, void *)
 
typedef void(* microtask_t5) (int *, int *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t6) (int *, int *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t7) (int *, int *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t8) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t9) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t10) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t11) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t12) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t13) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t14) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 
typedef void(* microtask_t15) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)
 

Functions

void __kmp_terminate_thread (int gtid)
 
static kmp_int32 __kmp_set_stack_info (int gtid, kmp_info_t *th)
 
static void__kmp_launch_worker (void *thr)
 
void __kmp_create_worker (int gtid, kmp_info_t *th, size_t stack_size)
 
void __kmp_exit_thread (int exit_status)
 
void __kmp_reap_monitor (kmp_info_t *th)
 
void __kmp_reap_worker (kmp_info_t *th)
 
void __kmp_enable (int new_state)
 
void __kmp_disable (int *old_state)
 
static void __kmp_atfork_prepare (void)
 
static void __kmp_atfork_parent (void)
 
static void __kmp_atfork_child (void)
 
void __kmp_register_atfork (void)
 
void __kmp_suspend_initialize (void)
 
void __kmp_suspend_initialize_thread (kmp_info_t *th)
 
void __kmp_suspend_uninitialize_thread (kmp_info_t *th)
 
int __kmp_try_suspend_mx (kmp_info_t *th)
 
void __kmp_lock_suspend_mx (kmp_info_t *th)
 
void __kmp_unlock_suspend_mx (kmp_info_t *th)
 
template<class C >
static void __kmp_suspend_template (int th_gtid, C *flag)
 
template<bool C, bool S>
void __kmp_suspend_32 (int th_gtid, kmp_flag_32< C, S > *flag)
 
template<bool C, bool S>
void __kmp_suspend_64 (int th_gtid, kmp_flag_64< C, S > *flag)
 
template<bool C, bool S>
void __kmp_atomic_suspend_64 (int th_gtid, kmp_atomic_flag_64< C, S > *flag)
 
void __kmp_suspend_oncore (int th_gtid, kmp_flag_oncore *flag)
 
template void __kmp_suspend_32< false, false > (int, kmp_flag_32< false, false > *)
 
template void __kmp_suspend_64< false, true > (int, kmp_flag_64< false, true > *)
 
template void __kmp_suspend_64< true, false > (int, kmp_flag_64< true, false > *)
 
template void __kmp_atomic_suspend_64< false, true > (int, kmp_atomic_flag_64< false, true > *)
 
template void __kmp_atomic_suspend_64< true, false > (int, kmp_atomic_flag_64< true, false > *)
 
template<class C >
static void __kmp_resume_template (int target_gtid, C *flag)
 
template<bool C, bool S>
void __kmp_resume_32 (int target_gtid, kmp_flag_32< C, S > *flag)
 
template<bool C, bool S>
void __kmp_resume_64 (int target_gtid, kmp_flag_64< C, S > *flag)
 
template<bool C, bool S>
void __kmp_atomic_resume_64 (int target_gtid, kmp_atomic_flag_64< C, S > *flag)
 
void __kmp_resume_oncore (int target_gtid, kmp_flag_oncore *flag)
 
template void __kmp_resume_32< false, true > (int, kmp_flag_32< false, true > *)
 
template void __kmp_resume_32< false, false > (int, kmp_flag_32< false, false > *)
 
template void __kmp_resume_64< false, true > (int, kmp_flag_64< false, true > *)
 
template void __kmp_atomic_resume_64< false, true > (int, kmp_atomic_flag_64< false, true > *)
 
void __kmp_yield ()
 
void __kmp_gtid_set_specific (int gtid)
 
int __kmp_gtid_get_specific ()
 
double __kmp_read_cpu_time (void)
 
int __kmp_read_system_info (struct kmp_sys_info *info)
 
void __kmp_read_system_time (double *delta)
 
void __kmp_clear_system_time (void)
 
static int __kmp_get_xproc (void)
 
int __kmp_read_from_file (char const *path, char const *format,...)
 
void __kmp_runtime_initialize (void)
 
void __kmp_runtime_destroy (void)
 
void __kmp_thread_sleep (int millis)
 
void __kmp_elapsed (double *t)
 
void __kmp_elapsed_tick (double *t)
 
kmp_uint64 __kmp_now_nsec ()
 
int __kmp_is_address_mapped (void *addr)
 
int __kmp_invoke_microtask (microtask_t pkfn, int gtid, int tid, int argc, void *p_argv[])
 
void __kmp_hidden_helper_worker_thread_wait ()
 
void __kmp_do_initialize_hidden_helper_threads ()
 
void __kmp_hidden_helper_threads_initz_wait ()
 
void __kmp_hidden_helper_initz_release ()
 
void __kmp_hidden_helper_main_thread_wait ()
 
void __kmp_hidden_helper_main_thread_release ()
 
void __kmp_hidden_helper_worker_thread_signal ()
 
void __kmp_hidden_helper_threads_deinitz_wait ()
 
void __kmp_hidden_helper_threads_deinitz_release ()
 
bool __kmp_detect_shm ()
 
bool __kmp_detect_tmp ()
 

Variables

static struct kmp_sys_timer __kmp_sys_timer_data
 
static int __kmp_init_runtime = FALSE
 
static int __kmp_fork_count = 0
 
static pthread_condattr_t __kmp_suspend_cond_attr
 
static pthread_mutexattr_t __kmp_suspend_mutex_attr
 
static kmp_cond_align_t __kmp_wait_cv
 
static kmp_mutex_align_t __kmp_wait_mx
 
kmp_uint64 __kmp_ticks_per_msec = 1000000
 
kmp_uint64 __kmp_ticks_per_usec = 1000
 

Macro Definition Documentation

◆ TIMEVAL_TO_TIMESPEC

#define TIMEVAL_TO_TIMESPEC (   tv,
  ts 
)
Value:
do { \
(ts)->tv_sec = (tv)->tv_sec; \
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
} while (0)

Definition at line 94 of file z_Linux_util.cpp.

◆ TS2NS

#define TS2NS (   timespec)     (((timespec).tv_sec * (long int)1e9) + (timespec).tv_nsec)

Definition at line 102 of file z_Linux_util.cpp.

Typedef Documentation

◆ microtask_t0

typedef void(* microtask_t0) (int *, int *)

Definition at line 2754 of file z_Linux_util.cpp.

◆ microtask_t1

typedef void(* microtask_t1) (int *, int *, void *)

Definition at line 2755 of file z_Linux_util.cpp.

◆ microtask_t10

typedef void(* microtask_t10) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2769 of file z_Linux_util.cpp.

◆ microtask_t11

typedef void(* microtask_t11) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2771 of file z_Linux_util.cpp.

◆ microtask_t12

typedef void(* microtask_t12) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2774 of file z_Linux_util.cpp.

◆ microtask_t13

typedef void(* microtask_t13) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2777 of file z_Linux_util.cpp.

◆ microtask_t14

typedef void(* microtask_t14) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2780 of file z_Linux_util.cpp.

◆ microtask_t15

typedef void(* microtask_t15) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2783 of file z_Linux_util.cpp.

◆ microtask_t2

typedef void(* microtask_t2) (int *, int *, void *, void *)

Definition at line 2756 of file z_Linux_util.cpp.

◆ microtask_t3

typedef void(* microtask_t3) (int *, int *, void *, void *, void *)

Definition at line 2757 of file z_Linux_util.cpp.

◆ microtask_t4

typedef void(* microtask_t4) (int *, int *, void *, void *, void *, void *)

Definition at line 2758 of file z_Linux_util.cpp.

◆ microtask_t5

typedef void(* microtask_t5) (int *, int *, void *, void *, void *, void *, void *)

Definition at line 2759 of file z_Linux_util.cpp.

◆ microtask_t6

typedef void(* microtask_t6) (int *, int *, void *, void *, void *, void *, void *, void *)

Definition at line 2761 of file z_Linux_util.cpp.

◆ microtask_t7

typedef void(* microtask_t7) (int *, int *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2763 of file z_Linux_util.cpp.

◆ microtask_t8

typedef void(* microtask_t8) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2765 of file z_Linux_util.cpp.

◆ microtask_t9

typedef void(* microtask_t9) (int *, int *, void *, void *, void *, void *, void *, void *, void *, void *, void *)

Definition at line 2767 of file z_Linux_util.cpp.

Function Documentation

◆ __kmp_atfork_child()

static void __kmp_atfork_child ( void  )
static

◆ __kmp_atfork_parent()

static void __kmp_atfork_parent ( void  )
static

◆ __kmp_atfork_prepare()

static void __kmp_atfork_prepare ( void  )
static

◆ __kmp_atomic_resume_64()

template<bool C, bool S>
void __kmp_atomic_resume_64 ( int  target_gtid,
kmp_atomic_flag_64< C, S > *  flag 
)

Definition at line 1760 of file z_Linux_util.cpp.

◆ __kmp_atomic_resume_64< false, true >()

template void __kmp_atomic_resume_64< false, true > ( int  ,
kmp_atomic_flag_64< false, true > *   
)

◆ __kmp_atomic_suspend_64()

template<bool C, bool S>
void __kmp_atomic_suspend_64 ( int  th_gtid,
kmp_atomic_flag_64< C, S > *  flag 
)

Definition at line 1654 of file z_Linux_util.cpp.

◆ __kmp_atomic_suspend_64< false, true >()

template void __kmp_atomic_suspend_64< false, true > ( int  ,
kmp_atomic_flag_64< false, true > *   
)

◆ __kmp_atomic_suspend_64< true, false >()

template void __kmp_atomic_suspend_64< true, false > ( int  ,
kmp_atomic_flag_64< true, false > *   
)

◆ __kmp_clear_system_time()

void __kmp_clear_system_time ( void  )

Definition at line 1888 of file z_Linux_util.cpp.

◆ __kmp_create_worker()

void __kmp_create_worker ( int  gtid,
kmp_info_t th,
size_t  stack_size 
)

Definition at line 780 of file z_Linux_util.cpp.

◆ __kmp_detect_shm()

bool __kmp_detect_shm ( )

Definition at line 3083 of file z_Linux_util.cpp.

Referenced by __kmp_register_library_startup().

◆ __kmp_detect_tmp()

bool __kmp_detect_tmp ( )

Definition at line 3095 of file z_Linux_util.cpp.

Referenced by __kmp_register_library_startup().

◆ __kmp_disable()

void __kmp_disable ( int old_state)

Definition at line 1284 of file z_Linux_util.cpp.

◆ __kmp_do_initialize_hidden_helper_threads()

void __kmp_do_initialize_hidden_helper_threads ( )

Definition at line 3050 of file z_Linux_util.cpp.

◆ __kmp_elapsed()

void __kmp_elapsed ( double t)

Definition at line 2055 of file z_Linux_util.cpp.

◆ __kmp_elapsed_tick()

void __kmp_elapsed_tick ( double t)

Definition at line 2075 of file z_Linux_util.cpp.

◆ __kmp_enable()

void __kmp_enable ( int  new_state)

Definition at line 1275 of file z_Linux_util.cpp.

◆ __kmp_exit_thread()

void __kmp_exit_thread ( int  exit_status)

Definition at line 1058 of file z_Linux_util.cpp.

◆ __kmp_get_xproc()

static int __kmp_get_xproc ( void  )
static

Definition at line 1896 of file z_Linux_util.cpp.

References __kmp_type_convert(), and r.

Referenced by __kmp_runtime_initialize().

◆ __kmp_gtid_get_specific()

int __kmp_gtid_get_specific ( void  )

Definition at line 1816 of file z_Linux_util.cpp.

◆ __kmp_gtid_set_specific()

void __kmp_gtid_set_specific ( int  gtid)

Definition at line 1805 of file z_Linux_util.cpp.

Referenced by __kmp_launch_worker().

◆ __kmp_hidden_helper_initz_release()

void __kmp_hidden_helper_initz_release ( )

Definition at line 3058 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_main_thread_release()

void __kmp_hidden_helper_main_thread_release ( )

Definition at line 3066 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_main_thread_wait()

void __kmp_hidden_helper_main_thread_wait ( )

Definition at line 3062 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_threads_deinitz_release()

void __kmp_hidden_helper_threads_deinitz_release ( )

Definition at line 3078 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_threads_deinitz_wait()

void __kmp_hidden_helper_threads_deinitz_wait ( )

Definition at line 3074 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_threads_initz_wait()

void __kmp_hidden_helper_threads_initz_wait ( )

Definition at line 3054 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_worker_thread_signal()

void __kmp_hidden_helper_worker_thread_signal ( )

Definition at line 3070 of file z_Linux_util.cpp.

◆ __kmp_hidden_helper_worker_thread_wait()

void __kmp_hidden_helper_worker_thread_wait ( )

Definition at line 3046 of file z_Linux_util.cpp.

◆ __kmp_invoke_microtask()

int __kmp_invoke_microtask ( microtask_t  pkfn,
int  gtid,
int  tid,
int  argc,
void p_argv[] 
)

◆ __kmp_is_address_mapped()

int __kmp_is_address_mapped ( void addr)

Definition at line 2110 of file z_Linux_util.cpp.

◆ __kmp_launch_worker()

static void * __kmp_launch_worker ( void thr)
static

◆ __kmp_lock_suspend_mx()

void __kmp_lock_suspend_mx ( kmp_info_t th)

Definition at line 1474 of file z_Linux_util.cpp.

Referenced by __kmp_resume_template(), and __kmp_suspend_template().

◆ __kmp_now_nsec()

kmp_uint64 __kmp_now_nsec ( )

Definition at line 2078 of file z_Linux_util.cpp.

◆ __kmp_read_cpu_time()

double __kmp_read_cpu_time ( void  )

Definition at line 1834 of file z_Linux_util.cpp.

◆ __kmp_read_from_file()

int __kmp_read_from_file ( char const *  path,
char const *  format,
  ... 
)

Definition at line 1924 of file z_Linux_util.cpp.

References args, f(), path, and result.

◆ __kmp_read_system_info()

int __kmp_read_system_info ( struct kmp_sys_info info)

Definition at line 1844 of file z_Linux_util.cpp.

◆ __kmp_read_system_time()

void __kmp_read_system_time ( double delta)

Definition at line 1875 of file z_Linux_util.cpp.

◆ __kmp_reap_monitor()

void __kmp_reap_monitor ( kmp_info_t th)

Definition at line 1114 of file z_Linux_util.cpp.

References void.

Referenced by __kmp_internal_end().

◆ __kmp_reap_worker()

void __kmp_reap_worker ( kmp_info_t th)

Definition at line 1117 of file z_Linux_util.cpp.

◆ __kmp_register_atfork()

void __kmp_register_atfork ( void  )

◆ __kmp_resume_32()

template<bool C, bool S>
void __kmp_resume_32 ( int  target_gtid,
kmp_flag_32< C, S > *  flag 
)

Definition at line 1752 of file z_Linux_util.cpp.

◆ __kmp_resume_32< false, false >()

template void __kmp_resume_32< false, false > ( int  ,
kmp_flag_32< false, false > *   
)

◆ __kmp_resume_32< false, true >()

template void __kmp_resume_32< false, true > ( int  ,
kmp_flag_32< false, true > *   
)

◆ __kmp_resume_64()

template<bool C, bool S>
void __kmp_resume_64 ( int  target_gtid,
kmp_flag_64< C, S > *  flag 
)

Definition at line 1756 of file z_Linux_util.cpp.

◆ __kmp_resume_64< false, true >()

template void __kmp_resume_64< false, true > ( int  ,
kmp_flag_64< false, true > *   
)

◆ __kmp_resume_oncore()

void __kmp_resume_oncore ( int  target_gtid,
kmp_flag_oncore flag 
)

Definition at line 1763 of file z_Linux_util.cpp.

◆ __kmp_resume_template()

template<class C >
static void __kmp_resume_template ( int  target_gtid,
C flag 
)
inlinestatic

◆ __kmp_runtime_destroy()

void __kmp_runtime_destroy ( void  )

Definition at line 2021 of file z_Linux_util.cpp.

◆ __kmp_runtime_initialize()

void __kmp_runtime_initialize ( void  )

Definition at line 1941 of file z_Linux_util.cpp.

◆ __kmp_set_stack_info()

static kmp_int32 __kmp_set_stack_info ( int  gtid,
kmp_info_t th 
)
static

◆ __kmp_suspend_32()

template<bool C, bool S>
void __kmp_suspend_32 ( int  th_gtid,
kmp_flag_32< C, S > *  flag 
)

Definition at line 1646 of file z_Linux_util.cpp.

◆ __kmp_suspend_32< false, false >()

template void __kmp_suspend_32< false, false > ( int  ,
kmp_flag_32< false, false > *   
)

◆ __kmp_suspend_64()

template<bool C, bool S>
void __kmp_suspend_64 ( int  th_gtid,
kmp_flag_64< C, S > *  flag 
)

Definition at line 1650 of file z_Linux_util.cpp.

◆ __kmp_suspend_64< false, true >()

template void __kmp_suspend_64< false, true > ( int  ,
kmp_flag_64< false, true > *   
)

◆ __kmp_suspend_64< true, false >()

template void __kmp_suspend_64< true, false > ( int  ,
kmp_flag_64< true, false > *   
)

◆ __kmp_suspend_initialize()

void __kmp_suspend_initialize ( void  )

Definition at line 1416 of file z_Linux_util.cpp.

◆ __kmp_suspend_initialize_thread()

void __kmp_suspend_initialize_thread ( kmp_info_t th)

Definition at line 1424 of file z_Linux_util.cpp.

Referenced by __kmp_resume_template(), and __kmp_suspend_template().

◆ __kmp_suspend_oncore()

void __kmp_suspend_oncore ( int  th_gtid,
kmp_flag_oncore flag 
)

Definition at line 1657 of file z_Linux_util.cpp.

◆ __kmp_suspend_template()

template<class C >
static void __kmp_suspend_template ( int  th_gtid,
C flag 
)
inlinestatic

◆ __kmp_suspend_uninitialize_thread()

void __kmp_suspend_uninitialize_thread ( kmp_info_t th)

Definition at line 1449 of file z_Linux_util.cpp.

◆ __kmp_terminate_thread()

void __kmp_terminate_thread ( int  gtid)

Definition at line 443 of file z_Linux_util.cpp.

◆ __kmp_thread_sleep()

void __kmp_thread_sleep ( int  millis)

Definition at line 2052 of file z_Linux_util.cpp.

◆ __kmp_try_suspend_mx()

int __kmp_try_suspend_mx ( kmp_info_t th)

Definition at line 1470 of file z_Linux_util.cpp.

◆ __kmp_unlock_suspend_mx()

void __kmp_unlock_suspend_mx ( kmp_info_t th)

Definition at line 1479 of file z_Linux_util.cpp.

Referenced by __kmp_resume_template(), and __kmp_suspend_template().

◆ __kmp_yield()

void __kmp_yield ( )

Definition at line 1803 of file z_Linux_util.cpp.

Variable Documentation

◆ __kmp_fork_count

int __kmp_fork_count = 0
static

◆ __kmp_init_runtime

int __kmp_init_runtime = FALSE
static

◆ __kmp_suspend_cond_attr

pthread_condattr_t __kmp_suspend_cond_attr
static

Definition at line 117 of file z_Linux_util.cpp.

Referenced by __kmp_suspend_initialize(), and __kmp_suspend_initialize_thread().

◆ __kmp_suspend_mutex_attr

pthread_mutexattr_t __kmp_suspend_mutex_attr
static

Definition at line 118 of file z_Linux_util.cpp.

Referenced by __kmp_suspend_initialize(), and __kmp_suspend_initialize_thread().

◆ __kmp_sys_timer_data

struct kmp_sys_timer __kmp_sys_timer_data
static

Definition at line 105 of file z_Linux_util.cpp.

Referenced by __kmp_clear_system_time(), and __kmp_read_system_time().

◆ __kmp_ticks_per_msec

kmp_uint64 __kmp_ticks_per_msec = 1000000

Definition at line 123 of file z_Linux_util.cpp.

◆ __kmp_ticks_per_usec

kmp_uint64 __kmp_ticks_per_usec = 1000

Definition at line 124 of file z_Linux_util.cpp.

◆ __kmp_wait_cv

kmp_cond_align_t __kmp_wait_cv
static

Definition at line 120 of file z_Linux_util.cpp.

Referenced by __kmp_runtime_destroy(), and __kmp_runtime_initialize().

◆ __kmp_wait_mx

kmp_mutex_align_t __kmp_wait_mx
static

Definition at line 121 of file z_Linux_util.cpp.

Referenced by __kmp_runtime_destroy(), and __kmp_runtime_initialize().