Swarm-NG  1.1
gpulog_align.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2010 by Mario Juric *
3  * mjuric@cfa.harvard.EDU *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
27 #ifndef bits_gpulog_align_h__
28 #define bits_gpulog_align_h__
29 
30 //
31 // Struct alignment is handled differently between the CUDA compiler and other
32 // compilers (e.g. GCC, MS Visual C++ .NET)
33 //
34 #ifndef ALIGN
35  #define LOCALLY_DEFINED_ALIGN
36 
37  #ifdef __CUDACC__
38  #define ALIGN(x) __align__(x)
39  #else
40  #if defined(_MSC_VER) && (_MSC_VER >= 1300)
41  // Visual C++ .NET and later
42  #define ALIGN(x) __declspec(align(x))
43  #else
44  #if defined(__GNUC__)
45  // GCC
46  #define ALIGN(x) __attribute__ ((aligned (x)))
47  #else
48  // all other compilers
49  #define ALIGN(x)
50  #endif
51  #endif
52  #endif
53 #endif
54 
55 
56 #endif // bits_gpulog_align_h__