This repository was archived by the owner on Dec 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathsetup.py
executable file
·139 lines (112 loc) · 5 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import sys
from numpy.distutils.core import Extension, setup
from mkldiscover import mkl_exists
__author__ = "Anders S. Christensen"
__copyright__ = "Copyright 2016"
__credits__ = ["Anders S. Christensen (2016) https://github.com/qmlcode/qml"]
__license__ = "MIT"
__version__ = "0.3.1"
__maintainer__ = "Anders S. Christensen"
__email__ = "[email protected]"
__status__ = "Beta"
__description__ = "Quantum Machine Learning"
__url__ = "https://github.com/qmlcode/qml"
FORTRAN = "f90"
# GNU (default)
COMPILER_FLAGS = ["-O3", "-fopenmp", "-m64", "-march=native", "-fPIC",
"-Wno-maybe-uninitialized", "-Wno-unused-function", "-Wno-cpp"]
LINKER_FLAGS = ["-lgomp"]
MATH_LINKER_FLAGS = ["-lblas", "-llapack"]
# UNCOMMENT TO FORCE LINKING TO MKL with GNU compilers:
if mkl_exists(verbose=True):
LINKER_FLAGS = ["-lgomp", " -lpthread", "-lm", "-ldl"]
MATH_LINKER_FLAGS = ["-L${MKLROOT}/lib/intel64", "-lmkl_rt"]
# For clang without OpenMP: (i.e. most Apple/mac system)
if sys.platform == "darwin" and all(["gnu" not in arg for arg in sys.argv]):
COMPILER_FLAGS = ["-O3", "-m64", "-march=native", "-fPIC"]
LINKER_FLAGS = []
MATH_LINKER_FLAGS = ["-lblas", "-llapack"]
# Intel
if any(["intelem" in arg for arg in sys.argv]):
COMPILER_FLAGS = ["-xHost", "-O3", "-axAVX", "-qopenmp"]
LINKER_FLAGS = ["-liomp5", " -lpthread", "-lm", "-ldl"]
MATH_LINKER_FLAGS = ["-L${MKLROOT}/lib/intel64", "-lmkl_rt"]
ext_farad_kernels = Extension(name = 'farad_kernels',
sources = ['qml/farad_kernels.f90'],
extra_f90_compile_args = COMPILER_FLAGS,
extra_f77_compile_args = COMPILER_FLAGS,
extra_compile_args = COMPILER_FLAGS,
extra_link_args = LINKER_FLAGS,
language = FORTRAN,
f2py_options=['--quiet'])
ext_fcho_solve = Extension(name = 'fcho_solve',
sources = ['qml/fcho_solve.f90'],
extra_f90_compile_args = COMPILER_FLAGS,
extra_f77_compile_args = COMPILER_FLAGS,
extra_compile_args = COMPILER_FLAGS,
extra_link_args = MATH_LINKER_FLAGS + LINKER_FLAGS,
language = FORTRAN,
f2py_options=['--quiet'])
ext_fdistance = Extension(name = 'fdistance',
sources = ['qml/fdistance.f90'],
extra_f90_compile_args = COMPILER_FLAGS,
extra_f77_compile_args = COMPILER_FLAGS,
extra_compile_args = COMPILER_FLAGS,
extra_link_args = LINKER_FLAGS,
language = FORTRAN,
f2py_options=['--quiet'])
ext_fkernels = Extension(name = 'fkernels',
sources = ['qml/fkernels.f90'],
extra_f90_compile_args = COMPILER_FLAGS,
extra_f77_compile_args = COMPILER_FLAGS,
extra_compile_args = COMPILER_FLAGS,
extra_link_args = LINKER_FLAGS,
language = FORTRAN,
f2py_options=['--quiet'])
ext_frepresentations = Extension(name = 'frepresentations',
sources = ['qml/frepresentations.f90'],
extra_f90_compile_args = COMPILER_FLAGS,
extra_f77_compile_args = COMPILER_FLAGS,
extra_compile_args = COMPILER_FLAGS,
extra_link_args = MATH_LINKER_FLAGS + LINKER_FLAGS,
language = FORTRAN,
f2py_options=['--quiet'])
ext_fslatm = Extension(name = 'fslatm',
sources = ['qml/fslatm.f90'],
extra_f90_compile_args = COMPILER_FLAGS,
extra_f77_compile_args = COMPILER_FLAGS,
extra_compile_args = COMPILER_FLAGS,
extra_link_args = LINKER_FLAGS,
language = FORTRAN,
f2py_options=['--quiet'])
# use README.md as long description
def readme():
with open('README.md') as f:
return f.read()
def setup_pepytools():
setup(
name="qml",
packages=['qml'],
# metadata
version=__version__,
author=__author__,
author_email=__email__,
platforms = 'Any',
description = __description__,
long_description = readme(),
keywords = ['Machine Learning', 'Quantum Chemistry'],
classifiers = [],
url = __url__,
# set up package contents
ext_package = 'qml',
ext_modules = [
ext_farad_kernels,
ext_fcho_solve,
ext_fdistance,
ext_fkernels,
ext_fslatm,
ext_frepresentations,
],
)
if __name__ == '__main__':
setup_pepytools()