[kepler-dev] Build Broken (by MatlabExpression.java?)

Christopher Brooks cxh at eecs.berkeley.edu
Tue Apr 25 17:46:44 PDT 2006


The launcher program would launch Kepler.  Then, JNI would work.
I have not tried it, this is what one of the URLs suggests.

I recommend pursuing this approach over invoking Matlab in separate
process(es). Interprocess communication is tricky, handling out of
band error conditions is difficult. However, that said, I have no
cycles, so I can't fix the Ptolemy MatlabExpression actor.  Elaine
Cheong and I are going to look at JNI on Tuesday and Wednesday of next
week, maybe I'll have something to report.

_Christopher

--------

    A launcher program from Matlab to start Kepler/Ptolemy would mean that 
    Workflow users first start matlab and then run their workflows with 
    ptexecute
    or something of that sort?
    Currently from matlab Expression it takes a good 10-15 secs to start up 
    matlab. If we have 3-4 matlabExpression Actors in a workflow they
    will all start their own process and even be more slower. We can have a 
    singleton class which creates the process once and the matlabExpression
    actors can use(share) the Matlab process w/o starting a new separate 
    process for each actor.
    
    nandita.
    
    Christopher Brooks wrote:
    
    >Using Runtime and Process will likely work fine.  I think the problem
    >has to do with how the binaries that are loaded by JNI are created.
    >The problem started appearing under Windows with cygwin with gcc-3.2.
    >I think the problem is more associated with cygwin than with gcc.
    >There is a longish message in ptolemy-hackers,
    >
    >at http://groups.google.com/group/comp.soft-sys.ptolemy/browse_thread/thre
   ad/2c2093bbcd3af95d/28b132dc5abba5cd?lnk=st&q=jni+cygwin+ptolemy-hackers&rnu
   m=1#28b132dc5abba5cd
    >or
    >http://ptolemy.eecs.berkeley.edu/mailing-lists/split/0603/Re:_ptolemy_matl
   ab15
    >
    >The real solution under Windows appears to be to create a launcher program
    >
    >A quick test is to run
    >cd $PTII
    >./configure
    >cd ptolemy/jni/test
    >make
    >
    >Usually the tests will fail under Windows with gcc after gcc-3.2
    >If you trash your cygwin installatino and install the cygwin from
    >Ptolemy-3.0
    >http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII3.0/cygwin.htm
    >then the tests pass
    >
    >I looked at the Mathworks pages and indeed Matlab can call Java code,
    >but it looks like to call Matlab from Java, one must use JNI, which
    >is what we do.  Oh well.
    >
    >My one concern is that each time your actor fires, it execs a separate
    >Matlab process.  This could be slow.  However, under Cygwin at least
    >it works :-)
    >
    >I'd like to see this Cygwin/JNI problem solved, but have not had the
    >time.  I think it requires creating a launcher to launch Ptolemy
    >or Kepler.
    >
    >_Christopher
    >
    >
    >
    >
    >--------
    >
    >    Interesting,
    >    My actor uses the Runtime and Process classes, however they themselves
    
    >    use builtin JNI functions.
    >    
    >    If you can get my more info on invoking matlab without JNI that'd be g
   reat.
    >    
    >    I'm not sure exactly what you mean when you say JNI is broken under 
    >    windows cygwin. i can run my actor fine from cygwin, it's just a shell
    
    >    after all and uses the same version of java that the rest of the syste
   m 
    >    uses. Maybe it's just that i'm not familiar with the environment you'r
   e 
    >    using it in tho.
    >    
    >    --Tristan
    >    
    >    Christopher Brooks wrote:
    >    > Hi Tristan,
    >    > 
    >    > The Ptolemy MatlabExpression actor uses the JNI to communicate with
    >    > Matlab.  I don't think a separate process is invoked.  
    >    > 
    >    > I have not looked at Matlab lately, though Ernesto Wandeler recently
    >    > told me he had been able to invoke Matlab via Java and not use
    >    > JNI.
    >    > 
    >    > JNI under Windows Cygwin is utterly broken.   JNI using Microsoft
    >    > VC++ works.
    >    > 
    >    > 
    >    > _Christopher
    >    > 
    >    > --------
    >    > 
    >    >     My bad with that. I always figured that that java compliance set
   tings
    >    in 
    >    >     eclipse meant that the code would compile under 1.4 (or maybe it
    does
    >    
    >    >     and i'm doing something wrong). I've modified the actor now and 
   compi
    >   led 
    >    >     it using 1.4 to make sure it works, and will commit it again lat
   er on
    >    
    >    >     today (when i'm 100% sure it wont break anything :)).
    >    >     
    >    >     I've looked into the java interfaces that come with matlab, and 
   as fa
    >   r 
    >    >     as i can tell they're not much use to us.
    >    >     
    >    >      From what i've managed to figure out, they just allow people to
    writ
    >   e 
    >    >     java classes for use inside matlab's own jvm (i.e. the classes m
   ust b
    >   e 
    >    >     called from inside matlab), and don't do anything when run from 
   a 
    >    >     standard jvm.
    >    >     
    >    >     If anyone knows any different, please let me know. I'm not a big
    fan 
    >   of 
    >    >     the whole spawning additional processes to preform these tasks, 
   and e
    >   ven 
    >    >     less of having to parse text output to decipher the results. But
    for 
    >   now 
    >    >     i don't know of any other way of doing this.
    >    >     
    >    >     --Tristan
    >    >     
    >    >     Christopher Brooks wrote:
    >    >     > BTW - The Ptolemy Matlab expression actor uses JNI to communic
   ate
    >    >     > with Matlab.  I believe there is now a pure Java Matlab interf
   ace
    >    >     > which is much more robust than JNI.  I would support tossing t
   he
    >    >     > Ptolemy Matlab expression actor for a non-JNI Matlab actor.
    >    >     > 
    >    >     > Nandita create a MatlabStartScript utility that looks like it 
   start
    >   s
    >    >     > a remote Matlab process using Runtime.getRuntime().exec().  
    >    >     > I'm not so sure if this is the right thing, since it starts a 
    >    >     > separate process each time.  It might be better to have a 
    >    >     > more integrated actor?  However, I'm not sure what the plan is
    >    >     > for this actor, so there could easily be good uses for it.
    >    >     > 
    >    >     > 
    >    >     > _Christopher
    >    >     > 
    >    >     > --------
    >    >     > 
    >    >     >     MatlabExpression code is apparently keeping the nightly bu
   ild f
    >   rom 
    >    >     >     compiling. Would however is working on this please fix ASA
   P!
    >    >     >     
    >    >     >     (And is this different that the Matlab actor in PTII ? (wh
   ich w
    >   e coul
    >    >    d 
    >    >     >     put in Kepler)
    >    >     >     
    >    >     >     Dan Higgins
    >    >     >     NCEAS
    >    >     >     _______________________________________________
    >    >     >     Kepler-dev mailing list
    >    >     >     Kepler-dev at ecoinformatics.org
    >    >     >     http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listi
   nfo/k
    >   epler-
    >    >    dev
    >    >     > --------
    >    >     > _______________________________________________
    >    >     > Kepler-dev mailing list
    >    >     > Kepler-dev at ecoinformatics.org
    >    >     > http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/
   keple
    >   r-dev
    >    >     > 
    >    >     
    >    >     -- 
    >    >     Tristan King                            | Ph: (07) 4781 6911
    >    >     DART project team                       | Email: Tristan.King at jc
   u.edu
    >   .au
    >    >     James Cook University                   | Web: http://dart.edu.a
   u
    >    >     Townsville QLD 4814                     | http://plone.jcu.edu.a
   u/dar
    >   t/
    >    >     Australia                               |
    >    > --------
    >    > 
    >    
    >    -- 
    >    Tristan King                            | Ph: (07) 4781 6911
    >    DART project team                       | Email: Tristan.King at jcu.edu.
   au
    >    James Cook University                   | Web: http://dart.edu.au
    >    Townsville QLD 4814                     | http://plone.jcu.edu.au/dart
   /
    >    Australia                               |
    >--------
    >_______________________________________________
    >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