Skip to content

How To Run Your Program

bmwesting edited this page Apr 1, 2013 · 12 revisions

Adding the Configuration File to the Project

You've created the configuration file, now you just need to add it to the project. From the main Processing menu, click Sketch->Add File and point it to your configuration.xml file. Now the file will be located at data/configuration.xml relative to the sketch.

Exporting the Finished Program

Note: This section will likely change soon when full integration with the Processing IDE is complete.

To run your program, you must first export the application from the Processing environment. You may first wish to press the play button to make sure it actually executes. You will only see a window, but if you get any compile errors, you will know there are things you should fix. Otherwise, it will successfully export:

Exporting your applet

Running on a Cluster with a Shared Filesystem

You can use mperun to execute the sketch if your nodes share a filesystem.

mperun is located in the examples directory of the MPE source code. You can download it from Github here

  1. Copy the mperun script to a directory directly above you exported sketch.
  2. Run mperun through the command line, pointing it at your exported sketch: ./mperun /path/to/your/sketch/sketchfile
  3. The sketch should run in a distributed manner as specified in the configuration file.

NOTE: It is important that you point mperun to the correct file. On our systems with the peasycam example here, we execute the command:

./mperun /home/user/exports/peasyex/MPEPeasy

MPEPeasy is the script or executable that Processing produces for you during export.

Running the Program without a Shared Filesystem

To run on a single computer or a cluster without a shared filesystem, you can create an executable bash script using the following in a file entitled run.sh:

Mac

# head process
export RANK=0; ./peasytest.app/Contents/MacOS/JavaApplicationStub &

# render processes
export RANK=1; ./peasytest.app/Contents/MacOS/JavaApplicationStub &
export RANK=2; ./peasytest.app/Contents/MacOS/JavaApplicationStub &
export RANK=3; ./peasytest.app/Contents/MacOS/JavaApplicationStub &
export RANK=4; ./peasytest.app/Contents/MacOS/JavaApplicationStub

Linux

# head process
export RANK=0; sh peasytest &

# render processes
export RANK=1; sh peasytest &
export RANK=2; sh peasytest &
export RANK=3; sh peasytest &
export RANK=4; sh peasytest

This bash script should be located in the directory in which you exported your app. The directory should be named application.osx or application.linux, etc.

Finally, do a chmod a+x run.sh to make the file executable. Then run it in a terminal: ./run.sh

The program running.


Congratulations, you've run your first example. If you have questions, please check out the FAQ's section. If you still have questions, email the author!

Back to the Main Article