CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   OpenFOAM on deux pc (

Rider April 12, 2012 06:22

OpenFOAM on two pc

Anybody has already executed a parallel simulation on two pc ?

Currently, I execute my simulation in multi-core on one pc, but it's apparently not enough ... :(


lovecraft22 April 12, 2012 06:40

Yes, I would say anybody here has already ran a parallel simulation…

Rider April 12, 2012 06:47

Sorry, this is not what I meant :o

I just would like an help to realise this type of configuration

lovecraft22 April 12, 2012 07:12

First you need to decompose your domain using decomposePar (see decomposeParDict) among your processors, so if you have 2 processor you'll decompose your domain in 2 subparts.
Then, use mpirun to run any command you want. For example, if you want to run snappyHexMes in parallel you'll need to run:


mpirun -np 2 snappyHexMesh -parallel
where 2 is, again, the number of your processors. At the end run reconstructPar.

Have a look at par "2.3.11 Running in parallel" of the user manual.

Rider April 12, 2012 08:05

Thanks for your answer, but it's not really my question. I know how to realise a simulation in multi-core. Currently, I'm using it on 4 cores and on 8 cores. Personnaly, I use the command "FoamJob" but it's the same method as "mpirun"

My problem is to use two computeur for the same simulation, so use the 4 cores of the PC n1 and the 8 cores of the pc n2.

lovecraft22 April 12, 2012 08:50

Sorry, my mistake…
I found this one, don't know if it may be of any help…

wyldckat April 12, 2012 08:52

Greetings to all!

@Rider: you're already on the right track, by using foamJob. All you need is to create a file named "machines" on the base folder of your case.

With open source, when in doubt, check the code!

As for the format of the "machines" file, if using Open-MPI:

Best regards,

Rider April 12, 2012 09:11


Originally Posted by lovecraft22 (Post 354375)
Sorry, my mistake…

No problem. :) A forum is a platform of exchange.

Thanks for your answer. Have you an example of "machines" file ?

How the computers should being connected ?

wyldckat April 13, 2012 03:20

Hi Rider,

The example was on the link I posted and the connection is simple: both machine should reflect the same exact installation structure. And be on the same network, namely the following command should work in both directions:

ping the_other_machine_IP_or_name
Best regards,

Rider April 13, 2012 04:19

In fact, I don't really understand this example.

I don't see how to parameterise the two computers to share the simulation. Moreover, the fisrt computer has 4 cores and the seconde has 8 cores.

Can you detail the procedure in simple words ... for a basic simpleFoam simulation

Thanks for your help !

wyldckat April 13, 2012 04:26

:eek: ... OK... Example "machines" file:

machine1 slots=4 max-slots=4
machine2 slots=8 max-slots=8

I can't go into more details right now. Good luck!

sail April 14, 2012 07:32

In addition to the machinefile you also will need to have the case and OpenFoam in a shared directory (or a exact copy of both on the slave, but this might be impratical) and passwordless ssh access on the slave node.

You might find a nice howto on this subject on the clustermonkey website (that's how i learnt).

calim_cfd April 17, 2012 16:10

hi thou the user's guide has all the info you need you may get stuck while setting the case.. this is what you gotta do:

1:have the same OF version properly installed on all pcs along with permissions

2: create a machine files like this

192.168.15.xx cpu=n1
192.168.15.xx cpu=n2

where nx is the number of cores on each cpu.. this file can be fancier..

3: edit this file on the host machine, from where you're firing the job : /etc/hosts

and add all nodes on it.. like this:
192.xx.xx.xx name1 #
192.xx.xx.xx name2 #
192.xx.xx.xx name2 #

4: edit decomposepardict like this (the setting are for 5 cores, set it accordingly):

#ofSubdomains 5


distributed yes;

roots 4

note that the paths given above are only needed if you want each pc to store the files on it, instead of only using its cpu power. Also you only list the the slave nodes (4 if you're using 5). In this case you'd run the analysis from the direc: "/disk1/test/noh0"

most important thing is that inside each folder, here named "nohx" you have the exact same decomposed case, and i mean you got the folders 0, constant, system, processor* etc inside these "nohx" folders

5: selectively get the files back into the host/master machine through the command:

user@pc:/disk1/test/rec> scp -r user2@pcx:~/noh4/processor4 rec/

i guess you can figure out how to use this command

hope it helps!:D

djierian August 29, 2016 17:53


To do this, how are the two computers linked? Is a cross cable sufficient? or do I need an NFS and passworldess SSH as I've seen elsewhere on these forums.



calim_cfd August 30, 2016 06:29

hi Danny.

It's been a while since i've ran some simulations using more than one machine. Not sure if things haven't changed. Probably not, lol.

So, from what i can remember, i guess you don't need to setup a new file system. The cabling should be enough. I guess you could, even though, depending on how you work on linux OSs this won't change much.

It suffices that node0 sees has access and you have write and reading permissions for the other folders at the other nodes. Also, don't forget to setup the /etc/host file with the address of the nodes and the decomposePardict with the case locations.

Nonetheless, you should watch for a network bottleneck when you use 100mb or even 1gb networks. Your performance may not be that great, assuming you have some hardcore hardware, aka, cluster lol


All times are GMT -4. The time now is 23:12.