1/* 2 * Copyright (c) 2014 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetsstrasse 64, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#ifndef __BOMP_BACKEND_H 11#define __BOMP_BACKEND_H 12 13 14/* 15 * typedefs of backend specific functions 16 */ 17typedef int (*bomp_thread_func_t)(void *); 18typedef void (*backend_set_numa_fn_t)(unsigned id); 19typedef void (*backend_start_processing_fn_t)(void (*fn)(void *), void *data, unsigned nthreads); 20typedef void* (*backend_get_tls_fn_t)(void); 21typedef void (*backend_synchronize_fn_t)(void); 22typedef void (*backend_set_tls_fn_t)(void *data); 23typedef void* (*backend_get_thread_fn_t)(void); 24typedef void (*backend_thread_exit_fn_t)(int status); 25typedef void (*backend_end_processing_fn_t)(void); 26typedef struct thread *(*backend_thread_create_fn_t)(bomp_thread_func_t start_func, 27 void *arg, size_t stacksize); 28 29struct bomp_backend_fn 30{ 31 backend_set_tls_fn_t set_tls; 32 backend_get_tls_fn_t get_tls; 33 backend_set_numa_fn_t set_numa; 34 backend_get_thread_fn_t get_thread; 35 backend_start_processing_fn_t start_processing; 36 backend_end_processing_fn_t end_processing; 37 backend_thread_exit_fn_t thread_exit; 38 backend_synchronize_fn_t synchronize; 39}; 40 41struct bomp_state 42{ 43 bomp_backend_t backend_type; ///< the type of the backend for this state 44 struct bomp_backend_fn backend; ///< backend specific functions 45 struct omp_icv_device icv_dev; ///< global icv device 46 struct omp_icv_task icv_task; ///< global icv task 47 bomp_mutex_t critical_lock; 48 bomp_lock_t atomic_lock; 49 volatile uint32_t nested; 50 uint32_t num_threads; 51 uint32_t bomp_threads; 52 bool behaviour_nested; 53 bool behaviour_dynamic; 54 struct bomp_thread_local_data **tld; 55}; 56 57 58#endif /* __BOMP_TEAM_H */ 59