예제 #1
0
def configuration(parent_package='', parent_path=None):

    # The following three lines constitute minimal contents
    # of configuration(..) that is suitable for pure Python
    # packages.
    package = 'pad'
    from scipy_distutils.misc_util import default_config_dict
    config = default_config_dict(package, parent_package)

    return config
예제 #2
0
def configuration(parent_package='', parent_path=None):

    # The following three lines constitute minimal contents
    # of configuration(..) that is suitable for pure Python
    # packages.
    package = 'pad'
    from scipy_distutils.misc_util import default_config_dict
    config = default_config_dict(package,parent_package)

    return config
예제 #3
0
def configuration(parent_package='',parent_path=None):
    from scipy_distutils.core import Extension
    from scipy_distutils.misc_util import get_path,dot_join,\
         default_config_dict,dict_append
    from scipy_distutils.system_info import get_info,FFTWNotFoundError,\
         DJBFFTNotFoundError

    package_name = 'fftpack'
    fftw_info = get_info('fftw') or get_info('dfftw')
    if not fftw_info:
        print FFTWNotFoundError.__doc__
    djbfft_info = get_info('djbfft')
    if not djbfft_info:
        print DJBFFTNotFoundError.__doc__
    #djbfft_info = None
    #fftw_info = None
    config = default_config_dict(package_name,parent_package)
    local_path = get_path(__name__,parent_path)
    test_path = os.path.join(local_path,'tests')
    config['packages'].append(dot_join(parent_package,package_name,'tests'))
    config['package_dir'][package_name+'.tests'] = test_path

    dfftpack = glob(os.path.join(local_path,'dfftpack','*.f'))
    config['fortran_libraries'].append(('dfftpack',{'sources':dfftpack}))
    
    sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c',
               'src/zfftnd.c']
    sources = [os.path.join(local_path,x) for x in sources]
    ext_args = {}
    dict_append(ext_args,
                name = dot_join(parent_package,package_name,'_fftpack'),
                sources = sources,
                libraries = ['dfftpack'])
    if fftw_info:
        dict_append(ext_args,**fftw_info)
    if djbfft_info:
        dict_append(ext_args,**djbfft_info)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    sources = ['convolve.pyf','src/convolve.c']
    sources = [os.path.join(local_path,x) for x in sources]
    ext_args = {}
    dict_append(ext_args,
                name = dot_join(parent_package,package_name,'convolve'),
                sources = sources,
                libraries = ['dfftpack'])
    if fftw_info:
        dict_append(ext_args,**fftw_info)
    if djbfft_info:
        dict_append(ext_args,**djbfft_info)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    return config
def configuration (parent_package=''):
    package = 'linalg'
    config = default_config_dict(package,parent_package)
    del config['fortran_libraries']
    local_path = get_path(__name__)
    atlas_info = get_info('atlas_threads')
    if not atlas_info:
        atlas_info = get_info('atlas')
    if not atlas_info:
        raise AtlasNotFoundError,AtlasNotFoundError.__doc__
    ext = Extension('atlas_version',
                    sources=[os.path.join(local_path,'atlas_version.c')],
                    libraries=[atlas_info['libraries'][-1]],
                    library_dirs=atlas_info['library_dirs'])
    config['ext_modules'].append(ext)
    return config
