sarproz-group

Running SARPROZ from a Matlab .m file vs. command line

Viewing 8 reply threads
  • Author
    Posts
    • #6442
      amintavakkoli
      Participant

      Dear SARPROZ team,

      I have created an InputParfile.txt to run SARPROZ in background, without the GUI mode. If I write fig=main(‘full path to the InputParfile.txt’) and run this command from Matlab command window it works properly and creates the interferograms. However, when I write the command i.e. fig=main(‘full path to the InputParfile.txt’) in a “test.m” file and run the test.m file, SARPROZ does not run and Matlab gets stuck. I work on Matlab2021a. Can you help me with this problem? I run the test.m file from p-codes directory.

      Best

      Attachments:
      You must be logged in to view attached files.
    • #6444
      amintavakkoli
      Participant

      Here, I attached the “test.m” file I run from p-codes directory.

      Attachments:
      You must be logged in to view attached files.
    • #6446
      periz
      Keymaster

      it would be good to see the log file
      we tried it and it works (even if I do not really see the use to call the main from within a matlab script)
      probably the reason is not in the script rather is some other factors preventing the process to execute properly…

    • #6448
      amintavakkoli
      Participant

      Thanks for your answer, here is the contents of the “log file” :

      Welcome to SARPROZ

      by Daniele Perissin, copyright 2009-2021, http://www.sarproz.com

      Messages from this session are written in file 17_Nov_2021_08_19_04_sarproz.log
      directory /Users/sw/pcodes_2021-04-08

      MATLAB 9.10 (R2021a) 14-Nov-2020

      No errors are printed, just the SARPROZ freezing. I wonder whether this is because of Matlab version inconsistency or something else. It works properly when I run my script containing the “fig=main(…)” command on Matlab 2015b on Windows-10, while when I run it on Matlab2021a on Mac Pro 2019 – macOS Big Sur, it freezes.
      Moreover, the reason to run it in a script is because we want to run it on a cluster without graphic interface.

      Best

    • #6449
      periz
      Keymaster

      1. the script is useless. you can run sarproz on a cluster without graphic interface without that script.
      2. so, forget the script. if it freezes, the reason is somewhere else. did you try to run it without the script?
      3. before doing that, please update sarproz to the last version. get it running and use the manage version module to download the most recent version. then try it again
      4. please consider that we just discovered that matlab 2021a has a bug for which memory keeps increasing during parfor loops on clusters. so, you have to use older matlab versions. 2017a looks like stable on clusters
      best

    • #6450
      antani
      Participant

      Daniele,
      1.I do not understand why the script is useless. The way we work on the cluster entails that all the commands should be included in a script which then goes into a pipeline for processing.

      2.Yes when we run fig=main(InputPar.txt) in the Matlab graphic interface Sarproz runs. Instead when we launch the same command from a script it freezes.

      3. Yes we have the latest updated version of the software.

      4. Yes I experienced this bug already and I am aware of it. I do not see the RAM filling up while Sarproz is frozen (when we launch it from a Matlab script)

      I was wondering if there are any guidelines on how to install Sarproz without using the Matlab GUI. I would like to be able to run SARPROZ by writing a bash command like: ‘fig=main(InputPar.txt)’ has this been implemented and I was not able to find it on the Forum?

      Grazie 🙂

      • #6451
        periz
        Keymaster

        1.I do not understand why the script is useless. The way we work on the cluster entails that all the commands should be included in a script which then goes into a pipeline for processing.

        you can e.g. run:
        matlab -nodisplay -r “main(‘inptuparfile’); quit”
        or you can use the compiled version

        2.Yes when we run fig=main(InputPar.txt) in the Matlab graphic interface Sarproz runs. Instead when we launch the same command from a script it freezes.

        at this moment we do not have any elements to investigate this issue. our tests turned out ok. so, if you did try that, without any further elements, we can only guess it’s an issue related to matlab. what matlab version are you using? for other possible explanations, we’d need to check the procedure on your workstation.

        Please do what I stated before: use Matlab 2017a. We tested it on big clusters and it works. At the moment it’s the only successful test, since the other Matlab versions we tested look like having bugs.
        Please notice that Sarproz is currently compiled with Matlab 2017a.

    • #6453
      antani
      Participant

      Hi Daniele,
      Regarding Point 1 I tried to launch the Matlab with -nodisplay option.
      We got the error below:

      $ /Applications/MATLAB/MATLAB_R2021a.app/bin/matlab -nodisplay -r “main(‘/Users/Desktop/test_full_VV_Full_Graph/5_78/20180810_VV_1/InputParFile.txt’); quit”

      < M A T L A B (R) >
      Copyright 1984-2021 The MathWorks, Inc.
      R2021a Update 4 (9.10.0.1710957) 64-bit (maci64)
      July 1, 2021

      To get started, type doc.
      For product information, visit http://www.mathworks.com.

      Welcome to SARPROZ

      by Daniele Perissin, copyright 2009-2021, http://www.sarproz.com

      Messages from this session are written in file 17_Nov_2021_22_42_16_sarproz.log
      directory /Users/pmilillo/sw/pcodes_2021-04-08

      MATLAB 9.10 (R2021a) 14-Nov-2020

      Sarproz is going to set the Java Path. After that you’ll need to restart Matlab.

      It looks like that you already restarted Matlab
      However, something is still wrong…

      Are you sure you are starting Matlab from the pcodes directory?

      (1) open a terminal. (2) type cd ‘/Users/pmilillo/sw/pcodes_2021-04-08’ (3) Launch Matlab from the command line

      (unix users) Try the following: (1) open a terminal (2) type ‘hostname’ (3) ping the returned name (eg: ping mycomputername)
      (4) if no packets are received, add the name returned by ‘hostname’ to the file /etc/hosts

      WARNING: you need to exit and restart Matlab!!
      (base)

      Given that:
      a) I am in the codes directory and I do not want to launch Matlab by command line (we are trying to launch Matlab in -nodisplay mode)

      b)I added my hostname to /etc/host but still get the same error

      What is preventing Sarproz to run correctly? Please keep in mind that Matlab 2021a is the only version compatible with MacOs BigSur 11.6

    • #6454
      periz
      Keymaster

      so,
      1. the script is not needed
      2. the problem you get now is related to java. if you run the matlab gui and then from matlab you launch sarproz in command line mode, do you get the same problem? if not, then I guess we need to make a little modification, let me know.
      3. regarding matlab 2021a and mac: since day 0, we suggest everybody to set up a linux processing environment. it is clearly possible to process data also in windows and in mac, but at times it can be much more complicated. In particular if you use last release software environments. This is a general rule that applies to everybody. In fact, you might have strict dependencies and you might have bugs. This is exactly the case. Matlab 2021a, as previously stated, has an important bug, exactly for what concerns cluster processing. If you want to stitch to that, ask the Matlab support to solve it. My suggestion? Don’t use Matlab 2021a. Is it required by your macos? It means, you macos is not suitable for data processing. It’s very simple and there is nothing we can do about it.
      best

    • #6455
      antani
      Participant

      Just to complete this post with a good news:

      On MacPro 2019 I ran

      matlab -nodesktop -r “main(‘InputParFile.txt’);

      and it worked while when running the -nodisplay option it gives me the error above.

Viewing 8 reply threads
  • You must be logged in to reply to this topic.