User's Guide to COGITO
COGITO Documentation 97-1

User's Guide to COGITO

Overview

Cogito is a set of software tools for composite-grid methods. The aim is to simplify the construction of parallel PDE solvers. The tools are primarily intended for time-dependent PDE problems to be solved on composite, structured grids, using finite difference methods. Presently, explicit time-marching methods are supported, but the tools are being extended to handle implicit time-marching methods, methods for time harmonic and stationary problems, and adaptive methods.

The Cogito tools are object-oriented. The implementation is in Fortran 90, using MPI for the message passing. Code based on the Cogito routines is portable over a wide range of computers, serial and parallel. The tools raise the level of abstraction in the code considerably. Moreover, they make it fairly straightforward to write a composite-grid code which can be executed e.g. on a multicomputer.

Cogito can execute on all platforms that support MPI. Code based on Cogito has been executed (without modification) on a cluster of DEC Alpha Server 8200, on IBM SP/2 and on Cray T3D & T3E.

Cogito handles structured grids, individual grids as well as composite ones. It also handles grid functions on such grids. Moreover, there are operations that make it possible to express finite difference methods. The parallelism is of SPMD type, i.e., all processors execute the same code, but asynchronoulsy and on different subsets/partitions of the data. Cogito contains tools for automatic partitioning and distribution of composite (and individual) structured grids. Each grid function automatically gets the same distribution as the corresponding grid.

Cogito has an object-oriented design. This has several advantages. In the present context, information-hiding--leading to portable and easily maintainable code--should be mentioned. Moreover, this kind of design tends to yield a good modularization, and fairly small software parts (operations on classes) that can be combined in a flexible way. Finally, object-oriented software focusses on concepts in the application domain. This increases the readability of the code.

The Cogito classes

As Cogito is intended primarily for composite grid applications, the central classes are:

A Grid object represents a single, structured grid. A Composite grid is a union of a number of such grids. Finally, when a Grid Function object is created, the corresponding grid (single or composite) will be given as a parameter. The grid function will automatically have the same structure as the related grid.

In order to distribute a grid, a Distribution object is attached to it. All its grid functions will then be distributed in the same way as the grid itself.

Each class has a number of operations defining its public interface. For example, difference operators can be applied to objects of the class Grid Function. Other operations on this class are Number of variables, Copy, Add, Scale, Saxpy, etc.

All classes have operations Create and Delete, for the creation and deletion of an object, respectively.

How to use Cogito

Cogito is distributed with all necessary software enclosed, except the underlying message passing routines (on which the implementation of class Message is based). Thus, in order to use Cogito there is only need for linking the Cogito library and the relevant message passing library (e.g. PVM, if the PVM-based version of Cogito is to be used).

Initializations

A program which is to use some Cogito tools must contain the following declarations:
	include `cogito.h'

	integer SIZE
	parameter(SIZE=10000)
	integer memory(SIZE)

The first executable statement in a program using Cogito should be a call to the routine SetupCogito:

	call SetupCogito(memory,SIZE,fileName)

There are three parameters: an array representing the dynamic memory, an integer, which is the size of this memory, and the name of the executable file. The size of the memory vector must be chosen so that all data in the objects created with Cogito can reside within the memory vector. Some extra space must also be allocated so that the descriptions of the objects can be stored. Remember that, for example, a double precision number occupies the same space as two integers.

Before a program using Cogito ends, the routine ExitCogito should be called:

	call ExitCogito(memory)

At present, three platforms are supported: Intel's NX message passing library (Intel iPSC/2, iPSC/860, Paragon), IBM's MPL message passing library (IBM SP1, SP2), and PVM. The parameter fileName is at present only used by the PVM version.

In the PVM version, SetupCogito starts the virtual machine, by spawning the required number of processes. The program to spawn is located in the file given by the parameter fileName.

The user only needs to create a file PVMmachines containing the number of hosts, the number of tasks, and a listing of the computers that are to be included in the virtual machine. The first computer must be the one where the program starts. This file can also work as a PVM hostfile (see the PVM documentation for further information). We illustrate this by an example.

Example. Assume that the PVM-based Cogito library is to be executed on a cluster of work stations. The work stations in question are referred to by the following names: electra, dabih, toliman, heze, gredi, rana. The program should be started on the work station electra. The file PVMmachines could then have the following contents:


	#hosts=6
	#tasks=6
	electra
	dabih
	toliman
	heze
	gredi
	rana

(See the PVM documentation for further information on alternative ways of specifying which computers to include in the virtual machine.) The first executable statement in the user's program is:

	call SetupCogito(memory,SIZE,fileName)
This initializes both Cogito and PVM.

To exit Cogito and PVM:

	call ExitCogito(memory)
N.B.: Because SetupCogito simplifies the initialization of PVM, calling this routine could be useful also to persons who intend to use PVM directly.

Appendix A

In this appendix, the Fortran 77 specification of the routines SetupCogito and ExitCogito is given.

SetupCogito

Description

This routine initializes Cogito and must be called before Cogito can be used. When using the PVM-based version of Cogito this routine also makes the necessary initialization to set up the virtual machine.

Syntax

    subroutine SetupCogito(memory,size,fileName)
    integer memory(*)
    integer size
    character*(*) fileName

Parameters

    memory	IN/OUT	The memory vector.
    size	IN	The declared size of the memory vector.
    fileName	IN	The name of the executable file to spawn when 
                        using PVM.

ExitCogito

Description

This routine exits Cogito and must be called before the program ends to ensure a safe termination. When using the PVM-based version of Cogito this routine exits PVM.

Syntax

    subroutine ExitCogito(memory)
    integer memory(*)

Parameters

    memory	IN/OUT	The memory vector.

Last modified: August 21, 1997 by Peter Olsson