Initialization and Finalization
Tolosa : Initialization and Finalization
Section titled “Tolosa : Initialization and Finalization”To be able to use Tolosa-lib and any of its features and routines, one has to make sure to use the Tolosa_lib module. Moreover, two methods enable one to proceed with the initialization and finalization of a Tolosa program. Those methods need to be called at the beginning and end of a Tolosa program.
Therefore, the general structure of a Tolosa program should be :
PROGRAM example
USE Tolosa_lib
type(cli) :: input type(msh) :: mesh integer(ip) :: mpi_ghost_level
call Init_Tolosa( input=input , mesh=mesh , mpi_ghost_level = mpi_ghost_level )
[...]
call Final_Tolosa( mesh=mesh , timing_file=T )
END PROGRAM exampleThe handled operations of these methods will be described in the following paragraphs.
Initialization
Section titled “Initialization”To use the Tolosa-lib features and set the running environment concerning inputs, computation, domain, etc., one has to initialize Tolosa by calling the Init_Tolosa routine from the library.
type(cli) :: inputtype(msh) :: meshinteger(ip) :: mpi_ghost_level
call Init_Tolosa( input , mesh , mpi_ghost_level )The input, mesh and mpi_ghost_level variables are optional.
This routine enables one to :
- initialize the MPI environment : the pool of processes, the derived data types, etc. (See MPI)
- get the output files stream records length to be able to extract various data
- get the numbers regarding the machine precision limits
- if the
inputvariable is passed to the routine : get the arguments passed to the command line or specified in theinput.txtfile (See Inputs) - initialize timers to document the computation time repartition spent on various operations (See Timers)
- if the
meshvariable is passed to the routine : read or create the mesh and initialize spatial schemes considering the mesh (See Mesh)
Finalization
Section titled “Finalization”When the computation is over, one can finalize Tolosa by calling the Final_Tolosa routine.
type(msh) :: meshlogical :: withouttiminglogical :: timing_filelogical :: perf_nopartinteger(ip) :: perf_dxinteger(ip) :: perf_dt
call Final_Tolosa( mesh , withouttiming , timing_file , perf_dx , perf_dt , perf_nopart )All variables are optional.
This routine enables one to :
- Stop timers
- Compute the performance (in
microsec / dx / dt / proc) and write it : If the timing option is activated throughwithouttiming, a timing report is displayed, and the time performance is computed. Moreover, iftiming_fileis given, outputs and performance are written in thistiming_file. - Deallocate the mesh and other arrays