[kepler-dev] Running Matlab in Kepler

Christopher Brooks cxh at eecs.berkeley.edu
Tue Mar 18 17:52:49 PDT 2008

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.xml 
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\matlab\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
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?



    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/.
    Christopher Brooks wrote:
    > However, the Ptolemy matlab demo did not run  within Kepler:
    > ptolemy.kernel.util.IllegalActionException: There was a problem invoking 
    > 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 the 
    > classpath for 'ptolemy/matlab/ptmatlab.dll', but that was not found eithe
    > classpath was: 
    > c:\cxh\src\kepler\build\classes;c:\cxh\src\kepler\build\src;c:\cxh\src\ke
    > 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 actor
    > 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 problem 
    >> was because I was running Matlab in Kepler using windows operating 
    >> system. I was able to run the Matlab in Kepler without any error using 
    >> 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 you 
    >> 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 10secs. 
    >> However, the Matlab instructions used in this workflow can be executed 
    >> approximately in 1-2secs when typed directly in Matlab command line.
    >> 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 to
    >>     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 whether
    >>         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 used in
    >>         Ptolemy, yes?
    >>         Madhu:
    >>         You might also send a workflow snippet (e.g. MOML) that shows
    >>         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 reply.
    >>             I'm having the following problem:
    >>             t here is a significant slow down in the execution of my Mat
    >>             functions when they are executed inside Kepler.
    >>             I would like to know if this is a characteristic of Kepler w
    >>             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/kepler-dev

More information about the Kepler-dev mailing list