Read about our upcoming Code of Conduct on this issue

Commit 0ccd52a0 authored by paugier's avatar paugier
Browse files

Work on mkl

parent d9582d3055cd
......@@ -30,11 +30,11 @@ def get_default_config():
return config
def make_site_cfg_example_file():
def make_site_cfg_default_file():
config = get_default_config()
with open('site.cfg.example', 'wb') as configfile:
with open('site.cfg.default', 'w') as configfile:
config.write(configfile)
......@@ -51,9 +51,10 @@ def get_config():
value = config.get(section, option)
if option == 'use':
value = value.lower()
if value not in ['true', 'false']:
raise ValueError('"use" should be "True" of "False".')
value = value == 'true'
if not (section == 'fftw' and value == 'mkl'):
if value not in ['true', 'false']:
raise ValueError('"use" should be "True" of "False".')
value = value == 'true'
section_dict[option] = value
config_dict[section] = section_dict
......
......@@ -101,9 +101,9 @@ def modification_date(filename):
class CompilationError(Exception):
def __init__(self, out, err):
self.message = '\nstdout:\n {}\nstderr:\n{}'.format(
out.decode(), err.decode())
def __init__(self, command, out, err):
self.message = '\ncommand:\n{}\nstdout:\n {}\nstderr:\n{}'.format(
command, out.decode(), err.decode())
super(CompilationError, self). __init__()
def __str__(self):
......@@ -194,9 +194,10 @@ def make_obj_from_cpp(obj_file, cpp_file, options=None):
command += ['-I' + incdir for incdir in include_dirs]
command += ['-c', cpp_file, '-o', obj_file]
print(' '.join(command))
return subprocess.Popen(
p = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.command = ' '.join(command)
return p
def make_ext_from_objs(ext_file, obj_files, lib_dirs=None, libraries=None,
options=None):
......@@ -302,7 +303,7 @@ def make_extensions(extensions, lib_dirs=None, libraries=None,
for p in processes:
if p.returncode != 0:
out, err = p.communicate()
raise CompilationError(out, err)
raise CompilationError(p.command, out, err)
files['so'] = []
......
......@@ -144,7 +144,12 @@ if on_rtd:
else:
import numpy as np
ext_modules = []
libraries = set(['fftw3'])
if config['fftw']['use'].lower() == 'mkl':
libraries = set(('mkl_intel_ilp64', 'mkl_sequential', 'mkl_core'))
else:
libraries = set(['fftw3'])
lib_dirs = set()
include_dirs = set(
[src_cy_dir, src_base, src_cpp_3d, src_cpp_2d,
......@@ -176,6 +181,10 @@ def update_with_config(key):
lib_dirs.add(cfg['library_dir'])
if config['fftw']['use']:
update_with_config('fftw')
for base_name in base_names:
ext_modules.append(create_ext(base_name))
TMP = os.getenv('FFTW3_INC_DIR')
......
......@@ -23,7 +23,7 @@ include_dir =
library_dir =
[p3dfft]
use = True
use = False
dir =
include_dir =
library_dir =
......
Markdown is supported
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