name_conventions-english.tex 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. \subsection{Naming conventions}
  2. \label{subsec:nameconventions}
  3. \index{naming conventions}%
  4. The following substitutions were used to describe the conventions:
  5. \nopagebreak\par\bigskip
  6. {%
  7. \setlength{\leftskip}{0pt}\setlength{\parindent}{-\tabcolsep}%
  8. \SetLenVarWithWidth{\Acol}{\verbI{Action}}%
  9. \SetLenVarWithWidth{\Bcol}{--}%
  10. \begin{tabular}%
  11. {p{\Acol}p{\Bcol}p{\linewidth-\Acol-\Bcol-4\tabcolsep}}
  12. \verb|*|&--&any string of characters;\\
  13. \verbI{Action}&--&semantic name of an action, for example, <<Sync>> for
  14. synchronization or <<Fill>> for filling;\\
  15. \verbI{Tname}&--&\textbf{t}ype \textbf{name}, semantic name of an data type, it
  16. does not obligingly corresponds to the technical name of the structure;\\
  17. \verbI{BTA}&--&\textbf{b}ase \textbf{t}ype \textbf{a}cronym, acronym for a basic
  18. data type, so the following acronyms were used in the library already:\\
  19. &&
  20. \begin{tabular}{lllllll}
  21. &&&\verb|i8| &(\verb|signed char|), &\verb|u8| &(\verb|unsigned char|),\\
  22. &&&\verb|i16|&(\verb|signed short|), &\verb|u16|&(\verb|unsigned short|),\\
  23. &&&\verb|i32|&(\verb|signed int|), &\verb|u32|&(\verb|unsigned int|),\\
  24. &&&\verb|i64|&(\verb|signed long int|),&\verb|u64|&(\verb|unsigned long int|),\\
  25. &&&\verb|f32|&(\verb|float|), &\verb|f64|&(\verb|double|).
  26. \end{tabular}
  27. \end{tabular}
  28. }
  29. \bigskip
  30. \begin{samepage}
  31. \noindent%
  32. The following naming conventions were used in the library:\nopagebreak\par
  33. {\NmCnvDescript\verb|__*|\\* the library instances for internal use begin with two underscores. While regular use of the library, using of such instances is not assumed.\par}
  34. \end{samepage}
  35. \bigskip
  36. \begin{samepage}
  37. \centerline{\textbf{Macrodefinitions}}\nopagebreak\par
  38. {\NmCnvDescript\verb|_GHM_*|\\* \textbf{g}pgpu \textbf{h}ost \textbf{m}acro,
  39. preprocessor macrodefinition for the CPU program compiler.\par}
  40. {\NmCnvDescript\verb|_GDM_*|\\* \textbf{g}pgpu \textbf{d}evice \textbf{m}acro,
  41. preprocessor macrodefinition for the OpenCL program compiler.\par}
  42. {\NmCnvDescript\verb|_GHDM_*|\\* \textbf{g}pgpu \textbf{h}ost-\textbf{d}evice
  43. \textbf{m}acro, preprocessor macrodefinition common for the CPU program compiler
  44. and the OpenCL program compiler.\par}
  45. \end{samepage}
  46. \bigskip
  47. \begin{samepage}
  48. \centerline{\textbf{Data types}}\nopagebreak\par
  49. {\NmCnvDescript\verb|_GHT_*|\\* \textbf{g}pgpu \textbf{h}ost \textbf{t}ype, data type for CPU programs.\par}
  50. {\NmCnvDescript\verb|_GDT_*|\\* \textbf{g}pgpu \textbf{d}evice \textbf{t}ype, data type for OpenCL programs.\par}
  51. {\NmCnvDescript\verb|_GHDT_*|\\* \textbf{g}pgpu \textbf{h}ost-\textbf{d}evice
  52. \textbf{t}ype, data type common for CPU and OpenCL programs.\par}
  53. \end{samepage}
  54. \bigskip
  55. \begin{samepage}
  56. \centerline{\textbf{Enumerations}}\nopagebreak\par
  57. {\NmCnvDescript\verb|_GHE_*|\\* \textbf{g}pgpu \textbf{h}ost
  58. \textbf{e}numeration, enumeration for CPU programs.\par}
  59. {\NmCnvDescript\verb|_GDE_*|\\* \textbf{g}pgpu \textbf{d}evice
  60. \textbf{e}numeration, enumeration for OpenCL programs.\par}
  61. {\NmCnvDescript\verb|_GHDE_*|\\* \textbf{g}pgpu \textbf{h}ost-\textbf{d}evice
  62. \textbf{e}numeration, enumeration common for CPU and OpenCL programs.\par}
  63. \end{samepage}
  64. \bigskip
  65. \begin{samepage}
  66. \centerline{\textbf{Functions}}\nopagebreak\par
  67. {\NmCnvDescript\verb|_ghf_*()|\\* \textbf{g}pgpu \textbf{h}ost
  68. \textbf{f}unction, library function available for CPU programs only.\par}
  69. {\NmCnvDescript\verb|_gdf_*()|\\* \textbf{g}pgpu \textbf{d}evice
  70. \textbf{f}unction, library function available for OpenCL programs only.\par}
  71. {\NmCnvDescript\verb|_ghdf_*()|\\* \textbf{g}pgpu \textbf{h}ost-\textbf{d}evice
  72. \textbf{f}unction, library function common for CPU and OpenCL programs.\par}
  73. \end{samepage}
  74. \bigskip
  75. \begin{samepage}
  76. {\NmCnvDescript\verb|*_wdc*()|\\* \textbf{w}ith \textbf{d}ata \textbf{c}leaner,
  77. special type of function. If error occurred while the execution of such
  78. function, then callback function would be called which deallocates memory and
  79. sets to zeroes members of structure from the user data member of the workset,
  80. for details see~s.\ref{subsec:workset}.\par}
  81. \end{samepage}
  82. \bigskip
  83. \begin{samepage}
  84. {\NmCnvDescript%
  85. \verb|*_decl|\verbI{Tname}\verb|()|\nopagebreak\par
  86. \verb|*_decl|\verbI{Tname}\verb|_|\verbI{BTA}\verb|()|\\*
  87. \textbf{decl}arator, function returns a structure with members initialized to
  88. default values. The function does not allocate memory and \verbI{Tname}'s
  89. members-pointers are set to \verb|NULL|. Assignment the value returned such a
  90. function to an existing structure may lead to a memory leak, therefore
  91. \verb|*_decl*()| functions are being called for structure declaration only.\par}
  92. \end{samepage}
  93. \bigskip
  94. \begin{samepage}
  95. {\NmCnvDescript%
  96. \verb|*_genr|\verbI{Tname}\verb|()|\nopagebreak\par
  97. \verb|*_genr|\verbI{Tname}\verb|_|\verbI{BTA}\verb|()|\\*
  98. \textbf{gen}e\textbf{r}ator, the function allocates memory for all
  99. members-pointer of the \verbI{Tname} structure, the pointer to which is obtained
  100. from the arguments. Then the function assign values in accordance with its
  101. arguments. Such a function is analogue of the constructor. If an error occurred,
  102. the function would return \verb|int| value other than zero and completely
  103. deallocate memory of the \verbI{Tname} structure, including the
  104. members-structures.
  105. \verbI{Tname} is a semantic name, that does not obligingly corresponds to the
  106. technical name of the structure.\par
  107. \begin{ImpNote}
  108. If a pointer to an existing structure was passed as an argument of the
  109. \verb|*_genr*()| function, the structure would be correctly recreated with
  110. the deletion of all previous data and the deallocation of the corresponding
  111. memory, including the members-structures.
  112. \end{ImpNote}
  113. }
  114. \end{samepage}
  115. \bigskip
  116. \begin{samepage}
  117. {\NmCnvDescript%
  118. \verb|*_is|\verbI{Tname}\verb|_Valid()|\nopagebreak\par
  119. \verb|*_is|\verbI{Tname}\verb|_|\verbI{BTA}\verb|_Valid()|\\*
  120. the function performs minimal integrity check of the structure data and returns
  121. an \verb|int| value. If the structure data is integral, the \verb|*_is*_Valid()|
  122. function returns 1, otherwise 0 is returned.\par}
  123. \end{samepage}
  124. \bigskip
  125. \begin{samepage}
  126. {\NmCnvDescript%
  127. \verb|*|\verbI{ActionTname}\verb|()|\nopagebreak\par
  128. \verb|*|\verbI{ActionTname}\verb|_|\verbI{BTA}\verb|()|\\*
  129. the function performs \verbI{Action} over a \verbI{Tname} type. If an error
  130. occurred, an \verb|int| value other than zero would be returned and the memory
  131. of the structure would be completely deallocated, including the
  132. members-structures.
  133. \verbI{Tname} is a semantic name, that does not obligingly corresponds to the
  134. technical name of the structure.\par}
  135. \end{samepage}
  136. \bigskip
  137. \begin{samepage}
  138. {\NmCnvDescript%
  139. \verb|*_wipe|\verbI{Tname}\verb|()|\nopagebreak\par
  140. \verb|*_wipe|\verbI{Tname}\verb|_|\verbI{BTA}\verb|()|\\*
  141. the function completely deallocates the memory occupied by the members of the
  142. \verbI{Tname} structure, including the members-structures, then assigns default
  143. values to all of the structure members, and \verb|NULL| to the members-pointers.
  144. After applying the \verb|*_wipe*()| function, the state of the \verbI{Tname}
  145. structure is fully equivalent to the value returned by the \verb|*_decl*()|
  146. function and the memory occupied by the structure can be deallocated or the
  147. \verb|*_genr*()| function can be applied again. \verbI{Tname} is a semantic
  148. name, that does not obligingly corresponds to the technical name of the
  149. structure.\par}
  150. \end{samepage}
  151. \bigskip
  152. \begin{samepage}
  153. {\NmCnvDescript\verb|*_get|\verbI{Tname}\Verb|()|\\* the indirect data access function, if is called returns the \verbI{Tname} value obtained from the function arguments. \verbI{Tname} is a semantic name, that does not obligingly
  154. corresponds to the technical name of the structure.\par}
  155. \end{samepage}
  156. \bigskip
  157. \begin{samepage}
  158. \centerline{\textbf{Files}}\nopagebreak\par
  159. {\NmCnvDescript\Verb|*.clc|\\* file with the source code of the OpenCL program in OpenCL C language.\par}
  160. {\NmCnvDescript\Verb|*.clh|\\* header file with the source code of the OpenCL program in OpenCL C language.\par}
  161. {\NmCnvDescript\Verb|*.clo|\\* compiled OpenCL object. It only makes sense for OpenCL devices of the same architecture.\par}
  162. {\NmCnvDescript\Verb|*.clso|\\* linked OpenCL library (shared object/library). It only makes sense for OpenCL devices of the same architecture.\par}
  163. {\NmCnvDescript\Verb|*.clexe|\\* linked OpenCL executable. It only makes sense for OpenCL devices of the same architecture.\par}
  164. {\NmCnvDescript\Verb|*.clout|\\* an OpenCL file, content of which could not be identified using the library.\par}
  165. {\NmCnvDescript\verb|*.log|\\* log file.\par}
  166. \end{samepage}