mkl_dss.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /*******************************************************************************
  2. * Copyright 2004-2022 Intel Corporation.
  3. *
  4. * This software and the related documents are Intel copyrighted materials, and
  5. * your use of them is governed by the express license under which they were
  6. * provided to you (License). Unless the License provides otherwise, you may not
  7. * use, modify, copy, publish, distribute, disclose or transmit this software or
  8. * the related documents without Intel's prior written permission.
  9. *
  10. * This software and the related documents are provided as is, with no express
  11. * or implied warranties, other than those that are expressly stated in the
  12. * License.
  13. *******************************************************************************/
  14. /*
  15. * Content : oneMKL DSS C header file
  16. *
  17. * Contains main datatypes, prototypes and constants definition
  18. *
  19. ********************************************************************************
  20. */
  21. #if !defined( __MKL_DSS_H )
  22. #define __MKL_DSS_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif /* __cplusplus */
  26. #if !defined(MKL_CALL_CONV)
  27. # if defined(__MIC__) || defined(__TARGET_ARCH_MIC)
  28. # define MKL_CALL_CONV
  29. # else
  30. # define MKL_CALL_CONV __cdecl
  31. # endif
  32. #endif
  33. #if !defined(_mkl_api)
  34. #define _mkl_api(rtype,name,arg) extern rtype MKL_CALL_CONV name arg
  35. #endif
  36. #include "mkl_types.h"
  37. /*
  38. ** Basic data types
  39. */
  40. typedef void * _MKL_DSS_HANDLE_t;
  41. typedef char _CHARACTER_t;
  42. typedef char _CHARACTER_STR_t;
  43. /*
  44. ** _INTEGER_t will be deprecated
  45. */
  46. #define _INTEGER_t MKL_INT
  47. #if !defined( _WIN64 )
  48. typedef long _LONG_t;
  49. #else
  50. typedef long long _LONG_t;
  51. #endif
  52. typedef float _REAL_t;
  53. typedef double _DOUBLE_PRECISION_t;
  54. #define _DoubleComplexType struct { double r, i; }
  55. typedef _DoubleComplexType _DOUBLE_COMPLEX_t;
  56. /*
  57. ** MKL_DSS_DEFAULTS
  58. */
  59. #define MKL_DSS_DEFAULTS 0
  60. /*
  61. ** Out-of-core level option definitions
  62. */
  63. #define MKL_DSS_OOC_VARIABLE 1024
  64. #define MKL_DSS_OOC_STRONG 2048
  65. /*
  66. ** Refinement steps on / off
  67. */
  68. #define MKL_DSS_REFINEMENT_OFF 4096
  69. #define MKL_DSS_REFINEMENT_ON 8192
  70. /*
  71. ** Solver step's substitution
  72. */
  73. #define MKL_DSS_FORWARD_SOLVE 16384
  74. #define MKL_DSS_DIAGONAL_SOLVE 32768
  75. #define MKL_DSS_BACKWARD_SOLVE 49152
  76. #define MKL_DSS_TRANSPOSE_SOLVE 262144
  77. #define MKL_DSS_CONJUGATE_SOLVE 524288
  78. /*
  79. ** Single precision
  80. */
  81. #define MKL_DSS_SINGLE_PRECISION 65536
  82. /*
  83. ** Zero-based indexing
  84. */
  85. #define MKL_DSS_ZERO_BASED_INDEXING 131072
  86. /*
  87. ** Message level option definitions
  88. */
  89. #define MKL_DSS_MSG_LVL_SUCCESS -2147483647
  90. #define MKL_DSS_MSG_LVL_DEBUG -2147483646
  91. #define MKL_DSS_MSG_LVL_INFO -2147483645
  92. #define MKL_DSS_MSG_LVL_WARNING -2147483644
  93. #define MKL_DSS_MSG_LVL_ERROR -2147483643
  94. #define MKL_DSS_MSG_LVL_FATAL -2147483642
  95. /*
  96. ** Termination level option definitions
  97. */
  98. #define MKL_DSS_TERM_LVL_SUCCESS 1073741832
  99. #define MKL_DSS_TERM_LVL_DEBUG 1073741840
  100. #define MKL_DSS_TERM_LVL_INFO 1073741848
  101. #define MKL_DSS_TERM_LVL_WARNING 1073741856
  102. #define MKL_DSS_TERM_LVL_ERROR 1073741864
  103. #define MKL_DSS_TERM_LVL_FATAL 1073741872
  104. /*
  105. ** Structure option definitions
  106. */
  107. #define MKL_DSS_SYMMETRIC 536870976
  108. #define MKL_DSS_SYMMETRIC_STRUCTURE 536871040
  109. #define MKL_DSS_NON_SYMMETRIC 536871104
  110. #define MKL_DSS_SYMMETRIC_COMPLEX 536871168
  111. #define MKL_DSS_SYMMETRIC_STRUCTURE_COMPLEX 536871232
  112. #define MKL_DSS_NON_SYMMETRIC_COMPLEX 536871296
  113. /*
  114. ** Reordering option definitions
  115. */
  116. #define MKL_DSS_AUTO_ORDER 268435520
  117. #define MKL_DSS_MY_ORDER 268435584
  118. #define MKL_DSS_OPTION1_ORDER 268435648
  119. #define MKL_DSS_GET_ORDER 268435712
  120. #define MKL_DSS_METIS_ORDER 268435776
  121. #define MKL_DSS_METIS_OPENMP_ORDER 268435840
  122. /*
  123. ** Factorization option definitions
  124. */
  125. #define MKL_DSS_POSITIVE_DEFINITE 134217792
  126. #define MKL_DSS_INDEFINITE 134217856
  127. #define MKL_DSS_HERMITIAN_POSITIVE_DEFINITE 134217920
  128. #define MKL_DSS_HERMITIAN_INDEFINITE 134217984
  129. /*
  130. ** Return status values
  131. */
  132. #define MKL_DSS_SUCCESS 0
  133. #define MKL_DSS_ZERO_PIVOT -1
  134. #define MKL_DSS_OUT_OF_MEMORY -2
  135. #define MKL_DSS_FAILURE -3
  136. #define MKL_DSS_ROW_ERR -4
  137. #define MKL_DSS_COL_ERR -5
  138. #define MKL_DSS_TOO_FEW_VALUES -6
  139. #define MKL_DSS_TOO_MANY_VALUES -7
  140. #define MKL_DSS_NOT_SQUARE -8
  141. #define MKL_DSS_STATE_ERR -9
  142. #define MKL_DSS_INVALID_OPTION -10
  143. #define MKL_DSS_OPTION_CONFLICT -11
  144. #define MKL_DSS_MSG_LVL_ERR -12
  145. #define MKL_DSS_TERM_LVL_ERR -13
  146. #define MKL_DSS_STRUCTURE_ERR -14
  147. #define MKL_DSS_REORDER_ERR -15
  148. #define MKL_DSS_VALUES_ERR -16
  149. #define MKL_DSS_STATISTICS_INVALID_MATRIX -17
  150. #define MKL_DSS_STATISTICS_INVALID_STATE -18
  151. #define MKL_DSS_STATISTICS_INVALID_STRING -19
  152. #define MKL_DSS_REORDER1_ERR -20
  153. #define MKL_DSS_PREORDER_ERR -21
  154. #define MKL_DSS_DIAG_ERR -22
  155. #define MKL_DSS_I32BIT_ERR -23
  156. #define MKL_DSS_OOC_MEM_ERR -24
  157. #define MKL_DSS_OOC_OC_ERR -25
  158. #define MKL_DSS_OOC_RW_ERR -26
  159. /*
  160. ** Function prototypes for DSS routines
  161. */
  162. _mkl_api(MKL_INT,dss_create_,(_MKL_DSS_HANDLE_t *,
  163. MKL_INT const *));
  164. _mkl_api(MKL_INT,dss_define_structure_,(_MKL_DSS_HANDLE_t *,
  165. MKL_INT const *, MKL_INT const *, MKL_INT const *,
  166. MKL_INT const *, MKL_INT const *, MKL_INT const *));
  167. _mkl_api( MKL_INT,dss_reorder_,(_MKL_DSS_HANDLE_t *, MKL_INT const *,
  168. MKL_INT const *));
  169. _mkl_api(MKL_INT,dss_factor_real_,(_MKL_DSS_HANDLE_t *,
  170. MKL_INT const *, void const *));
  171. _mkl_api(MKL_INT,dss_factor_complex_,(_MKL_DSS_HANDLE_t *,
  172. MKL_INT const *, void const *));
  173. _mkl_api(MKL_INT,dss_solve_real_,(_MKL_DSS_HANDLE_t *,
  174. MKL_INT const *, void const *, MKL_INT const *,
  175. void *));
  176. _mkl_api(MKL_INT,dss_solve_complex_,(_MKL_DSS_HANDLE_t *,
  177. MKL_INT const *, void const *, MKL_INT const *,
  178. void *));
  179. _mkl_api( MKL_INT,dss_statistics_,( _MKL_DSS_HANDLE_t *, MKL_INT const *,
  180. _CHARACTER_STR_t const *, _DOUBLE_PRECISION_t *));
  181. _mkl_api(MKL_INT,dss_delete_,(_MKL_DSS_HANDLE_t const *,
  182. MKL_INT const *));
  183. /*
  184. ** In order to promote portability and to avoid having most users deal with these issues, the C header
  185. ** file mkl_dss.h provides a set of macros and type definitions that are intended to hide the
  186. ** inter-language calling conventions and provide an interface to the DSS that appears natural for
  187. ** C/C++.
  188. */
  189. #define dss_create(handle, opt) dss_create_(&(handle), &(opt))
  190. #define dss_define_structure(handle, opt, rowIndex, nRows, rCols,\
  191. columns, nNonZeros) dss_define_structure_(&(handle), &(opt),\
  192. (rowIndex), &(nRows), &(rCols), (columns), &(nNonZeros))
  193. #define dss_reorder(handle, opt, perm) dss_reorder_(&(handle), &(opt),\
  194. (perm))
  195. #define dss_factor_real(handle, opt,\
  196. rValues) dss_factor_real_(&(handle), &(opt), (rValues))
  197. #define dss_factor_complex(handle, opt,\
  198. rValues) dss_factor_complex_(&(handle), &(opt), (rValues))
  199. #define dss_solve_real(handle, opt, rRhsValues, nRhs,\
  200. rSolValues) dss_solve_real_(&(handle), &(opt), (rRhsValues), &(nRhs),\
  201. (rSolValues))
  202. #define dss_solve_complex(handle, opt, rRhsValues, nRhs,\
  203. rSolValues) dss_solve_complex_(&(handle), &(opt), (rRhsValues),\
  204. &(nRhs), (rSolValues))
  205. #define dss_statistics(handle, opt, stat, ret) \
  206. dss_statistics_(&(handle), &(opt), (stat), (ret))
  207. #define dss_delete(handle, opt) dss_delete_(&(handle), &(opt))
  208. #define DSS_CREATE(handle, opt) dss_create_(&(handle), &(opt))
  209. #define DSS_DEFINE_STRUCTURE(handle, opt, rowIndex, nRows, rCols,\
  210. columns, nNonZeros) dss_define_structure_(&(handle), &(opt),\
  211. (rowIndex), &(nRows), &(rCols), (columns), &(nNonZeros))
  212. #define DSS_REORDER(handle, opt, perm) dss_reorder_(&(handle), &(opt),\
  213. (perm))
  214. #define DSS_FACTOR_REAL(handle, opt,\
  215. rValues) dss_factor_real_(&(handle), &(opt), (rValues))
  216. #define DSS_FACTOR_COMPLEX(handle, opt,\
  217. rValues) dss_factor_complex_(&(handle), &(opt), (rValues))
  218. #define DSS_SOLVE_REAL(handle, opt, rRhsValues, nRhs,\
  219. rSolValues) dss_solve_real_(&(handle), &(opt), (rRhsValues), &(nRhs),\
  220. (rSolValues))
  221. #define DSS_SOLVE_COMPLEX(handle, opt, rRhsValues, nRhs,\
  222. rSolValues) dss_solve_complex_(&(handle), &(opt), (rRhsValues),\
  223. &(nRhs), (rSolValues))
  224. #define DSS_STATISTICS(handle, opt, stat, ret) \
  225. dss_statistics_(&(handle), &(opt), (stat), (ret))
  226. #define DSS_DELETE(handle, opt) dss_delete_(&(handle), &(opt))
  227. #ifdef __cplusplus
  228. }
  229. #endif /* __cplusplus */
  230. #endif