4.9. Setup Unit Environment

Different Applications come with different requirements to the runtime environment. This section will describe how the shell environment for a CU can be configured, the next two sections will describe how to configure CUs to run as MPI application and how to insert arbitrary setup commands.

The CU environment is simply configured as a Python dictionary on the unit description, like this:

cud = rp.ComputeUnitDescription()

cud.executable  = '/bin/echo'
cud.arguments   = ['$RP_UNIT_ID greets $TEST']
cud.environment = {'TEST' : 'jabberwocky'}

which will make the environment variable TEST available during CU execution. Some other variables, such as the RP_UNIT_ID above, are set by RP internally and are here used for demonstration – but those should not be relied upon.

4.9.1. Running the Example

08_unit_environment.py. uses the above blob to run a bag of echo commands:

../_images/08_unit_environment.png

4.9.2. What’s Next?

Running MPI applications, and :ref:providing more generic environment setup <chapter_user_guide_10>`, are the topics for the next two sections.