Author Topic: jumbled transmission output  (Read 5809 times)

0 Members and 1 Guest are viewing this topic.

Offline Derek Stewart

  • Regular QuantumATK user
  • **
  • Posts: 9
  • Reputation: 0
    • View Profile
jumbled transmission output
« on: March 6, 2009, 17:37 »
Hi everyone,

We are trying to do some parallel transmission calculations with ATK.  We are running into a problem where the transmission output lines appear to be jumbled.  It looks like the program is printing out results from different nodes and the lines are being merged with no carriage returns between them.  Our print statement is:

print trans_energy.pop(),'\t',trans_coeff.pop()


For example we get:

0.923 eV        0.209212442784
0.924 eV        0.296368037242
0.925 eV        0.50.009 eV     3.10781739019e-11
-0.008 eV       3.05943705848e-11
-0.007 eV       3.01449322864e-11
-0.006 eV       2.97280958329e-11
-0.005 eV       2.93422624775e-11


or

0.842 eV        0.100164929123
0.843 eV        0.100308432721
0.844 eV        0.100430468154
0.845 eV        0.10053021030.00575102241749
-0.08 eV        0.00551587865742
-0.079 eV       0.0052757592935
-0.078 eV       0.00503039033118


Have other people experienced this problem?

Thanks,

Derek
 

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: jumbled transmission output
« Reply #1 on: March 6, 2009, 18:30 »
This is an important point, so it's good that we get a chance to comment on it. Any and all statements that produce I/O (such as disk operations, file read/write, and print statements) must be made "parallel-safe" when you run ATK under MPI, otherwise multiple MPI processes will attempt to write to the same file. This is because when you execute a script in parallel, each node actually runs the whole script and executes all statements. In the benign case this results in double output in your stdout log, but in other situations your files, like VNL files, may be corrupted. To make a statement "parallel-safe", precede it with the statement:
Code
if processIsMaster():
This function should be imported from the ATK.MPI module. Thus, for a full example (I'm completing your example with the for-loop):
Code
from ATK.MPI import processIsMaster

...

if processIsMaster():
    for i in range(len(trans_energy)):
        print trans_energy.pop(),'\t',trans_coeff.pop()
Note that VNL always produces MPI-safe scripts. NOTE: The above approach to print the spectrum is a bit dangerous. Once the loop is done, the variables trans_energy and trans_coeff are destroyed (empty). Cf. this example:
Code
v = [1,2,3]
for i in range(len(v)):
    print v.pop()
print v
which produces
Quote
3 2 1 []
A better example of how to write nicely formatted T(E) can be found in the manual.
« Last Edit: March 6, 2009, 18:37 by Anders Blom »

Offline Derek Stewart

  • Regular QuantumATK user
  • **
  • Posts: 9
  • Reputation: 0
    • View Profile
Re: jumbled transmission output
« Reply #2 on: March 6, 2009, 20:45 »
Hi Anders,

Thank you for your quick response.  I will try switching the way the transmission is printed out and see how it does.

Thanks again,

Derek