prism_init (appl_name, ierror)
The initialisation of the OASIS4 coupling environment is performed with a call to prism_init. This routine belongs to the class of so-called collective calls and therefore has to be called once initially by each process of each application.
Since all communication is built on MPI routines, the initialisation of the MPI library is checked below prism_init, and a call to MPI_Init is performed if it has not been called already by the application. It is therefore not allowed to place a call to MPI_Init after the prism_init call in the application code, since this will lead to a runtime error with most MPI implementations. Conversely, a call to prism_terminate (see 5.8.1) will terminate the coupling. If MPI_Init has been called before prism_init, internal message passing within the application is still possible after the call to prism_terminate; in this case, MPI_Finalize must be called somewhere after prism_terminate in order to shut down the parallel application in a well defined way.
Within prism_init, it is detected if the coupled model has been started in the spawn or not_spawn mode (see 4.1 and 6.4). In spawn mode, all spawned processes remain in prism_init and participate in the launching of further processes until the spawning of all applications is completed.
Below prism_init call, the SCC XML information (see 6.4) is transfered from the Driver to the application process PSMILe (see 4.1).