-
Notifications
You must be signed in to change notification settings - Fork 3
/
mpi.py
42 lines (34 loc) · 1.08 KB
/
mpi.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
#! /usr/bin/env python
# encoding: utf-8
# JB Mouret - 2009
"""
Quick n dirty mpi detection
"""
import os, glob, types
import Options, Configure
def detect_mpi(conf):
env = conf.env
opt = Options.options
conf.env['LIB_MPI'] = 'mpi'
conf.env['MPI_FOUND'] = False
if Options.options.no_mpi :
return
if Options.options.mpi:
conf.env['CPPPATH_MPI'] = Options.options.mpi + '/include'
conf.env['LIBPATH_MPI'] = [Options.options.mpi + '/lib', Options.options.mpi + '/lib64']
else:
conf.env['CPPPATH_MPI'] = ['/usr/include/mpi', '/usr/local/include/mpi', '/usr/include', '/usr/local/include']
conf.env['LIBPATH_MPI'] = ['/usr/lib', '/usr/local/lib']
res = Configure.find_file('mpi.h', conf.env['CPPPATH_MPI'] )
conf.check_message('header','mpi.h', (res != '') , res)
if (res == '') :
return 0
conf.env['MPI_FOUND'] = True
return 1
def detect(conf):
return detect_mpi(conf)
def set_options(opt):
opt.add_option("--no-mpi",
default=False, action='store_true',
help='disable mpi', dest='no_mpi')
opt.add_option('--mpi', type='string', help='path to mpi', dest='mpi')