Tools
Contents
Introduction
Since version 2.0, AQUAgpusph is designed like a sandbox, such that the tools that will be used to perform the simulation can be selected "on the fly". Anyway, in order to do more accessible the code some Presets are provided "out of the box", which are defining Variables, Definitions and Tools to carry out specific actions.
Defining new tools
In order to define new tools an specific section should be opened in the simulation definition XML input files (take a look on the examples to learn more about this):
<Tools> <!-- ... --> </Tools>
The new tools will be defined between the new "Tools" opened section. Each tool is defined as follows:
<Tool name="NAME" action="ACTION" type="TYPE">
Where ACTION, NAME and TYPE should be conveniently set. Depending on the selected "action" and "type" some other specific attributes will be required.
Name
The name of the variable can be arbitrary selected. If the XML file was included providing a prefix, the final name of the tool will be the concatenation of the prefix and the provided name.
Actions
Actions can be used to specify the position of the kernel we are defining. The possibilities are described in the following subsections:
add
The new tool will be appended at the end of the list of tools. No additional attributes are required.
insert
The new tool will be inserted in a specific position. One of the following attributes should be provided:
- at="ID" : The tool will be placed in the position ID.
- before="REF" : The tool will be placed before the already existing tool REF.
- after="REF" : The tool will be placed after the already existing tool REF.
- before_prefix="REF" : The tool will be placed before the already existing tool PREFIXREF, with PREFIXREF is the resulting text of joining the Prefix passed when the XML file was included, and REF.
- after_prefix="REF" : The tool will be placed after the already existing tool PREFIXREF, with PREFIXREF is the resulting text of joining the Prefix passed when the XML file was included, and REF.
remove
Then the tool with the provided name will be removed. No additional attributes are required.
replace
Then the tool with the provided name will be replaced with the new one.
Type
Several types of tools can be used:
kernel
An OpenCL kernel will be executed in the position specified. The attribute path="OpenCLSourceCodePath" should be provided, replacing OpenCLSourceCodePath by the OpenCL source code location.
The OpenCL code should provide a __kernel void main()
method (entry point name setting is not supported). AQUAgpusph is detecting automatically the input variables of the kernel, that should match with the defined ones
copy
Copy one Array variable into another one (both should have the same type and length). The attributes in="OrigVar" and out="DestVar" must be provided, where OrigVar and DestVar are the names of the origin and source Array variables respectively.