4.1 Entry and exit from QDP
QDP must first be initialized before any QDP functions are to be used
except for QDP_is_initialized()
which may be called anytime.
Initializing QDP also initializes QMP if it has not already been done.
Thus the user can safely start QMP before QDP and do any necessary
broadcasts or other operations.
Before any QDP field operations are done one must also create the
lattice layout.
Entry to QDP
Syntax | void QDP_initialize(int *argc, char ***argv);
| Meaning | Starts QDP.
| Example | QDP_initialize(&argc, &argv);
|
|
The routine QDP_initialize
is called once by all nodes and
starts QDP operations.
It initialiazes message passing (if not already done),
but does not setup the site layout
(see QDP_create_layout
and related functions).
It also defines the global variable
int QDP_this_node;
specifying the logical node number of the current node.
Exit from QDP
Syntax | void QDP_finalize(void);
| Meaning | Exits QDP.
| Example | QDP_finalize();
|
|
This call provides for an orderly shutdown. It is called by all
nodes. It also finalizes QMP only if it was initialized by QDP.
If profiling was turned on in any functions then node 0 will dump some
statistics to stdout
.
Then it returns control to the calling process.
Panic exit from QDP
Syntax | void QDP_abort(int status);
| Meaning | Panic shutdown of the process.
| Example | QDP_abort(1);
|
|
This routine may be called by one or more nodes. It sends kill
signals to all nodes and exits with exit status status
.
Check for initialization
Syntax | int QDP_is_initialized(void);
| Meaning | Checks if QDP is initialized.
| Example | if(!QDP_is_initialized()) QDP_initialize(&argc, &argv);
|
|
Control profiling
Syntax | int QDP_profcontrol(int new);
| Meaning | Controls profiling.
| Example | old = QDP_profcontrol(new);
|
|
Profiling results are only available for code that is compiled with
the macro QDP_PROFILE
defined. This must be defined before
the qdp.h header is included. When QDP_finalize
is called
a list of QDP function and call times will be sent to stdout on
node 0. This function toggles the accumulation of the profiling
statistics within the profiled sections of code.
A value of zero turns the collection of timing info off and
nonzero values turn it on. It is on by default.
Control checking communications
Syntax | int QDP_check_comm(int new);
| Meaning | Controls checking communications.
| Example | old = QDP_check_comm(new);
|
|
A nonzero value turns the internal communications checksums on and
zero turns it off. It is off by default.