MADNESS 0.10.1
madness_config.h
Go to the documentation of this file.
1/*
2 This file is part of MADNESS.
3
4 Copyright (C) 2014 Virginia Tech
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 For more information please contact:
21
22 Robert J. Harrison
23 Oak Ridge National Laboratory
24 One Bethel Valley Road
25 P.O. Box 2008, MS-6367
26
27 email: harrisonrj@ornl.gov
28 tel: 865-241-3937
29 fax: 865-572-0680
30*/
31
32/**
33 \file madness_config.h
34 \brief Macros and tools pertaining to the configuration of MADNESS.
35 \ingroup libraries
36*/
37
38#ifndef MADNESS_MADNESS_CONFIG_H__INCLUDED
39#define MADNESS_MADNESS_CONFIG_H__INCLUDED
40
41#include <madness/config.h>
42/* undefine what every autoheader package defines to avoid clashes */
43#undef PACKAGE
44#undef PACKAGE_NAME
45#undef PACKAGE_BUGREPORT
46#undef PACKAGE_STRING
47#undef PACKAGE_TARNAME
48#undef PACKAGE_URL
49#undef PACKAGE_VERSION
50#undef VERSION
51
52/* System check */
53#if defined(__CRAYXT)
54
55# define HAVE_CRAYXT 1
56# define MADNESS_HAVE_CRAYXT 1
57
58#elif defined(__CRAYXE)
59
60# define HAVE_CRAYXE 1
61# define MADNESS_HAVE_CRAYXE 1
62# define X86_64 1
63# define MADNESS_HAVE_X86_64 1
64
65#elif defined(__bgp__)
66
67# define HAVE_IBMBGP 1
68# define MADNESS_HAVE_POWERPC_32 1
69
70#elif defined(__bgq__)
71
72# define HAVE_IBMBGQ 1
73# define MADNESS_HAVE_POWERPC_64 1
74
75#endif /* System check */
76
77
78/* Processor and instruction set checks */
79#if defined(__x86_64__) || defined(_M_X64)
80 /* x86 64-bit */
81# define X86_64 1
82# define MADNESS_HAVE_X86_64 1
83
84/* http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130819/086386.html */
85/* AVX-512 where F=foundational; ER, CD and PF extensions may also be useful some day. */
86# if defined(__AVX512F__)
87# define MADNESS_HAVE_AVX512 1
88# endif
89
90# if defined(__AVX2__)
91# define MADNESS_HAVE_AVX2 1
92# endif
93
94# if defined(__AVX__)
95# define MADNESS_HAVE_AVX 1
96# endif
97
98# if defined(__SSE4_2__)
99# define MADNESS_HAVE_SSE42 1
100# endif
101
102# if defined(__SSE4_1__)
103# define MADNESS_SSE41 1
104# endif
105
106# if defined(__SSSE3__)
107# define MADNESS_HAVE_SSSE3 1
108# endif
109
110# if defined(__SSE3__)
111# define MADNESS_HAVE_SSE3 1
112# endif
113
114/* x86 64-bit always has SSE2 */
115# define MADNESS_HAVE_SSE2 1
116# define MADNESS_HAVE_SSE 1
117
118# if defined(_M_IX86_FP) /* Defined in MS compiler. 1 = SSE, 2: SSE2 */
119
120# if _M_IX86_FP == 2
121# define MADNESS_HAVE_SSE2 2
122# elif _M_IX86_FP == 1
123# define MADNESS_HAVE_SSE 1
124# endif
125
126# endif /* defined(_M_IX86_FP) */
127
128
129#elif defined(__i386) || defined(_M_IX86)
130 /* x86 32-bit */
131# define X86_32
132# define MADNESS_HAVE_X86_32
133
134# if defined(__SSE2__)
135# define MADNESS_HAVE_SSE2 2
136# endif
137
138# if defined(__SSE__)
139# define MADNESS_HAVE_SSE 1
140# endif
141
142#endif /* x86 */
143
144
145#if defined(__powerpc__) || defined(__ppc__) || defined(__PPC__)
146 /* POWER PC */
147
148# if defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \
149 defined(__64BIT__) || defined(_LP64) || defined(__LP64__)
150 /* POWER PC 64-bit */
151# define MADNESS_HAVE_POWERPC_64 1
152
153# else
154 /* POWER PC 32-bit */
155# define MADNESS_HAVE_POWERPC_32 1
156
157# endif
158
159#endif /* POWERPC */
160
161/* ----------- compiler checks -------------------*/
162/*
163 * - copied from https://github.com/ValeevGroup/tiledarray/blob/master/src/TiledArray/config.h.in
164 * - ids taken from CMake
165 * - macros are discussed at https://sourceforge.net/p/predef/wiki/Compilers/
166*/
167#define MADNESS_CXX_COMPILER_ID_GNU 0
168#define MADNESS_CXX_COMPILER_ID_Clang 1
169#define MADNESS_CXX_COMPILER_ID_AppleClang 2
170#define MADNESS_CXX_COMPILER_ID_XLClang 3
171#define MADNESS_CXX_COMPILER_ID_Intel 4
172#if defined(__INTEL_COMPILER_BUILD_DATE) /* macros like __ICC and even __INTEL_COMPILER can be affected by command options like -no-icc */
173# define MADNESS_CXX_COMPILER_ID MADNESS_CXX_COMPILER_ID_Intel
174# define MADNESS_CXX_COMPILER_IS_ICC 1
175#endif
176#if defined(__clang__) && !defined(MADNESS_CXX_COMPILER_IS_ICC)
177# define MADNESS_CXX_COMPILER_IS_CLANG 1
178# if defined(__apple_build_version__)
179# define MADNESS_CXX_COMPILER_ID MADNESS_CXX_COMPILER_ID_AppleClang
180# elif defined(__ibmxl__)
181# define MADNESS_CXX_COMPILER_ID MADNESS_CXX_COMPILER_ID_XLClang
182# else
183# define MADNESS_CXX_COMPILER_ID MADNESS_CXX_COMPILER_ID_Clang
184# endif
185#endif
186#if defined(__GNUG__) && !defined(MADNESS_CXX_COMPILER_IS_ICC) && !defined(MADNESS_CXX_COMPILER_IS_CLANG)
187# define MADNESS_CXX_COMPILER_ID MADNESS_CXX_COMPILER_ID_GNU
188# define MADNESS_CXX_COMPILER_IS_GCC 1
189#endif
190
191/* ----------- preprocessor checks ---------------*/
192#define MADNESS_PRAGMA(x) _Pragma(#x)
193/* same as MADNESS_PRAGMA(x), but expands x */
194#define MADNESS_XPRAGMA(x) MADNESS_PRAGMA(x)
195/* "concats" a and b with a space in between */
196#define MADNESS_CONCAT(a,b) a b
197#ifdef MADNESS_CXX_COMPILER_IS_CLANG
198#define MADNESS_PRAGMA_CLANG(x) MADNESS_XPRAGMA( MADNESS_CONCAT(clang,x) )
199#else
200#define MADNESS_PRAGMA_CLANG(x)
201#endif
202#ifdef MADNESS_CXX_COMPILER_IS_GCC
203#define MADNESS_PRAGMA_GCC(x) MADNESS_XPRAGMA( MADNESS_CONCAT(GCC,x) )
204#else
205#define MADNESS_PRAGMA_GCC(x)
206#endif
207
208/* ----------- end of preprocessor checks ---------*/
209
210#endif // MADNESS_MADNESS_CONFIG_H__INCLUDED