正在加载图片...
OpenMP API 4.0 C/C++ Page 3 Runtime Library Routines Retumn types are show in greer Execution environment routines affect and monitor threads.processors,and the parallel environment.The library routines are external functions with"C"linkage cution Environm nent Routines mp_set_num_thn mp get_num ot sp omp_get_num_,teams [32z间 See kind above. void omp_set_num_thre 22 omp get_team_num [3.2.27) mostcdosing nt omp get thread limit void 1.Ihe int_um): omp _getmax threads int omp_get_team_num(void): h void omptmaxactive leveb(int m) omp get thread_num it omp get_ma Lock Routines omp tet_num_procs region,ret the nt omp get levellyoidl: ck t"lockh omp_in_parallel 2632.6 ICVs greaterthan void omp_init nest___) e2321周 rov lock omp set dynamic void omp_destroy nest lock(ompest lock) Setlo omp_get_dynamic Unset lock [3.B3a uted Test lock [.3.5]3.3.5] nt omp_get_ca elaiontkoid omp_get_proc_bind ism,by setting the int omp_nest lock(omp_nest lock_ Timing Routines omp_set_schedule iihhetethartapiedhennuntime格tsed omp-set ometwme double omp_get_wtimelvoid): vod omp_set_sc r(seconds betweer omp_get_default_device cke)us omewtime. double omp get wtick void): D 2013 DocnMP ARB OMP1013© 2013 OpenMP ARB OMP1013C OpenMP API 4.0 C/C++ Page 3 Runtime Library Routines Return types are shown in green. Execution environment routines affect and monitor threads, processors, and the parallel environment. The library routines are external functions with “C” linkage. Execution Environment Routines omp_set_num_threads [3.2.1] [3.2.1] Affects the number of threads used for subsequent parallel regions not specifying a num_threads clause, by setting the value of the first element of the nthreads-var ICV of the current task to num_threads. void omp_set_num_threads(int num_threads); omp_get_num_threads [3.2.2] [3.2.2] Returns the number of threads in the current team. The binding region for an omp_get_num_threads region is the innermost enclosing parallel region. int omp_get_num_threads(void); omp_get_max_threads [3.2.3] [3.2.3] Returns an upper bound on the number of threads that could be used to form a new team if a parallel construct without a num_threads clause were encountered after execution returns from this routine. int omp_get_max_threads(void); omp_get_thread_num [3.2.4] [3.2.4] Returns the thread number of the calling thread within the current team. int omp_get_thread_num(void); omp_get_num_procs [3.2.5] [3.2.5] Returns the number of processors that are available to the device at the time the routine is called. int omp_get_num_procs(void); omp_in_parallel [3.2.6] [3.2.6] Returns true if the active-levels-var ICV is greater than zero; otherwise it returns false. int omp_in_parallel(void); omp_set_dynamic [3.2.7] [3.2.7] Returns the value of the dyn-var ICV, which indicates if dynamic adjustment of the number of threads is enabled or disabled. void omp_set_dynamic(int dynamic_threads); omp_get_dynamic [3.2.8] [3.2.8] This routine returns the value of the dyn-var ICV, which is true if dynamic adjustment of the number of threads is enabled for the current task. int omp_get_dynamic(void); 4.0 omp_get_cancellation [3.2.9] Returns the value of the cancel-var ICV, which controls the behavior of cancel construct and cancellation points. int omp_get_cancellation(void); omp_set_nested [3.2.10] [3.2.9] Enables or disables nested parallelism, by setting the nest-var ICV. void omp_set_nested(int nested); omp_get_nested [3.2.11] [3.2.10] Returns the value of the nest-var ICV, which indicates if nested parallelism is enabled or disabled. int omp_get_nested(void); omp_set_schedule [3.2.12] [3.2.11] Affects the schedule that is applied when runtime is used as schedule kind. void omp_set_schedule(omp_sched_t kind, int modifier); kind: one of the folowing, or an implementation-defined schedule: omp_sched_static = 1 omp_sched_dynamic = 2 omp_sched_guided = 3 omp_sched_auto = 4 omp_get_schedule [3.2.13] [3.2.12] Returns the value of run-sched-var ICV, which is the schedule applied when runtime schedule is used. void omp_get_schedule( omp_sched_t *kind, int *modifier); See kind above. omp_get_thread_limit [3.2.14] [3.2.13] Returns the value of the thread-limit-var ICV, which is the maximum number of OpenMP threads available. int omp_get_thread_limit(void); omp_set_max_active_levels [3.2.15] [3.2.14] Limits the number of nested active parallel regions, by setting max-active-levels-var ICV. void omp_set_max_active_levels(int max_levels); omp_get_max_active_levels [3.2.16] [3.2.15] Returns the value of max-active-levels-var ICV, which determines the maximum number of nested active parallel regions. int omp_get_max_active_levels(void); omp_get_level [3.2.17] [3.2.16] For the enclosing device region, returns the levels-vars ICV, which is the number of nested parallel regions that enclose the task containing the call. int omp_get_level(void); omp_get_ancestor_thread_num [3.2.18] [3.2.17] Returns, for a given nested level of the current thread, the thread number of the ancestor of the current thread. int omp_get_ancestor_thread_num(int level); omp_get_team_size [3.2.19] [3.2.18] Returns, for a given nested level of the current thread, the size of the thread team to which the ancestor or the current thread belongs. int omp_get_team_size(int level); omp_get_active_level [3.2.20] [3.2.19] Returns the value of the active-level-vars ICV, which determines the number of active, nested parallel regions enclosing the task that contains the call. int omp_get_active_level(void); omp_in_final [3.2.21] [3.2.20] Returns true if the routine is executed in a final task region; otherwise, it returns false. int omp_in_final(void); 4.0 omp_get_proc_bind [3.2.22] Returns the thread affinity policy to be used for the subsequent nested parallel regions that do not specify a proc_bind clause. omp_proc_bind_t omp_get_proc_bind(void); Returns one of: omp_proc_bind_false = 0 omp_proc_bind_true = 1 omp_proc_bind_master = 2 omp_proc_bind_close = 3 omp_proc_bind_spread = 4 4.0 omp_set_default_device [3.2.23] Controls the default target device by assigning the value of the default-device-var ICV. void omp_set_default_device(int device_num); 4.0 omp_get_default_device [3.2.24] Returns the default target device. int omp_get_default_device(void); 4.0 omp_get_num_devices [3.2.25] Returns the number of target devices. int omp_get_num_devices(void); 4.0 omp_get_num_teams [3.2.26] Returns the number of teams in the current teams region, or 1 if called from outside of a teams region. int omp_get_num_teams(void); 4.0 omp_get_team_num [3.2.27] Returns the team number of calling thread. The team number is an integer between 0 and one less than the value returned by omp_get_num_teams, inclusive. int omp_get_team_num(void); 4.0 omp_is_initial_device [3.2.28] Returns true if the current task is executing on the host device; otherwise, it returns false. int omp_is_initial_device(void); Lock Routines General-purpose lock routines. Two types of locks are supported: simple locks and nestable locks. A nestable lock can be set multiple times by the same task before being unset; a simple lock cannot be set if it is already owned by the task trying to set it. Initialize lock [3.3.1] [3.3.1] Initialize an OpenMP lock. void omp_init_lock(omp_lock_t *lock); void omp_init_nest_lock(omp_nest_lock_t *lock); Destroy lock [3.3.2] [3.3.2] Ensure that the OpenMP lock is uninitialized. void omp_destroy_lock(omp_lock_t *lock); void omp_destroy_nest_lock(omp_nest_lock_t *lock); Set lock [3.3.3] [3.3.3] Sets an OpenMP lock. The calling task region is suspended until the lock is set. void omp_set_lock(omp_lock_t *lock); void omp_set_nest_lock(omp_nest_lock_t *lock); Unset lock [3.3.4] [3.3.4] Unsets an OpenMP lock. void omp_unset_lock(omp_lock_t *lock); void omp_unset_nest_lock(omp_nest_lock_t *lock); Test lock [3.3.5] [3.3.5] Attempt to set an OpenMP lock but do not suspend execution of the task executing the routine. int omp_test_lock(omp_lock_t *lock); int omp_test_nest_lock(omp_nest_lock_t *lock); Timing Routines Timing routines support a portable wall clock timer.These record elapsed time per-thread and are not guaranteed to be globally consistent across all the threads participating in an application. omp_get_wtime [3.4.1] [3.4.1] Returns elapsed wall clock time in seconds. double omp_get_wtime(void); omp_get_wtick [3.4.2] [3.4.2] Returns the precision of the timer (seconds between ticks) used by omp_get_wtime. double omp_get_wtick(void);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有