[kepler-users] [kepler-dev] Tool for automatic generation of actors from C codes

Christopher Brooks cxh at eecs.berkeley.edu
Wed Mar 13 10:47:41 PDT 2013


Hi Tomasz,
That's pretty interesting.

Are you aware of the EmbeddedC Actor in Ptolemy?
See http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#CodeGen
In Ptolemy II 8.0, we have
http://sisyphus:8079/hudson/job/ptII/javadoc/ptolemy/actor/lib/jni/EmbeddedCActor.html#in_browser
In Ptolemy II devel tree we have
http://sisyphus:8079/hudson/job/ptII/javadoc/ptolemy/cg/lib/EmbeddedCodeActor.html#in_browser

I've attached a screenshot.

What the EmbeddedCodeActor does is provide a way to write C code, 
compile it and at run time get and set values.

I may be misunderstanding this, but it seems like your system provides a 
way to wrap main() functions and pass in command line arguments and 
presumably read values.  One nice thing about this is that the main() 
method presumably gets invoked each time fire() is called instead of 
execing an entire separate process with the Exec actor.

A slightly different way to do this is to use the bcvtb system and 
connect to a binary via sockets and set and get data that way.

There are many ways to do somewhat similar, but slightly different things.

_Christopher


On 3/13/13 6:15 AM, Tomasz Żok wrote:
> Dear Kepler contributors and users,
>
> we are glad to announce availibility of a tool which automates the process of
> actor creation from an arbitrary C code.
>
> The idea is to generate Kepler actor from any code that runs as a standalone
> executable. It is however a real integration, not a replacement for Exec actor
> which runs binaries. As a result of running presented tool you will get an
> actor with ports mapped to code arguments and working directly on typed Kepler
> tokens (eg. DoubleToken). Technically, your code becomes (fully automatically)
> a shared library loaded by the actor when requested.
>
> The principle is that you take an existing code (with "int main()" function,
> normally compilable to an executable), use this tool and you get an equivalent
> in form of Kepler actor. The only extra effort is to prepare a short XML of
> this form:
>          <actor>
>              <inputs>
>                  <in type="String" name="myArgument1"/>
>                  <in type="Integer" name="myArgument2"/>
>                  <in type="Double" name="myArgument3"/>
>              </inputs>
>          </actor>
>
> As you can see, it only defines the type and name of the expected inputs
>
>
> Let's say you have a program used like this:
>      ./my_app test 123 1.0
>
> Then you could use the XML as above and will get an actor with three typed
> ports. The above program execution would be equal to passing StringToken
> "test" to port myArgument1, IntToken 123 to myArgument2 and DoubleToken 1.0
> to myArgument3
>
>
> The attached archive contains README file with step by step guide. It also
> presents an example ready to run by anybody. Additionally I attach a simple
> workflow making use of this example and its screenshot.
>
>
> Some additional notes:
> - A common practice in C codes is to explicitly call "void exit(int status)"
>    instead of making "int main()" return the exit code. This situation is
>    handled, there is no need to change your code if it does this.
> - There is also one thing you must be aware of. If your code assumes that some
>    files are present in the *current directory* then remember that they will be
>    searched for from Kepler's perspective. It is advisable to remove this
>    assumption and pass absolute paths as additional code arguments.
>
> Regards,
> Tomek, Piotrek and Marcin
>
>
>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev

-- 
Christopher Brooks, PMP                       University of California
Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm/TRUST         Berkeley, CA 94720-1774
cxh at eecs.berkeley.edu, 707.332.0670           (Office: 545Q Cory)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20130313/49cc15fc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: EmbeddedCActorScreenShot.png
Type: image/png
Size: 140102 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20130313/49cc15fc/attachment-0001.png>


More information about the Kepler-users mailing list