forked from sferes2/sferes2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tbb.py
55 lines (45 loc) · 1.51 KB
/
tbb.py
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
#! /usr/bin/env python
# encoding: utf-8
# JB Mouret - 2009
"""
Quick n dirty tbb detection
"""
import os, glob, types
import Options, Configure
def detect_tbb(conf):
env = conf.env
opt = Options.options
if Options.options.no_tbb:
print "TBB (multicore) is disabled"
return 0
if Options.options.tbb:
conf.env['CPPPATH_TBB'] = [Options.options.tbb + '/include']
conf.env['LIBPATH_TBB'] = [Options.options.tbb + '/lib']
else:
conf.env['CPPPATH_TBB'] = ['/opt/intel/include']
conf.env['LIBPATH_TBB'] = ['/opt/intel/lib']
res = Configure.find_file('tbb/parallel_for.h', conf.env['CPPPATH_TBB']+['/usr/include', '/usr/local/include'])
conf.check_message('header','tbb/parallel_for.h', (res != '') , res)
if (res == '') :
return 0
if Options.options.apple:
res = Configure.find_file('libtbb.dylib', conf.env['LIBPATH_TBB'] + ['/usr/lib', '/usr/local/lib'])
else:
res = Configure.find_file('libtbb.so', conf.env['LIBPATH_TBB'] + ['/usr/lib', '/usr/local/lib'])
conf.check_message('library','libtbb', (res != ''), res)
if (res == '') :
return 0
conf.env['LIB_TBB'] = ['tbb']
return 1
def detect(conf):
tbb_found = detect_tbb(conf)
if tbb_found != 0:
conf.env['TBB_ENABLED'] = True
else:
conf.env['TBB_ENABLED'] = False
conf.env['LIB_TBB'] = []
return detect_tbb(conf)
def set_options(opt):
opt.add_option('--tbb', type='string', help='path to tbb', dest='tbb')
opt.add_option('--no-tbb', default=False, action='store_true',
help='disable tbb (multicore)', dest='no_tbb')