예제 #5
0
def configuration(parent_package='',parent_path=None):
    from scipy_distutils.core import Extension
    from scipy_distutils.misc_util import get_path,\
         default_config_dict, dot_join
    from scipy_distutils.system_info import dict_append, get_info

    package = 'special'
    config = default_config_dict(package,parent_package)
    local_path = get_path(__name__,parent_path)

    define_macros = []
    if sys.byteorder == "little":
        define_macros.append(('USE_MCONF_LE',None))
    else:
        define_macros.append(('USE_MCONF_BE',None))
    if sys.platform=='win32':
        define_macros.append(('NOINFINITIES',None))
        define_macros.append(('NONANS',None))

    c_misc = glob(os.path.join(local_path,'c_misc','*.c'))
    cephes = glob(os.path.join(local_path,'cephes','*.c'))
    if sys.platform=='win32':
        cephes = [f for f in cephes if os.path.basename(f)!='fabs.c']
    mach = glob(os.path.join(local_path,'mach','*.f'))
    amos = glob(os.path.join(local_path,'amos','*.f'))
    toms = glob(os.path.join(local_path,'toms','*.f'))
    cdf = glob(os.path.join(local_path,'cdflib','*.f'))
    specfun = glob(os.path.join(local_path, 'specfun','*.f'))
    
    # C libraries
    config['libraries'].append(('c_misc',{'sources':c_misc}))
    config['libraries'].append(('cephes',{'sources':cephes,
                                          'macros':define_macros}))

    # Fortran libraries
    config['libraries'].append(('mach',{'sources':mach}))
    config['libraries'].append(('amos',{'sources':amos}))
    config['libraries'].append(('toms',{'sources':toms}))
    config['libraries'].append(('cdf',{'sources':cdf}))
    config['libraries'].append(('specfun',{'sources':specfun}))
    
    # Extension
    sources = ['cephesmodule.c', 'amos_wrappers.c', 'specfun_wrappers.c',
               'toms_wrappers.c','cdf_wrappers.c','ufunc_extras.c']
    sources = [os.path.join(local_path,x) for x in sources]
    ext_args = {}
    dict_append(ext_args,
                name=dot_join(parent_package,package,'cephes'),
                sources = sources,
                libraries = ['amos','toms','c_misc','cephes','mach',
                             'cdf', 'specfun'],
                define_macros = define_macros
                )
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    ext_args = {'name':dot_join(parent_package,package,'specfun'),
                'sources':[os.path.join(local_path,'specfun.pyf')],
                'f2py_options':['--no-wrap-functions'],
                #'define_macros':[('F2PY_REPORT_ATEXIT_DISABLE',None)],
                'libraries' : ['specfun'],
                'depends':specfun
                }
    ext = Extension(**ext_args)
    ext.need_fcompiler_opts = 1
    config['ext_modules'].append(ext)

    return config
