author | Tom Henderson <tomh@tomh.org> |
Thu, 01 Oct 2015 11:07:22 -0700 | |
changeset 11677 | 1e2add816314 |
parent 10476 | 8abf67214c5d |
permissions | -rw-r--r-- |
6113
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
1 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
2 |
import sys |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
3 |
import subprocess |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9173
diff
changeset
|
4 |
|
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9173
diff
changeset
|
5 |
from waflib import Options |
7498
643cfe62eabf
Don't traceback on missing mpic++
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
6 |
from waflib.Errors import WafError |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
7 |
|
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
8 |
def configure(conf): |
7540
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
9 |
if Options.options.enable_mpi: |
7542
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
10 |
# try to detect openmpi installation |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
11 |
mpi = conf.check_cfg(path='mpic++', args='-showme', |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
12 |
package='', uselib_store='MPI', mandatory=False) |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
13 |
if mpi: |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
14 |
conf.env.append_value('DEFINES_MPI', 'NS3_OPENMPI') |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
15 |
else: |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
16 |
# try the MPICH2 flags |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
17 |
mpi = conf.check_cfg(path='mpic++', args='-compile-info -link-info', |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
18 |
package='', uselib_store='MPI', mandatory=False) |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
19 |
if mpi: |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
20 |
conf.env.append_value('DEFINES_MPI', 'NS3_MPICH') |
5351a9cdb84b
Bug 1137 - mpi module is hard-coded for openmpi
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7540
diff
changeset
|
21 |
if mpi: |
7540
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
22 |
conf.env.append_value('DEFINES_MPI', 'NS3_MPI') |
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
23 |
conf.env['ENABLE_MPI'] = True |
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
24 |
for libpath in conf.env.LIBPATH_MPI: |
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
25 |
if 'mpi' in libpath: |
9173
513f8ec65729
bug 1525 Linker error with mpi on Mac 10.8
Brian Swenson <bswenson3@gatech.edu>
parents:
7542
diff
changeset
|
26 |
conf.env.append_value('LINKFLAGS_MPI', '-Wl,-rpath,'+libpath) |
7540
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
27 |
conf.report_optional_feature("mpi", "MPI Support", True, '') |
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
28 |
else: |
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
29 |
conf.report_optional_feature("mpi", "MPI Support", False, 'mpic++ not found') |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
30 |
else: |
7540
98a60a822ae5
Overhaul mpi detection logic, add -Wl,-rpath option for Fedora
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7525
diff
changeset
|
31 |
conf.report_optional_feature("mpi", "MPI Support", False, 'option --enable-mpi not selected') |
6113
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
32 |
|
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
33 |
|
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
34 |
def build(bld): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7086
diff
changeset
|
35 |
env = bld.env |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
36 |
sim = bld.create_ns3_module('mpi', ['core', 'network']) |
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
37 |
sim.source = [ |
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
38 |
'model/distributed-simulator-impl.cc', |
10476 | 39 |
'model/granted-time-window-mpi-interface.cc', |
7085 | 40 |
'model/mpi-receiver.cc', |
10476 | 41 |
'model/null-message-simulator-impl.cc', |
42 |
'model/null-message-mpi-interface.cc', |
|
43 |
'model/remote-channel-bundle.cc', |
|
44 |
'model/remote-channel-bundle-manager.cc', |
|
45 |
'model/mpi-interface.cc', |
|
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
46 |
] |
6113
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
47 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9173
diff
changeset
|
48 |
headers = bld(features='ns3header') |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
49 |
headers.module = 'mpi' |
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
50 |
headers.source = [ |
10476 | 51 |
'model/mpi-receiver.h', |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
52 |
'model/mpi-interface.h', |
10476 | 53 |
'model/parallel-communication-interface.h', |
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
54 |
] |
6113
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff
changeset
|
55 |
|
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
56 |
if env['ENABLE_MPI']: |
7525
9a36f1d5d229
Fix modules wscript usage of 'use' parameter
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7498
diff
changeset
|
57 |
sim.use.append('MPI') |
7086 | 58 |
|
59 |
if bld.env['ENABLE_EXAMPLES']: |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9173
diff
changeset
|
60 |
bld.recurse('examples') |
6905
355d6562399e
Modular bindings: scan the applications, contrib, mpi, flow-monitor, and point-to-point modules.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6833
diff
changeset
|
61 |
|
7019
23bec5444c05
The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6905
diff
changeset
|
62 |
bld.ns3_python_bindings() |