10b57cec5SDimitry Andric/* 20b57cec5SDimitry Andric * include/omp.h.var 30b57cec5SDimitry Andric */ 40b57cec5SDimitry Andric 50b57cec5SDimitry Andric 60b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 70b57cec5SDimitry Andric// 80b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 90b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 100b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 110b57cec5SDimitry Andric// 120b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric#ifndef __OMP_H 160b57cec5SDimitry Andric# define __OMP_H 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric# include <stdlib.h> 190b57cec5SDimitry Andric# include <stdint.h> 200b57cec5SDimitry Andric 210b57cec5SDimitry Andric# define KMP_VERSION_MAJOR @LIBOMP_VERSION_MAJOR@ 220b57cec5SDimitry Andric# define KMP_VERSION_MINOR @LIBOMP_VERSION_MINOR@ 230b57cec5SDimitry Andric# define KMP_VERSION_BUILD @LIBOMP_VERSION_BUILD@ 240b57cec5SDimitry Andric# define KMP_BUILD_DATE "@LIBOMP_BUILD_DATE@" 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric# ifdef __cplusplus 270b57cec5SDimitry Andric extern "C" { 280b57cec5SDimitry Andric# endif 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric# define omp_set_affinity_format ompc_set_affinity_format 310b57cec5SDimitry Andric# define omp_get_affinity_format ompc_get_affinity_format 320b57cec5SDimitry Andric# define omp_display_affinity ompc_display_affinity 330b57cec5SDimitry Andric# define omp_capture_affinity ompc_capture_affinity 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric# if defined(_WIN32) 360b57cec5SDimitry Andric# define __KAI_KMPC_CONVENTION __cdecl 370b57cec5SDimitry Andric# ifndef __KMP_IMP 380b57cec5SDimitry Andric# define __KMP_IMP __declspec(dllimport) 390b57cec5SDimitry Andric# endif 400b57cec5SDimitry Andric# else 410b57cec5SDimitry Andric# define __KAI_KMPC_CONVENTION 420b57cec5SDimitry Andric# ifndef __KMP_IMP 430b57cec5SDimitry Andric# define __KMP_IMP 440b57cec5SDimitry Andric# endif 450b57cec5SDimitry Andric# endif 460b57cec5SDimitry Andric 470b57cec5SDimitry Andric /* schedule kind constants */ 480b57cec5SDimitry Andric typedef enum omp_sched_t { 490b57cec5SDimitry Andric omp_sched_static = 1, 500b57cec5SDimitry Andric omp_sched_dynamic = 2, 510b57cec5SDimitry Andric omp_sched_guided = 3, 520b57cec5SDimitry Andric omp_sched_auto = 4, 530b57cec5SDimitry Andric omp_sched_monotonic = 0x80000000 540b57cec5SDimitry Andric } omp_sched_t; 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric /* set API functions */ 570b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); 580b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); 590b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nested (int); 600b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); 610b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); 620b57cec5SDimitry Andric 630b57cec5SDimitry Andric /* query API functions */ 640b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); 650b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); 660b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_nested (void); 670b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); 680b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); 690b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); 700b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); 710b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_in_final (void); 720b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); 730b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_level (void); 740b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); 750b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); 760b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); 770b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); 780b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); 790b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_max_task_priority (void); 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric /* lock API functions */ 820b57cec5SDimitry Andric typedef struct omp_lock_t { 830b57cec5SDimitry Andric void * _lk; 840b57cec5SDimitry Andric } omp_lock_t; 850b57cec5SDimitry Andric 860b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); 870b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); 880b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); 890b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); 900b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); 910b57cec5SDimitry Andric 920b57cec5SDimitry Andric /* nested lock API functions */ 930b57cec5SDimitry Andric typedef struct omp_nest_lock_t { 940b57cec5SDimitry Andric void * _lk; 950b57cec5SDimitry Andric } omp_nest_lock_t; 960b57cec5SDimitry Andric 970b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); 980b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); 990b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); 1000b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); 1010b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); 1020b57cec5SDimitry Andric 1030b57cec5SDimitry Andric /* OpenMP 5.0 Synchronization hints*/ 1040b57cec5SDimitry Andric typedef enum omp_sync_hint_t { 1050b57cec5SDimitry Andric omp_sync_hint_none = 0, 1060b57cec5SDimitry Andric omp_lock_hint_none = omp_sync_hint_none, 1070b57cec5SDimitry Andric omp_sync_hint_uncontended = 1, 1080b57cec5SDimitry Andric omp_lock_hint_uncontended = omp_sync_hint_uncontended, 1090b57cec5SDimitry Andric omp_sync_hint_contended = (1<<1), 1100b57cec5SDimitry Andric omp_lock_hint_contended = omp_sync_hint_contended, 1110b57cec5SDimitry Andric omp_sync_hint_nonspeculative = (1<<2), 1120b57cec5SDimitry Andric omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, 1130b57cec5SDimitry Andric omp_sync_hint_speculative = (1<<3), 1140b57cec5SDimitry Andric omp_lock_hint_speculative = omp_sync_hint_speculative, 1150b57cec5SDimitry Andric kmp_lock_hint_hle = (1<<16), 1160b57cec5SDimitry Andric kmp_lock_hint_rtm = (1<<17), 1170b57cec5SDimitry Andric kmp_lock_hint_adaptive = (1<<18) 1180b57cec5SDimitry Andric } omp_sync_hint_t; 1190b57cec5SDimitry Andric 1200b57cec5SDimitry Andric /* lock hint type for dynamic user lock */ 1210b57cec5SDimitry Andric typedef omp_sync_hint_t omp_lock_hint_t; 1220b57cec5SDimitry Andric 1230b57cec5SDimitry Andric /* hinted lock initializers */ 1240b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t); 1250b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_init_nest_lock_with_hint(omp_nest_lock_t *, omp_lock_hint_t); 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andric /* time API functions */ 1280b57cec5SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); 1290b57cec5SDimitry Andric extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); 1300b57cec5SDimitry Andric 1310b57cec5SDimitry Andric /* OpenMP 4.0 */ 1320b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); 1330b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); 1340b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); 1350b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); 1360b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); 1370b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); 1380b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); 1390b57cec5SDimitry Andric 1400b57cec5SDimitry Andric /* OpenMP 4.5 */ 1410b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_initial_device (void); 1420b57cec5SDimitry Andric extern void* __KAI_KMPC_CONVENTION omp_target_alloc(size_t, int); 1430b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_target_free(void *, int); 1440b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_is_present(void *, int); 1450b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy(void *, void *, size_t, size_t, size_t, int, int); 1460b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect(void *, void *, size_t, int, const size_t *, 1470b57cec5SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int); 1480b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_associate_ptr(void *, void *, size_t, size_t, int); 1490b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_disassociate_ptr(void *, int); 1500b57cec5SDimitry Andric 1510b57cec5SDimitry Andric /* OpenMP 5.0 */ 1520b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_device_num (void); 1530b57cec5SDimitry Andric typedef void * omp_depend_t; 1540b57cec5SDimitry Andric 155*e8d8bef9SDimitry Andric /* OpenMP 5.1 interop */ 156*e8d8bef9SDimitry Andric typedef intptr_t omp_intptr_t; 157*e8d8bef9SDimitry Andric 158*e8d8bef9SDimitry Andric /* 0..omp_get_num_interop_properties()-1 are reserved for implementation-defined properties */ 159*e8d8bef9SDimitry Andric typedef enum omp_interop_property { 160*e8d8bef9SDimitry Andric omp_ipr_fr_id = -1, 161*e8d8bef9SDimitry Andric omp_ipr_fr_name = -2, 162*e8d8bef9SDimitry Andric omp_ipr_vendor = -3, 163*e8d8bef9SDimitry Andric omp_ipr_vendor_name = -4, 164*e8d8bef9SDimitry Andric omp_ipr_device_num = -5, 165*e8d8bef9SDimitry Andric omp_ipr_platform = -6, 166*e8d8bef9SDimitry Andric omp_ipr_device = -7, 167*e8d8bef9SDimitry Andric omp_ipr_device_context = -8, 168*e8d8bef9SDimitry Andric omp_ipr_targetsync = -9, 169*e8d8bef9SDimitry Andric omp_ipr_first = -9 170*e8d8bef9SDimitry Andric } omp_interop_property_t; 171*e8d8bef9SDimitry Andric 172*e8d8bef9SDimitry Andric #define omp_interop_none 0 173*e8d8bef9SDimitry Andric 174*e8d8bef9SDimitry Andric typedef enum omp_interop_rc { 175*e8d8bef9SDimitry Andric omp_irc_no_value = 1, 176*e8d8bef9SDimitry Andric omp_irc_success = 0, 177*e8d8bef9SDimitry Andric omp_irc_empty = -1, 178*e8d8bef9SDimitry Andric omp_irc_out_of_range = -2, 179*e8d8bef9SDimitry Andric omp_irc_type_int = -3, 180*e8d8bef9SDimitry Andric omp_irc_type_ptr = -4, 181*e8d8bef9SDimitry Andric omp_irc_type_str = -5, 182*e8d8bef9SDimitry Andric omp_irc_other = -6 183*e8d8bef9SDimitry Andric } omp_interop_rc_t; 184*e8d8bef9SDimitry Andric 185*e8d8bef9SDimitry Andric typedef void * omp_interop_t; 186*e8d8bef9SDimitry Andric 187*e8d8bef9SDimitry Andric /*! 188*e8d8bef9SDimitry Andric * The `omp_get_num_interop_properties` routine retrieves the number of implementation-defined properties available for an `omp_interop_t` object. 189*e8d8bef9SDimitry Andric */ 190*e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_interop_properties(const omp_interop_t); 191*e8d8bef9SDimitry Andric /*! 192*e8d8bef9SDimitry Andric * The `omp_get_interop_int` routine retrieves an integer property from an `omp_interop_t` object. 193*e8d8bef9SDimitry Andric */ 194*e8d8bef9SDimitry Andric extern omp_intptr_t __KAI_KMPC_CONVENTION omp_get_interop_int(const omp_interop_t, omp_interop_property_t, int *); 195*e8d8bef9SDimitry Andric /*! 196*e8d8bef9SDimitry Andric * The `omp_get_interop_ptr` routine retrieves a pointer property from an `omp_interop_t` object. 197*e8d8bef9SDimitry Andric */ 198*e8d8bef9SDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_interop_ptr(const omp_interop_t, omp_interop_property_t, int *); 199*e8d8bef9SDimitry Andric /*! 200*e8d8bef9SDimitry Andric * The `omp_get_interop_str` routine retrieves a string property from an `omp_interop_t` object. 201*e8d8bef9SDimitry Andric */ 202*e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_str(const omp_interop_t, omp_interop_property_t, int *); 203*e8d8bef9SDimitry Andric /*! 204*e8d8bef9SDimitry Andric * The `omp_get_interop_name` routine retrieves a property name from an `omp_interop_t` object. 205*e8d8bef9SDimitry Andric */ 206*e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_name(const omp_interop_t, omp_interop_property_t); 207*e8d8bef9SDimitry Andric /*! 208*e8d8bef9SDimitry Andric * The `omp_get_interop_type_desc` routine retrieves a description of the type of a property associated with an `omp_interop_t` object. 209*e8d8bef9SDimitry Andric */ 210*e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_type_desc(const omp_interop_t, omp_interop_property_t); 211*e8d8bef9SDimitry Andric /*! 212*e8d8bef9SDimitry Andric * The `omp_get_interop_rc_desc` routine retrieves a description of the return code associated with an `omp_interop_t` object. 213*e8d8bef9SDimitry Andric */ 214*e8d8bef9SDimitry Andric extern const char * __KAI_KMPC_CONVENTION omp_get_interop_rc_desc(const omp_interop_rc_t, omp_interop_rc_t); 215*e8d8bef9SDimitry Andric 216*e8d8bef9SDimitry Andric /* OpenMP 5.1 device memory routines */ 217*e8d8bef9SDimitry Andric 218*e8d8bef9SDimitry Andric /*! 219*e8d8bef9SDimitry Andric * The `omp_target_memcpy_async` routine asynchronously performs a copy between any combination of host and device pointers. 220*e8d8bef9SDimitry Andric */ 221*e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_async(void *, const void *, size_t, size_t, size_t, int, 222*e8d8bef9SDimitry Andric int, int, omp_depend_t *); 223*e8d8bef9SDimitry Andric /*! 224*e8d8bef9SDimitry Andric * The `omp_target_memcpy_rect_async` routine asynchronously performs a copy between any combination of host and device pointers. 225*e8d8bef9SDimitry Andric */ 226*e8d8bef9SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_target_memcpy_rect_async(void *, const void *, size_t, int, const size_t *, 227*e8d8bef9SDimitry Andric const size_t *, const size_t *, const size_t *, const size_t *, int, int, 228*e8d8bef9SDimitry Andric int, omp_depend_t *); 229*e8d8bef9SDimitry Andric /*! 230*e8d8bef9SDimitry Andric * The `omp_get_mapped_ptr` routine returns the device pointer that is associated with a host pointer for a given device. 231*e8d8bef9SDimitry Andric */ 232*e8d8bef9SDimitry Andric extern void * __KAI_KMPC_CONVENTION omp_get_mapped_ptr(const void *, int); 233*e8d8bef9SDimitry Andric 2340b57cec5SDimitry Andric /* kmp API functions */ 2350b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); 2360b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); 2370b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); 2380b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); 2390b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); 2400b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_library (void); 2410b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); 2420b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library (int); 2430b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); 2440b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); 2450b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); 2460b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); 2470b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_disp_num_buffers (int); 2480b57cec5SDimitry Andric 2490b57cec5SDimitry Andric /* Intel affinity API */ 2500b57cec5SDimitry Andric typedef void * kmp_affinity_mask_t; 2510b57cec5SDimitry Andric 2520b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); 2530b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); 2540b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); 2550b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); 2560b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); 2570b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); 2580b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); 2590b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); 2600b57cec5SDimitry Andric 2610b57cec5SDimitry Andric /* OpenMP 4.0 affinity API */ 2620b57cec5SDimitry Andric typedef enum omp_proc_bind_t { 2630b57cec5SDimitry Andric omp_proc_bind_false = 0, 2640b57cec5SDimitry Andric omp_proc_bind_true = 1, 2650b57cec5SDimitry Andric omp_proc_bind_master = 2, 2660b57cec5SDimitry Andric omp_proc_bind_close = 3, 2670b57cec5SDimitry Andric omp_proc_bind_spread = 4 2680b57cec5SDimitry Andric } omp_proc_bind_t; 2690b57cec5SDimitry Andric 2700b57cec5SDimitry Andric extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); 2710b57cec5SDimitry Andric 2720b57cec5SDimitry Andric /* OpenMP 4.5 affinity API */ 2730b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_num_places (void); 2740b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num_procs (int); 2750b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_place_proc_ids (int, int *); 2760b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_place_num (void); 2770b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_partition_num_places (void); 2780b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_get_partition_place_nums (int *); 2790b57cec5SDimitry Andric 2800b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); 2810b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_aligned_malloc (size_t, size_t); 2820b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); 2830b57cec5SDimitry Andric extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); 2840b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_free (void *); 2850b57cec5SDimitry Andric 2860b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); 2870b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); 2880b57cec5SDimitry Andric 2890b57cec5SDimitry Andric /* OpenMP 5.0 Tool Control */ 2900b57cec5SDimitry Andric typedef enum omp_control_tool_result_t { 2910b57cec5SDimitry Andric omp_control_tool_notool = -2, 2920b57cec5SDimitry Andric omp_control_tool_nocallback = -1, 2930b57cec5SDimitry Andric omp_control_tool_success = 0, 2940b57cec5SDimitry Andric omp_control_tool_ignored = 1 2950b57cec5SDimitry Andric } omp_control_tool_result_t; 2960b57cec5SDimitry Andric 2970b57cec5SDimitry Andric typedef enum omp_control_tool_t { 2980b57cec5SDimitry Andric omp_control_tool_start = 1, 2990b57cec5SDimitry Andric omp_control_tool_pause = 2, 3000b57cec5SDimitry Andric omp_control_tool_flush = 3, 3010b57cec5SDimitry Andric omp_control_tool_end = 4 3020b57cec5SDimitry Andric } omp_control_tool_t; 3030b57cec5SDimitry Andric 3040b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_control_tool(int, int, void*); 3050b57cec5SDimitry Andric 3060b57cec5SDimitry Andric /* OpenMP 5.0 Memory Management */ 3070b57cec5SDimitry Andric typedef uintptr_t omp_uintptr_t; 3080b57cec5SDimitry Andric 3090b57cec5SDimitry Andric typedef enum { 310*e8d8bef9SDimitry Andric omp_atk_sync_hint = 1, 3115ffd83dbSDimitry Andric omp_atk_alignment = 2, 3125ffd83dbSDimitry Andric omp_atk_access = 3, 3135ffd83dbSDimitry Andric omp_atk_pool_size = 4, 3145ffd83dbSDimitry Andric omp_atk_fallback = 5, 3155ffd83dbSDimitry Andric omp_atk_fb_data = 6, 3165ffd83dbSDimitry Andric omp_atk_pinned = 7, 3175ffd83dbSDimitry Andric omp_atk_partition = 8 3180b57cec5SDimitry Andric } omp_alloctrait_key_t; 3190b57cec5SDimitry Andric 3200b57cec5SDimitry Andric typedef enum { 3215ffd83dbSDimitry Andric omp_atv_false = 0, 3225ffd83dbSDimitry Andric omp_atv_true = 1, 3235ffd83dbSDimitry Andric omp_atv_contended = 3, 3245ffd83dbSDimitry Andric omp_atv_uncontended = 4, 325*e8d8bef9SDimitry Andric omp_atv_serialized = 5, 326*e8d8bef9SDimitry Andric omp_atv_sequential = omp_atv_serialized, // (deprecated) 3275ffd83dbSDimitry Andric omp_atv_private = 6, 3285ffd83dbSDimitry Andric omp_atv_all = 7, 3295ffd83dbSDimitry Andric omp_atv_thread = 8, 3305ffd83dbSDimitry Andric omp_atv_pteam = 9, 3315ffd83dbSDimitry Andric omp_atv_cgroup = 10, 3325ffd83dbSDimitry Andric omp_atv_default_mem_fb = 11, 3335ffd83dbSDimitry Andric omp_atv_null_fb = 12, 3345ffd83dbSDimitry Andric omp_atv_abort_fb = 13, 3355ffd83dbSDimitry Andric omp_atv_allocator_fb = 14, 3365ffd83dbSDimitry Andric omp_atv_environment = 15, 3375ffd83dbSDimitry Andric omp_atv_nearest = 16, 3385ffd83dbSDimitry Andric omp_atv_blocked = 17, 3395ffd83dbSDimitry Andric omp_atv_interleaved = 18 3400b57cec5SDimitry Andric } omp_alloctrait_value_t; 341*e8d8bef9SDimitry Andric #define omp_atv_default ((omp_uintptr_t)-1) 3420b57cec5SDimitry Andric 3430b57cec5SDimitry Andric typedef struct { 3440b57cec5SDimitry Andric omp_alloctrait_key_t key; 3450b57cec5SDimitry Andric omp_uintptr_t value; 3460b57cec5SDimitry Andric } omp_alloctrait_t; 3470b57cec5SDimitry Andric 3480b57cec5SDimitry Andric# if defined(_WIN32) 3490b57cec5SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 3500b57cec5SDimitry Andric typedef omp_uintptr_t omp_allocator_handle_t; 3510b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_null_allocator; 3520b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_default_mem_alloc; 3530b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_large_cap_mem_alloc; 3540b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_const_mem_alloc; 3550b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_high_bw_mem_alloc; 3560b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_low_lat_mem_alloc; 3570b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_cgroup_mem_alloc; 3580b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_pteam_mem_alloc; 3590b57cec5SDimitry Andric extern __KMP_IMP omp_allocator_handle_t const omp_thread_mem_alloc; 3600b57cec5SDimitry Andric typedef omp_uintptr_t omp_memspace_handle_t; 3610b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_default_mem_space; 3620b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_large_cap_mem_space; 3630b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_const_mem_space; 3640b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_high_bw_mem_space; 3650b57cec5SDimitry Andric extern __KMP_IMP omp_memspace_handle_t const omp_low_lat_mem_space; 3660b57cec5SDimitry Andric# else 3670b57cec5SDimitry Andric# if __cplusplus >= 201103 3680b57cec5SDimitry Andric typedef enum omp_allocator_handle_t : omp_uintptr_t 3690b57cec5SDimitry Andric# else 3700b57cec5SDimitry Andric typedef enum omp_allocator_handle_t 3710b57cec5SDimitry Andric# endif 3720b57cec5SDimitry Andric { 3730b57cec5SDimitry Andric omp_null_allocator = 0, 3740b57cec5SDimitry Andric omp_default_mem_alloc = 1, 3750b57cec5SDimitry Andric omp_large_cap_mem_alloc = 2, 3760b57cec5SDimitry Andric omp_const_mem_alloc = 3, 3770b57cec5SDimitry Andric omp_high_bw_mem_alloc = 4, 3780b57cec5SDimitry Andric omp_low_lat_mem_alloc = 5, 3790b57cec5SDimitry Andric omp_cgroup_mem_alloc = 6, 3800b57cec5SDimitry Andric omp_pteam_mem_alloc = 7, 3810b57cec5SDimitry Andric omp_thread_mem_alloc = 8, 3820b57cec5SDimitry Andric KMP_ALLOCATOR_MAX_HANDLE = UINTPTR_MAX 3830b57cec5SDimitry Andric } omp_allocator_handle_t; 3840b57cec5SDimitry Andric# if __cplusplus >= 201103 3850b57cec5SDimitry Andric typedef enum omp_memspace_handle_t : omp_uintptr_t 3860b57cec5SDimitry Andric# else 3870b57cec5SDimitry Andric typedef enum omp_memspace_handle_t 3880b57cec5SDimitry Andric# endif 3890b57cec5SDimitry Andric { 3900b57cec5SDimitry Andric omp_default_mem_space = 0, 3910b57cec5SDimitry Andric omp_large_cap_mem_space = 1, 3920b57cec5SDimitry Andric omp_const_mem_space = 2, 3930b57cec5SDimitry Andric omp_high_bw_mem_space = 3, 3940b57cec5SDimitry Andric omp_low_lat_mem_space = 4, 3950b57cec5SDimitry Andric KMP_MEMSPACE_MAX_HANDLE = UINTPTR_MAX 3960b57cec5SDimitry Andric } omp_memspace_handle_t; 3970b57cec5SDimitry Andric# endif 3980b57cec5SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_init_allocator(omp_memspace_handle_t m, 3990b57cec5SDimitry Andric int ntraits, omp_alloctrait_t traits[]); 4000b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_destroy_allocator(omp_allocator_handle_t allocator); 4010b57cec5SDimitry Andric 4020b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_default_allocator(omp_allocator_handle_t a); 4030b57cec5SDimitry Andric extern omp_allocator_handle_t __KAI_KMPC_CONVENTION omp_get_default_allocator(void); 4040b57cec5SDimitry Andric# ifdef __cplusplus 4050b57cec5SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a = omp_null_allocator); 406*e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a = omp_null_allocator); 407*e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, 408*e8d8bef9SDimitry Andric omp_allocator_handle_t allocator = omp_null_allocator, 409*e8d8bef9SDimitry Andric omp_allocator_handle_t free_allocator = omp_null_allocator); 4100b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void * ptr, omp_allocator_handle_t a = omp_null_allocator); 4110b57cec5SDimitry Andric# else 4120b57cec5SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_alloc(size_t size, omp_allocator_handle_t a); 413*e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_calloc(size_t nmemb, size_t size, omp_allocator_handle_t a); 414*e8d8bef9SDimitry Andric extern void *__KAI_KMPC_CONVENTION omp_realloc(void *ptr, size_t size, omp_allocator_handle_t allocator, 415*e8d8bef9SDimitry Andric omp_allocator_handle_t free_allocator); 4160b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_free(void *ptr, omp_allocator_handle_t a); 4170b57cec5SDimitry Andric# endif 4180b57cec5SDimitry Andric 4190b57cec5SDimitry Andric /* OpenMP 5.0 Affinity Format */ 4200b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_set_affinity_format(char const *); 4210b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_get_affinity_format(char *, size_t); 4220b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_display_affinity(char const *); 4230b57cec5SDimitry Andric extern size_t __KAI_KMPC_CONVENTION omp_capture_affinity(char *, size_t, char const *); 4240b57cec5SDimitry Andric 4250b57cec5SDimitry Andric /* OpenMP 5.0 events */ 4260b57cec5SDimitry Andric# if defined(_WIN32) 4270b57cec5SDimitry Andric // On Windows cl and icl do not support 64-bit enum, let's use integer then. 4280b57cec5SDimitry Andric typedef omp_uintptr_t omp_event_handle_t; 4290b57cec5SDimitry Andric# else 4300b57cec5SDimitry Andric typedef enum omp_event_handle_t { KMP_EVENT_MAX_HANDLE = UINTPTR_MAX } omp_event_handle_t; 4310b57cec5SDimitry Andric# endif 4320b57cec5SDimitry Andric extern void __KAI_KMPC_CONVENTION omp_fulfill_event ( omp_event_handle_t event ); 4330b57cec5SDimitry Andric 4340b57cec5SDimitry Andric /* OpenMP 5.0 Pause Resources */ 4350b57cec5SDimitry Andric typedef enum omp_pause_resource_t { 4360b57cec5SDimitry Andric omp_pause_resume = 0, 4370b57cec5SDimitry Andric omp_pause_soft = 1, 4380b57cec5SDimitry Andric omp_pause_hard = 2 4390b57cec5SDimitry Andric } omp_pause_resource_t; 4400b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource(omp_pause_resource_t, int); 4410b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_pause_resource_all(omp_pause_resource_t); 4420b57cec5SDimitry Andric 4430b57cec5SDimitry Andric extern int __KAI_KMPC_CONVENTION omp_get_supported_active_levels(void); 4440b57cec5SDimitry Andric 4455ffd83dbSDimitry Andric /* OpenMP 5.1 Display Environment */ 4465ffd83dbSDimitry Andric extern void omp_display_env(int verbose); 4475ffd83dbSDimitry Andric 4480b57cec5SDimitry Andric# undef __KAI_KMPC_CONVENTION 4490b57cec5SDimitry Andric# undef __KMP_IMP 4500b57cec5SDimitry Andric 4510b57cec5SDimitry Andric /* Warning: 4520b57cec5SDimitry Andric The following typedefs are not standard, deprecated and will be removed in a future release. 4530b57cec5SDimitry Andric */ 4540b57cec5SDimitry Andric typedef int omp_int_t; 4550b57cec5SDimitry Andric typedef double omp_wtime_t; 4560b57cec5SDimitry Andric 4570b57cec5SDimitry Andric# ifdef __cplusplus 4580b57cec5SDimitry Andric } 4590b57cec5SDimitry Andric# endif 4600b57cec5SDimitry Andric 4610b57cec5SDimitry Andric#endif /* __OMP_H */ 462