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

7.7 Process Identification

Each process in parallel ANSYS FLUENT has a unique integer identifier that is stored as the global variable myid. When you use myid in your parallel UDF, it will return the integer ID of the current compute node (including the host). The host process has an ID of node_host(=999999) and is stored as the global variable node_host. Compute node-0 has an ID of 0 and is assigned to the global variable node_zero. Below is a list of global variables in parallel ANSYS FLUENT.

Global Variables in Parallel ANSYS FLUENT

int node_zero = 0;
int node_host = 999999;
int node_one = 1;
int node_serial = 1000000;

int node_last;  /* returns the id of the last compute node  */
int compute_node_count; /* returns the number of compute nodes */
int myid;  /*  returns the id of the current compute node (and host) */

myid is commonly used in conditional-if statements in parallel UDF code. Below is some sample code that uses the global variable myid. In this example, the total number of faces in a face thread is first computed by accumulation. Then, if myid is not compute node-0, the number of faces is passed from all of the compute nodes to compute node-0 using the message passing macro PRF_CSEND_INT. (See Section  7.5.8 for details on PRF_CSEND_INT.)

Example: Usage of myid

  int noface=0;
  begin_f_loop(f, tf)    /* loops over faces in a face thread and 
                            computes number of faces */
    {
     noface++;
    }
  end_f_loop(f, tf)

/* Pass the number of faces from node 1,2, ... to node 0 */

#if RP_NODE
if(myid!=node_zero)
  {
   PRF_CSEND_INT(node_zero, &noface, 1, myid);
  }
#endif


next up previous contents index Previous: 7.6 Limitations of Parallel
Up: 7. Parallel Considerations
Next: 7.8 Parallel UDF Example
Release 12.0 © ANSYS, Inc. 2009-01-14