Information Technology Reference
In-Depth Information
• EXECUTEFRAMES: it is used to set how many frames are needed before the
decision on changing the processor will execute the next tasks.
An example of the configuration script file can be seen in List 1.
List 1: Configuration Variables
INITFRAMES ( 20
DISCARDFRAME ( 5
LOOPFRAMES ( 50
USEHARDWARE ( ALLAVAILABLE
EXECUTEFRAMES ( 5
The automatic update task begins executing after the DISCARDFRAME are
executed. In the sequel, it executes INITFRAMES frames in the CPU cores and the
next INITFRAMES in the GPU.
Afterward, it decides where the next LOOPFRAMES frames will be executed.
If the LOOPFRAMES is greater than -1, it executes EXECUTEFRAMES frames
in the CPU cores and it executes EXECUTEFRAMES frames in the GPU. Finally,
it decides where the next LOOPFRAMES frames will be executed and keep
repeating until the application is aborted.
The heuristic script is used in order to distribute automatically the tasks
between the CPU cores and the GPU. This script defines three functions:
• reset (): reset all the variables that the script uses in order to decide which
processor will execute the task. This function is called after the LOOPFRAMES
frames are executed. The variable that are normally used by the heuristic are:
-
CPUTime: an array that contains the sum of all the elapsed times that the
task has been processed in this CPU thread;
-
GPUTime: the sum of all the elapsed times that the task has been processed
in the GPU;
-
numBodies: the number of bodies that have been processed;
-
initialBodies: the number of bodies in the beginning of the processing.
• SetVariable (elapsedTime, numberBodies, processor, thread): this function sets
all the variables that the heuristic uses. This function is called after running the
EXECUTEFRAMES frames in each processor. The script that defines this
function can be seen on List 2.
• main (): This is the function that executes the heuristic and decides which
processor
will
execute
the
task.
This
function
is
called
just
before
the
LOOPFRAMES frames is executed.
List 2: SETVARIABLE script
numBodies ( numberBodies
if processor == CPU then
CPUTime[thread] ( CPUTime[thread] + elapsedTime
else
GPUTime ( GPUTime + elapsedTime
end if
Search WWH ::




Custom Search