QuantumATK Forum

QuantumATK => Scripts, Tutorials and Applications => Topic started by: xhsh on March 30, 2010, 04:16

Title: How to do parallel in analysis?
Post by: xhsh on March 30, 2010, 04:16
Hello, Dear all,

I want to do parallel in analysis, e.g., in the calculation of the transmission or LDOS. However, when I use more than 1 processors, it seems that each processor do the same job separately and print the same information to the standard output. This makes the output very messy. So I have two questions here:

1. Can we do parallel in analysis?

2. If we can,  how can we print information from only one processor in the python script, say, node 0, please?

Thank you very much!!
Title: Re: How to do parallel in analysis?
Post by: Anders Blom on March 30, 2010, 08:32
Please read the manual http://quantumwise.com/documents/manuals/ATK-2008.10/chap.parallel.html

1) Yes

2) use the function processIsMaster()
Title: Re: How to do parallel in analysis?
Post by: xhsh on March 30, 2010, 11:05
That is very nice.  Thank you very much!!
Title: Re: How to do parallel in analysis?
Post by: Anders Blom on March 30, 2010, 11:29
I was a bit sloppy. Correct code:

Code
from ATK.MPI import *
if processIsMaster():
    print "I am the master node"
    print "Here is the result of the analysis:"
    ...
Title: Re: How to do parallel in analysis?
Post by: xhsh on March 31, 2010, 03:27
Your first reply already solved my problem. A hint is enough.  Thank you very much for being so careful.
Title: Re: How to do parallel in analysis?
Post by: Anders Blom on March 31, 2010, 07:23
That's good :)

It's just that since the answers might be very useful for other users too, it's best to be careful to do it correct and explicit, at least from my part :)