0
$\begingroup$

I have a fortran program has some command line parameters.

I want to use Mathematica's Run function to realize simple parallelization to loop over a set of command line paramters.

What is more, there is a system size parameter L in my fortran program. With larger L, more memory needed.

I first done test with L=100, the mathematica script run.m is simply

Run["./a.out",0,0,0,0,0,0,0]

and math -script run.m works great.

However, if I change L=300 in fortran and recompile. math -script run.m got errors like

[q@i02n18 no_v]$ math -script run.m
 getting sparse matrix ...
 getting dos by chebyshev ...
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source
a.out              00000000004D70E1  Unknown               Unknown  Unknown
a.out              00000000004D521B  Unknown               Unknown  Unknown
a.out              0000000000479AB4  Unknown               Unknown  Unknown
a.out              00000000004798C6  Unknown               Unknown  Unknown
a.out              0000000000436029  Unknown               Unknown  Unknown
a.out              0000000000439C16  Unknown               Unknown  Unknown
libpthread-2.17.s  00002AC56B1F0370  Unknown               Unknown  Unknown
a.out              00000000004166F0  chebyshev_ldos_            78  module_chebyshev.f90
a.out              00000000004127D6  twoband_                  118  model_twoband.f90
a.out              0000000000411228  MAIN__                     39  main.f90
a.out              0000000000403BDE  Unknown               Unknown  Unknown
libc-2.17.so       00002AC56B720B35  __libc_start_main     Unknown  Unknown
a.out              0000000000403AE9  Unknown               Unknown  Unknown

As we can see, it did start calculation because it print two lines of message, but then subject to "segmentation fault occurred"

However, at the time, if I run ./a.out 0 0 0 0 0 0 0 in the terminal, it works, and if I look at the memory usage, it is quite small as 145MB. So it probably not due to memory issue maybe?

Is anybody know whether there is some implicit limit of Run function?

$\endgroup$
  • $\begingroup$ Hi, @ilian. Could you explain it a little, why we need LD_LIBRARY_PATH? Anyway, it is seems not a convenient workaround, because my program needs other libraries error while loading shared libraries: libmkl_intel_lp64.so: cannot open shared object file: No such file or directory $\endgroup$ – matheorem Jan 22 '18 at 3:05
  • 1
    $\begingroup$ You should set LD_LIBRARY_PATH to its normal value (outside Mathematica) then. The Mathematica launcher script prepends to it, so likely the crash is due to your program loading an incorrect MKL library from Mathematica's layout. $\endgroup$ – ilian Jan 22 '18 at 3:09
  • $\begingroup$ @ilian I don't get it. But L=100 case is working. $\endgroup$ – matheorem Jan 22 '18 at 3:10
  • $\begingroup$ @ilian No, it is not working. Still segmentation fault $\endgroup$ – matheorem Jan 22 '18 at 3:16
  • $\begingroup$ @ilian The error message is the same, no matter inside or outside mma $\endgroup$ – matheorem Jan 22 '18 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.