You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple page/section aimed at Python users explaining the CUDA C equivalent of common syntax vs python which they may need for defining agent functions.
E.g, defining variable, if-else, for, function define/call.
Could link to an external guide/s at the end for greater detail.
The text was updated successfully, but these errors were encountered:
FLAMGPU agent functions are written using CUDA, which itself is a form of C++ (albeit lacking support for most of the standard library). The syntax required to write agent functions is likely to be cover a small subset of available C++ feature, common to other C style languages such as Java and C# like control flow operations, rather than needing to learn about technical features such as manual memory management and pointers.
If you're using the Python API and are unfamiliar with these languages, the difference between common statements is outlined below:
Variables
Python
foo=5foo+=2bar=foo
CUDA
int foo = 5;
foo += 2;
int bar = foo;
Unlike python, CUDA requires variables types to be specified. The types supported by FLAMEGPU are:
CUDA uses curly brackets instead of indentation for scoping blocks. (The brackets aren't strictly required if there's only a single statement (;) in the block.
for loops
Python
foriinrange(10):
# do something
CUDA
for (int i = 0; i < 10; ++i) {
// do something
}
For loops have 3 parts, separated by semi colons; for(<variable definition>;<condition>;<post-iteration action>).
Simple page/section aimed at Python users explaining the CUDA C equivalent of common syntax vs python which they may need for defining agent functions.
E.g, defining variable, if-else, for, function define/call.
Could link to an external guide/s at the end for greater detail.
The text was updated successfully, but these errors were encountered: