[ANSYS, Inc. Logo] return to home search
next up previous contents index

7.3 Parallelizing Your Serial UDF

ANSYS FLUENT's serial solver contains Cortex and only a single ANSYS FLUENT process. The parallel solver, on the other hand, contains three types of executable: Cortex, host, and compute node (or simply "node'' for short). When ANSYS FLUENT runs in parallel, an instance of Cortex starts, followed by one host and n compute nodes, thereby giving a total of n+2 running processes. For this reason, when you are running in parallel, you will need to make sure that your function will successfully execute as a host and a node process. At first it may appear that you should write three different versions of your UDF: one for serial, host, and node. Good programming practice, however, would suggest that you write a single UDF that, when compiled, can execute on any of the three versions. This process is referred to in this manual as "parallelizing'' your serial UDF. You can do this by adding special macros for parallel as well as compiler directives to your UDF, as described below. Compiler directives, (e.g., #if RP_NODE, RP_HOST, PARALLEL) and their negated forms, direct the compiler to include only portions of the function that apply to a particular process, and ignore the rest (see Section  7.5.1).

A general rule of thumb is that your serial UDF needs to be "parallelized'' if it performs an operation that is dependent on sending or receiving data from another compute node (or the host). UDFs that involve global reductions such as global sums, minimums or maximums, or ones that perform computations on data residing in adjacent compute nodes, for example, will need to be modified in order to run in parallel. Some other types of operations that require parallelization of serial source code include the following:

After the source code for your "parallelized'' UDF has been written, it can be compiled using the same methods for serial UDFs. Instructions for compiling UDFs can be found in Chapter  5.


next up previous contents index Previous: 7.2 Cells and Faces
Up: 7. Parallel Considerations
Next: 7.4 Parallelization of Discrete
Release 12.0 © ANSYS, Inc. 2009-01-14