Next: , Previous: I/O utilities, Up: QDP Functions


4.8 Temporary entry and exit from QDP

For a variety of reasons it may be necessary to remove data from QDP structures. Conversely, it may be necessary to reinsert data into QDP structures. For example, a highly optimized linear solver may operate outside QDP. The operands would need to be extracted from QDP fields and the eventual solution reinserted. It may also be useful to suspend QDP communications temporarily to gain separate access to the communications layer. For this purpose function calls are provided to put the QDP implementation and/or QDP objects into a known state, extract values, and reinsert them.

Exposing QDP data

Syntax QLA_Type * QDP_expose_T(Type *src);


Meaning Deliver data values from field src.


Type I, R, C, V, H, D, M, P


Example r = QDP_expose_M(a);

This function grants direct access to the data values contained in the QDP field src. The return value is a pointer to an array of QLA data dest of type T. The order of the data is given by QDP_index. No QDP operations are permitted on exposed data until QDP_reset is called. (See next.)

Returning control of QDP data

Syntax void QDP_reset_T(Type *field);


Meaning Returns control of data values to QDP.


Type I, R, C, V, H, D, M, P


Example QDP_reset_M(r);

This call signals to QDP that the user is ready to resume QDP operations with the data in the specified field.

Extracting QDP data

Syntax void QDP_extract_T(QLA_Type *dest, Type *src);


Meaning Copy data values from field src to array dest.


Type I, R, C, V, H, D, M, P


Example QDP_extract_M(r, a, QDP_even);

The user must allocate space of size QDP_sites_on_node*sizeof(QLA_Type) for the destination array before calling this function, regardless of the size of the subset. This function copies the data values contained in the QDP field src to the destination field. Only values belonging to the specified subset are copied. Any values in the destination array not associated with the subset are left unmodified. The order of the data is given by QDP_index. Since a copy is made, QDP operations involving the source field may proceed without disruption.

Inserting QDP data

Syntax void QDP_insert_T(Type *dest, QLA_Type *src);


Meaning Inserts data values from QLA array src.


Type I, R, C, V, H, D, M, P


Example QDP_insert_M(a, r);

Only data associated with the specified subset are inserted. Other values are unmodified. The data order must conform to QDP_index. This call, analogous to a fill operation, is permitted at any time and does not interfere with QDP operations.

Extracting QDP data to a packed array

Syntax void QDP_extract_packed_T(QLA_Type *dest, Type *src);


Meaning Copy data values from field src to array dest.


Type I, R, C, V, H, D, M, P


Example QDP_extract_M(r, a, QDP_even);

The user must allocate space of size QDP_subset_len(subset)*sizeof(QLA_Type) for the destination array before calling this function. This function copies the data values contained in the QDP field src to the destination field. Only values belonging to the specified subset are copied and they are stored contiguously in the destination array. The order of the data is given by QDP_index. Since a copy is made, QDP operations involving the source field may proceed without disruption.

Inserting QDP data from a packed array

Syntax void QDP_insert_packed_T(Type *dest, QLA_Type *src);


Meaning Inserts data values from QLA array src.


Type I, R, C, V, H, D, M, P


Example QDP_insert_M(a, r);

Only data associated with the specified subset are inserted. Other values are unmodified. The data order must conform to QDP_index. This call, analogous to a fill operation, is permitted at any time and does not interfere with QDP operations.

Suspending QDP communications

If a user wishes to suspend QDP communications temporarily and carry on communications by other means, it is first necessary to call QDP_suspend_comm.

Syntax void QDP_suspend_comm(void);


Meaning Suspends QDP communications.


Example QDP_suspend_comm();

No QDP shifts can then be initiated until QDP_resume is called. However QDP linear algebra operations without shifts may proceed.

Resuming QDP communications

To resume QDP communications one uses

Syntax void QDP_resume_comm(void);


Meaning Restores QDP communications.


Example QDP_resume_comm();