MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
common_magma.h
Go to the documentation of this file.
1 /*
2  -- MAGMA (version 1.4.0) --
3  Univ. of Tennessee, Knoxville
4  Univ. of California, Berkeley
5  Univ. of Colorado, Denver
6  August 2013
7 
8  @author Mathieu Faverge
9 
10  Based on PLASMA common.h
11 */
12 
13 /***************************************************************************/
16 #ifndef MAGMA_COMMON_H
17 #define MAGMA_COMMON_H
18 
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <cublas.h>
22 #include <math.h>
23 #include <string.h>
24 #include <ctype.h>
25 
26 #include <cuda_runtime_api.h>
27 
28 #if defined( _WIN32 ) || defined( _WIN64 )
29 
30  #include "magmawinthread.h"
31  #include <windows.h>
32  #include <limits.h>
33  #include <io.h>
34 
35  // functions where Microsoft fails to provide C99 standard
36  #define copysign(x,y) _copysign(x,y)
37  double log2( double x ); // defined in auxiliary.cpp
38 
39 #else
40 
41  #include <pthread.h>
42  #include <unistd.h>
43  #include <inttypes.h>
44 
45 #endif
46 
47 #if defined(__APPLE__)
48  #include "pthread_barrier.h"
49 #endif
50 
51 #include "magma.h"
52 #include "magma_lapack.h"
53 #include "operators.h"
54 #include "transpose.h"
55 #include "magma_threadsetting.h"
56 
61 #if __STDC_VERSION__ < 199901L
62 # if __GNUC__ >= 2 || _MSC_VER >= 1300
63 # define __func__ __FUNCTION__
64 # else
65 # define __func__ "<unknown>"
66 # endif
67 #endif
68 
72 #if defined(linux) || defined(__linux) || defined(__linux__)
73 #if defined(__GNUC_EXCL__) || defined(__GNUC__)
74 #define MAGMA_HAVE_WEAK 1
75 #endif
76 #endif
77 
78 /***************************************************************************/
81 #ifndef max
82 #define max(a, b) ((a) > (b) ? (a) : (b))
83 #endif
84 
85 #ifndef min
86 #define min(a, b) ((a) < (b) ? (a) : (b))
87 #endif
88 
89 #ifndef roundup
90 #define roundup(a, b) (b <= 0) ? (a) : (((a) + (b)-1) & ~((b)-1))
91 #endif
92 
98 #define magma_dsqrt sqrt
99 #define magma_ssqrt sqrtf
100 
101 #endif /* MAGMA_COMMON_H */