mkl_service.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /*******************************************************************************
  2. * Copyright 1999-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:
  16. ! Intel(R) oneAPI Math Kernel Library (oneMKL) interface for service routines
  17. !******************************************************************************/
  18. #ifndef _MKL_SERVICE_H_
  19. #define _MKL_SERVICE_H_
  20. #include <stdlib.h>
  21. #include "mkl_types.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif /* __cplusplus */
  25. void MKL_Get_Version(MKLVersion *ver); /* Returns information about the version of the oneMKL software */
  26. #define mkl_get_version MKL_Get_Version
  27. void MKL_Get_Version_String(char *buffer, int len); /* Returns a string that contains oneMKL library version information */
  28. #define mkl_get_version_string MKL_Get_Version_String
  29. void MKL_Free_Buffers(void); /* Frees the memory allocated by the oneMKL Memory Allocator */
  30. #define mkl_free_buffers MKL_Free_Buffers
  31. void MKL_Thread_Free_Buffers(void); /* Frees the memory allocated by the oneMKL Memory Allocator in the current thread only */
  32. #define mkl_thread_free_buffers MKL_Thread_Free_Buffers
  33. MKL_INT64 MKL_Mem_Stat(int* nbuffers); /* oneMKL Memory Allocator statistical information. */
  34. /* Returns an amount of memory, allocated by the oneMKL Memory Allocator */
  35. /* in <nbuffers> buffers. */
  36. #define mkl_mem_stat MKL_Mem_Stat
  37. #define MKL_PEAK_MEM_DISABLE 0
  38. #define MKL_PEAK_MEM_ENABLE 1
  39. #define MKL_PEAK_MEM_RESET -1
  40. #define MKL_PEAK_MEM 2
  41. MKL_INT64 MKL_Peak_Mem_Usage(int reset); /* Returns the peak amount of memory, allocated by the oneMKL Memory Allocator */
  42. #define mkl_peak_mem_usage MKL_Peak_Mem_Usage
  43. void* MKL_malloc(size_t size, int align); /* Allocates the aligned buffer */
  44. #define mkl_malloc MKL_malloc
  45. void* MKL_calloc(size_t num, size_t size, int align); /* Allocates the aligned num*size - bytes memory buffer initialized by zeros */
  46. #define mkl_calloc MKL_calloc
  47. void* MKL_realloc(void *ptr, size_t size); /* Changes the size of memory buffer allocated by MKL_malloc/MKL_calloc */
  48. #define mkl_realloc MKL_realloc
  49. void MKL_free(void *ptr); /* Frees the memory allocated by MKL_malloc() */
  50. #define mkl_free MKL_free
  51. int MKL_Disable_Fast_MM(void); /* Turns off the oneMKL Memory Allocator */
  52. #define mkl_disable_fast_mm MKL_Disable_Fast_MM
  53. void MKL_Get_Cpu_Clocks(unsigned MKL_INT64 *); /* Gets CPU clocks */
  54. #define mkl_get_cpu_clocks MKL_Get_Cpu_Clocks
  55. double MKL_Get_Cpu_Frequency(void); /* Gets CPU frequency in GHz */
  56. #define mkl_get_cpu_frequency MKL_Get_Cpu_Frequency
  57. double MKL_Get_Max_Cpu_Frequency(void); /* Gets max CPU frequency in GHz */
  58. #define mkl_get_max_cpu_frequency MKL_Get_Max_Cpu_Frequency
  59. double MKL_Get_Clocks_Frequency(void); /* Gets clocks frequency in GHz */
  60. #define mkl_get_clocks_frequency MKL_Get_Clocks_Frequency
  61. int MKL_Set_Num_Threads_Local(int nth);
  62. #define mkl_set_num_threads_local MKL_Set_Num_Threads_Local
  63. void MKL_Set_Num_Threads(int nth);
  64. #define mkl_set_num_threads MKL_Set_Num_Threads
  65. int MKL_Get_Max_Threads(void);
  66. #define mkl_get_max_threads MKL_Get_Max_Threads
  67. void MKL_Set_Num_Stripes(int nstripes);
  68. #define mkl_set_num_stripes MKL_Set_Num_Stripes
  69. int MKL_Get_Num_Stripes(void);
  70. #define mkl_get_num_stripes MKL_Get_Num_Stripes
  71. int MKL_Domain_Set_Num_Threads(int nth, int MKL_DOMAIN);
  72. #define mkl_domain_set_num_threads MKL_Domain_Set_Num_Threads
  73. int MKL_Domain_Get_Max_Threads(int MKL_DOMAIN);
  74. #define mkl_domain_get_max_threads MKL_Domain_Get_Max_Threads
  75. void MKL_Set_Dynamic(int bool_MKL_DYNAMIC);
  76. #define mkl_set_dynamic MKL_Set_Dynamic
  77. int MKL_Get_Dynamic(void);
  78. #define mkl_get_dynamic MKL_Get_Dynamic
  79. /* oneMKL Progress routine */
  80. #ifndef _MKL_PROGRESS_H_
  81. #define _MKL_PROGRESS_H_
  82. int MKL_PROGRESS ( int* thread, int* step, char* stage, int lstage );
  83. int MKL_PROGRESS_( int* thread, int* step, char* stage, int lstage );
  84. int mkl_progress ( int* thread, int* step, char* stage, int lstage );
  85. int mkl_progress_( int* thread, int* step, char* stage, int lstage );
  86. #endif /* _MKL_PROGRESS_H_ */
  87. int MKL_Enable_Instructions(int);
  88. #define mkl_enable_instructions MKL_Enable_Instructions
  89. #define MKL_ENABLE_SSE4_2 0
  90. #define MKL_ENABLE_AVX 1
  91. #define MKL_ENABLE_AVX2 2
  92. #define MKL_ENABLE_AVX512_MIC 3
  93. #define MKL_ENABLE_AVX512 4
  94. #define MKL_ENABLE_AVX512_MIC_E1 5
  95. #define MKL_ENABLE_AVX512_E1 6
  96. #define MKL_ENABLE_AVX512_E2 7
  97. #define MKL_ENABLE_AVX512_E3 8
  98. #define MKL_ENABLE_AVX512_E4 9
  99. #define MKL_ENABLE_AVX2_E1 10
  100. #define MKL_SINGLE_PATH_ENABLE 0x0600
  101. /* Single Dynamic library interface */
  102. #define MKL_INTERFACE_LP64 0
  103. #define MKL_INTERFACE_ILP64 1
  104. #define MKL_INTERFACE_GNU 2
  105. int MKL_Set_Interface_Layer(int code);
  106. #define mkl_set_interface_layer MKL_Set_Interface_Layer
  107. /* Single Dynamic library threading */
  108. #define MKL_THREADING_INTEL 0
  109. #define MKL_THREADING_SEQUENTIAL 1
  110. #define MKL_THREADING_PGI 2
  111. #define MKL_THREADING_GNU 3
  112. #define MKL_THREADING_TBB 4
  113. int MKL_Set_Threading_Layer(int code);
  114. #define mkl_set_threading_layer MKL_Set_Threading_Layer
  115. typedef void (* XerblaEntry) (const char * Name, const int * Num, const int Len);
  116. XerblaEntry mkl_set_xerbla(XerblaEntry xerbla);
  117. typedef int (* ProgressEntry) (int* thread, int* step, char* stage, int stage_len);
  118. ProgressEntry mkl_set_progress(ProgressEntry progress);
  119. typedef int (* PardisopivotEntry) (double* aii, double* bii, double*eps);
  120. PardisopivotEntry mkl_set_pardiso_pivot(PardisopivotEntry pardiso_pivot);
  121. /* oneMKL CBWR */
  122. int MKL_CBWR_Get(int);
  123. #define mkl_cbwr_get MKL_CBWR_Get
  124. int MKL_CBWR_Set(int);
  125. #define mkl_cbwr_set MKL_CBWR_Set
  126. int MKL_CBWR_Get_Auto_Branch(void);
  127. #define mkl_cbwr_get_auto_branch MKL_CBWR_Get_Auto_Branch
  128. /* oneMKL Verbose */
  129. int MKL_Set_Env_Mode(int);
  130. #define mkl_set_env_mode MKL_Set_Env_Mode
  131. int MKL_Verbose(int);
  132. #define mkl_verbose MKL_Verbose
  133. int MKL_Verbose_Output_File(const char *fname);
  134. #define mkl_verbose_output_file MKL_Verbose_Output_File
  135. #define MKL_EXIT_UNSUPPORTED_CPU 1
  136. #define MKL_EXIT_CORRUPTED_INSTALL 2
  137. #define MKL_EXIT_NO_MEMORY 3
  138. #ifndef __MKLExitHandler
  139. #define __MKLExitHandler
  140. typedef void (* MKLExitHandler)(int why);
  141. #endif
  142. void MKL_Set_Exit_Handler(MKLExitHandler h);
  143. #define mkl_set_exit_handler MKL_Set_Exit_Handler
  144. /* oneMKL MPI */
  145. enum {
  146. MKL_BLACS_CUSTOM = 0,
  147. MKL_BLACS_MSMPI = 1,
  148. MKL_BLACS_INTELMPI = 2,
  149. #if !defined(_WIN32) & !defined(_WIN64)
  150. MKL_BLACS_MPICH2 = 3,
  151. MKL_BLACS_LASTMPI = 4
  152. #else
  153. MKL_BLACS_LASTMPI = 3
  154. #endif
  155. };
  156. int MKL_Set_mpi(int vendor, const char *custom_library_name);
  157. #define mkl_set_mpi MKL_Set_mpi
  158. /* oneMKL Memory control */
  159. #define MKL_MEM_MCDRAM 1
  160. int MKL_Set_Memory_Limit(int mem_type, size_t limit);
  161. #define mkl_set_memory_limit MKL_Set_Memory_Limit
  162. void MKL_Finalize(void);
  163. #define mkl_finalize MKL_Finalize
  164. #ifdef __cplusplus
  165. }
  166. #endif /* __cplusplus */
  167. #endif /* _MKL_SERVICE_H_ */