2010-03-08 21:07:31 -05:00
|
|
|
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
|
|
|
|
import sys
|
2011-04-07 13:34:14 +01:00
|
|
|
import subprocess
|
2013-04-01 22:33:46 +02:00
|
|
|
|
|
|
|
|
from waflib import Options
|
2011-09-13 19:25:55 +01:00
|
|
|
from waflib.Errors import WafError
|
2010-03-08 21:07:31 -05:00
|
|
|
|
2011-04-07 13:34:14 +01:00
|
|
|
def configure(conf):
|
2011-09-25 15:43:30 +01:00
|
|
|
if Options.options.enable_mpi:
|
2011-09-25 16:28:09 +01:00
|
|
|
# try to detect openmpi installation
|
|
|
|
|
mpi = conf.check_cfg(path='mpic++', args='-showme',
|
|
|
|
|
package='', uselib_store='MPI', mandatory=False)
|
|
|
|
|
if mpi:
|
|
|
|
|
conf.env.append_value('DEFINES_MPI', 'NS3_OPENMPI')
|
|
|
|
|
else:
|
|
|
|
|
# try the MPICH2 flags
|
|
|
|
|
mpi = conf.check_cfg(path='mpic++', args='-compile-info -link-info',
|
|
|
|
|
package='', uselib_store='MPI', mandatory=False)
|
|
|
|
|
if mpi:
|
|
|
|
|
conf.env.append_value('DEFINES_MPI', 'NS3_MPICH')
|
|
|
|
|
if mpi:
|
2011-09-25 15:43:30 +01:00
|
|
|
conf.env.append_value('DEFINES_MPI', 'NS3_MPI')
|
|
|
|
|
conf.env['ENABLE_MPI'] = True
|
|
|
|
|
for libpath in conf.env.LIBPATH_MPI:
|
|
|
|
|
if 'mpi' in libpath:
|
2012-12-07 10:19:29 -05:00
|
|
|
conf.env.append_value('LINKFLAGS_MPI', '-Wl,-rpath,'+libpath)
|
2011-09-25 15:43:30 +01:00
|
|
|
conf.report_optional_feature("mpi", "MPI Support", True, '')
|
2011-04-07 13:34:14 +01:00
|
|
|
else:
|
2011-09-25 15:43:30 +01:00
|
|
|
conf.report_optional_feature("mpi", "MPI Support", False, 'mpic++ not found')
|
|
|
|
|
else:
|
|
|
|
|
conf.report_optional_feature("mpi", "MPI Support", False, 'option --enable-mpi not selected')
|
2011-04-07 13:34:14 +01:00
|
|
|
|
|
|
|
|
|
2010-03-08 21:07:31 -05:00
|
|
|
def build(bld):
|
2011-09-08 16:13:40 +01:00
|
|
|
env = bld.env
|
2011-04-07 13:34:14 +01:00
|
|
|
sim = bld.create_ns3_module('mpi', ['core', 'network'])
|
|
|
|
|
sim.source = [
|
|
|
|
|
'model/distributed-simulator-impl.cc',
|
2013-12-06 14:57:33 -05:00
|
|
|
'model/granted-time-window-mpi-interface.cc',
|
2011-04-26 14:57:48 -04:00
|
|
|
'model/mpi-receiver.cc',
|
2013-12-06 14:57:33 -05:00
|
|
|
'model/null-message-simulator-impl.cc',
|
|
|
|
|
'model/null-message-mpi-interface.cc',
|
|
|
|
|
'model/remote-channel-bundle.cc',
|
|
|
|
|
'model/remote-channel-bundle-manager.cc',
|
|
|
|
|
'model/mpi-interface.cc',
|
2011-04-07 13:34:14 +01:00
|
|
|
]
|
|
|
|
|
|
2013-04-01 22:33:46 +02:00
|
|
|
headers = bld(features='ns3header')
|
2011-04-07 13:34:14 +01:00
|
|
|
headers.module = 'mpi'
|
|
|
|
|
headers.source = [
|
2011-04-26 14:57:48 -04:00
|
|
|
'model/mpi-receiver.h',
|
2013-12-06 14:57:33 -05:00
|
|
|
'model/mpi-interface.h',
|
|
|
|
|
'model/parallel-communication-interface.h',
|
2011-04-07 13:34:14 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
if env['ENABLE_MPI']:
|
2011-09-22 13:03:25 +01:00
|
|
|
sim.use.append('MPI')
|
2011-04-26 15:38:09 -04:00
|
|
|
|
|
|
|
|
if bld.env['ENABLE_EXAMPLES']:
|
2013-04-01 22:33:46 +02:00
|
|
|
bld.recurse('examples')
|
2011-03-13 18:40:36 +00:00
|
|
|
|
2011-04-07 13:34:14 +01:00
|
|
|
bld.ns3_python_bindings()
|