Important
The guidelines shown are for running Lumerical (Python) API scripts, 'lumapi' or 'lumopt' from the Terminal in Linux. The process allows running the Lumerical API scripts (.py) utilizing only 1 Lumerical GUI license.
Running the API from the Lumerical CAD/GUI in Linux will check out 2 Lumerical GUI licenses. One for the currently opened CAD/GUI and another (2nd) GUI license when running the API.
Configuration
- Check the PATH or Python3 and Lumerical installation you are using.
- The output should show your current settings.
echo $PATH
echo $PYTHONPATH
which python3
which fdtd-solutions
- Append the Lumerical API installation path into your current shell/terminal session.
export PYTHONPATH=/{lumerical_install_path}/api/python:$PYTHONPATH
- Add the Lumerical install path into your current shell/terminal session if you want to use our bundled Python3.
export PATH=/{lumerical_install_path}/bin:/{lumerical_install_path}/python/bin:$PATH
- Check the PATH or Python3 and Lumerical installation to confirm the new settings.
Note: See this KB for more information on setting the environment variables on Linux. If you are going to use your installation of Python3, ensure that all the modules required by our API are installed.
Running the API script
- Change the directory to the location of your script file.
- Run the Python API script using the Python 3 set in your environment.
cd /path_to/script_simulation_files
python3 myscript.py
Note: This will run the simulation in your script using the resource configuration (product preference.ini file) set in the Lumerical GUI. If you want to run optimization/sweeps concurrently on your local machine, set this beforehand in the resource configuration with the "Capacity" option.