rtsDDe (1158446), страница 2
Текст из файла (страница 2)
void dvm_FreeStruct (void *StructPtr);
The macrodefinition returns to the free memory the memory block, specified by StructPtr pointer, and assigns NULL to StructPtr pointer. The macrodefinition can be invoked with NULL value of StructPtr pointer.
3Requesting program execution time in the form, independent from hardware and software environment
double dvm_time (void);
The function returns program execution time in seconds. Note that a sense of execution time notion can be different for different environments.
4Requesting internal numbers of functionally provided processors
A user program startup on the processor system requires specifying (as startup parameters) the following characteristics of the processor system as multidimensional array: the processor system rank and sizes of all its dimensions. Let the rank of the processor system be n, and size of k-th dimension be PSSizek (1 k n). Then when Run-Time System is initialized an internal number ProcNumberint will be assigned to the each processor:
| | n | n |
where:
| Ik | | processor index value of k-th dimension of the processor system index space (0 Ik PSSizek 1). |
So the internal number is the linear index of the processor in index space of the processor system.
Each processor has also external number ProcNumberext (a processor number in hardware-software environment, where Run-Time System operates). When Run-Time System is initialized, it requests the external number using environment-dependent tools.
In interprocessor exchanges a processor identifier ProcIdent is used as the processor address. The correspondence
ProcNumberint ProcIdent
is defined by Message Passing System and returned to Run-Time System when it is initialized.
There are three functionally special processors: main processor, input/output processor and central processor among processors, assigned to a task.
The main processor is the first processor, where the parallel program was initialized (a subtask, executed on the processor, is considered as initiator of all other subtasks). The main processor has zero internal number.
Input/output processor is intended to deal with the file system directly and its internal number is zero.
The central processor computes the reduction functions and is defined by an index vector ([PSSize1/2], ... ,[PSSizen/2]).
int rtl_GetCurrentProc(void);
The function returns internal number of the current processor.
int rtl_GetMasterProc(void);
The function returns internal number of the main processor.
int rtl_GetIOProc(void);
The function returns internal number of the input/output processor.
int rtl_GetCentralProc(void);
The function returns internal number of the central processor.
5Message passing tools, independent from base system of message passing
A set of presented below functions serves as interface between Run-Time System itself and used message passing system (MPI, PVM and so on). This set is not belongs to the tools, provided by Run-Time System for user program. Nevertheless, minimal environment-independent set of message passing functions may be useful for test and environment-experimental programs, accompanied with Run-Time System.
The internal processor number is used as processor address in the functions, considered below. This number is substituted for processor identifier (see section 4) when the functions of message passing system are called. It is assumed that the logic of main message passing schemes (synchronous, asynchronous and “NO WAIT scheme) is known.
Memory area for sent or received message should be allocate dynamically by the functions, considered in section 2.
5.1Synchronous message exchange
5.1.1Synchronous sending
| int rtl_Send ( | void | *MesPtr, |
| MesPtr | | pointer to the message to be sent. |
| Count | | a number of elements in the message. |
| Size | | sent message element size in bytes. |
| ProcNum | | internal number of the processor, the message is sent to. |
The function returns non-negative value in the case of success and negative value otherwise.
5.1.2Synchronous receiving
| int rtl_Recv ( | void | *MesPtr, |
| MesPtr | | pointer to memory area to write received message. |
| Count | | a number of elements in received message. |
| Size | | received message element size in bytes. |
| ProcNum | | internal number of the processor, whose message should be received. |
The function returns non-negative value in the case of success and negative value otherwise.
5.2Asynchronous message exchange
5.2.1Asynchronous sending
| int rtl_SendA ( | void | *MesPtr, |
| MesPtr | | pointer to the message to be sent. |
| Count | | a number of elements in the message. |
| Size | | sent message element size in bytes. |
| ProcNum | | internal number of the processor, the message is sent to. |
| Tag | | class number of sent message (message classification is in a competence of message passing system user). |
The function returns non-negative value in the case of success and negative value otherwise.
5.2.2Asynchronous receiving
| int rtl_RecvA ( | void | *MesPtr, |
| MesPtr | | pointer to memory area to write received message. |
| Count | | number of elements in received message. |
| Size | | received message element size in bytes. |
| ProcNum | | internal number of the processor, whose message should be received. |
| Tag | | class number of received message. |
The function returns non-negative value in the case of success and negative value otherwise.
5.3Message exchange in "NO-WAIT" mode
5.3.1Sending in "NO-WAIT" mode
| int rtl_Sendnowait ( | void | *MesPtr, |
| MesPtr | | pointer to the message to be sent. |
| Count | | number of elements in sent message. |
| Size | | sent message element size in bytes. |
| ProcNum | | internal number of the processor, the message is sent to. |
| Tag | | class number of sent message (message classification is in a competence of message passing system user). |
| *ReqPtr | | structure-flag, that is set in state "request has been performed", when addressee received the message. |
The function returns non-negative value in the case of success and negative value otherwise.
5.3.2Receiving in "NO-WAIT" mode
| int rtl_Recvnowait ( | void | *MesPtr, |
| MesPtr | | pointer to memory area to write received message. |
| Count | | number of elements in received message. |
| Size | | received message element size in bytes. |
| ProcNum | | internal number of the processor, whose message should be received. |
| Tag | | class number of received message. |
| *ReqPtr | | structure-flag, which is set in state "request has been performed", when the message will be written by MesPtr address. |
The function returns non-negative value in the case of success and negative value otherwise.
5.3.3Waiting for sending or receiving completion
void rtl_Waitrequest(RTL_Request *ReqPtr);
ReqPtr structure-flag, from which state "request has been performed" is awaited.
5.3.4Requesting sending or receiving completion
int rtl_Testrequest(RTL_Request *ReqPtr);
ReqPtr structure-flag, from which state "request has been performed" is awaited.
The following values are returned:
| 0 | | message passing is not completed (*ReqPtr is not set in state "request has been performed"); |
| 1 | | message passing is completed (*ReqPtr is set in state "request has been performed"). |
5.4Passing message from specified processor to all other processors (broadcast passing)
| int rtl_BroadCast ( | void | *MesPtr, |















