Basic Operation

Keep in mind that command files are created by interactively executing EnSight and then saving the command language to a file. To apply your commands to a new dataset, you would edit the command file in a text editor and change the name of the input dataset and the output files (such as images) and then execute the modified command file in batch.

Command language is not flexible: it does not allow programming or looping or decision making. It is, however, possible to convert the command language file to a Python file to add programming constructs if necessary.

Command language processing does not always handle errors gracefully. Usually the command file processing will simply stop when an error is found. But it is possible to issue commands to EnSight that can cause terminal errors.

Example

Suppose you have 5 similar solver runs. You wish to do the same postprocessing to each dataset and run them overnight and show up in the morning and look at images and movies.

The first step is to create the command file. Load one of the solver runs into an interactive session of EnSight and create the visuals and outputs you desire. Then save the commands to a file. Next, make four copies of the command file and edit each one for input and output files.

Now run each of your jobs in batch as described above. Note that if your batch job is expected to run overnight on your remote Linux system you might consider using the Linux nohup command.

If you don't have computing resources to handle all the jobs simultaneously then submit them sequentially. If you are on a shared resource and licenses are limited, your EnSight batch process will fail if it is unable to acquire a license token. To work around this, consider using one of the following EnSight startup modifiers: -token_try_again, -token_wait_for, or -token_wait_until which will allow your batch EnSight processes to wait for an available EnSight license token to become available (see Command Line Start-up Options).

Direct OpenGL, bypass X-Server

If your machine has X-server issues (for example, problems starting up the X-server) or issues with the DISPLAY environmental variable, and you have an nVidia graphics card with driver 358.16 or later, and are on Linux, you can start EnSight up with the -egl option. EnSight will use embedded OpenGL (which bypasses the X-server and makes direct calls to the graphics card, which must be present) as follows.

ensight -egl -batch -p file.py

In a multi-GPU system the first GPU will be used by default. To choose a GPU, set the environment variable CEI_EGL_GPU to a value between 0 and the number of GPUs minus 1.

Software Rendering

If the batch machine has inadequate or lacks a graphics card you can execute EnSight in a software mode which will utilize the CPU to generate the graphics. The execution will be significantly slower but assuming you save only a few images may have little impact on the overall run time. To use software rendering in batch, run EnSight with a -X as follows:

ensight -X -batch -p file.enc

Alternatively -glsw is interpreted the same as -X

Advanced Concepts

Image Size

There are two resolutions you need to keep in mind when setting up a batch run of EnSight. First is the window size when you are running EnSight. Second is the size of any images that you save. In order for the images saved in your batch run to capture the same imagery it is important that the image be the same aspect ratio (width vs. height) as the image generated when you created the command file interactively in EnSight. Lacking the same aspect ratio it is possible that the images saved in batch mode may cut off some portion of your scene.

When saving an image in EnSight you can specify the Window Size. If this is set to Current View the image will be saved at the current resolution of the graphics window. By default, the current window size when you execute in batch mode is 1280x720 (width x height). The current window size when you execute EnSight interactively is variable, that is, the window can be resized. See below for instructions on determining the current window size and aspect ratio. The current window size in batch can be specified by setting the size on the start line such as:

ensight -batch 1024 768 -p file.enc

It it much better to save images by specifying the resolution of the images, that is, either setting the Window Size to a user defined size or using one of the predetermined resolutions such as HD 1080p. This prevents the issue of trying to match the window size and forcing you to

  • Know the resolution

  • Specify it on the start line

If you set “Window size” to Current view you must specify the resolution when you start EnSight in batch mode if you are going to match the images you saved interactively. The resolution is not required to be the same, but keeping the aspect ratio is important. It is better to save images using an option other than Current view.

If you wish to know what the current resolution and aspect ratio you can pull up a user defined tool as follows:

To precisely control the graphics screen size during your interactive session,

  1. Click on the tool box icon at the top.

  2. Open the Utilities folder, and double click on the Resize rendering window tool.

  3. Adjust or note the window size and aspect ratio.

Python

EnSight can also run EnSight Python scripts in batch exactly the same as command files.

ensight -p file.py

EnSight Python has all of the advantages of the Python programming language (variables, looping, if/then, and a number of python modules) as well as the capabilities of the EnSight journaling language in the EnSight Python module.

For example, instead of editing five command files, which are custom edited for each solution dataset, you can create a single EnSight python file which loops through a list of the dataset filenames and executes the desired commands and auto creates the output image and animations.