common.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00037 #pragma once
00038
00039 #ifdef __CUDACC__
00040
00041 #undef _GLIBCXX_ATOMIC_BUILTINS
00042 #undef _GLIBCXX_USE_INT128
00043 #endif
00044
00045
00046
00047 #include <cassert>
00048 #include <cmath>
00049 #include <stdint.h>
00050 #include <cstring>
00051 #include <cstdio>
00052
00053
00054 #include <iostream>
00055 #include <fstream>
00056 #include <string>
00057 #include <stdexcept>
00058 #include <map>
00059 #include <vector>
00060 #include <set>
00061 #include <algorithm>
00062 #include <limits>
00063 #ifndef __CUDACC__
00064
00065
00066 #include <sstream>
00067 #include <valarray>
00068 #endif
00069
00070
00071 #include <boost/shared_ptr.hpp>
00072 #include <boost/bind.hpp>
00073
00074 using boost::shared_ptr;
00075
00076
00077 #include <cuda.h>
00078 #include <cuda_runtime.h>
00079
00080
00081
00082 #include <errno.h>
00083 #include <sys/types.h>
00084 #include <sys/stat.h>
00085 #include <time.h>
00086
00087 #include "runtime_error.hpp"
00088
00089
00090
00091
00092
00093 #ifdef __CUDACC__
00094 #define ALIGN(x) __align__(x)
00095 #else
00096 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
00097
00098 #define ALIGN(x) __declspec(align(x))
00099 #else
00100 #if defined(__GNUC__)
00101
00102 #define ALIGN(x) __attribute__ ((aligned (x)))
00103 #else
00104
00105 #define ALIGN(x)
00106 #endif
00107 #endif
00108 #endif
00109
00111 #define $$(x) (std::cerr << __FILE__ << "(" << __FUNCTION__ << "):" << __LINE__ << " |> " << (x) << std::endl)
00112
00113 #define $PRINT(x) (std::cerr << __FILE__ << __LINE__ << ": " << x << std::endl)
00114
00116 #define $_(x) (std::cerr << __FILE__ << "(" << __FUNCTION__ << "):" << __LINE__ << " " << (#x) << " = " << (x) << std::endl)
00117
00119 #define $$$ (std::cerr << __FILE__ << "(" << __FUNCTION__ << "):" << __LINE__ << " @@ " << std::endl)
00120 #define SYNC cudaThreadSynchronize()
00121