forked from KaHIP/KaHIP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
126 lines (107 loc) · 4.54 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#/******************************************************************************
# * SConstruct
# *
# * Source of KaHIP -- Karlsruhe High Quality Partitioning.
# *
# ******************************************************************************
# * Copyright (C) 2013 Christian Schulz <[email protected]>
# *
# * This program is free software: you can redistribute it and/or modify it
# * under the terms of the GNU General Public License as published by the Free
# * Software Foundation, either version 3 of the License, or (at your option)
# * any later version.
# *
# * This program is distributed in the hope that it will be useful, but WITHOUT
# * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# * more details.
# *
# * You should have received a copy of the GNU General Public License along with
# * this program. If not, see <http://www.gnu.org/licenses/>.
# *****************************************************************************/
# scons build file for the KaHIP.
#
# You can build it in the following variants:
#
# optimized no debug symbols, no assertions, optimization.
# optimized_output no debug symbols, no assertions, optimization -- more output on console.
#
# scons variant=${variant} program=${program}
import os
import platform
import sys
# Get the current platform.
SYSTEM = platform.uname()[0]
HOST = platform.uname()[1]
# Get shortcut to $HOME.
HOME = os.environ['HOME']
def GetEnvironment():
"""Get environment variables from command line and environment.
Exits on errors.
Returns
Environment with the configuration from the command line.
"""
opts = Variables()
opts.Add('variant', 'the variant to build, optimized or optimized with output', 'optimized')
opts.Add('program', 'program or interface to compile', 'kaffpa')
env = Environment(options=opts, ENV=os.environ)
if not env['variant'] in ['optimized','optimized_output','debug']:
print 'Illegal value for variant: %s' % env['variant']
sys.exit(1)
if not env['program'] in ['kaffpa', 'kaffpaE', 'partition_to_vertex_separator','library','graphchecker']:
print 'Illegal value for program: %s' % env['program']
sys.exit(1)
# Special configuration for 64 bit machines.
if platform.architecture()[0] == '64bit':
env.Append(CPPFLAGS=['-DPOINTER64=1'])
return env
# Get the common environment.
env = GetEnvironment()
env.Append(CPPPATH=['../extern/argtable-2.10/include'])
env.Append(CPPPATH=['./lib'])
env.Append(CPPPATH=['./lib/tools'])
env.Append(CPPPATH=['./lib/partition'])
env.Append(CPPPATH=['./lib/io'])
env.Append(CPPPATH=['./lib/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/'])
env.Append(LIBPATH=['../extern/argtable-2.10/lib'])
env.Append(CPPPATH=['../lib'])
env.Append(CPPPATH=['../lib/tools'])
env.Append(CPPPATH=['../lib/partition'])
env.Append(CPPPATH=['../lib/io'])
env.Append(CPPPATH=['../lib/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/'])
env.Append(LIBPATH=['../../extern/argtable-2.10/lib'])
env.Append(CPPPATH=['/usr/include/openmpi/'])
conf = Configure(env)
if SYSTEM == 'Darwin':
env.Append(CPPPATH=['/opt/local/include/','../include'])
env.Append(LIBPATH=['/opt/local/lib/'])
env.Append(LIBPATH=['/opt/local/lib/openmpi/'])
# homebrew related paths
env.Append(LIBPATH=['/usr/local/lib/'])
env.Append(LIBPATH=['/usr/local/lib/openmpi/'])
#by D. Luxen
if not conf.CheckLibWithHeader('argtable2', 'argtable2.h', 'CXX'):
print "argtable library not found. Exiting"
Exit(-1)
if not conf.CheckCXXHeader('mpi.h'):
print "openmpi header not found. Exiting"
Exit(-1)
#
#
env.Append(CXXFLAGS = '-fopenmp')
# Apply variant specific settings.
if env['variant'] == 'optimized':
env.Append(CXXFLAGS = '-DNDEBUG -Wall -funroll-loops -fno-stack-limit -O3')
env.Append(CCFLAGS = '-O3 -DNDEBUG -funroll-loops')
elif env['variant'] == 'optimized_output':
# A little bit more output on the console
env.Append(CXXFLAGS = ' -DNDEBUG -funroll-loops -Wall -fno-stack-limit -O3 ')
env.Append(CCFLAGS = '-O3 -DNDEBUG -DKAFFPAOUTPUT ')
else:
env.Append(CXXFLAGS = ' -DNDEBUG -Wall -funroll-loops -fno-stack-limit -O3')
env.Append(CCFLAGS = '-O3 -DNDEBUG -funroll-loops ')
if SYSTEM != 'Darwin':
env.Append(CXXFLAGS = '-march=native')
env.Append(CCFLAGS = '-march=native')
# Execute the SConscript.
SConscript('SConscript', exports=['env'],variant_dir=env['variant'], duplicate=False)