[kepler-dev] Running Matlab in Kepler

Christopher Brooks cxh at eecs.berkeley.edu
Thu Mar 20 16:22:53 PDT 2008


Done!
_Christopher
--------

    This is a multi-part message in MIME format.
    --------------040208070502050804000702
    Content-Type: text/plain; charset=ISO-8859-1; format=flowed
    Content-Transfer-Encoding: 7bit
    
    
    Hi Christopher,
    
    Here's a patch.
    
    Thanks,
    
      --dan
    
    Christopher Brooks wrote:
    > 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 tha
   t
    >     > 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/MatlabExpress
   ion.xm
    >    l 
    >     > loadLibrary: 0 ptolemy/matlab/ptmatlab
    >     > loadLibrary: 2 about to call System.loadLibrary(ptolemy/matlab/ptma
   tlab)
    >     > 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/ptma
   tlab)
    >     > 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 platfor
   m?
    >     >
    >     > _Christopher
    >     >
    >     >
    >     > --------
    >     >
    >     >     
    >     >     Hi Christopher,
    >     >     
    >     >     I am updating the Kepler build scripts for the Ptolemy matlab a
   ctor.
    >     >     Could you change ptolemy.matlab.Engine to load the JNI library 
   as
    >     >     'ptmatlab' instead of 'ptolemy/matlab/ptmatlab'? The latter pre
   vents
    >     >     the library from being loaded unless it is in a directory struc
   ture
    >     >     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 probl
   em 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\d
   iva.ja
    >    r;c:\c
    >     >    xh\ptII\build\ptolemy-doc.jar;c:\cxh\ptII\build\classes;c:\cxh\p
   tII\bu
    >    ild\sr
    >     >    c 
    >     >     > Also tried loadLibrary("ptmatlab", exception for loadLibrary 
   was: 
    >     >     > java.lang.UnsatisfiedLinkError: no ptmatlab in java.library.p
   ath
    >     >     > 	at ptolemy.matlab.Expression.preinitialize(Expression.j
   ava:202)
    >     >     > 	at ptolemy.actor.Director.preinitialize(Director.java:8
   65)
    >     >     >
    >     >     > So, the next step would be to get the Ptolemy Matlab Expressi
   on 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 expire
   d.
    >     >     >
    >     >     > _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 ope
   rating
    >     
    >     >     >> system. I was able to run the Matlab in Kepler without any e
   rror 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 K
   epler.
    >     
    >     >     >> The Matlab actor I am using is /Matlabexpression/. I am send
   ing yo
    >    u 
    >     >     >> a workflow that calculates the kurtosis and skewness of a Ga
   ussian
    >     
    >     >     >> 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 b
   e exec
    >    uted 
    >     >     >> approximately in 1-2secs when typed directly in Matlab comma
   nd lin
    >    e.
    >     >     >>  
    >     >     >> Your help will be very valuable for me to further use the Ke
   pler.
    >     >     >>  
    >     >     >> 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.c
   om;
    >     >     >>     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 sur
   e 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) t
   hat 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 executi
   on 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 m
   y
    >     >     >>             implementation.
    >     >     >>
    >     >     >>             Thank you for your attention,
    >     >     >>             Sincerely,
    >     >     >>             Madhu.
    >     >     >>              
    >     >     >>             Madhu Kishore Yerramothu
    >     >     >>             Graduate Teaching Assistant,
    >     >     >>             Department of Electrical and Computer Engineerin
   g,
    >     >     >>             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
    >     >     >   
    >     > --------
    >     >   
    > --------
    >   
    
    
    --------------040208070502050804000702
    Content-Type: text/plain;
     name="diff.txt"
    Content-Transfer-Encoding: 7bit
    Content-Disposition: attachment;
     filename="diff.txt"
    
    Index: ptolemy/data/expr/UtilityFunctions.java
    ===================================================================
    RCS file: /home/cvs/cvsanon/ptII/ptolemy/data/expr/UtilityFunctions.java,v
    retrieving revision 1.157
    diff -r1.157 UtilityFunctions.java
    792c792
    < 		osName.startsWith("Mac OS X")) {
    ---
    >                 osName.startsWith("Mac OS X")) {
    794c794
    < 		if (osName.startsWith("Mac OS X")) {
    ---
    >                 if (osName.startsWith("Mac OS X")) {
    796c796
    < 		} else {
    ---
    >                 } else {
    813,816c813,821
    <                         shortLibraryName = "/lib"
    <                                 + library.substring(index + 1);
    <                         library = library.substring(0, index)
    <                                 + shortLibraryName;
    ---
    >                         if(osName.startsWith("Mac OS X")) {
    >                             library = library.substring(index + 1);
    >                             shortLibraryName = library;    
    >                         } else {
    >                             shortLibraryName = "/lib"
    >                                     + library.substring(index + 1);
    >                             library = library.substring(0, index)
    >                                     + shortLibraryName;
    >                         }
    
    --------------040208070502050804000702--
--------


More information about the Kepler-dev mailing list