GPUart  1.01
Prototype of GPUart, an application-based limited preemptive GPU scheduler for embedded real-time systems
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
GPUart_Scheduler.h
Go to the documentation of this file.
1 //Copyright (c) 2017-2018 Christoph A. Hartmann, Ulrich Margull and Technische Hochschule Ingolstadt (THI)
2 //
3 //Permission is hereby granted, free of charge, to any person obtaining a copy of this
4 //software and associated documentation files (the "Software"), to deal in the Software
5 //without restriction, including without limitation the rights to use, copy, modify,
6 //merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7 //permit persons to whom the Software is furnished to do so, subject to the following
8 //conditions:
9 //
10 //The above copyright notice and this permission notice shall be included in all copies
11 //or substantial portions of the Software.
12 //
13 //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14 //INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
15 //PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
16 //HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 //SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 
20 /*
21 * File: GPUart_Scheduler.h
22 * Created by: Christoph Hartmann
23 * Institute: Technische Hochschule Ingolstadt
24 * Date: 03.04.2017 */
25 /********************************************************
26 * ___ ___ ___ ___ 3 ___ *
27 * | | | | | |\ /| | | | | | *
28 * |___ | | |___| | \/ | | | |___ | | *
29 * | | | |\ | | | | | | | *
30 * | |___| | \ | | |___| ___| | |___ *
31 * *
32 *********************************************************/
33 
43 #ifndef GPUART_SCHEDULER_H
44 #define GPUART_SCHEDULER_H
45 
46 
47 
48 /************************************************************************************************/
49 /* Include */
50 /************************************************************************************************/
51 #include "../GPUart_Common/GPUart_Common.h"
52 #include "../GPUart_Config/GPUart_Config.h"
53 
54 
55 /************************************************************************************************/
56 /* Type definitions */
57 /************************************************************************************************/
58 
73 };
74 
75 
76 /************************************************************************************************/
77 /* Function declaration */
78 /************************************************************************************************/
79 
80 /*
81  * @brief Executes the scheduling decision.
82  *
83  * If the compiler switch S_NON_PREEMPTIVE is defined, this function schedules kernel non-preemptively,
84  * otherwise it schedules them in a limited preemptive manner. First this function updates the kernel's
85  * scheduling state and deletes completed kernels form #gpuS_JobList_s, then it updates the job list
86  * #gpuS_JobList_s with all new released kernels. After that, this function iterates through #gpuS_JobList_s
87  * and executes the scheduling decision according to the scheduling policy defined in #S_SCHED_POLICY.
88  *
89  *
90  * @return GPUART_SUCCESS
91  *
92  */
94 
95 
96 
97 /*
98  * @brief Releases a new job and pushes it to the shared job stack #gpuS_JobStackShared_s.
99  *
100  * @param kernel_task_id_e task_id_e -> The ID of the kernel which this function instatiates.
101  *
102  * @return GPUART_SUCCESS if kernel has been instantiated successfully.
103  * @return GPUART_ERROR_INVALID_ARGUMENT if kernel ID is invalid.
104  * @return GPUART_ERROR_NO_OPERTATION if there is already an active instance (job) of that kernel.
105  *
106  */
108 
109 
110 /*
111  * @brief Queries whether a job has terminated.
112  *
113  * @param kernel_task_id_e task_id_e -> The ID of the kernel.
114  *
115  * @return GPUART_SUCCESS if kernel has been terminated
116  * @return GPUART_ERROR_NOT_READY if kernel is still active.
117  *
118  */
120 
121 
122 /*
123  * @brief Queries whether a kernel is ready to get instantiated.
124  *
125  * @param kernel_task_id_e task_id_e -> The ID of the kernel.
126  *
127  * @return GPUART_SUCCESS if kernel can get instantiated.
128  * @return GPUART_ERROR_NOT_READY if there is already an active instance (job) of that kernel.
129  *
130  */
132 
133 
134 /*
135  * @brief Initializes the GPUart Scheduling layer.
136  *
137  * Initializes all variables of the Scheduling layer.
138  *
139  * @return GPUART_SUCCESS
140  *
141  */
143 
144 
145 /*
146  * @brief Destroys the GPUart Scheduling layer.
147  *
148  * Destroys the mutex of each #job_stack_s.
149  *
150  * @return GPUART_SUCCESS
151  *
152  */
154 
155 
156 
157 #endif
Definition: GPUart_Scheduler.h:71
GPUart_Retval gpuS_schedule(void)
Executes the scheduling decision.
Definition: GPUart_Scheduler.cpp:593
GPUart_Retval gpuS_query_terminated(kernel_task_id_e task_id_e)
Queries whether a job has terminated.
Definition: GPUart_Scheduler.cpp:722
Definition: GPUart_Scheduler.h:70
gpuS_kernelTask_status_e
The possible scheduling states of a kernel.
Definition: GPUart_Scheduler.h:68
GPUart_Retval gpuS_destroy(void)
Destroys the GPUart Scheduling layer.
Definition: GPUart_Scheduler.cpp:810
Definition: GPUart_Scheduler.h:72
GPUart_Retval gpuS_new_Job(kernel_task_id_e task_id_e)
Releases a new job and pushes it to the shared job stack gpuS_JobStackShared_s.
Definition: GPUart_Scheduler.cpp:678
GPUart_Retval gpuS_query_ready_to_call(kernel_task_id_e task_id_e)
Queries whether a kernel is ready to get instantiated.
Definition: GPUart_Scheduler.cpp:743
kernel_task_id_e
Defines the IDs for GPGPU kernels.
Definition: GPUart_Config.h:101
Definition: GPUart_Scheduler.h:69
GPUart_Retval gpuS_init(void)
Initializes the GPUart Scheduling layer.
Definition: GPUart_Scheduler.cpp:770
signed int GPUart_Retval
The standard return type of functions in GPUart, representing an error code.
Definition: GPUart_Common.h:99