示例#1
0
#setup cython code
import sys, os
from setuptools import setup, find_packages
from Cython.Build import cythonize
import numpy as np
import scipy as sp

#os.chdir('..') #move up one level
setup(name="pycompass",
      install_requires=['Cython', 'scipy', 'mplstereonet', 'xmltodict'],
      packages=find_packages(),
      ext_modules=cythonize("pycompass/SNE/pdf.pyx"),
      include_dirs=[np.get_include(), sp.get_include()])
示例#2
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

import numpy
import scipy

setup(cmdclass={'build_ext': build_ext},
      ext_modules=[
          Extension(
              "py_signet",
              sources=["py_signet.pyx"],
              include_dirs=[
                  ".",
                  numpy.get_include(),
                  scipy.get_include(), "/usr/local/include/"
              ],
              language='c++',
              extra_link_args=[
                  "-L/usr/local/lib/", "-lgsl", "-lgslcblas", "-lm"
              ],
          ),
      ])
示例#3
0
from distutils.core import setup
from Cython.Build import cythonize
import scipy as sp

setup(name="Sumrules",
      ext_modules=cythonize("lib/analytics.pyx", [sp.get_include()]))
示例#4
0
except ImportError:
    print('scipy is required for installation')
    sys.exit(1)

try:
    from Cython.Build import cythonize
except ImportError:
    print('Cython is required for installation')
    sys.exit(1)

#fast log loss
extensions = [
    Extension(DISTNAME + ".loss_functions." + "fast_log_loss",
              [DISTNAME + "/loss_functions/fast_log_loss.pyx"],
              include_dirs=[numpy.get_include(),
                            scipy.get_include()],
              extra_compile_args=["-ffast-math"]),
    Extension(DISTNAME + ".loss_functions." + "lookup_log_loss",
              [DISTNAME + "/loss_functions/lookup_log_loss.pyx"],
              include_dirs=[numpy.get_include(),
                            scipy.get_include()],
              extra_compile_args=["-ffast-math"])
]

if __name__ == "__main__":

    old_path = os.getcwd()
    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))

    os.chdir(local_path)
    sys.path.insert(0, local_path)
示例#5
0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
import scipy

setup(
    name='SparseGroupLasso',
    ext_modules=[
        Extension('group_lasso_fast', ['group_lasso_fast.pyx'],
                  include_dirs=[np.get_include(), scipy.get_include()])
    ],
    cmdclass={'build_ext': build_ext}
)
示例#6
0
#!/usr/bin/env python2

"""
setup.py

Author: Jonah Miller ([email protected])
Time-stamp: <2014-10-12 23:20:00 (jonah)>

This program compiles the *.pyx file into a binary. If there are more
files, we can add those too.
"""

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy,scipy # not necessary here, but included for example purposes
import Cython
import Cython.Compiler
import Cython.Compiler.Options
# An example of an option you might set:
# Cython.Compiler.Options.buffer_max_dims = 9

setup(
    cmdclass = {'build_ext' : build_ext},
    ext_modules = [Extension("pi_monte_carlo",["pi_monte_carlo.pyx"])],
    include_dirs=[numpy.get_include(),scipy.get_include()] # you don't need this for our simple example but I include it because you'll probably want it.
    )
示例#7
0
from Cython.Build import cythonize
import numpy
import scipy

if sys.platform == "win32":
    openmp = '/Qopenmp'
    opti = '/O2'
    march = "/march=native"
else:
    openmp = "-fopenmp"
    opti = "-O2"
    march = "-march=native"

