[Getdp] Launching GetDP from another program

Lars Rindorf lrf at teknologisk.dk
Sun Nov 28 20:01:49 CET 2010


Hi John

I run getdp using python, a script language. It is very simple and very versatile. You could try it out.

KR Lars



Fra: getdp-bounces at ace20.montefiore.ulg.ac.be [mailto:getdp-bounces at ace20.montefiore.ulg.ac.be] På vegne af John_V
Sendt: 27. november 2010 17:31
Til: r.sabariego at ulg.ac.be
Cc: getdp at geuz.org
Emne: Re: [Getdp] Launching GetDP from another program

Ruth: Thank you for your offer to look at the files. I may take you up on it, but I should do some work first.  I suspect the problem somehow lies in the launch from my Java program because GetDP works OK for me too when I run it by hand. (...and my solver.par file is the same as the default one you attached to your last message.)

I had a thought to simplify the command by putting the getdp command line into a batch file (FEA.bat). Then my Java program only needs to launch FEA.bat. What could be simpler? This doesn't work either. I get a

java.io.IOException: Cannot run program "FEA.bat" in directory "It here gives the correct path to my directory, where I can plainly see the FEA.bat file." : CreateProcess error=2, The system cannot find the file specified.

Something is very strange here, but it does not seem to involve GetDP. I suspect there is something else on the command line, possibly something non-printing so does not show up when GetDP reports Running 'getdp_sparskit sample -pre EleSta_v -cal' but which corrupts either the command (if only that is given) or the last option if a command and options are given. Let me follow this clue before I bother you further.

Thanks for you help.

John


On Sat, Nov 27, 2010 at 2:37 AM, Ruth V. Sabariego <r.sabariego at ulg.ac.be<mailto:r.sabariego at ulg.ac.be>> wrote:
The message "Missing number" has to do with the parameters for the solver Sparskit.
Have you checked the content of your file 'solver.par'?
I send you the default file, just in case.
I am not able to reproduce your error. Everything works fine here: GetDP 2.1.0 compiled with Sparskit or GetDP 2.1.1 compiled with PetSc.
Could you send your files?

Regards,
Ruth


On 27/11/10 02:32, John_V wrote:
Thanks Ruth. Unfortunately, I did also try this, with the same result. --John

On Fri, Nov 26, 2010 at 3:22 PM, Ruth V. Sabariego <r.sabariego at ulg.ac.be<mailto:r.sabariego at ulg.ac.be>> wrote:
I often launch GetDP from Matlab without any problem.
Try with:
getdp_sparskit sample -sol EleSta_v

Ruth

getdp_sparskit sample -pre EleSta_v -cal
On 26/11/10 20:25, John_V wrote:
Has anyone successfully launched GetDP from another program?

I have a Java program that writes problem specification files for GetDP and then attempts to launch it. I don't understand GetDP's ""Missing number"" error message.

Here's the SHORT VERSION of my story. GetD itself reports:
Running 'getdp_sparskit sample -pre EleSta_v -cal'
Info    : Started on Fri Nov 26 13:29:57 2010

Then it produces error output as follows:
Error   : Missing number

Does anyone know what is the "Missing number" to which GetDP is referring? The reported command, 'getdp_sparskit sample -pre EleSta_v -cal', does run properly if I type it manually at a DOS prompt or put it in a batch file. (getdp_sparskit is my renamed getdp executable after compiling with the sparskit library.)

If instead I change the command line to 'getdp_sparskit sample -pre EleSta_v -cal 1>output.txt 2>errout.txt' there is more progress before it fails. I get the following normal output followed by error message:
Info    : Started on Fri Nov 26 13:28:24 2010
Info    : Unknown option: '2>errout.txt'
Info    : Loading problem definition 'sample.pro<http://sample.pro>'
Info    : Loading problem definition 'Jacobian_Lib.pro'
Info    : Loading problem definition 'Integration_Lib.pro'
Info    : Loading problem definition 'EleSta_v.pro'
Info    : Selected Resolution 'EleSta_v'
Info    : Loaded Geometric data 'sample.msh'
Info    : System 'Sys_Ele' : Real
P r e - P r o c e s s i n g . . .
Info    : Loding Pre-Processing data 'sample.pre'
Info    : (CPU = 10.4375s)
E n d   P r e - P r o c e s s i n g
P r o c e s s i n g . . .
Info    : Generate[Sys_Ele]
Info    : Loading parameter file 'solver.par'
Error   : Unknown solver parameter 'pre EleSta_v'
The solver.par file in my working directory works OK when I run from the command line, and it does not contain the characters EleSta_v, so this error message is also mysterious.

I would appreciate any insights.

John


DETAILED VERSION. Below is one version of the code I use to launch GetDP from my Java program and the resulting output. (I wrote a second version, using Java's ProcessBuilder class in hopes of seeing a different result, but the output was identical.)

My Java code:
         String[] command = new String[] {
            "getdp_sparskit",
            "sample",
            "-pre EleSta_v",
            "-cal"
         };

         Runtime runtime = Runtime.getRuntime();
         Process child = runtime.exec(command, null, new File(feaFolder)); /* feaFolder is working directory with sample.pro<http://sample.pro>, etc.*/
         InputStream is = child.getInputStream();
         InputStreamReader isr = new InputStreamReader(is);
         BufferedReader br = new BufferedReader(isr);
         BufferedReader brErr = new BufferedReader(new InputStreamReader(child.getErrorStream()));
         String line;

         System.out.printf("Output of running %s is:",
             Arrays.toString(command));

         while ((line = br.readLine()) != null) {
           System.out.println(line);
         }

         System.out.printf("Error output of running %s is:", Arrays.toString(command));

         while((line = brErr.readLine()) != null) {
            System.out.println(line);
         }

         int exitVal = child.waitFor();

The exitVal = 1 indicates a not-normal exit.

Output and error message:
Output of running [getdp_sparskit, sample, -pre EleSta_v, -cal] is:
Info    : Running 'getdp_sparskit sample -pre EleSta_v -cal'
Info    : Started on Fri Nov 26 13:29:57 2010
Error output of running [getdp_sparskit, sample, -pre EleSta_v, -cal] is:Error   : Missing number

The longer, more successful message reported above resulted from changing the definition of command to
         String[] command = new String[] {
            "getdp_sparskit",
            "sample",
            "-solve EleSta_v",
            "1>output.txt",
            "2>errout.txt"
         };




_______________________________________________

getdp mailing list

getdp at geuz.org<mailto:getdp at geuz.org>

http://www.geuz.org/mailman/listinfo/getdp



--

Dr. Ir. Ruth V. Sabariego

University of Liege, Dept. of Electrical Engineering & Computer Science,

Applied & Computational Electromagnetics (ACE),

phone: +32-4-3663737 - fax: +32-4-3662910 - http://ace.montefiore.ulg.ac.be/

_______________________________________________
getdp mailing list
getdp at geuz.org<mailto:getdp at geuz.org>
http://www.geuz.org/mailman/listinfo/getdp




--

Dr. Ir. Ruth V. Sabariego

University of Liege, Dept. of Electrical Engineering & Computer Science,

Applied & Computational Electromagnetics (ACE),

phone: +32-4-3663737 - fax: +32-4-3662910 - http://ace.montefiore.ulg.ac.be/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/getdp/attachments/20101128/fc59c443/attachment.html>