[kepler-dev] Running Matlab in Kepler

Christopher Brooks cxh at eecs.berkeley.edu
Wed Mar 19 14:15:52 PDT 2008


Hi Dan,

I've tested it under Windows and I believe Solaris.  Possibly Linux.
Santa did not bring me a Mac, though I think one is in my future,
so I have not tested it on a Mac.

It would probably be easiest for you to create a patch for
ptolemy/data/expr/UtilityFunctions.java, which I could fold in right
away.  The alternative is remote debugging, which is time consuming.

Or, you could tell me where you added the print statements (just send
me the method?) and the full name and location of the shared library
that is to be added.  I could make some guesses, but I'll likely be
wrong and you'll have to edit UtilitiyFunctions.java anyway.


_Christopher



--------

    
    Hi Christopher,
    
    I added similar print statements to UtilityFunctions.loadLibrary(),
    and first it tries to load 'ptolemy/matlab/ptmatlab', followed by
    '/libptmatlab'.
    
    This is on a Mac, but the code that constructs the alternate name
    is different depending on if it's Windows or non-Windows. Have you
    tested this on a non-Windows machine?
    
      --dan
    
    Christopher Brooks wrote:
    > Hi Dan,
    >
    > The way ptolemy.matlab.Engine works is that it calls 
    > ptolemy.data.expr.UtilityFunctions.loadLibrary(), which tries
    > really hard to load the library using different paths.
    >
    > I added some print statements to loadLibrary(), and you can see that
    > in the default situation is finds $PTII/ptolemy/matlab/ptmatlab.dll
    > and then loads it
    >
    > bash-3.2$ cd $PTII/ptolemy/matlab
    > bash-3.2$ $PTII/bin/vergil -jni demo/MatlabExpression/MatlabExpression.xm
   l 
    > loadLibrary: 0 ptolemy/matlab/ptmatlab
    > loadLibrary: 2 about to call System.loadLibrary(ptolemy/matlab/ptmatlab)
    > loadLibrary: 4 about to call System.loadLibrary(C:\cxh\ptII\ptolemy\matla
   b\ptmatlab.dll)
    > loadLibrary: 5 done!
    >
    > If I move the $PTII/ptolemy/matlab/ptmatlab.dll to somewhere in my
    > path ($PTII/bin), then it finds it there as well:
    > bash-3.2$ ls *.dll
    > ptmatlab.dll
    > bash-3.2$ mv *.dll $PTII/bin
    > bash-3.2$ $PTII/bin/vergil -jni
    > loadLibrary: 0 ptolemy/matlab/ptmatlab
    > loadLibrary: 2 about to call System.loadLibrary(ptolemy/matlab/ptmatlab)
    > loadLibrary: 3 about to call System.loadLibrary(ptmatlab)
    >
    > On what platform are you running the Kepler build scripts?  Maybe
    > UtilityFunctions.loadLibrary() needs to be updated for that platform?
    >
    > _Christopher
    >
    >
    > --------
    >
    >     
    >     Hi Christopher,
    >     
    >     I am updating the Kepler build scripts for the Ptolemy matlab actor.
    >     Could you change ptolemy.matlab.Engine to load the JNI library as
    >     'ptmatlab' instead of 'ptolemy/matlab/ptmatlab'? The latter prevents
    >     the library from being loaded unless it is in a directory structure
    >     that has the form .../ptolemy/matlab/.
    >     
    >     Thanks,
    >     
    >       --dan
    >     
    >     
    >     Christopher Brooks wrote:
    >     > However, the Ptolemy matlab demo did not run  within Kepler:
    >     >
    >     > ptolemy.kernel.util.IllegalActionException: There was a problem inv
   oking 
    >     > the Ptolemy II Matlab interface.
    >     > The interface has been tested under Windows and Linux,
    >     > requires that Matlab be installed on the local machine.Refer to 
    >     > $PTII/ptolemy/matlab/makefile for moreinformation.
    >     >    in .MatlabExpression.MatlabExpression
    >     > Because:
    >     > Did not find 'ptolemy/matlab/ptmatlab' in path, searched user.home 
    >     > (c:\cxh\src\kepler) user.dir (C:\Documents and Settings\cxh) and th
   e 
    >     > classpath for 'ptolemy/matlab/ptmatlab.dll', but that was not found
    eithe
    >    r.
    >     > classpath was: 
    >     > c:\cxh\src\kepler\build\classes;c:\cxh\src\kepler\build\src;c:\cxh\
   src\ke
    >    pler;c:\cxh\src\kepler\configs;c:\cxh\src\kepler\lib;c:\cxh\src\kepler
   \lib\i
    >    mages;c:\cxh\src\kepler\build\kepler-icons.jar;c:\cxh\ptII\lib\diva.ja
   r;c:\c
    >    xh\ptII\build\ptolemy-doc.jar;c:\cxh\ptII\build\classes;c:\cxh\ptII\bu
   ild\sr
    >    c 
    >     > Also tried loadLibrary("ptmatlab", exception for loadLibrary was: 
    >     > java.lang.UnsatisfiedLinkError: no ptmatlab in java.library.path
    >     > 	at ptolemy.matlab.Expression.preinitialize(Expression.java:202)
    >     > 	at ptolemy.actor.Director.preinitialize(Director.java:865)
    >     >
    >     > So, the next step would be to get the Ptolemy Matlab Expression act
   or
    >     > to work in Kepler or to try the same experiment in Ptolemy.
    >     >
    >     > I can't try it right now because my Matlab license has expired.
    >     >
    >     > _Christopher
    >     >
    >     >
    >     > myerramothu at miners.utep.edu wrote:
    >     >   
    >     >> Hello Everyone,
    >     >>  
    >     >> Thank you Dr. Ludaescher for your reply. The problem that I posted
    in 
    >     >> Kepler users mailing list was my first question and I think the pr
   oblem 
    >     >> was because I was running Matlab in Kepler using windows operating
    
    >     >> system. I was able to run the Matlab in Kepler without any error u
   sing 
    >     >> Linux operating system.
    >     >>  
    >     >> My current problem is: I observed a significant slow down in the 
    >     >> execution of my Matlab functions when they are executed in Kepler.
    
    >     >> The Matlab actor I am using is /Matlabexpression/. I am sending yo
   u 
    >     >> a workflow that calculates the kurtosis and skewness of a Gaussian
    
    >     >> random sequence as an attachment to this email. The workflow that 
   I am 
    >     >> sending was developed and executed by me in Linux operating system
    and 
    >     >> time taken to execute this workflow was approximately 2mins and 10
   secs. 
    >     >> However, the Matlab instructions used in this workflow can be exec
   uted 
    >     >> approximately in 1-2secs when typed directly in Matlab command lin
   e.
    >     >>  
    >     >> Your help will be very valuable for me to further use the Kepler.
    >     >>  
    >     >> Please check the attachment to this email.
    >     >>  
    >     >> Thank you very much for your time,
    >     >> Sincerely,
    >     >> Madhu.
    >     >>
    >     >>
    >     >>
    >     >>
    >     >>     --------------------------------------------------------------
   ------
    >    ----
    >     >>     CC: myerramothu at miners.utep.edu; daks-dev at googlegroups.com;
    >     >>     crawl at sdsc.edu; cxh at eecs.berkeley.edu; jones at nceas.ucsb.edu
    >     >>     From: altintas at sdsc.edu
    >     >>     Subject: Re: Running Matlab in Kepler
    >     >>     Date: Sun, 2 Mar 2008 21:49:12 -0800
    >     >>     To: ludaesch at ucdavis.edu
    >     >>
    >     >>     Hi Madhu,
    >     >>
    >     >>     Which Matlab actor are you using?  I couldn't find your post t
   o
    >     >>     kepler-dev. Could you please forward that one as well?
    >     >>
    >     >>     Thanks,
    >     >>     -ilkay
    >     >>
    >     >>     On Mar 1, 2008, at 2:56 PM, Bertram Ludaescher wrote:
    >     >>
    >     >>         Hi Madhu:
    >     >>
    >     >>         I haven't used the Matlab actor directly, so not sure whet
   her
    >     >>         the problem you describe is a known issue.
    >     >>         I'm cc-ing some people who might know.
    >     >>
    >     >>         All (Ptolemy/Kepler people developers):
    >     >>         Have you witnessed the problem Madhu described?
    >     >>         I think we use the same Matlab actor in Kepler that is use
   d in
    >     >>         Ptolemy, yes?
    >     >>
    >     >>         Madhu:
    >     >>         You might also send a workflow snippet (e.g. MOML) that sh
   ows
    >     >>         the problem to kepler-dev.
    >     >>
    >     >>         best
    >     >>
    >     >>         BL
    >     >>
    >     >>
    >     >>         On Thu, Feb 28, 2008 at 5:20 PM, <myerramothu at miners.utep.
   edu
    >     >>         <mailto:myerramothu at miners.utep.edu>> wrote:
    >     >>
    >     >>             Hello Dr. Ludaescher,
    >     >>              
    >     >>             Sorry to contact you directly.
    >     >>             I sent an e-mail to the the Kepler mailing list
    >     >>             about using Kepler with Matlab but I didn't get any re
   ply.
    >     >>             I'm having the following problem:
    >     >>             t here is a significant slow down in the execution of 
   my Mat
    >    lab
    >     >>             functions when they are executed inside Kepler.
    >     >>             I would like to know if this is a characteristic of Ke
   pler w
    >    ith
    >     >>             Matlab or if it could be a problem specific to my
    >     >>             implementation.
    >     >>
    >     >>             Thank you for your attention,
    >     >>             Sincerely,
    >     >>             Madhu.
    >     >>              
    >     >>             Madhu Kishore Yerramothu
    >     >>             Graduate Teaching Assistant,
    >     >>             Department of Electrical and Computer Engineering,
    >     >>             University of Texas at El Paso
    >     >>             El Paso, TX 79968.
    >     >>             Phone: 915 217 4778
    >     >>             Email: myerramothu at miners.utep.edu
    >     >>             <mailto:myerramothu at miners.utep.edu>
    >     >>
    >     >>              
    >     >>              
    >     >>
    >     >>
    >     >>
    >     >>     
    >     > _______________________________________________
    >     > Kepler-dev mailing list
    >     > Kepler-dev at ecoinformatics.org
    >     > http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/keple
   r-dev
    >     >   
    > --------
    >   
--------


More information about the Kepler-dev mailing list