visit-dav / visit

VisIt - Visualization and Data Analysis for Mesh-based Scientific Data
https://visit.llnl.gov
BSD 3-Clause "New" or "Revised" License
429 stars 111 forks source link

Running python scripts using Visit and argparse #12258

Closed doutriaux1 closed 3 years ago

doutriaux1 commented 3 years ago

Hello,

I have a python script that uses both visit and argparse up until this week my script had the following lines to make it work

p = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
p.add_argument("--visit", default="/usr/gapps/visit/current")
# lots of other p.add_argument here
sys.path.insert(0, os.path.join(
    args.visit, "linux-x86_64/lib/site-packages"))
pth = os.environ["PATH"]
pth = "{}/bin:{}".format(os.path.dirname(args.visit), pth)
os.environ["PATH"] = pth
import visit  # noqa
visit.LaunchNowin()

And everything worked fine with my regular python

But today the visit.LaunchNoWin() line returns (on rztopaz and rzalastor):

ERROR: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/gapps/visit/3.1.3/linux-x86_64/lib/libvisitcommon.so)

visit launches fine from the command line. So I figured I would just launch via -cli -s

Unfortunately using

/usr/gapps/visit/bin/visit -cli  -nowin -s ~/git/feature-detection/drivers/elements_snapshot.py -s crp.sql -o ../Hohlraum/HWH_domain_18.ftThresholdChge_0.5.ftNoZ_n.ftNumSeq_10.ftThreshold_0.8.laserPowerMult_1.0.minimalAle_0.NODES_2.NODES_XENA_1.PROC_72.PROCS_XENA_18.meshResolution_0.15.foamDensity_0.35/pngs

Leads to mangling of the -s options and other options seems to be passed to visit as well.

So my question are

  1. Any idea how to fix the GLIBCXX_3.4.20' not found
  2. If not how can I use argparse and visit -cli together?

Thanks.

doutriaux1 commented 3 years ago

Adding: export LD_LIBRARY_PATH=/usr/tce/packages/gcc/gcc-4.9.3/lib64 To my path fixed the loading issue. (figured out this path by using ldd on the problematic library

doutriaux1 commented 3 years ago

I would still like to hera about using visit -cli and argparse together though.

doutriaux1 commented 3 years ago

Or how to specify a specific version of visit, right now I need the 'visit' executable to be in my path, but pointing to /usr/gapps/visit/3.1.3 does seem to find ny visit executable.

cyrush commented 3 years ago

The std lib path issue is a result of the system python being compiled with different compilers and or different settings than VisIt's python. Glad you could fix with LD_LIB, depending on how much the compilers or the config args change between the two, importing might not even be possible.

visit uses the same launcher to launch all installed version.

If you want the equiv of:

/usr/gapps/visit/bin/visit -v 3.1.3

You could use:

visit.AddArgument("-v 3.1.3")

Before the call to:

visit.LaunchNoWin()