MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_init

Function af_init

src/api/c/device.cpp:112–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112af_err af_init() {
113 try {
114 thread_local std::once_flag flag;
115 std::call_once(flag, []() {
116 init();
117#if defined(USE_MKL) && !defined(USE_STATIC_MKL)
118 int errCode = -1;
119 // Have used the AF_MKL_INTERFACE_SIZE as regular if's so that
120 // we will know if these are not defined when using MKL when a
121 // compilation error is generated.
122 if (AF_MKL_INTERFACE_SIZE == 4) {
123 errCode = mkl_set_interface_layer(MKL_INTERFACE_LP64);
124 } else if (AF_MKL_INTERFACE_SIZE == 8) {
125 errCode = mkl_set_interface_layer(MKL_INTERFACE_ILP64);
126 }
127 if (errCode == -1) {
128 AF_ERROR(
129 "Intel MKL Interface layer was not specified prior to the "
130 "call and the input parameter is incorrect.",
131 AF_ERR_RUNTIME);
132 }
133 switch (AF_MKL_THREAD_LAYER) {
134 case 0:
135 errCode = mkl_set_threading_layer(MKL_THREADING_SEQUENTIAL);
136 break;
137 case 1:
138 errCode = mkl_set_threading_layer(MKL_THREADING_GNU);
139 break;
140 case 2:
141 errCode = mkl_set_threading_layer(MKL_THREADING_INTEL);
142 break;
143 case 3:
144 errCode = mkl_set_threading_layer(MKL_THREADING_TBB);
145 break;
146 }
147 if (errCode == -1) {
148 AF_ERROR(
149 "Intel MKL Thread layer was not specified prior to the "
150 "call and the input parameter is incorrect.",
151 AF_ERR_RUNTIME);
152 }
153#endif
154 });
155 }
156 CATCHALL;
157 return AF_SUCCESS;
158}
159
160af_err af_info() {
161 try {

Callers 15

af_create_random_engineFunction · 0.70
af_retain_random_engineFunction · 0.70
af_random_uniformFunction · 0.70
af_random_normalFunction · 0.70
af_release_random_engineFunction · 0.70
af_randuFunction · 0.70

Calls 1

initFunction · 0.50

Tested by

no test coverage detected