Python Forum
Parallizing subprocess.check
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parallizing subprocess.check
#1
Hi,

I have a code which compromises of making an input file and submitting it to an executable using subprocess.check_all. Unfortunately the process is too slow. The input file size usually tends to be larger than few hundred megabytes.

I was wondering if its useful to write the input file in binary and run the subprocess in parallel.

input_xyz = open(initial + "_xyz.inp", "w")
input_xyz.write("{0:d}\n".format(length**3))
for ix in np.linspace(xmin, xmax, length, True):
    for iy in np.linspace(ymin, ymax, length, True):
        for iz in np.linspace(zmin, zmax, length, True):
            input_xyz.write("{0:12.6f} {1:12.6f} {2:12.6f}\n".format(ix, iy, iz))
input_xyz.close()

subprocess.check_call(["elec_pot_calc", initial + ".tvb", initial + ".csx",
        initial + "_xyz.inp", initial + "_xyz.out"])
The input is a set of xyzzy files with a header which is the number of inputs

Quote:1000
-10.403406 -12.484424 -16.060428
and output will be the same with an added number calculated in the executable
Quote:1000
-10.4034060000000004 -12.4844240000000006 -16.0604280000000017 0.0008508183029086
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  subprocess in thread python to check reachability anna 3 3,387 Sep-05-2018, 04:01 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020