You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

common.h 16 kB

13 years ago
12 years ago
12 years ago
12 years ago
12 years ago
13 years ago
13 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #ifndef COMMON_H
  39. #define COMMON_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. /* Assume C declarations for C++ */
  43. #endif /* __cplusplus */
  44. #ifndef _GNU_SOURCE
  45. #define _GNU_SOURCE
  46. #endif
  47. #ifndef __USE_XOPEN
  48. #define __USE_XOPEN
  49. #endif
  50. #ifndef __USE_SVID
  51. #define __USE_SVID
  52. #endif
  53. #ifdef BUILD_KERNEL
  54. #include "config_kernel.h"
  55. #else
  56. #include "config.h"
  57. #endif
  58. #undef ENABLE_SSE_EXCEPTION
  59. #if defined(SMP_SERVER) || defined(SMP_ONDEMAND)
  60. #define SMP
  61. #endif
  62. #if defined(OS_WINNT) || defined(OS_CYGWIN_NT) || defined(OS_INTERIX)
  63. #define WINDOWS_ABI
  64. #define OS_WINDOWS
  65. #ifdef DOUBLE
  66. #define DOUBLE_DEFINED DOUBLE
  67. #undef DOUBLE
  68. #endif
  69. #endif
  70. #if !defined(NOINCLUDE) && !defined(ASSEMBLER)
  71. #include <stdio.h>
  72. #include <stdlib.h>
  73. #include <string.h>
  74. #include <unistd.h>
  75. #ifdef OS_LINUX
  76. #include <malloc.h>
  77. #include <sched.h>
  78. #endif
  79. #if defined(OS_DARWIN) || defined(OS_FREEBSD) || defined(OS_NETBSD)
  80. #include <sched.h>
  81. #endif
  82. #ifdef OS_WINDOWS
  83. #ifdef ATOM
  84. #define GOTO_ATOM ATOM
  85. #undef ATOM
  86. #endif
  87. #include <windows.h>
  88. #include <math.h>
  89. #ifdef GOTO_ATOM
  90. #define ATOM GOTO_ATOM
  91. #undef GOTO_ATOM
  92. #endif
  93. #else
  94. #include <sys/mman.h>
  95. #include <sys/shm.h>
  96. #include <sys/time.h>
  97. #include <unistd.h>
  98. #include <math.h>
  99. #ifdef SMP
  100. #include <pthread.h>
  101. #endif
  102. #endif
  103. #if defined(OS_SUNOS)
  104. #include <thread.h>
  105. #endif
  106. #ifdef __DECC
  107. #include <c_asm.h>
  108. #include <machine/builtins.h>
  109. #endif
  110. #if defined(ARCH_IA64) && defined(ENABLE_SSE_EXCEPTION)
  111. #include <fenv.h>
  112. #endif
  113. #endif
  114. #if defined(OS_WINDOWS) && defined(DOUBLE_DEFINED)
  115. #define DOUBLE DOUBLE_DEFINED
  116. #undef DOUBLE_DEFINED
  117. #endif
  118. #undef DEBUG_INFO
  119. #define SMP_DEBUG
  120. #undef MALLOC_DEBUG
  121. #undef SMP_ALLOC_DEBUG
  122. #ifndef ZERO
  123. #ifdef XDOUBLE
  124. #define ZERO 0.e0L
  125. #elif defined DOUBLE
  126. #define ZERO 0.e0
  127. #else
  128. #define ZERO 0.e0f
  129. #endif
  130. #endif
  131. #ifndef ONE
  132. #ifdef XDOUBLE
  133. #define ONE 1.e0L
  134. #elif defined DOUBLE
  135. #define ONE 1.e0
  136. #else
  137. #define ONE 1.e0f
  138. #endif
  139. #endif
  140. #define BITMASK(a, b, c) ((((a) >> (b)) & (c)))
  141. #define ALLOCA_ALIGN 63UL
  142. #define NUM_BUFFERS (MAX_CPU_NUMBER * 2)
  143. #ifdef NEEDBUNDERSCORE
  144. #define BLASFUNC(FUNC) FUNC##_
  145. #else
  146. #define BLASFUNC(FUNC) FUNC
  147. #endif
  148. #undef USE_PTHREAD_LOCK
  149. #undef USE_PTHREAD_SPINLOCK
  150. #if defined(USE_PTHREAD_LOCK) && defined(USE_PTHREAD_SPINLOCK)
  151. #error "You can't specify both LOCK operation!"
  152. #endif
  153. #ifdef SMP
  154. #define USE_PTHREAD_LOCK
  155. #undef USE_PTHREAD_SPINLOCK
  156. #endif
  157. #ifdef OS_WINDOWS
  158. #undef USE_PTHREAD_LOCK
  159. #undef USE_PTHREAD_SPINLOCK
  160. #endif
  161. #if defined(USE_PTHREAD_LOCK)
  162. #define LOCK_COMMAND(x) pthread_mutex_lock(x)
  163. #define UNLOCK_COMMAND(x) pthread_mutex_unlock(x)
  164. #elif defined(USE_PTHREAD_SPINLOCK)
  165. #ifndef ASSEMBLER
  166. typedef volatile int pthread_spinlock_t;
  167. int pthread_spin_lock (pthread_spinlock_t *__lock);
  168. int pthread_spin_unlock (pthread_spinlock_t *__lock);
  169. #endif
  170. #define LOCK_COMMAND(x) pthread_spin_lock(x)
  171. #define UNLOCK_COMMAND(x) pthread_spin_unlock(x)
  172. #else
  173. #define LOCK_COMMAND(x) blas_lock(x)
  174. #define UNLOCK_COMMAND(x) blas_unlock(x)
  175. #endif
  176. #define GOTO_SHMID 0x510510
  177. #if 0
  178. #ifndef __CUDACC__
  179. #define __global__
  180. #define __device__
  181. #define __host__
  182. #define __shared__
  183. #endif
  184. #endif
  185. #ifndef ASSEMBLER
  186. #ifdef QUAD_PRECISION
  187. typedef struct {
  188. unsigned long x[2];
  189. } xdouble;
  190. #elif defined EXPRECISION
  191. #define xdouble long double
  192. #else
  193. #define xdouble double
  194. #endif
  195. #if defined(OS_WINDOWS) && defined(__64BIT__)
  196. typedef long long BLASLONG;
  197. typedef unsigned long long BLASULONG;
  198. #else
  199. typedef long BLASLONG;
  200. typedef unsigned long BLASULONG;
  201. #endif
  202. #ifdef USE64BITINT
  203. typedef BLASLONG blasint;
  204. #else
  205. typedef int blasint;
  206. #endif
  207. #else
  208. #ifdef USE64BITINT
  209. #define INTSHIFT 3
  210. #define INTSIZE 8
  211. #else
  212. #define INTSHIFT 2
  213. #define INTSIZE 4
  214. #endif
  215. #endif
  216. #ifdef XDOUBLE
  217. #define FLOAT xdouble
  218. #ifdef QUAD_PRECISION
  219. #define XFLOAT xidouble
  220. #endif
  221. #ifdef QUAD_PRECISION
  222. #define SIZE 32
  223. #define BASE_SHIFT 5
  224. #define ZBASE_SHIFT 6
  225. #else
  226. #define SIZE 16
  227. #define BASE_SHIFT 4
  228. #define ZBASE_SHIFT 5
  229. #endif
  230. #elif defined(DOUBLE)
  231. #define FLOAT double
  232. #define SIZE 8
  233. #define BASE_SHIFT 3
  234. #define ZBASE_SHIFT 4
  235. #else
  236. #define FLOAT float
  237. #define SIZE 4
  238. #define BASE_SHIFT 2
  239. #define ZBASE_SHIFT 3
  240. #endif
  241. #ifndef XFLOAT
  242. #define XFLOAT FLOAT
  243. #endif
  244. #ifndef COMPLEX
  245. #define COMPSIZE 1
  246. #else
  247. #define COMPSIZE 2
  248. #endif
  249. #if defined(C_PGI) || defined(C_SUN)
  250. #define CREAL(X) (*((FLOAT *)&X + 0))
  251. #define CIMAG(X) (*((FLOAT *)&X + 1))
  252. #else
  253. #define CREAL __real__
  254. #define CIMAG __imag__
  255. #endif
  256. #define Address_H(x) (((x)+(1<<15))>>16)
  257. #define Address_L(x) ((x)-((Address_H(x))<<16))
  258. #ifndef MAX_CPU_NUMBER
  259. #define MAX_CPU_NUMBER 2
  260. #endif
  261. #if defined(OS_SUNOS)
  262. #define YIELDING thr_yield()
  263. #endif
  264. #if defined(OS_WINDOWS)
  265. #define YIELDING SwitchToThread()
  266. #endif
  267. #if defined(ARMV7) || defined(ARMV6) || defined(ARMV8)
  268. #define YIELDING asm volatile ("nop;nop;nop;nop;nop;nop;nop;nop; \n");
  269. #endif
  270. #ifdef PILEDRIVER
  271. #ifndef YIELDING
  272. #define YIELDING __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop;\n");
  273. #endif
  274. #endif
  275. #ifndef YIELDING
  276. #define YIELDING sched_yield()
  277. #endif
  278. /***
  279. To alloc job_t on heap or statck.
  280. please https://github.com/xianyi/OpenBLAS/issues/246
  281. ***/
  282. #if defined(OS_WINDOWS)
  283. #define GETRF_MEM_ALLOC_THRESHOLD 32
  284. #define BLAS3_MEM_ALLOC_THRESHOLD 32
  285. #endif
  286. #ifndef GETRF_MEM_ALLOC_THRESHOLD
  287. #define GETRF_MEM_ALLOC_THRESHOLD 80
  288. #endif
  289. #ifndef BLAS3_MEM_ALLOC_THRESHOLD
  290. #define BLAS3_MEM_ALLOC_THRESHOLD 160
  291. #endif
  292. #ifdef QUAD_PRECISION
  293. #include "common_quad.h"
  294. #endif
  295. #ifdef ARCH_ALPHA
  296. #include "common_alpha.h"
  297. #endif
  298. #ifdef ARCH_X86
  299. #include "common_x86.h"
  300. #endif
  301. #ifdef ARCH_X86_64
  302. #include "common_x86_64.h"
  303. #endif
  304. #ifdef ARCH_IA64
  305. #include "common_ia64.h"
  306. #endif
  307. #ifdef ARCH_POWER
  308. #include "common_power.h"
  309. #endif
  310. #ifdef sparc
  311. #include "common_sparc.h"
  312. #endif
  313. #ifdef ARCH_MIPS64
  314. #include "common_mips64.h"
  315. #endif
  316. #ifdef ARCH_ARM
  317. #include "common_arm.h"
  318. #endif
  319. #ifdef ARCH_ARM64
  320. #include "common_arm64.h"
  321. #endif
  322. #ifdef OS_LINUX
  323. #include "common_linux.h"
  324. #endif
  325. #define MMAP_ACCESS (PROT_READ | PROT_WRITE)
  326. #ifdef __NetBSD__
  327. #define MMAP_POLICY (MAP_PRIVATE | MAP_ANON)
  328. #else
  329. #define MMAP_POLICY (MAP_PRIVATE | MAP_ANONYMOUS)
  330. #endif
  331. #include "param.h"
  332. #include "common_param.h"
  333. #ifndef STDERR
  334. #define STDERR stderr
  335. #endif
  336. #ifndef MASK
  337. #define MASK(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
  338. #endif
  339. #if defined(XDOUBLE) || defined(DOUBLE)
  340. #define FLOATRET FLOAT
  341. #else
  342. #ifdef NEED_F2CCONV
  343. #define FLOATRET double
  344. #else
  345. #define FLOATRET float
  346. #endif
  347. #endif
  348. #ifndef ASSEMBLER
  349. #ifndef NOINCLUDE
  350. /* Inclusion of a standard header file is needed for definition of __STDC_*
  351. predefined macros with some compilers (e.g. GCC 4.7 on Linux). This occurs
  352. as a side effect of including either <features.h> or <stdc-predef.h>. */
  353. #include <stdio.h>
  354. #endif // NOINCLUDE
  355. /* C99 supports complex floating numbers natively, which GCC also offers as an
  356. extension since version 3.0. If neither are available, use a compatible
  357. structure as fallback (see Clause 6.2.5.13 of the C99 standard). */
  358. #if (defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \
  359. (__GNUC__ >= 3 && !defined(__cplusplus)))
  360. #define OPENBLAS_COMPLEX_C99
  361. typedef float _Complex openblas_complex_float;
  362. typedef double _Complex openblas_complex_double;
  363. typedef xdouble _Complex openblas_complex_xdouble;
  364. #else
  365. #define OPENBLAS_COMPLEX_STRUCT
  366. typedef struct { float real, imag; } openblas_complex_float;
  367. typedef struct { double real, imag; } openblas_complex_double;
  368. typedef struct { xdouble real, imag; } openblas_complex_xdouble;
  369. #endif
  370. #endif // ASSEMBLER
  371. #ifndef IFLUSH
  372. #define IFLUSH
  373. #endif
  374. #ifndef IFLUSH_HALF
  375. #define IFLUSH_HALF
  376. #endif
  377. #if defined(C_GCC) && (( __GNUC__ <= 3) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2)))
  378. #ifdef USE_OPENMP
  379. #undef USE_OPENMP
  380. #endif
  381. #endif
  382. #ifndef ASSEMBLER
  383. #ifndef MIN
  384. #define MIN(a,b) (a>b? b:a)
  385. #endif
  386. #ifndef MAX
  387. #define MAX(a,b) (a<b? b:a)
  388. #endif
  389. #define TOUPPER(a) {if ((a) > 0x60) (a) -= 0x20;}
  390. #if defined(__FreeBSD__) || defined(__APPLE__)
  391. #define MAP_ANONYMOUS MAP_ANON
  392. #endif
  393. /* Common Memory Management Routine */
  394. void blas_set_parameter(void);
  395. int blas_get_cpu_number(void);
  396. void *blas_memory_alloc (int);
  397. void blas_memory_free (void *);
  398. int get_num_procs (void);
  399. #if defined(OS_LINUX) && defined(SMP) && !defined(NO_AFFINITY)
  400. int get_num_nodes (void);
  401. int get_num_proc (int);
  402. int get_node_equal (void);
  403. #endif
  404. void goto_set_num_threads(int);
  405. void gotoblas_affinity_init(void);
  406. void gotoblas_affinity_quit(void);
  407. void gotoblas_dynamic_init(void);
  408. void gotoblas_dynamic_quit(void);
  409. void gotoblas_profile_init(void);
  410. void gotoblas_profile_quit(void);
  411. #ifdef USE_OPENMP
  412. int omp_in_parallel(void);
  413. int omp_get_num_procs(void);
  414. #else
  415. #ifdef __ELF__
  416. int omp_in_parallel (void) __attribute__ ((weak));
  417. int omp_get_num_procs(void) __attribute__ ((weak));
  418. #endif
  419. #endif
  420. static __inline void blas_unlock(volatile BLASULONG *address){
  421. MB;
  422. *address = 0;
  423. }
  424. static __inline int readenv(char *env) {
  425. char *p;
  426. p = getenv(env);
  427. if (p == NULL) return 0; else return atoi(p);
  428. }
  429. #if !defined(XDOUBLE) || !defined(QUAD_PRECISION)
  430. static __inline void compinv(FLOAT *b, FLOAT ar, FLOAT ai){
  431. #ifndef UNIT
  432. FLOAT ratio, den;
  433. if (
  434. #ifdef XDOUBLE
  435. (fabsl(ar)) >= (fabsl(ai))
  436. #elif defined DOUBLE
  437. (fabs (ar)) >= (fabs (ai))
  438. #else
  439. (fabsf(ar)) >= (fabsf(ai))
  440. #endif
  441. ) {
  442. ratio = ai / ar;
  443. den = (FLOAT)(ONE / (ar * (ONE + ratio * ratio)));
  444. ar = den;
  445. ai = -ratio * den;
  446. } else {
  447. ratio = ar / ai;
  448. den = (FLOAT)(ONE /(ai * (ONE + ratio * ratio)));
  449. ar = ratio * den;
  450. ai = -den;
  451. }
  452. b[0] = ar;
  453. b[1] = ai;
  454. #else
  455. b[0] = ONE;
  456. b[1] = ZERO;
  457. #endif
  458. }
  459. #endif
  460. #ifdef MALLOC_DEBUG
  461. void *blas_debug_alloc(int);
  462. void *blas_debug_free(void *);
  463. #undef malloc
  464. #undef free
  465. #define malloc(a) blas_debug_alloc(a)
  466. #define free(a) blas_debug_free (a)
  467. #endif
  468. #ifndef COPYOVERHEAD
  469. #define GEMMRETTYPE int
  470. #else
  471. typedef struct {
  472. double outercopy;
  473. double innercopy;
  474. double kernel;
  475. double mflops;
  476. } copyoverhead_t;
  477. #define GEMMRETTYPE copyoverhead_t
  478. #endif
  479. #endif
  480. #ifndef BUILD_KERNEL
  481. #define KNAME(A, B) A
  482. #else
  483. #define KNAME(A, B) A##B
  484. #endif
  485. #include "common_interface.h"
  486. #ifdef SANITY_CHECK
  487. #include "common_reference.h"
  488. #endif
  489. #include "common_macro.h"
  490. #include "common_level1.h"
  491. #include "common_level2.h"
  492. #include "common_level3.h"
  493. #include "common_lapack.h"
  494. #ifdef CBLAS
  495. # define OPENBLAS_CONST /* see comment in cblas.h */
  496. # include "cblas.h"
  497. #endif
  498. #ifndef ASSEMBLER
  499. #if 0
  500. #include "symcopy.h"
  501. #endif
  502. #if defined(SMP_SERVER) && defined(SMP_ONDEMAND)
  503. #error Both SMP_SERVER and SMP_ONDEMAND are specified.
  504. #endif
  505. #if defined(SMP_SERVER) || defined(SMP_ONDEMAND)
  506. #include "common_thread.h"
  507. #endif
  508. #endif
  509. #define INFO_NUM 99
  510. #ifndef DEFAULT_CPU_NUMBER
  511. #define DEFAULT_CPU_NUMBER 4
  512. #endif
  513. #ifndef IDEBUG_START
  514. #define IDEBUG_START
  515. #endif
  516. #ifndef IDEBUG_END
  517. #define IDEBUG_END
  518. #endif
  519. #if !defined(ASSEMBLER) && defined(FUNCTION_PROFILE)
  520. typedef struct {
  521. int func;
  522. unsigned long long calls, fops, area, cycles, tcycles;
  523. } func_profile_t;
  524. extern func_profile_t function_profile_table[];
  525. extern int gotoblas_profile;
  526. #ifdef XDOUBLE
  527. #define NUMOPT QNUMOPT
  528. #elif defined DOUBLE
  529. #define NUMOPT DNUMOPT
  530. #else
  531. #define NUMOPT SNUMOPT
  532. #endif
  533. #define FUNCTION_PROFILE_START() { unsigned long long profile_start = rpcc(), profile_end;
  534. #ifdef SMP
  535. #define FUNCTION_PROFILE_END(COMP, AREA, OPS) \
  536. if (gotoblas_profile) { \
  537. profile_end = rpcc(); \
  538. function_profile_table[PROFILE_FUNC_NAME].calls ++; \
  539. function_profile_table[PROFILE_FUNC_NAME].area += SIZE * COMPSIZE * (AREA); \
  540. function_profile_table[PROFILE_FUNC_NAME].fops += (COMP) * (OPS) / NUMOPT; \
  541. function_profile_table[PROFILE_FUNC_NAME].cycles += (profile_end - profile_start); \
  542. function_profile_table[PROFILE_FUNC_NAME].tcycles += blas_cpu_number * (profile_end - profile_start); \
  543. } \
  544. }
  545. #else
  546. #define FUNCTION_PROFILE_END(COMP, AREA, OPS) \
  547. if (gotoblas_profile) { \
  548. profile_end = rpcc(); \
  549. function_profile_table[PROFILE_FUNC_NAME].calls ++; \
  550. function_profile_table[PROFILE_FUNC_NAME].area += SIZE * COMPSIZE * (AREA); \
  551. function_profile_table[PROFILE_FUNC_NAME].fops += (COMP) * (OPS) / NUMOPT; \
  552. function_profile_table[PROFILE_FUNC_NAME].cycles += (profile_end - profile_start); \
  553. function_profile_table[PROFILE_FUNC_NAME].tcycles += (profile_end - profile_start); \
  554. } \
  555. }
  556. #endif
  557. #else
  558. #define FUNCTION_PROFILE_START()
  559. #define FUNCTION_PROFILE_END(COMP, AREA, OPS)
  560. #endif
  561. #if 1
  562. #define PRINT_DEBUG_CNAME
  563. #define PRINT_DEBUG_NAME
  564. #else
  565. #define PRINT_DEBUG_CNAME if (readenv("GOTO_DEBUG")) fprintf(stderr, "GotoBLAS : %s\n", CHAR_CNAME)
  566. #define PRINT_DEBUG_NAME if (readenv("GOTO_DEBUG")) fprintf(stderr, "GotoBLAS : %s\n", CHAR_NAME)
  567. #endif
  568. #ifdef __cplusplus
  569. }
  570. #endif /* __cplusplus */
  571. #endif