Commit 729beb3d authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

compilation in tox virtualenv works

parent 09839f19
...@@ -31,14 +31,14 @@ try: ...@@ -31,14 +31,14 @@ try:
if not here.startswith(os.path.join(dist_loc, 'bfps')): if not here.startswith(os.path.join(dist_loc, 'bfps')):
# not installed, but there is another version that *is* # not installed, but there is another version that *is*
raise DistributionNotFound raise DistributionNotFound
header_dir = _dist.location header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp')
lib_dir = header_dir lib_dir = _dist.location
except DistributionNotFound: except DistributionNotFound:
#__version__ = 'Please install this project with setup.py' #__version__ = 'Please install this project with setup.py'
import subprocess import subprocess
__version__ = 'git revision ' + subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip() __version__ = 'git revision ' + subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
header_dir = './src' header_dir = './bfps/cpp'
lib_dir = './lib' lib_dir = './'
if not os.path.isfile(os.path.join(header_dir, 'base.hpp')): if not os.path.isfile(os.path.join(header_dir, 'base.hpp')):
tdir = os.path.dirname(os.path.realpath(__file__)) tdir = os.path.dirname(os.path.realpath(__file__))
header_dir = os.path.join(tdir, os.pardir) header_dir = os.path.join(tdir, os.pardir)
......
...@@ -98,6 +98,10 @@ class code(base): ...@@ -98,6 +98,10 @@ class code(base):
include_dirs = [bfps.header_dir, include_dirs = [bfps.header_dir,
'/usr/lib64/mpi/gcc/openmpi/include', '/usr/lib64/mpi/gcc/openmpi/include',
os.path.join(local_install_dir, 'include')] os.path.join(local_install_dir, 'include')]
if not os.path.isfile(os.path.join(bfps.header_dir, 'base.hpp')):
raise IOError('header not there:\n' +
'{0}\n'.format(os.path.join(bfps.header_dir, 'base.hpp')) +
'{0}\n'.format(bfps.dist_loc))
libraries = ['fftw3_mpi', libraries = ['fftw3_mpi',
'fftw3', 'fftw3',
'fftw3f_mpi', 'fftw3f_mpi',
...@@ -108,6 +112,7 @@ class code(base): ...@@ -108,6 +112,7 @@ class code(base):
for idir in include_dirs: for idir in include_dirs:
command_strings += ['-I{0}'.format(idir)] command_strings += ['-I{0}'.format(idir)]
command_strings += ['-L' + os.path.join(local_install_dir, 'lib')] command_strings += ['-L' + os.path.join(local_install_dir, 'lib')]
command_strings += ['-L' + os.path.join(local_install_dir, 'lib64')]
command_strings.append('-L' + bfps.lib_dir) command_strings.append('-L' + bfps.lib_dir)
for libname in libraries: for libname in libraries:
command_strings += ['-l' + libname] command_strings += ['-l' + libname]
...@@ -119,7 +124,7 @@ class code(base): ...@@ -119,7 +124,7 @@ class code(base):
ncpu = 2, ncpu = 2,
simname = 'test', simname = 'test',
iter0 = 0): iter0 = 0):
if self.compile_code(): if self.compile_code() == 0:
current_dir = os.getcwd() current_dir = os.getcwd()
if not os.path.isdir(self.work_dir): if not os.path.isdir(self.work_dir):
os.makedirs(self.work_dir) os.makedirs(self.work_dir)
...@@ -132,7 +137,7 @@ class code(base): ...@@ -132,7 +137,7 @@ class code(base):
'mpirun', 'mpirun',
'-np', '-np',
'{0}'.format(ncpu), '{0}'.format(ncpu),
'./' + self.name + '.elf', './' + self.name,
simname, simname,
'{0}'.format(iter0)]) '{0}'.format(iter0)])
os.chdir(current_dir) os.chdir(current_dir)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment