예제 #1
0
파일: setup.py 프로젝트: bjodah/chemreac
                        'std': 'c++11',
                        'define': ['CYTHON_TRACE=1'],
                        'inc_py': True,
                    }
                },
                'flags': flags,
                'options': options,
            },
            pycompilation_link_kwargs={
                'options': ((['WITH_DEBUG'] if WITH_DEBUG else []) +
                            (['openmp'] if WITH_OPENMP else [])),
                'std': 'c++11',
            },
            include_dirs=[
                np.get_include(), fd.get_include(), bdi.get_include(),
                pc.get_include(), _path_under_setup('include')
            ],
            libraries=['sundials_cvodes', LLAPACK, 'sundials_nvecserial', 'm'],
            logger=True,
        )
    ]

modules = [
    pkg_name+'.util',
]

tests = [
    pkg_name+'.tests',
    pkg_name+'.util.tests',
]
예제 #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
from pycvodes import get_include
header_fname = 'cvodes_cxx.hpp'
assert header_fname in os.listdir(get_include())
path = os.path.join(get_include(), header_fname)
assert open(path, 'rt').readline().startswith('#pragma once')
예제 #3
0
파일: cvode.py 프로젝트: bjodah/pyodesys
 def __init__(self, *args, **kwargs):
     self.compile_kwargs = copy.deepcopy(_compile_kwargs)
     self.compile_kwargs['include_dirs'].append(pycvodes.get_include())
     self.compile_kwargs['libraries'].extend(['sundials_cvodes', os.environ.get('LLAPACK', 'lapack'),
                                              'sundials_nvecserial', 'm'])
     super(NativeCvodeCode, self).__init__(*args, **kwargs)
예제 #4
0
파일: setup.py 프로젝트: chemreac/chemreac
        if os.path.exists(_cpp):
            if os.path.exists(_pyx) and os.path.getmtime(_pyx) - 1e-6 >= os.path.getmtime(_cpp):
                USE_CYTHON = True
            else:
                USE_CYTHON = False
        else:
            if os.path.exists(_pyx):
                USE_CYTHON = True
            else:
                raise ValueError("Neither pyx nor cpp file found")

    ext_modules.append(Extension('chemreac._chemreac', ['chemreac/_chemreac' + ('.pyx' if USE_CYTHON else '.cpp')]))

    if USE_CYTHON:
        ext_modules = cythonize(ext_modules, include_path=[
            'chemreac/include', pc.get_include(), os.path.join('external', 'anyode', 'cython_def')])
    ext_modules[0].include_dirs += [
        np.get_include(), fd.get_include(), bdi.get_include(),
        pc.get_include(), package_include, os.path.join('external', 'anyode', 'include')
    ]
    ext_modules[0].sources = [rendered_path] + ext_modules[0].sources
    ext_modules[0].language = 'c++'
    ext_modules[0].extra_compile_args = ['-std=c++11'] + (['-fopenmp'] if _WITH_OPENMP else [])
    ext_modules[0].define_macros +=  (
        ([('CHEMREAC_WITH_DEBUG', None)] if _WITH_DEBUG else []) +
        ([('CHEMREAC_WITH_DATA_DUMPING', None)] if _WITH_DATA_DUMPING else []) +
        ([('BLOCK_DIAG_ILU_WITH_OPENMP', None)] if os.environ.get('BLOCK_DIAG_ILU_WITH_OPENMP', '') == '1' else [])
    )
    ext_modules[0].libraries += pc.config['SUNDIALS_LIBS'].split(',') + pc.config['LAPACK'].split(',') + ['m']

modules = [
예제 #5
0
def test_get_include():
    assert get_include().endswith('include')
    assert 'cvodes_cxx.hpp' in os.listdir(get_include())
예제 #6
0
def test_get_include():
    assert get_include().endswith('include')
    assert 'cvodes_cxx.hpp' in os.listdir(get_include())