ext_modules = [
    Extension("src.C_Extensions.sample", ["src/C_Extensions/sample.pyx"],
              include_dirs=[".", scipy.get_include()],
              extra_compile_args=[opti, march],
              extra_link_args=[opti, march]),
    Extension("src.C_Extensions.helper", ["src/C_Extensions/helper.pyx"],
              include_dirs=[".", numpy.get_include()],
              extra_compile_args=[openmp, opti, march],
              extra_link_args=[openmp, opti, march]),
    Extension("src.C_Extensions.Trans_cy", ["src/C_Extensions/Trans_cy.pyx"],
              include_dirs=["src/C_Extensions",
                            numpy.get_include()]),
    Extension("src.C_Extensions.Trans_cy_TKF91",
              ["src/C_Extensions/Trans_cy_TKF91.pyx"],
              include_dirs=["src/C_Extensions", ".",
                            numpy.get_include()]),
    Extension("src.C_Extensions.algorithms_cython",
              sources=[
示例#8
0
文件: setup.py 项目: jsnel/glotaran
        for clean_path in self._clean_tree:
            try:
                shutil.rmtree(clean_path)
            except Exception:
                pass


try:
    import numpy
    import scipy
    from numpy.distutils.core import setup, Extension

    ext_modules = [
        Extension(name="kinetic_matrix_no_irf",
                  sources=["glotaran/models/spectral_temporal/kinetic_matrix_no_irf.pyx"],
                  include_dirs=[numpy.get_include(), scipy.get_include(),
                                "glotaran/models/spectral_temporal"]),
        Extension("kinetic_matrix_gaussian_irf",
                  ["glotaran/models/spectral_temporal/erfce.c",
                   "glotaran/models/spectral_temporal/kinetic_matrix_gaussian_irf.pyx"],
                  include_dirs=[numpy.get_include(), scipy.get_include(),
                                "glotaran/models/spectral_temporal"]),
        Extension(name="doas_matrix_faddeva",
                  sources=["glotaran/models/doas/doas_matrix_faddeva.pyx"],
                  include_dirs=[numpy.get_include(), scipy.get_include(),
                                "glotaran/models/doas"]),
        Extension(name="scalTOMS680",
                  sources=["glotaran/models/doas/scalTOMS680.pyf",
                           "glotaran/models/doas/scalTOMS680.f"],
                  include_dirs=[numpy.get_include(), scipy.get_include(),
                                "glotaran/models/doas"]),
示例#9
0
python2 build_cython_loss_functions.py build_ext --inplace
python3 build_cython_loss_functions.py build_ext --inplace

"""
import numpy
import scipy
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext


#fast log loss
ext_modules = [Extension(name = "fast_log_loss",
                         sources=["fast_log_loss.pyx"],
                         include_dirs=[numpy.get_include(), scipy.get_include()],
                         libraries=["m"],
                         extra_compile_args = ["-ffast-math"])]

setup(
    cmdclass = {'build_ext': build_ext},
    include_dirs = [numpy.get_include(), scipy.get_include()],
    ext_modules = ext_modules,
)

#lookup log loss
ext_modules = [Extension(name = "lookup_log_loss",
                         sources=["lookup_log_loss.pyx"],
                         include_dirs=[numpy.get_include(), scipy.get_include()],
                         libraries=["m"],
                         extra_compile_args = ["-ffast-math"])]
示例#10
0
            try:
                shutil.rmtree(clean_path)
            except Exception:
                pass


try:
    import numpy
    import scipy
    ext_modules = [
        Extension(
            "kinetic_matrix_no_irf",
            ["glotaran/models/spectral_temporal/kinetic_matrix_no_irf.pyx"],
            include_dirs=[
                numpy.get_include(),
                scipy.get_include(), "glotaran/models/spectral_temporal"
            ]),
        Extension("kinetic_matrix_gaussian_irf", [
            "glotaran/models/spectral_temporal/erfce.c",
            "glotaran/models/spectral_temporal/kinetic_matrix_gaussian_irf.pyx"
        ],
                  include_dirs=[
                      numpy.get_include(),
                      scipy.get_include(), "glotaran/models/spectral_temporal"
                  ]),
    ]

except ImportError:
    raise ImportError(
        f"To install glotaran you need to have following packages installed:\n"
        f"{setup_requires[0]}\n"

import os
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np                           # <---- New line
import scipy as la                           # <---- New line
import copy

#os.environ["CC"] = "clang"
#os.environ["CXX"] = "clang++"
os.environ["CC"] = "gcc-5"
os.environ["CXX"] = "g++-5"
#os.environ["CC"] = "icc"
#os.environ["CXX"] = "icpc"

# for GNU
os.environ["ARCHFLAGS"] = "-arch x86_64"

ext_modules = [Extension("ao2mo", ["ao2mo.pyx"], extra_compile_args=['-fopenmp', '-O3'], extra_link_args=['-fopenmp'])]

setup(
  name = 'ao2mo.pyx',
  cmdclass = {'build_ext': build_ext},
  include_dirs = [np.get_include(), la.get_include()],         # <---- New line
  ext_modules = ext_modules
  )