/[escript]/branches/trilinos_from_5897/site_scons/dependencies.py
ViewVC logotype

Contents of /branches/trilinos_from_5897/site_scons/dependencies.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5914 - (show annotations)
Wed Feb 10 06:15:12 2016 UTC (2 years, 7 months ago) by caltinay
File MIME type: text/x-python
File size: 23754 byte(s)
Added support for more Trilinos preconditioners and solvers.
Need to think about how to deal with the wealth of options!

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2016 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Open Software License version 3.0
9 # http://www.opensource.org/licenses/osl-3.0.php
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2016 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Open Software License version 3.0
23 http://www.opensource.org/licenses/osl-3.0.php"""
24 __url__="https://launchpad.net/escript-finley"
25
26 import os, re, sys
27 from distutils import sysconfig
28 from subprocess import PIPE, Popen
29 from SCons.Script.SConscript import Configure
30 from site_init import findLibWithHeader, detectModule
31
32 REQUIRED_BOOST = (1, 46)
33
34 def checkCompiler(env):
35 conf = Configure(env.Clone())
36 if 'CheckCXX' in dir(conf): # exists since scons 1.1.0
37 if not conf.CheckCXX():
38 print("Cannot run C++ compiler '%s' (check config.log)" % (env['CXX']))
39 env.Exit(1)
40 else:
41 if not conf.CheckFunc('printf', language='c++'):
42 print("Cannot run C++ compiler '%s' (check config.log)" % (env['CXX']))
43 env.Exit(1)
44
45 conf.env['buildvars']['cxx']=conf.env['CXX']
46
47 if conf.CheckFunc('gethostname', language='c++'):
48 conf.env.Append(CPPDEFINES = ['HAVE_GETHOSTNAME'])
49
50 if conf.CheckCXXHeader('byteswap.h'):
51 checkhdr="""#include <byteswap.h>
52 #define SCbswap32() {int x=0;bswap_32(x);}"""
53 if conf.CheckFunc('SCbswap32', header=checkhdr, language='c++'):
54 conf.env.Append(CPPDEFINES = ['HAVE_BYTESWAP_H'])
55 if conf.CheckCXXHeader('sys/endian.h'):
56 conf.env.Append(CPPDEFINES = ['HAVE_SYS_ENDIAN_H'])
57 if conf.CheckCXXHeader('libkern/OSByteOrder.h'):
58 conf.env.Append(CPPDEFINES = ['HAVE_OSBYTEORDER_H'])
59
60 return conf.Finish()
61
62 def checkPython(env):
63 # First we check to see if the config file has specified
64 # where to find the file. Ideally, this should be automatic
65 # but we need to deal with the case where python is not in its INSTALL
66 # directory.
67 # Use the python scons is running
68 if env['pythoncmd']=='python':
69 python_inc_path=sysconfig.get_python_inc()
70 if env['IS_WINDOWS']:
71 python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')
72 elif env['PLATFORM']=='darwin':
73 python_lib_path=sysconfig.get_config_var('LIBPL')
74 else:
75 python_lib_path=sysconfig.get_config_var('LIBDIR')
76
77 #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux
78 if env['IS_WINDOWS']:
79 python_libs=['python%s%s'%(sys.version_info[0], sys.version_info[1])]
80 else:
81 python_libs=['python'+sysconfig.get_python_version()]
82
83 env['buildvars']['python']=sys.executable
84 env['buildvars']['python_version']=str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])
85
86 #if we want to use a python other than the one scons is running
87 else:
88 initstring='from __future__ import print_function;from distutils import sysconfig;'
89 if env['pythonlibname']!='':
90 python_libs=env['pythonlibname']
91 else: # work it out by calling python
92 if ['IS_WINDOWS']:
93 cmd='print("python%s%s"%(sys.version_info[0], sys.version_info[1]))'
94 else:
95 cmd='print("python"+sysconfig.get_python_version())'
96 p=Popen([env['pythoncmd'], '-c', initstring+cmd], stdout=PIPE)
97 python_libs=p.stdout.readline()
98 if env['usepython3']: # This is to convert unicode str into py2 string
99 python_libs=python_libs.encode() # If scons runs on py3 then this must be rethought
100 p.wait()
101 python_libs=python_libs.strip()
102
103 # Now we know whether we are using python3 or not
104 p=Popen([env['pythoncmd'], '-c', initstring+'print(sysconfig.get_python_inc())'], stdout=PIPE)
105 python_inc_path=p.stdout.readline()
106 if env['usepython3']:
107 python_inc_path=python_inc_path.encode()
108 p.wait()
109 python_inc_path=python_inc_path.strip()
110 if env['IS_WINDOWS']:
111 cmd="import os;os.path.join(sysconfig.get_config_var('prefix'), 'libs')"
112 elif env['PLATFORM']=='darwin':
113 cmd="sysconfig.get_config_var(\"LIBPL\")"
114 else:
115 cmd="sysconfig.get_config_var(\"LIBDIR\")"
116
117 p=Popen([env['pythoncmd'], '-c', initstring+'print('+cmd+')'], stdout=PIPE)
118 python_lib_path=p.stdout.readline()
119 if env['usepython3']:
120 python_lib_path=python_lib_path.decode()
121 p.wait()
122 python_lib_path=python_lib_path.strip()
123
124 env['buildvars']['python']=env['pythoncmd']
125 p=Popen([env['pythoncmd'], '-c', 'from __future__ import print_function;import sys;print(str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2]))'], stdout=PIPE)
126 verstring=p.stdout.readline().strip()
127 p.wait()
128 env['buildvars']['python_version']=verstring
129
130 # Check for an override from the config file.
131 # Ideally, this should be automatic but we need to deal with the case
132 # where python is not in its INSTALL directory
133 if env['pythonlibpath']!='':
134 python_lib_path=env['pythonlibpath']
135
136 if env['pythonincpath']!='':
137 python_inc_path=env['pythonincpath']
138
139 conf = Configure(env.Clone())
140
141 if env['sysheaderopt'] == '':
142 conf.env.AppendUnique(CPPPATH = [python_inc_path])
143 else:
144 conf.env.Append(CCFLAGS = [env['sysheaderopt'], python_inc_path])
145
146 conf.env.AppendUnique(LIBPATH = [python_lib_path])
147 conf.env.AppendUnique(LIBS = python_libs)
148 # The wrapper script needs to find the libs
149 conf.env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], python_lib_path)
150
151 if not conf.CheckCXXHeader('Python.h'):
152 print("Cannot find python include files (tried 'Python.h' in directory %s)" % (python_inc_path))
153 env.Exit(1)
154 if not conf.CheckFunc('Py_Exit', language='c++'):
155 print("Cannot find python library method Py_Main (tried %s in directory %s)" % (python_libs, python_lib_path))
156 env.Exit(1)
157
158 return conf.Finish()
159
160 def checkCudaVersion(env):
161 # NVCC availability is already checked in the Tool file
162 p=Popen([env['NVCC'], '-V'], stdout=PIPE)
163 out=p.stdout.readlines()
164 env['nvcc_version']='(unknown version)'
165 p.wait()
166 for line in out:
167 if 'release' in line:
168 version=line[line.find('release'):].strip()
169 env['nvcc_version']=version
170 break
171 env['buildvars']['nvcc']=env['NVCC']
172 return env
173
174 def checkBoost(env):
175 boost_inc_path,boost_lib_path=findLibWithHeader(env, env['boost_libs'], 'boost/python.hpp', env['boost_prefix'], lang='c++')
176 if env['sysheaderopt'] == '':
177 env.AppendUnique(CPPPATH = [boost_inc_path])
178 else:
179 # This is required because we can't -isystem /usr/include since it
180 # breaks std includes
181 if os.path.normpath(boost_inc_path) == '/usr/include':
182 env.Append(CCFLAGS=[env['sysheaderopt'], os.path.join(boost_inc_path,'boost')])
183 else:
184 env.Append(CCFLAGS=[env['sysheaderopt'], boost_inc_path])
185
186 env.AppendUnique(LIBPATH = [boost_lib_path])
187 env.AppendUnique(LIBS = env['boost_libs'])
188 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], boost_lib_path)
189
190 # Try to extract the boost version from version.hpp
191 boosthpp=open(os.path.join(boost_inc_path, 'boost', 'version.hpp'))
192 boostversion='unknown'
193 for line in boosthpp:
194 ver=re.match(r'#define BOOST_VERSION (\d+)',line)
195 if ver:
196 boostversion=ver.group(1)
197 boostversion = int(boostversion)
198 maj = boostversion/100000
199 minor = (boostversion/100)%1000
200 sub = boostversion % 100
201 env['boost_version'] = "%d.%d.%d"%(maj,minor,sub)
202 if maj <= REQUIRED_BOOST[0] and minor < REQUIRED_BOOST[1]:
203 print("The boost version referenced must be at least version %d.%d "%REQUIRED_BOOST + "(have %d.%d.%d)"%(maj,minor,sub))
204 env.Exit(1)
205 boosthpp.close()
206 env['buildvars']['boost_inc_path']=boost_inc_path
207 env['buildvars']['boost_lib_path']=boost_lib_path
208 env['buildvars']['boostversion']=boostversion
209 return env
210
211 def checkNumpy(env):
212 if not detectModule(env, 'numpy'):
213 print("Cannot import numpy. If it is installed try setting your PYTHONPATH and probably %s"%env['LD_LIBRARY_PATH_KEY'])
214 env.Exit(1)
215
216 ## check for numpy header (optional)
217 conf = Configure(env.Clone())
218 if env['usepython3']:
219 # FIXME: This is until we can work out how to make the checks in python 3
220 conf.env['numpy_h']=False
221 else:
222 if conf.CheckCXXHeader(['Python.h','numpy/ndarrayobject.h']):
223 conf.env.Append(CPPDEFINES = ['HAVE_NUMPY_H'])
224 conf.env['numpy_h']=True
225 else:
226 conf.env['numpy_h']=False
227
228 return conf.Finish()
229
230 def checkCUDA(env):
231 try:
232 cuda_inc_path,cuda_lib_path=findLibWithHeader(env, 'cudart', 'thrust/version.h', env['cuda_prefix'], lang='c++')
233 env.AppendUnique(CPPPATH = [cuda_inc_path])
234 env.AppendUnique(LIBPATH = [cuda_lib_path])
235 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], cuda_lib_path)
236 env['cuda']=True
237 except:
238 env['cuda']=False
239 return env
240
241 def checkCppUnit(env):
242 try:
243 cppunit_inc_path,cppunit_lib_path=findLibWithHeader(env, env['cppunit_libs'], 'cppunit/TestFixture.h', env['cppunit_prefix'], lang='c++')
244 env.AppendUnique(CPPPATH = [cppunit_inc_path])
245 env.AppendUnique(LIBPATH = [cppunit_lib_path])
246 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], cppunit_lib_path)
247 env['cppunit']=True
248 except:
249 env['cppunit']=False
250 return env
251
252 def checkOptionalModules(env):
253 ######## scipy
254 if not detectModule(env, 'scipy'):
255 env['warnings'].append("Cannot import scipy. NetCDF sources will not be available for inversions.")
256
257 ######## pyproj
258 if not detectModule(env, 'pyproj'):
259 env['warnings'].append("Cannot import pyproj. Inversions may not work.")
260
261 ######## gdal
262 if not detectModule(env, 'gdal'):
263 env['warnings'].append("Cannot import gdal. Inversions will not honour WKT coordinate system information.")
264
265 ######## sympy
266 if not detectModule(env, 'sympy'):
267 env['warnings'].append("Cannot import sympy. Symbolic toolbox and nonlinear PDEs will not be available.")
268 else:
269 import sympy as sp
270 spVer=sp.__version__
271 spl=spVer.split('.')
272 if int(spl[0]) == 0 and int(spl[1]) < 7:
273 env['sympy']=False
274 env['warnings'].append("sympy version too old. Symbolic toolbox and nonlinear PDEs will not be available.")
275
276 ######## gmshpy
277 env['gmshpy'] = detectModule(env, 'gmshpy')
278
279 return env
280
281 def checkForTrilinos(env):
282 trilinos_inc_path=''
283 trilinos_lib_path=''
284 if env['trilinos']:
285 havelibs = (len(env['trilinos_libs']) > 0)
286 trilinos_inc_path,trilinos_lib_path=findLibWithHeader(env,
287 env['trilinos_libs'], 'Tpetra_CrsMatrix.hpp',
288 env['trilinos_prefix'], lang='c++', try_link=havelibs)
289 if not havelibs:
290 packages=['Tpetra','Kokkos','Belos','Amesos2','Zoltan2','Ifpack2','MueLu']
291 libs = []
292 for pk in packages:
293 # find out what libraries to link with...
294 makefile = os.path.join(trilinos_inc_path, 'Makefile.export.%s'%pk)
295 try:
296 for l in open(makefile, 'r').readlines():
297 if l.startswith("%s_LIBRARIES"%pk): # or l.startswith("Trilinos_TPL_LIBRARIES"):
298 lst = l.split('=')[1].strip().split()
299 lst = [e.replace('-l','',1) for e in lst]
300 libs.append(lst)
301 except Exception as e:
302 raise RuntimeError('Error reading Trilinos export Makefile\n%s'%(e))
303 env['trilinos_libs'] = libs
304
305 env.AppendUnique(CPPPATH = [trilinos_inc_path])
306 env.AppendUnique(LIBPATH = [trilinos_lib_path])
307 env.Append(CPPDEFINES = ['USE_TRILINOS'])
308 # Note that we do not add the libs globally
309 env['buildvars']['trilinos_inc_path']=trilinos_inc_path
310 env['buildvars']['trilinos_lib_path']=trilinos_lib_path
311 env['buildvars']['trilinos']=int(env['trilinos'])
312 return env
313
314 def checkOptionalLibraries(env):
315 ######## netCDF
316 netcdf_inc_path=''
317 netcdf_lib_path=''
318 if env['netcdf']:
319 netcdf_inc_path,netcdf_lib_path=findLibWithHeader(env, env['netcdf_libs'], 'netcdf.h', env['netcdf_prefix'], lang='c++')
320 env.AppendUnique(CPPPATH = [netcdf_inc_path])
321 env.AppendUnique(LIBPATH = [netcdf_lib_path])
322 env.AppendUnique(LIBS = env['netcdf_libs'])
323 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], netcdf_lib_path)
324 env.Append(CPPDEFINES = ['USE_NETCDF'])
325 env['buildvars']['netcdf_inc_path']=netcdf_inc_path
326 env['buildvars']['netcdf_lib_path']=netcdf_lib_path
327 env['buildvars']['netcdf']=int(env['netcdf'])
328
329 ######## PAPI
330 papi_inc_path=''
331 papi_lib_path=''
332 if env['papi']:
333 papi_inc_path,papi_lib_path=findLibWithHeader(env, env['papi_libs'], 'papi.h', env['papi_prefix'], lang='c++')
334 env.AppendUnique(CPPPATH = [papi_inc_path])
335 env.AppendUnique(LIBPATH = [papi_lib_path])
336 env.AppendUnique(LIBS = env['papi_libs'])
337 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], papi_lib_path)
338 env.Append(CPPDEFINES = ['PAPI'])
339 env['buildvars']['papi_inc_path']=papi_inc_path
340 env['buildvars']['papi_lib_path']=papi_lib_path
341 env['buildvars']['papi']=int(env['papi'])
342
343 ######## MKL
344 mkl_inc_path=''
345 mkl_lib_path=''
346 if env['mkl']:
347 mkl_inc_path,mkl_lib_path=findLibWithHeader(env, env['mkl_libs'], 'mkl_pardiso.h', env['mkl_prefix'], lang='c++')
348 env.AppendUnique(CPPPATH = [mkl_inc_path])
349 env.AppendUnique(LIBPATH = [mkl_lib_path])
350 env.AppendUnique(LIBS = env['mkl_libs'])
351 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], mkl_lib_path)
352 env.Append(CPPDEFINES = ['MKL'])
353 env['buildvars']['mkl_inc_path']=mkl_inc_path
354 env['buildvars']['mkl_lib_path']=mkl_lib_path
355 env['buildvars']['mkl']=int(env['mkl'])
356
357 ######## UMFPACK
358 umfpack_inc_path=''
359 umfpack_lib_path=''
360 if env['umfpack']:
361 umfpack_inc_path,umfpack_lib_path=findLibWithHeader(env, env['umfpack_libs'], 'umfpack.h', env['umfpack_prefix'], lang='c++')
362 env.AppendUnique(CPPPATH = [umfpack_inc_path])
363 env.AppendUnique(LIBPATH = [umfpack_lib_path])
364 env.AppendUnique(LIBS = env['umfpack_libs'])
365 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], umfpack_lib_path)
366 env.Append(CPPDEFINES = ['USE_UMFPACK'])
367 env['buildvars']['umfpack_inc_path']=umfpack_inc_path
368 env['buildvars']['umfpack_lib_path']=umfpack_lib_path
369 env['buildvars']['umfpack']=int(env['umfpack'])
370
371 ######## LAPACK
372 if env['lapack']=='mkl' and not env['mkl']:
373 print("mkl_lapack requires MKL!")
374 env.Exit(1)
375
376 env['uselapack'] = env['lapack']!='none'
377 lapack_inc_path=''
378 lapack_lib_path=''
379 if env['uselapack']:
380 if env['longindices']:
381 print("Sorry, cannot use LAPACK with 64-bit index types. Set longindices to False or disable LAPACK.")
382 env.Exit(1)
383 header='clapack.h'
384 if env['lapack']=='mkl':
385 env.AppendUnique(CPPDEFINES = ['MKL_LAPACK'])
386 header='mkl_lapack.h'
387 lapack_inc_path,lapack_lib_path=findLibWithHeader(env, env['lapack_libs'], header, env['lapack_prefix'], lang='c++')
388 env.AppendUnique(CPPPATH = [lapack_inc_path])
389 env.AppendUnique(LIBPATH = [lapack_lib_path])
390 env.AppendUnique(LIBS = env['lapack_libs'])
391 env.Append(CPPDEFINES = ['USE_LAPACK'])
392 env['buildvars']['lapack_inc_path']=lapack_inc_path
393 env['buildvars']['lapack_lib_path']=lapack_lib_path
394 env['buildvars']['lapack']=env['lapack']
395
396 ######## Silo
397 silo_inc_path=''
398 silo_lib_path=''
399 if env['silo']:
400 silo_inc_path,silo_lib_path=findLibWithHeader(env, env['silo_libs'], 'silo.h', env['silo_prefix'], lang='c++')
401 env.AppendUnique(CPPPATH = [silo_inc_path])
402 env.AppendUnique(LIBPATH = [silo_lib_path])
403 # Note that we do not add the libs since they are only needed for the
404 # weipa library and tools.
405 #env.AppendUnique(LIBS = [env['silo_libs']])
406 env['buildvars']['silo_inc_path']=silo_inc_path
407 env['buildvars']['silo_lib_path']=silo_lib_path
408 env['buildvars']['silo']=int(env['silo'])
409
410 ######## VisIt
411 visit_inc_path=''
412 visit_lib_path=''
413 if env['visit']:
414 visit_inc_path,visit_lib_path=findLibWithHeader(env, env['visit_libs'], 'VisItControlInterface_V2.h', env['visit_prefix'], lang='c++')
415 env.AppendUnique(CPPPATH = [visit_inc_path])
416 env.AppendUnique(LIBPATH = [visit_lib_path])
417 env['buildvars']['visit_inc_path']=visit_inc_path
418 env['buildvars']['visit_lib_path']=visit_lib_path
419 env['buildvars']['visit']=int(env['visit'])
420
421 ######## MPI
422 if env['mpi']=='no':
423 env['mpi']='none'
424
425 env['usempi'] = env['mpi']!='none'
426 mpi_inc_path=''
427 mpi_lib_path=''
428 if env['usempi']:
429 mpi_inc_path,mpi_lib_path=findLibWithHeader(env, env['mpi_libs'], 'mpi.h', env['mpi_prefix'], lang='c++')
430 env.AppendUnique(CPPPATH = [mpi_inc_path])
431 env.AppendUnique(LIBPATH = [mpi_lib_path])
432 env.AppendUnique(LIBS = env['mpi_libs'])
433 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], mpi_lib_path)
434 env.Append(CPPDEFINES = ['ESYS_MPI', 'MPI_NO_CPPBIND', 'MPICH_IGNORE_CXX_SEEK'])
435 # NetCDF 4.1 defines MPI_Comm et al. if MPI_INCLUDED is not defined!
436 # On the other hand MPT and OpenMPI don't define the latter so we have
437 # to do that here
438 if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']:
439 env.Append(CPPDEFINES = ['MPI_INCLUDED'])
440 env['buildvars']['mpi_inc_path']=mpi_inc_path
441 env['buildvars']['mpi_lib_path']=mpi_lib_path
442 env['buildvars']['mpi']=env['mpi']
443
444 ######## BOOMERAMG
445 if env['mpi'] == 'none': env['boomeramg'] = False
446 boomeramg_inc_path=''
447 boomeramg_lib_path=''
448 if env['boomeramg']:
449 boomeramg_inc_path,boomeramg_lib_path=findLibWithHeader(env, env['boomeramg_libs'], 'HYPRE.h', env['boomeramg_prefix'], lang='c++')
450 env.AppendUnique(CPPPATH = [boomeramg_inc_path])
451 env.AppendUnique(LIBPATH = [boomeramg_lib_path])
452 env.AppendUnique(LIBS = env['boomeramg_libs'])
453 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], boomeramg_lib_path)
454 env.Append(CPPDEFINES = ['BOOMERAMG'])
455 env['buildvars']['boomeramg_inc_path']=boomeramg_inc_path
456 env['buildvars']['boomeramg_lib_path']=boomeramg_lib_path
457 env['buildvars']['boomeramg']=int(env['boomeramg'])
458
459 ######## ParMETIS
460 if not env['usempi']: env['parmetis'] = False
461 parmetis_inc_path=''
462 parmetis_lib_path=''
463 if env['parmetis']:
464 parmetis_inc_path,parmetis_lib_path=findLibWithHeader(env, env['parmetis_libs'], 'parmetis.h', env['parmetis_prefix'], lang='c++')
465 env.AppendUnique(CPPPATH = [parmetis_inc_path])
466 env.AppendUnique(LIBPATH = [parmetis_lib_path])
467 env.AppendUnique(LIBS = env['parmetis_libs'])
468 env.PrependENVPath(env['LD_LIBRARY_PATH_KEY'], parmetis_lib_path)
469
470 # Try to extract the parmetis version from parmetis.h
471 header=open(os.path.join(parmetis_inc_path, 'parmetis.h')).readlines()
472 major,minor,sub = None,None,None
473 for line in header:
474 ver=re.match(r'#define PARMETIS_MAJOR_VERSION\s*(\d+)',line)
475 if ver:
476 major = int(ver.group(1))
477 continue
478 ver=re.match(r'#define PARMETIS_MINOR_VERSION\s*(\d+)',line)
479 if ver:
480 minor = int(ver.group(1))
481 continue
482 ver=re.match(r'#define PARMETIS_SUBMINOR_VERSION\s*(\d+)',line)
483 if ver:
484 sub = int(ver.group(1))
485 continue
486 if major is not None:
487 env['parmetis_version'] = "%d.%d.%d"%(major,minor,0 if sub is None else sub)
488 if env['longindices']:
489 # ParMETIS version 3.x does not support 64-bit indices
490 if major < 4:
491 print("Sorry, cannot use ParMETIS version < 4.0 with 64-bit index types. Set longindices to False or disable ParMETIS.")
492 env.Exit(1)
493 else:
494 # check if ParMETIS was built with 64-bit indices
495 conf = Configure(env.Clone())
496 idxsize=conf.CheckTypeSize('idx_t', '#include <parmetis.h>', 'C++')
497 if idxsize != 8:
498 print("Sorry, ParMETIS was not compiled with 64-bit indices. Set longindices to False or disable/rebuild ParMETIS.")
499 env.Exit(1)
500 else:
501 env['parmetis_version'] = "unknown"
502
503 env.Append(CPPDEFINES = ['USE_PARMETIS'])
504 env['buildvars']['parmetis_inc_path']=parmetis_inc_path
505 env['buildvars']['parmetis_lib_path']=parmetis_lib_path
506 env['buildvars']['parmetis']=int(env['parmetis'])
507
508 ######## gmsh (for tests)
509 env['gmsh'] = False
510 if env['IS_WINDOWS']:
511 try:
512 p=Popen(['gmsh', '-info'], stderr=PIPE)
513 _,e=p.communicate()
514 if e.split().count("MPI"):
515 env['gmsh']='m'
516 else:
517 env['gmsh']='s'
518 p.wait()
519 except OSError:
520 pass
521 else:
522 which = Popen(['which', 'gmsh'], stdout=PIPE)
523 path,_ = which.communicate()
524 if which.wait() == 0:
525 cmd = ['ldd', path[:-1]]
526 if env['IS_OSX']:
527 cmd = ['otool','-L', path[:-1]]
528 try:
529 p=Popen(cmd, stdout=PIPE)
530 gmshlibs,_ = p.communicate()
531 ret = p.wait()
532 if ret == 0 and 'libmpi' in gmshlibs:
533 env['gmsh'] = 'm'
534 else:
535 env['gmsh'] = 's'
536 except OSError:
537 pass
538
539 ######## boost::iostreams
540 if env['compressed_files']:
541 try:
542 boost_inc_path, boost_lib_path = findLibWithHeader(env, env['compression_libs'], 'boost/iostreams/filter/gzip.hpp', env['boost_prefix'], lang='c++')
543 env.Append(CPPDEFINES = ['USE_BOOSTIO'])
544 env.AppendUnique(LIBS = env['compression_libs'])
545 except RuntimeError as e:
546 env['compressed_files'] = False
547 env['buildvars']['compressed_files']=int(env['compressed_files'])
548
549 ######## Trilinos
550 env = checkForTrilinos(env)
551 return env
552
553 def checkPDFLatex(env):
554 if 'PDF' in dir(env) and '.tex' in env.PDF.builder.src_suffixes(env):
555 env['pdflatex']=True
556 else:
557 env['pdflatex']=False
558 return env
559
560

  ViewVC Help
Powered by ViewVC 1.1.26