Wiki
Clone wikisynergia2 / RunningSynergiaScripts
Running Synergia scripts
After building CHEF and Synergia, setting the LD_LIBRARY_PATH and PYTHONPATH to the library and module installed locations allow one to launch Synergia scripts from within python.
If following the previous instructions, CHEF_INSTALL_DIR
has been defined and both Synergia and CHEF have been installed there, the following definitions suffice for running a Synergia script:
If you are on a Linux machine:
export LD_LIBRARY_PATH=${CHEF_INSTALL_DIR}/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
In the following, replace the Python version with the version corresponding to your build.
export PYTHONPATH=${CHEF_INSTALL_DIR}/lib:${CHEF_INSTALL_DIR}/lib/python3.6/site-packages${PYTHONPATH+:$PYTHONPATH}
The following variable is needed for the Synergia options and job creation to work correctly.
export SYNERGIA2DIR=${CHEF_INSTALL_DIR}/lib
After that, the script can be run using python
or python3
according to the version used in the build.
A run of the fodo_workflow
example on Ubuntu 18.04 using Python3 is shown below:
vagrant@vagrant:~$ export CHEF_INSTALL_DIR=~/synergia2-install
vagrant@vagrant:~$ export LD_LIBRARY_PATH=${CHEF_INSTALL_DIR}/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
vagrant@vagrant:~$ export PYTHONPATH=${CHEF_INSTALL_DIR}/lib:${CHEF_INSTALL_DIR}/lib/python3.6/site-packages${PYTHONPATH+:$PYTHONPATH}
vagrant@vagrant:~$ export SYNERGIA2DIR=${CHEF_INSTALL_DIR}/lib
vagrant@vagrant:~$ cd fodo_workflow
vagrant@vagrant:~/fodo_workflow$ python3 fodo_workflow.py
Propagator: starting turn 1
Propagator: step 1/8, s_n=1.0000, macroparticles = 50000, time = 0.126s
Propagator: step 2/8, s_n=2.0000, macroparticles = 50000, time = 0.125s
Propagator: step 3/8, s_n=6.0000, macroparticles = 50000, time = 0.006s
Propagator: step 4/8, s_n=10.0000, macroparticles = 50000, time = 0.006s
Propagator: step 5/8, s_n=11.0000, macroparticles = 50000, time = 0.124s
Propagator: step 6/8, s_n=12.0000, macroparticles = 50000, time = 0.124s
Propagator: step 7/8, s_n=16.0000, macroparticles = 50000, time = 0.006s
Propagator: step 8/8, s_n=20.0000, macroparticles = 50000, time = 0.006s
Propagator: turn 1/1, macroparticles = 50000, time = 0.52s
vagrant@vagrant:~/fodo_workflow$
Updated