wscript 3.66 KB
Newer Older
1
2
#!/usr/bin/env python
# encoding: utf-8
3
4
import sys
sys.path.insert(0, './waf_tools')
5

6
7
VERSION = '0.0.1'
APPNAME = 'limbo'
8
9
10
11

srcdir = '.'
blddir = 'build'

12
import glob
13
14
import os
import subprocess
15
import limbo
16
from waflib.Build import BuildContext
17

18

19
20
21
22
23
def options(opt):
        opt.load('compiler_cxx boost waf_unit_test')
        opt.load('compiler_c')
        opt.load('eigen')
        opt.load('tbb')
24
        opt.load('mkl')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
25
        opt.load('sferes')
26
        opt.load('limbo')
27
28
        opt.load('openmp')
        #opt.load('ode')
29
        opt.add_option('--exp', type='string', help='exp(s) to build, separate by comma', dest='exp')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
30
31
        opt.add_option('--qsub', type='string', help='config file (json) to submit to torque', dest='qsub')
        opt.add_option('--oar', type='string', help='config file (json) to submit to oar', dest='oar')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
32
        opt.load('xcode')
33
34
35
        for i in glob.glob('exp/*'):
                opt.recurse(i)

36

37
def configure(conf):
38
        conf.load('compiler_cxx boost waf_unit_test')
39
40
41
        conf.load('compiler_c')
        conf.load('eigen')
        conf.load('tbb')
42
        conf.load('mkl')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
43
        conf.load('sferes')
44
        conf.load('openmp')
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
45
        conf.load('xcode')
46

47
48
49
        if conf.env.CXX_NAME in ["icc", "icpc"]:
            common_flags = "-Wall -std=c++11"
            opt_flags = " -O3 -xHost  -march=native -mtune=native -unroll -fma -g"
50
        else:
51
52
53
54
55
            if int(conf.env['CC_VERSION'][0]+conf.env['CC_VERSION'][1]) < 47:
                common_flags = "-Wall -std=c++0x"
            else:
                common_flags = "-Wall -std=c++11"
            opt_flags = " -O3 -march=native -g"
56

57
        conf.check_boost(lib='serialization filesystem \
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
58
            system unit_test_framework program_options \
59
            graph thread', min_version='1.39')
60
61
        conf.check_eigen()
        conf.check_tbb()
62
63
        conf.check_openmp()
        conf.check_mkl()
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
64
        conf.check_sferes()
65
        #conf.check_ode()
66
        if conf.is_defined('USE_TBB'):
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
67
                common_flags += " -DUSE_TBB"
68

Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
69
        if conf.is_defined('USE_SFERES'):
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
70
                common_flags += " -DUSE_SFERES -DSFERES_FAST_DOMSORT"
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
71

72
        if conf.env['CXXFLAGS_ODE']:
73
                common_flags += ' ' + conf.env['CXXFLAGS_ODE']
74

75
76
        all_flags = common_flags + opt_flags
        conf.env['CXXFLAGS'] = conf.env['CXXFLAGS'] + all_flags.split(' ')
77
78
        print conf.env['CXXFLAGS']

Jean-Baptiste Mouret's avatar
misc    
Jean-Baptiste Mouret committed
79
80
81
82
83
84
        if conf.options.exp:
                for i in conf.options.exp.split(','):
                        print 'configuring for exp: ' + i
                        conf.recurse('exp/' + i)


85
def build(bld):
86
87
88
89
90
    bld.recurse('src/')
    if bld.options.exp:
        for i in bld.options.exp.split(','):
            print 'Building exp: ' + i
            bld.recurse('exp/' + i)
91
92
        from waflib.Tools import waf_unit_test
        bld.add_post_fun(waf_unit_test.summary)
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
93

94

95
def build_extensive_tests(ctx):
96
    ctx.recurse('src/')
97
98
99
    ctx.recurse('src/tests')


100
101
102
103
def submit_extensive_tests(ctx):
    for fullname in glob.glob('build/src/tests/combinations/*'):
        if os.path.isfile(fullname) and os.access(fullname, os.X_OK):
            fpath, fname = os.path.split(fullname)
104
            s = "cd " + fpath + ";oarsub -l /nodes=1/core=2,walltime=00:15:00 -n " + fname + " -O " + fname + ".stdout.%jobid%.log -E " + fname + ".stderr.%jobid%.log ./" + fname
105
106
107
108
            retcode = subprocess.call(s, shell=True, env=None)
            print "oarsub returned:" + str(retcode)


109
def shutdown(ctx):
110
111
    if ctx.options.qsub:
        limbo.qsub(ctx.options.qsub)
Jean-Baptiste Mouret's avatar
Jean-Baptiste Mouret committed
112
113
    if ctx.options.oar:
        limbo.oar(ctx.options.oar)
114
115
116
117
118


class BuildExtensiveTestsContext(BuildContext):
    cmd = 'build_extensive_tests'
    fun = 'build_extensive_tests'