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 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9#include <bomp_internal.h>
10
11/**
12 * \brief allocated an initializes a new task ICV set
13 *
14 * \returns pointer to the ICV task struct
15 *
16 * The struct is initialized based on the parent
17 */
18struct omp_icv_task *bomp_icv_new(void)
19{
20    assert(!"NYI");
21    return 0;
22}
23
24/**
25 * \brief Initializes the task specific ICV from the parent task
26 *
27 * \param icv_task  ICV task struct to initialize
28 *
29 * If there is no parent task, then the global ICVs are taken
30 */
31void bomp_icv_init_from_parent(struct omp_icv_task *icv_task)
32{
33    assert(!"NYI");
34}
35
36/**
37 * \brief Initializes the task specific ICV from the environment
38 *
39 * \param icv_task  ICV task struct to initialize
40 *
41 * This function initializes the task ICV based on the values defined in
42 * environment.h.
43 *
44 * The function may only be called to initialize the global task ICV
45 */
46void bomp_icv_init_from_env(struct omp_icv_task *icv_task)
47{
48    icv_task->dynamic = OMP_DYNAMIC;
49    icv_task->nested = OMP_NESTED;
50    icv_task->nthreads = g_thread_limit;
51    icv_task->thread_limit = g_thread_limit;
52    icv_task->place_partition = OMP_PLACES;
53    icv_task->active_levels = 0;
54    icv_task->levels=0;
55    icv_task->run_sched = OMP_SCHEDULE;
56    icv_task->run_sched_modifier = 0;
57#if OMP_VERSION >= OMP_VERSION_40
58    icv_task->bind = OMP_PROC_BIND;
59    icv_task->default_device = OMP_DEFAULT_DEVICE;
60#endif
61}
62
63/**
64 * \brief Initializes the device specific ICV from the environment
65 *
66 * \param icv_dev   ICV task struct to initialize
67 *
68 * This function initializes the device ICV based on the values defined in
69 * environment.h.
70 */
71void bomp_icv_dev_init_from_env(struct omp_icv_device *icv_dev)
72{
73    icv_dev->dev_sched = 0;
74    icv_dev->stack_size = OMP_STACKSIZE;
75    icv_dev->wait_policy = OMP_WAIT_POLICY;
76    icv_dev->max_active_levels = OMP_MAX_ACTIVE_LEVELS;
77#if OMP_VERSION >= OMP_VERSION_40
78    icv_dev->cancel = OMP_CANCELLATION;
79#endif
80}
81