00001 #ifndef IMOC_H_ 00002 #define IMOC_H_ 00003 00004 00005 #include <stdint.h> 00006 00007 #include "../moc.h" 00008 #include "imoc_core.h" 00009 00010 00011 00012 /** 00013 * \addtogroup internal_p2p_imm 00014 **/ 00015 //@{ 00016 00017 /** 00018 * @name Constants for MOC_Request.request_type 00019 */ 00020 //@{ 00021 00022 /** 00023 * MOC_Request is associated with a DMA-Communication. 00024 **/ 00025 #define MOC_REQ_TYPE_DMA 0 00026 00027 /** 00028 * MOC_Request is associated with aISsend-Communication. 00029 **/ 00030 #define MOC_REQ_TYPE_ISSEND 1 00031 00032 //@} 00033 //@} 00034 00035 /** 00036 * \addtogroup internal_p2p_main 00037 **/ 00038 //@{ 00039 00040 /** 00041 * @name Internal constants 00042 */ 00043 //@{ 00044 00045 /** 00046 * Defines a treshold, when to use memcpy and when to use DMA in a get-operation 00047 * on the PPU. 00048 **/ 00049 #define MEMCPY_GET_TRESHOLD 156 00050 00051 /** 00052 * Defines a treshold, when to use memcpy and when to use DMA in a put-operation 00053 * on the PPU. 00054 **/ 00055 #define MEMCPY_PUT_TRESHOLD 2210 00056 00057 //@} 00058 00059 /** 00060 * @name Internal shared functions 00061 */ 00062 //@{ 00063 00064 /** 00065 * Get the next valid message-envelope from "source" with specified "tag" and "comm". 00066 * 00067 * @param source \b in rank of sending node 00068 * @param tag \b in message-tag 00069 * @param comm \b in message-communicator 00070 * @param isSpecial \b in true to return special-message 00071 * @param status \b inout MOC_status-instance to add some information (e.g. source by MOC_ANY_SOURCE) 00072 * @returns pointer to the appropriate message-queue-entry. 00073 **/ 00074 moc_message_envelope_t* IMOC_get_entry(int source, int tag, MOC_Comm comm, int isSpecial, MOC_Status *status); 00075 00076 00077 /** 00078 * Get next free entry in message-queue (a local copy of the message-queue has to be used). 00079 * To ensure correct ordering message-tag and -comm and -type has to be specified. 00080 * 00081 * @param pqueue \b in pointer to local copy of remote message-queue 00082 * @param tag \b in message-tag 00083 * @param comm \b in message-communicator 00084 * @param isSpecial \b in true if message should be a special message 00085 * @param index \b out index of free entry 00086 * @return 0 when success otherwise error-code 00087 **/ 00088 int IMOC_getFreeEntry ( moc_message_envelope_t* pqueue, uint8_t tag, MOC_Comm comm, int isSpecial, int* index ); 00089 00090 /** 00091 * Get free message-ID. 00092 * 00093 * \note Message-ID is index of message-status-array 00094 * 00095 * @param mid \b out free message-ID 00096 * @retval MOC_SUCCESS No error; MPI routine completed successfully. 00097 * @retval MOC_ERR_MESSAGE_EXHAUSTED No further messages possible. 00098 **/ 00099 int IMOC_getFreeMID ( int *mid ); 00100 00101 /** 00102 * Wait till message with message-ID mid has been received. 00103 * 00104 * Waits till message-status-flag 'outstanding' is 0. 00105 * 00106 * @param mid \b in message-ID 00107 * @return 0 when success otherwise error-code 00108 **/ 00109 int IMOC_waitForMessageCompletion ( uint8_t mid ); 00110 00111 /** 00112 * Tests if message with message-ID mid has been received. 00113 * 00114 * Tests if message-status-flag 'outstanding' is 0. 00115 * 00116 * @param mid \b in message-ID 00117 * @param status \b out status of message 00118 * @retval MOC_SUCCESS No error; MPI routine completed successfully. 00119 **/ 00120 int IMOC_testForMessageCompletion ( uint8_t mid, uint8_t *status ); 00121 00122 //@} 00123 //@} 00124 00125 00126 00127 00128 /** 00129 * \addtogroup internal_error 00130 * 00131 * This section deals with error-messages. 00132 * 00133 * An array of type \ref error_strings_struct stores error-messages and 00134 * their corresponding error-codes. \ref MOC_Error_string searches this 00135 * list for a given error-code and returns the error-message. 00136 **/ 00137 //@{ 00138 00139 00140 /** 00141 * Error-Strings structure. 00142 * 00143 * stores the error-string to a given error-code 00144 **/ 00145 typedef struct error_strings_struct 00146 { 00147 int error_code; /**< error-code */ 00148 char * text; /**< error-text */ 00149 } error_strings_t; /**< typedef for \ref error_strings_struct */ 00150 00151 00152 //@} 00153 00154 00155 00156 /** 00157 * \addtogroup internal_p2p_bmalloc 00158 * 00159 * Information about already allocated buffer-space is stored in the 00160 * status-array. But this information has no order which forces us 00161 * everytime we want to allocate buffer-space to create an ordered list 00162 * of already allocated buffer-space. To avoid this we have additionally 00163 * an ordered linked-list. This list orders the indexes (== message-IDs) 00164 * of the status-array-entries in ascending order of the memory-addresses. 00165 * This enables fast searching for free buffer-space. 00166 * 00167 * Allocated buffer-space is cleared by the receiving process by setting 00168 * the appropriate flag in the status-array-entry. This is done by a 00169 * DMA-Transfer and so no collaboration of the sending-process is needed. 00170 * During the next allocation of buffer-space nodes with disabled buffer-flags 00171 * are freed. 00172 **/ 00173 //@{ 00174 00175 00176 00177 /** 00178 * Node of linked list holding information about allocated buffer-space. 00179 **/ 00180 typedef struct moc_internal_buffer_node_struct 00181 { 00182 struct moc_internal_buffer_node_struct *next_node; /**< Pointer to 00183 next entry **/ 00184 uint8_t mid; /**< Message-ID of message using buffer-space. 00185 Information about the used buffer-space is stored in the 00186 appropriate message-status-entry (mid is index of entry). **/ 00187 } moc_internal_buffer_node_t; 00188 00189 00190 00191 /** 00192 * Allocate buffer-space. 00193 * 00194 * @param size \b in size of buffer-space 00195 * @param mid \b in corresponding message-ID 00196 * @return effective address of allocated buffer-space (16-byte aligned) 00197 **/ 00198 uint64_t IMOC_bmalloc ( uint32_t size, uint8_t mid ); 00199 00200 //@} 00201 #endif /*IMOC_H_*/
1.5.6