예제 #6
0
def configuration(parent_package='',parent_path=None):
    from scipy_distutils.core import Extension
    from scipy_distutils.misc_util import dot_join, get_path, default_config_dict
    from scipy_distutils.system_info import get_info, dict_append, NotFoundError

    from interface_gen import generate_interface

    package = 'linalg'
    config = default_config_dict(package,parent_package)
    local_path = get_path(__name__,parent_path)
    def local_join(*paths):
        return os.path.join(*((local_path,)+paths))

    lapack_opt = get_info('lapack_opt')

    if not lapack_opt:
        raise NotFoundError,'no lapack/blas resources found'

    atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \
                      if k=='ATLAS_INFO']+[None])[0] 
    if atlas_version:
        print 'ATLAS version',atlas_version

    target_dir = ''
    skip_names = {'clapack':[],'flapack':[],'cblas':[],'fblas':[]}
    if skip_single_routines:
        target_dir = 'dbl'
        skip_names['clapack'].extend(\
            'sgesv cgesv sgetrf cgetrf sgetrs cgetrs sgetri cgetri'\
            ' sposv cposv spotrf cpotrf spotrs cpotrs spotri cpotri'\
            ' slauum clauum strtri ctrtri'.split())
        skip_names['flapack'].extend(skip_names['clapack'])
        skip_names['flapack'].extend(\
            'sgesdd cgesdd sgelss cgelss sgeqrf cgeqrf sgeev cgeev'\
            ' sgegv cgegv ssyev cheev slaswp claswp sgees cgees'
            ' sggev cggev'.split())
        skip_names['cblas'].extend('saxpy caxpy'.split())
        skip_names['fblas'].extend(skip_names['cblas'])
        skip_names['fblas'].extend(\
            'srotg crotg srotmg srot csrot srotm sswap cswap sscal cscal'\
            ' csscal scopy ccopy sdot cdotu cdotc snrm2 scnrm2 sasum scasum'\
            ' isamax icamax sgemv cgemv chemv ssymv strmv ctrmv'\
            ' sgemm cgemm'.split())

    if using_lapack_blas:
        target_dir = join(target_dir,'blas')
        skip_names['fblas'].extend(\
            'drotmg srotmg drotm srotm'.split())

    if atlas_version=='3.2.1_pre3.3.6':
        target_dir = join(target_dir,'atlas321')
        skip_names['clapack'].extend(\
            'sgetri dgetri cgetri zgetri spotri dpotri cpotri zpotri'\
            ' slauum dlauum clauum zlauum strtri dtrtri ctrtri ztrtri'.split())
    elif atlas_version>'3.4.0' and atlas_version<='3.5.12':
        skip_names['clapack'].extend('cpotrf zpotrf'.split())

    def generate_pyf(extension, build_dir):
        name = extension.name.split('.')[-1]
        target = join(build_dir,target_dir,name+'.pyf')
        if name[0]=='c' and atlas_version is None and newer(__file__,target):
            f = open(target,'w')
            f.write('python module '+name+'\n')
            f.write('usercode void empty_module(void) {}\n')
            f.write('interface\n')
            f.write('subroutine empty_module()\n')
            f.write('intent(c) empty_module\n')
            f.write('end subroutine empty_module\n')
            f.write('end interface\nend python module'+name+'\n')
            f.close()
            return target
        if newer_group(extension.depends,target):
            generate_interface(name,
                               extension.depends[0],
                               target,
                               skip_names[name])
        return target

    # fblas:
    ext_args = {'name': dot_join(parent_package,package,'fblas'),
                'sources': [generate_pyf,
                            local_join('src','fblaswrap.f')],
                'depends': map(local_join,['generic_fblas.pyf',
                                           'generic_fblas1.pyf',
                                           'generic_fblas2.pyf',
                                           'generic_fblas3.pyf',
                                           'interface_gen.py'])
                }
    dict_append(ext_args,**lapack_opt)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    # cblas:
    ext_args = {'name': dot_join(parent_package,package,'cblas'),
                'sources': [generate_pyf],
                'depends': map(local_join,['generic_cblas.pyf',
                                           'generic_cblas1.pyf',
                                           'interface_gen.py'])
                }
    dict_append(ext_args,**lapack_opt)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    # flapack:
    ext_args = {'name': dot_join(parent_package,package,'flapack'),
                'sources': [generate_pyf],
                'depends': map(local_join,['generic_flapack.pyf',
                                           'flapack_user_routines.pyf',
                                           'interface_gen.py'])
                }
    dict_append(ext_args,**lapack_opt)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    # clapack:
    ext_args = {'name': dot_join(parent_package,package,'clapack'),
                'sources': [generate_pyf],
                'depends': map(local_join,['generic_clapack.pyf',
                                           'interface_gen.py'])
                }
    dict_append(ext_args,**lapack_opt)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    # _flinalg:
    ext_args = {'name':dot_join(parent_package,package,'_flinalg'),
                'sources':[local_join('src','det.f'),
                           local_join('src','lu.f')]
                }
    dict_append(ext_args,**lapack_opt)
    config['ext_modules'].append(Extension(**ext_args))

    # calc_lwork:
    ext_args = {'name':dot_join(parent_package,package,'calc_lwork'),
                'sources':[local_join('src','calc_lwork.f')],
                }
    dict_append(ext_args,**lapack_opt)
    config['ext_modules'].append(Extension(**ext_args))

    # atlas_version:
    ext_args = {'name':dot_join(parent_package,package,'atlas_version'),
                'sources':[os.path.join(local_path,'atlas_version.c')]}
    dict_append(ext_args,**lapack_opt)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)

    # iterative methods
    methods = ['BiCGREVCOM.f.src',
               'BiCGSTABREVCOM.f.src',
               'CGREVCOM.f.src',
               'CGSREVCOM.f.src',
#               'ChebyREVCOM.f.src',
               'GMRESREVCOM.f.src',
#               'JacobiREVCOM.f.src',
               'QMRREVCOM.f.src',
#               'SORREVCOM.f.src'
               ]
    Util = ['STOPTEST2.f.src','getbreak.f.src']
    sources = Util + methods + ['_iterative.pyf.src']
    ext_args = {
        'name': dot_join(parent_package,package,'_iterative'),
        'sources': [local_join('iterative',x) for x in sources]
        }
    dict_append(ext_args, **lapack_opt)
    ext = Extension(**ext_args)
    config['ext_modules'].append(ext)    

    return config