CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   question about parallelization (https://www.cfd-online.com/Forums/fluent-udf/174722-question-about-parallelization.html)

flo90000 July 18, 2016 09:38

question about parallelization
 
Hello,

I want to parallelize some UDFs. I read the guide and I understand that I have to put the compiler directives(if RP_HOST!,if RP_NODE!, if RP_PARALLEL!, ...) when its process perform but I don't understand when host or node processes will perform. So I don't even know when I must write each parallel compiler.

Thanks you for your help.

Zbynek July 18, 2016 12:35

What you are asking would need a very long answer that you can find in the Fluent Guides. I will give only a very short overview.

To understand when you need to parallelize the UDFs, you need to understand how the computer works when running in parallel first. When you start a computation with, let's say, two parallel processes, the computational mesh is split between the two nodes. Your code is executed on each node separately. Imagine situation 1 - you have a UDF that defines a drag coefficient. The coefficient is calculated in every single cell, no matter what node the specific cell resides at. So there is no need to parallelize the code.

Now imagine situation 2 - you want to integrate a quantity over the whole domain. However, you have part of the domain on Node 0 and another part of the domain on Node 1. If you run a serial code here, you get one result for one node and another result for the other node. That's not what you want though. So here you need to parallelize - tell the computer to run the code on Node 0 and 1, then send the result from Node 1 to Node 0 and sum it here. If you want to print it, you need to send it to host, if I remember well. Simply put, whenever passing data between nodes is required, you need to parallelize your UDF.


All times are GMT -4. The time now is 13:39.