Multitasking made easy

Field Precision programs are optimized for the latest generation of multi-core or multi-processor PCs. The 64-bit major solution programs (HiPhi, Magnum, GamBet,…) feature true parallel operation. The time-intensive subroutines have been coded in OpenMP, giving significant improvements in speed (see magnum-in-parallel or multicore-gambet). A second feature is the capability to run multiple independent calculations simultaneously. All the solution programs can run in the background if launched from a Windows batch file. Background operation is automatic and faster than running in a window. Unfortunately, this capability is often overlooked because of the effort required to create batch files and to keep track of what tasks are running. The problem was brought home to me during a recent consulting project where I needed to make an extended sequence of Trak calculations with small changes in geometry. Each step involved re-running three programs. Even though I was well aware of the batch file capability, laziness prevailed and I ran each calculation interactively. My irritation level was not quite high enough to overcome my inertia. We recently added a new feature to our program launchers (TC, AMaze, GBLaunch and Xenos) that should tip the balance — the ability to create and to run Tasks. A Task is any sequence of installed programs and input files for a background run. With the feature you can 1) quickly define Tasks in an interactive dialog, 2) launch simultaneous Tasks in the background and 3) find out which tasks are running. I’ll discuss how it works in this article.

Figure 1. Task control group in the TC program launcher.

Figure 1. Task control group in the TC program launcher.

Figure 1 shows the new Task control group in the TC program launcher. The CREATE TASK button calls up the dialog of Figure 2. The user supplies a file prefix FPREFIX that indicates the function of the Task. The Task information will be stored in a DOS batch file FPREFIX.BAT created in the current TC data directory. Commands in the file are compatible with all recent Windows versions including Windows 7.

Figure 2. Create task dialog

Figure 2. Create task dialog

Each row represents an operation (batch file command). The first column defines the action. Clicking on a cell brings up a menu that includes all TriComp programs capable of background operation that are installed on the user’s computer. In addition, several relatively safe DOS commands are included (ERASE, COPY, MOVE, RENAME and REM). All commands operate on a file (FILEIN). The DOS commands COPY, MOVE and RENAME require a second file name (FILEOUT). You can type file names in the cells. By default, the files are in the TC working directory, but you can include path information if the files are in other directories. Alternatively, you can click in a cell and pick the SELECT FILE command to raise the standard Windows dialog for choosing files anywhere on the computer. There is a nice feature for the TriComp programs — only files with appropriate suffixes are displayed (e.g., *.EIN or *.SCR for EStat).

Click the OK button when the sequence is complete to create the batch file. Here is an example:

REM TriComp batch file, Field Precision
START /B /WAIT C:\fieldp\tricomp\mesh64.exe C:\Temp\convergegun
START /B /WAIT C:\fieldp\tricomp\estat64.exe C:\Temp\convergegun
START /B /WAIT C:\fieldp\tricomp\trak64.exe C:\Temp\convergegun
ERASE *.?ls
START /B /WAIT C:\fieldp\tricomp\notify.exe
IF EXIST Electrode01.ACTIVE ERASE Electrode01.ACTIVE

The operations listed perform a complete Trak calculation in the background and then erase all listing files. Here are some notable features:

  • The operations are performed sequentially because data from one operation may be used in the next. To run calculations in parallel, define and run multiple Tasks.
  • You can modify the file with an editor if you are familiar with DOS commands.
  • The DOS commands recognize the standard wildcard conventions (* for any character grouping, ? for any character).
  • The programs adds the command notify.exe to the task sequence if AUDIO ALARM is checked. In this case, the computer beeps when a task is completed.
  • The final command to erase a file FPREFIX.ACTIVE is added to all batch files. The presence of an activate file indicates that the task is running.
Figure 3. Run task dialog

Figure 3. Run task dialog

Click the RUN TASK button when you have created Tasks or moved predefined task files to the data directory. The dialog (Figure 3) organizes tasks into two groups: ones that are available to run and ones that are currently running (i.e., FPREFIX.ACTIVE has been detected). To launch a task, choose one from the top list and click OK. The program creates a file FPREFIX.ACTIVE and runs the batch file. The program sequence runs silently in the background and the results appear almost magically. In the meantime, you can prepare other inputs or run other tasks.

This year, we’re concentrating on program features to improve the user experience. We have two goals: 1) increase the computation speed and efficiency and 2) reduce the setup times. Clearly, users should worry less about program details so they can concentrate on physic issues. Our next job is to add macro capabilities to the 2D and 3D postprocessors. With this feature, the programs will remember the steps in a session to create an analysis script.

For more information on our programs, please see

Comments are closed.