The following diagram shows the operations involved in the dynamic build process where the problem description contained in the problem.xml file is loaded at runtime. The normal arrows indicate operations occurring before runtime whereas the bold arrows indicate the file dependencies at runtime when executing the simulator. Red font is used with system programs like the C++ compiler and linker. Blue font is used to indicate the SPARK programs and files used in the build process.
This is the default mode of operation accomplished when executing the SPARK makefile.
- Note:
- The dynamic solver library is called libsolver.so on UNIX/Linux platforms.
- The dynamic libraries containing the compiled atomic classes have the extension *.so on the UNIX/Linux platforms.
- The executable simulator is called sparksolver on the UNIX/Linux platforms.
Along with the problem.xml file, the SPARK solver needs to be able to access at runtime the dynamic libraries class0.dll, class1.dll, ... where the various callbacks in each atomic class are compiled.
The paths to the dynamic libraries are specified in the problem.stp file generated by the parser program. They are relative paths with respect to the current working directory where the parser program is invoked.
At runtime, the dynamic libraries are located by the problem loader in solver by using the respective relative paths prefixed by either one of the following paths:
- the parser's working directory, or
- any directory that is listed in the environment variable
SPARK_LIBPATH
, or
- any directory that is listed in the environment variable
SPARK_CLASSPATH
.
The environment variable SPARK_LIBPATH
contains a series of paths delimited with commas. E.g., SPARK_LIBPATH="c:\users\spark_projects\spring,c:\users\spark_projects\room_fc"
If an entry in SPARK_LIBPATH
indicates a relative path, then it is expanded to an absolute path by prefixing it with the current working directory of the simulator.
The environment variable SPARK_CLASSPATH
contains a series of paths delimited with commas. E.g., SPARK_CLASSPATH="c:\users\spark_projects\spring,c:\users\spark_projects\room_fc"
If an entry in SPARK_CLASSPATH
indicates a relative path, then it is expanded to an absolute path by prefixing it with the current directory where the parser program was called.
A dynamically-built problem is solved using the executable driver sparksolver.exe. The program sparksolver.exe is obtained by compiling the default driver function. It is relying on the dynamic solver library libsolver.dll which must be located in the system path. The SPARK distribution installs the dynamic solver library in the bin/ subdirectory and adds the path this directory to the system path.
At runtime the following files are needed to make a simulation run:
- the problem description file, problem.xml
- the dynamic libraries containing the compiled atomic classes
- the preference file, problem.prf
- the run control file, problem.run.
The behavior of the default SPARK driver function assumes that only one problem is solved at each call of the simulator executable. The names of the needed files are passed to the simulator at the command-line in any order. Each file type is identified by parsing its extension. Remember that the names of the dynamic libraries containing the compiled atomic classes are obtained from the problem.xml file and located at runtime using the previously-described loading scheme (See Locate the dynamic libraries with the compiled atomic classes).
To simulate a dynamically-built problem with the default driver function, type at the command line:
sparksolver problem.run problem.prf problem.xml <enter>
- Note:
- It is also possible to build static SPARK problems that are essentially pre-compiled and do not need to be loaded at runtime (See Build a SPARK problem statically).