We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Optimization flags in setup.py should be completely avoided
Hard-coding compiler flag `-march=native` in setup.py completely destroys possibility to set up Qutip on heterogeneous cluster. In general, it brings a lot of problems for people that don't have a good experience in debugging "illegal instruction" errors, that often happen, if you compile the module on different machine than you use.

If you are sure you need optimized build for localhost, you might use
```
export CFLAGS="-O3 -march=native"
export CXXFLAGS="$CFLAGS"
pip install qutip
```
instead or provide separate option for setup.py script.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 """QuTiP: The Quantum Toolbox in Python
3 
4 QuTiP is open-source software for simulating the dynamics of closed and open
5 quantum systems. The QuTiP library depends on the excellent Numpy, Scipy, and
6 Cython numerical packages. In addition, graphical output is provided by
7 Matplotlib.  QuTiP aims to provide user-friendly and efficient numerical
8 simulations of a wide variety of quantum mechanical problems, including those
9 with Hamiltonians and/or collapse operators with arbitrary time-dependence,
10 commonly found in a wide range of physics applications. QuTiP is freely
11 available for use and/or modification on all common platforms. Being free of
12 any licensing fees, QuTiP is ideal for exploring quantum mechanics in research
13 as well as in the classroom.
14 """
15 
16 DOCLINES = __doc__.split('\n')
17 
18 CLASSIFIERS = """\
19 Development Status :: 4 - Beta
20 Intended Audience :: Science/Research
21 License :: OSI Approved :: BSD License
22 Programming Language :: Python
23 Programming Language :: Python :: 3
24 Topic :: Scientific/Engineering
25 Operating System :: MacOS
26 Operating System :: POSIX
27 Operating System :: Unix
28 Operating System :: Microsoft :: Windows
29 """
30 
31 # import statements
32 import os
33 import sys
34 # The following is required to get unit tests up and running.
35 # If the user doesn't have, then that's OK, we'll just skip unit tests.
36 try:
37     from setuptools import setup, Extension
38     TEST_SUITE = 'nose.collector'
39     TESTS_REQUIRE = ['nose']
40     EXTRA_KWARGS = {
41         'test_suite': TEST_SUITE,
42         'tests_require': TESTS_REQUIRE
43     }
44 except:
45     from distutils.core import setup
46     from distutils.extension import Extension
47     EXTRA_KWARGS = {}
48 
49 try:
50     import numpy as np
51 except:
52     np = None
53 
54 from Cython.Build import cythonize
55 from Cython.Distutils import build_ext
56 
57 # all information about QuTiP goes here
58 MAJOR = 4
59 MINOR = 4
60 MICRO = 0
61 ISRELEASED = False
62 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
63 REQUIRES = ['numpy (>=1.8)', 'scipy (>=0.15)', 'cython (>=0.21)']
64 INSTALL_REQUIRES = ['numpy>=1.8', 'scipy>=0.15', 'cython>=0.21']
65 PACKAGES = ['qutip', 'qutip/ui', 'qutip/cy', 'qutip/cy/src',
66             'qutip/qip', 'qutip/qip/models',
67             'qutip/qip/algorithms', 'qutip/control', 'qutip/nonmarkov',
68             'qutip/_mkl', 'qutip/tests', 'qutip/legacy',
69             'qutip/cy/openmp', 'qutip/cy/openmp/src']
70 PACKAGE_DATA = {
71     'qutip': ['configspec.ini'],
72     'qutip/tests': ['*.ini'],
73     'qutip/cy': ['*.pxi', '*.pxd', '*.pyx'],
74     'qutip/cy/src': ['*.cpp', '*.hpp'],
75     'qutip/control': ['*.pyx'],
76     'qutip/cy/openmp': ['*.pxd', '*.pyx'],
77     'qutip/cy/openmp/src': ['*.cpp', '*.hpp']
78 }
79 # If we're missing numpy, exclude import directories until we can
80 # figure them out properly.
81 INCLUDE_DIRS = [np.get_include()] if np is not None else []
82 # ajgpitch Mar 2017:
83 # This HEADERS did not work, but I will leave it in anyway, as it is supposed to.
84 # I had to do the nasty thing with PACKAGES and PACKAGE_DATA above.
85 HEADERS = ['qutip/cy/src/zspmv.hpp', 'qutip/cy/openmp/src/zspmv_openmp.hpp']
86 NAME = "qutip"
87 AUTHOR = ("Alexander Pitchford, Paul D. Nation, Robert J. Johansson, "
88           "Chris Granade, Arne Grimsmo")
89 AUTHOR_EMAIL = ("alex.pitchford@gmail.com, nonhermitian@gmail.com, "
90                 "jrjohansson@gmail.com, cgranade@cgranade.com, "
91                 "arne.grimsmo@gmail.com")
92 LICENSE = "BSD"
93 DESCRIPTION = DOCLINES[0]
94 LONG_DESCRIPTION = "\n".join(DOCLINES[2:])
95 KEYWORDS = "quantum physics dynamics"
96 URL = "http://qutip.org"
97 CLASSIFIERS = [_f for _f in CLASSIFIERS.split('\n') if _f]
98 PLATFORMS = ["Linux", "Mac OSX", "Unix", "Windows"]
99 
100 
101 def git_short_hash():
102     try:
103         git_str = "+" + os.popen('git log -1 --format="%h"').read().strip()
104     except:
105         git_str = ""
106     else:
107         if git_str == '+': #fixes setuptools PEP issues with versioning
108             git_str = ''
109     return git_str
110 
111 FULLVERSION = VERSION
112 if not ISRELEASED:
113     FULLVERSION += '.dev'+str(MICRO)+git_short_hash()
114 
115 # NumPy's distutils reads in versions differently than
116 # our fallback. To make sure that versions are added to
117 # egg-info correctly, we need to add FULLVERSION to
118 # EXTRA_KWARGS if NumPy wasn't imported correctly.
119 if np is None:
120     EXTRA_KWARGS['version'] = FULLVERSION
121 
122 
123 def write_version_py(filename='qutip/version.py'):
124     cnt = """\
125 # THIS FILE IS GENERATED FROM QUTIP SETUP.PY
126 short_version = '%(version)s'
127 version = '%(fullversion)s'
128 release = %(isrelease)s
129 """
130     a = open(filename, 'w')
131     try:
132         a.write(cnt % {'version': VERSION, 'fullversion':
133                 FULLVERSION, 'isrelease': str(ISRELEASED)})
134     finally:
135         a.close()
136 
137 local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
138 os.chdir(local_path)
139 sys.path.insert(0, local_path)
140 sys.path.insert(0, os.path.join(local_path, 'qutip'))  # to retrive _version
141 
142 # always rewrite _version
143 if os.path.exists('qutip/version.py'):
144     os.remove('qutip/version.py')
145 
146 write_version_py()
147 
148 # Add Cython extensions here
149 cy_exts = ['spmatfuncs', 'stochastic', 'sparse_utils', 'graph_utils', 'interpolate',
150            'spmath', 'heom', 'math', 'spconvert', 'ptrace', 'checks', 'brtools',
151            'brtools_checks', 'br_tensor', 'inter', 'cqobjevo', 'cqobjevo_factor', 'piqs']
152 
153 # Extra link args
154 _link_flags = []
155 
156 # If on Win and Python version >= 3.5 and not in MSYS2 (i.e. Visual studio compile)
157 if (sys.platform == 'win32' and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35
158     and os.environ.get('MSYSTEM') is None):
159     _compiler_flags = ['/w', '/Ox']
160 # Everything else
161 else:
162     _compiler_flags = ['-w', '-O3', '-march=native', '-funroll-loops']
163     if sys.platform == 'darwin':
164         # These are needed for compiling on OSX 10.14+
165         _compiler_flags.append('-mmacosx-version-min=10.9')
166         _link_flags.append('-mmacosx-version-min=10.9')
167 
168 
169 
170 EXT_MODULES =[]
171 # Add Cython files from qutip/cy
172 for ext in cy_exts:
173     _mod = Extension('qutip.cy.'+ext,
174             sources = ['qutip/cy/'+ext+'.pyx', 'qutip/cy/src/zspmv.cpp'],
175             include_dirs = [np.get_include()],
176             extra_compile_args=_compiler_flags,
177             extra_link_args=_link_flags,
178             language='c++')
179     EXT_MODULES.append(_mod)
180 
181 # Add Cython files from qutip/control
182 _mod = Extension('qutip.control.cy_grape',
183             sources = ['qutip/control/cy_grape.pyx'],
184             include_dirs = [np.get_include()],
185             extra_compile_args=_compiler_flags,
186             extra_link_args=_link_flags,
187             language='c++')
188 EXT_MODULES.append(_mod)
189 
190 
191 # Add optional ext modules here
192 if "--with-openmp" in sys.argv:
193     sys.argv.remove("--with-openmp")
194     if (sys.platform == 'win32'
195             and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35):
196         omp_flags = ['/openmp']
197         omp_args = []
198     else:
199         omp_flags = ['-fopenmp']
200         omp_args = omp_flags
201     _mod = Extension('qutip.cy.openmp.parfuncs',
202             sources = ['qutip/cy/openmp/parfuncs.pyx',
203                        'qutip/cy/openmp/src/zspmv_openmp.cpp'],
204             include_dirs = [np.get_include()],
205             extra_compile_args=_compiler_flags+omp_flags,
206             extra_link_args=omp_args+_link_flags,
207             language='c++')
208     EXT_MODULES.append(_mod)
209     # Add benchmark pyx
210     _mod = Extension('qutip.cy.openmp.benchmark',
211             sources = ['qutip/cy/openmp/benchmark.pyx'],
212             include_dirs = [np.get_include()],
213             extra_compile_args=_compiler_flags,
214             extra_link_args=_link_flags,
215             language='c++')
216     EXT_MODULES.append(_mod)
217 
218     # Add brtools_omp
219     _mod = Extension('qutip.cy.openmp.br_omp',
220             sources = ['qutip/cy/openmp/br_omp.pyx'],
221             include_dirs = [np.get_include()],
222             extra_compile_args=_compiler_flags,
223             extra_link_args=_link_flags,
224             language='c++')
225     EXT_MODULES.append(_mod)
226 
227     # Add omp_sparse_utils
228     _mod = Extension('qutip.cy.openmp.omp_sparse_utils',
229             sources = ['qutip/cy/openmp/omp_sparse_utils.pyx'],
230             include_dirs = [np.get_include()],
231             extra_compile_args=_compiler_flags+omp_flags,
232             extra_link_args=omp_args+_link_flags,
233             language='c++')
234     EXT_MODULES.append(_mod)
235 
236     # Add cqobjevo_omp
237     _mod = Extension('qutip.cy.openmp.cqobjevo_omp',
238             sources = ['qutip/cy/openmp/cqobjevo_omp.pyx'],
239             include_dirs = [np.get_include()],
240             extra_compile_args=_compiler_flags+omp_flags,
241             extra_link_args=omp_args,
242             language='c++')
243     EXT_MODULES.append(_mod)
244 
245 
246 # Remove -Wstrict-prototypes from cflags
247 import distutils.sysconfig
248 cfg_vars = distutils.sysconfig.get_config_vars()
249 if "CFLAGS" in cfg_vars:
250     cfg_vars["CFLAGS"] = cfg_vars["CFLAGS"].replace("-Wstrict-prototypes", "")
251 
252 
253 # Setup commands go here
254 setup(
255     name = NAME,
256     version = FULLVERSION,
257     packages = PACKAGES,
258     include_package_data=True,
259     include_dirs = INCLUDE_DIRS,
260     headers = HEADERS,
261     ext_modules = cythonize(EXT_MODULES),
262     cmdclass = {'build_ext': build_ext},
263     author = AUTHOR,
264     author_email = AUTHOR_EMAIL,
265     license = LICENSE,
266     description = DESCRIPTION,
267     long_description = LONG_DESCRIPTION,
268     keywords = KEYWORDS,
269     url = URL,
270     classifiers = CLASSIFIERS,
271     platforms = PLATFORMS,
272     requires = REQUIRES,
273     package_data = PACKAGE_DATA,
274     zip_safe = False,
275     install_requires=INSTALL_REQUIRES,
276     **EXTRA_KWARGS
277 )
278 _cite = """\
279 ==============================================================================
280 Installation complete
281 Please cite QuTiP in your publication.
282 ==============================================================================
283 For your convenience a bibtex reference can be easily generated using
284 `qutip.cite()`"""
285 print(_cite)
286
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -159,7 +159,7 @@
     _compiler_flags = ['/w', '/Ox']
 # Everything else
 else:
-    _compiler_flags = ['-w', '-O3', '-march=native', '-funroll-loops']
+    _compiler_flags = ['-w', '-O3', '-funroll-loops']
     if sys.platform == 'darwin':
         # These are needed for compiling on OSX 10.14+
         _compiler_flags.append('-mmacosx-version-min=10.9')

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -159,7 +159,7 @@\n     _compiler_flags = ['/w', '/Ox']\n # Everything else\n else:\n-    _compiler_flags = ['-w', '-O3', '-march=native', '-funroll-loops']\n+    _compiler_flags = ['-w', '-O3', '-funroll-loops']\n     if sys.platform == 'darwin':\n         # These are needed for compiling on OSX 10.14+\n         _compiler_flags.append('-mmacosx-version-min=10.9')\n", "issue": "Optimization flags in setup.py should be completely avoided\nHard-coding compiler flag `-march=native` in setup.py completely destroys possibility to set up Qutip on heterogeneous cluster. In general, it brings a lot of problems for people that don't have a good experience in debugging \"illegal instruction\" errors, that often happen, if you compile the module on different machine than you use.\r\n\r\nIf you are sure you need optimized build for localhost, you might use\r\n```\r\nexport CFLAGS=\"-O3 -march=native\"\r\nexport CXXFLAGS=\"$CFLAGS\"\r\npip install qutip\r\n```\r\ninstead or provide separate option for setup.py script.\n", "before_files": [{"content": "#!/usr/bin/env python\n\"\"\"QuTiP: The Quantum Toolbox in Python\n\nQuTiP is open-source software for simulating the dynamics of closed and open\nquantum systems. The QuTiP library depends on the excellent Numpy, Scipy, and\nCython numerical packages. In addition, graphical output is provided by\nMatplotlib.  QuTiP aims to provide user-friendly and efficient numerical\nsimulations of a wide variety of quantum mechanical problems, including those\nwith Hamiltonians and/or collapse operators with arbitrary time-dependence,\ncommonly found in a wide range of physics applications. QuTiP is freely\navailable for use and/or modification on all common platforms. Being free of\nany licensing fees, QuTiP is ideal for exploring quantum mechanics in research\nas well as in the classroom.\n\"\"\"\n\nDOCLINES = __doc__.split('\\n')\n\nCLASSIFIERS = \"\"\"\\\nDevelopment Status :: 4 - Beta\nIntended Audience :: Science/Research\nLicense :: OSI Approved :: BSD License\nProgramming Language :: Python\nProgramming Language :: Python :: 3\nTopic :: Scientific/Engineering\nOperating System :: MacOS\nOperating System :: POSIX\nOperating System :: Unix\nOperating System :: Microsoft :: Windows\n\"\"\"\n\n# import statements\nimport os\nimport sys\n# The following is required to get unit tests up and running.\n# If the user doesn't have, then that's OK, we'll just skip unit tests.\ntry:\n    from setuptools import setup, Extension\n    TEST_SUITE = 'nose.collector'\n    TESTS_REQUIRE = ['nose']\n    EXTRA_KWARGS = {\n        'test_suite': TEST_SUITE,\n        'tests_require': TESTS_REQUIRE\n    }\nexcept:\n    from distutils.core import setup\n    from distutils.extension import Extension\n    EXTRA_KWARGS = {}\n\ntry:\n    import numpy as np\nexcept:\n    np = None\n\nfrom Cython.Build import cythonize\nfrom Cython.Distutils import build_ext\n\n# all information about QuTiP goes here\nMAJOR = 4\nMINOR = 4\nMICRO = 0\nISRELEASED = False\nVERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)\nREQUIRES = ['numpy (>=1.8)', 'scipy (>=0.15)', 'cython (>=0.21)']\nINSTALL_REQUIRES = ['numpy>=1.8', 'scipy>=0.15', 'cython>=0.21']\nPACKAGES = ['qutip', 'qutip/ui', 'qutip/cy', 'qutip/cy/src',\n            'qutip/qip', 'qutip/qip/models',\n            'qutip/qip/algorithms', 'qutip/control', 'qutip/nonmarkov',\n            'qutip/_mkl', 'qutip/tests', 'qutip/legacy',\n            'qutip/cy/openmp', 'qutip/cy/openmp/src']\nPACKAGE_DATA = {\n    'qutip': ['configspec.ini'],\n    'qutip/tests': ['*.ini'],\n    'qutip/cy': ['*.pxi', '*.pxd', '*.pyx'],\n    'qutip/cy/src': ['*.cpp', '*.hpp'],\n    'qutip/control': ['*.pyx'],\n    'qutip/cy/openmp': ['*.pxd', '*.pyx'],\n    'qutip/cy/openmp/src': ['*.cpp', '*.hpp']\n}\n# If we're missing numpy, exclude import directories until we can\n# figure them out properly.\nINCLUDE_DIRS = [np.get_include()] if np is not None else []\n# ajgpitch Mar 2017:\n# This HEADERS did not work, but I will leave it in anyway, as it is supposed to.\n# I had to do the nasty thing with PACKAGES and PACKAGE_DATA above.\nHEADERS = ['qutip/cy/src/zspmv.hpp', 'qutip/cy/openmp/src/zspmv_openmp.hpp']\nNAME = \"qutip\"\nAUTHOR = (\"Alexander Pitchford, Paul D. Nation, Robert J. Johansson, \"\n          \"Chris Granade, Arne Grimsmo\")\nAUTHOR_EMAIL = (\"alex.pitchford@gmail.com, nonhermitian@gmail.com, \"\n                \"jrjohansson@gmail.com, cgranade@cgranade.com, \"\n                \"arne.grimsmo@gmail.com\")\nLICENSE = \"BSD\"\nDESCRIPTION = DOCLINES[0]\nLONG_DESCRIPTION = \"\\n\".join(DOCLINES[2:])\nKEYWORDS = \"quantum physics dynamics\"\nURL = \"http://qutip.org\"\nCLASSIFIERS = [_f for _f in CLASSIFIERS.split('\\n') if _f]\nPLATFORMS = [\"Linux\", \"Mac OSX\", \"Unix\", \"Windows\"]\n\n\ndef git_short_hash():\n    try:\n        git_str = \"+\" + os.popen('git log -1 --format=\"%h\"').read().strip()\n    except:\n        git_str = \"\"\n    else:\n        if git_str == '+': #fixes setuptools PEP issues with versioning\n            git_str = ''\n    return git_str\n\nFULLVERSION = VERSION\nif not ISRELEASED:\n    FULLVERSION += '.dev'+str(MICRO)+git_short_hash()\n\n# NumPy's distutils reads in versions differently than\n# our fallback. To make sure that versions are added to\n# egg-info correctly, we need to add FULLVERSION to\n# EXTRA_KWARGS if NumPy wasn't imported correctly.\nif np is None:\n    EXTRA_KWARGS['version'] = FULLVERSION\n\n\ndef write_version_py(filename='qutip/version.py'):\n    cnt = \"\"\"\\\n# THIS FILE IS GENERATED FROM QUTIP SETUP.PY\nshort_version = '%(version)s'\nversion = '%(fullversion)s'\nrelease = %(isrelease)s\n\"\"\"\n    a = open(filename, 'w')\n    try:\n        a.write(cnt % {'version': VERSION, 'fullversion':\n                FULLVERSION, 'isrelease': str(ISRELEASED)})\n    finally:\n        a.close()\n\nlocal_path = os.path.dirname(os.path.abspath(sys.argv[0]))\nos.chdir(local_path)\nsys.path.insert(0, local_path)\nsys.path.insert(0, os.path.join(local_path, 'qutip'))  # to retrive _version\n\n# always rewrite _version\nif os.path.exists('qutip/version.py'):\n    os.remove('qutip/version.py')\n\nwrite_version_py()\n\n# Add Cython extensions here\ncy_exts = ['spmatfuncs', 'stochastic', 'sparse_utils', 'graph_utils', 'interpolate',\n           'spmath', 'heom', 'math', 'spconvert', 'ptrace', 'checks', 'brtools',\n           'brtools_checks', 'br_tensor', 'inter', 'cqobjevo', 'cqobjevo_factor', 'piqs']\n\n# Extra link args\n_link_flags = []\n\n# If on Win and Python version >= 3.5 and not in MSYS2 (i.e. Visual studio compile)\nif (sys.platform == 'win32' and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35\n    and os.environ.get('MSYSTEM') is None):\n    _compiler_flags = ['/w', '/Ox']\n# Everything else\nelse:\n    _compiler_flags = ['-w', '-O3', '-march=native', '-funroll-loops']\n    if sys.platform == 'darwin':\n        # These are needed for compiling on OSX 10.14+\n        _compiler_flags.append('-mmacosx-version-min=10.9')\n        _link_flags.append('-mmacosx-version-min=10.9')\n\n\n\nEXT_MODULES =[]\n# Add Cython files from qutip/cy\nfor ext in cy_exts:\n    _mod = Extension('qutip.cy.'+ext,\n            sources = ['qutip/cy/'+ext+'.pyx', 'qutip/cy/src/zspmv.cpp'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n# Add Cython files from qutip/control\n_mod = Extension('qutip.control.cy_grape',\n            sources = ['qutip/control/cy_grape.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\nEXT_MODULES.append(_mod)\n\n\n# Add optional ext modules here\nif \"--with-openmp\" in sys.argv:\n    sys.argv.remove(\"--with-openmp\")\n    if (sys.platform == 'win32'\n            and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35):\n        omp_flags = ['/openmp']\n        omp_args = []\n    else:\n        omp_flags = ['-fopenmp']\n        omp_args = omp_flags\n    _mod = Extension('qutip.cy.openmp.parfuncs',\n            sources = ['qutip/cy/openmp/parfuncs.pyx',\n                       'qutip/cy/openmp/src/zspmv_openmp.cpp'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags+omp_flags,\n            extra_link_args=omp_args+_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n    # Add benchmark pyx\n    _mod = Extension('qutip.cy.openmp.benchmark',\n            sources = ['qutip/cy/openmp/benchmark.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n    # Add brtools_omp\n    _mod = Extension('qutip.cy.openmp.br_omp',\n            sources = ['qutip/cy/openmp/br_omp.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n    # Add omp_sparse_utils\n    _mod = Extension('qutip.cy.openmp.omp_sparse_utils',\n            sources = ['qutip/cy/openmp/omp_sparse_utils.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags+omp_flags,\n            extra_link_args=omp_args+_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n    # Add cqobjevo_omp\n    _mod = Extension('qutip.cy.openmp.cqobjevo_omp',\n            sources = ['qutip/cy/openmp/cqobjevo_omp.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags+omp_flags,\n            extra_link_args=omp_args,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n\n# Remove -Wstrict-prototypes from cflags\nimport distutils.sysconfig\ncfg_vars = distutils.sysconfig.get_config_vars()\nif \"CFLAGS\" in cfg_vars:\n    cfg_vars[\"CFLAGS\"] = cfg_vars[\"CFLAGS\"].replace(\"-Wstrict-prototypes\", \"\")\n\n\n# Setup commands go here\nsetup(\n    name = NAME,\n    version = FULLVERSION,\n    packages = PACKAGES,\n    include_package_data=True,\n    include_dirs = INCLUDE_DIRS,\n    headers = HEADERS,\n    ext_modules = cythonize(EXT_MODULES),\n    cmdclass = {'build_ext': build_ext},\n    author = AUTHOR,\n    author_email = AUTHOR_EMAIL,\n    license = LICENSE,\n    description = DESCRIPTION,\n    long_description = LONG_DESCRIPTION,\n    keywords = KEYWORDS,\n    url = URL,\n    classifiers = CLASSIFIERS,\n    platforms = PLATFORMS,\n    requires = REQUIRES,\n    package_data = PACKAGE_DATA,\n    zip_safe = False,\n    install_requires=INSTALL_REQUIRES,\n    **EXTRA_KWARGS\n)\n_cite = \"\"\"\\\n==============================================================================\nInstallation complete\nPlease cite QuTiP in your publication.\n==============================================================================\nFor your convenience a bibtex reference can be easily generated using\n`qutip.cite()`\"\"\"\nprint(_cite)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\"\"\"QuTiP: The Quantum Toolbox in Python\n\nQuTiP is open-source software for simulating the dynamics of closed and open\nquantum systems. The QuTiP library depends on the excellent Numpy, Scipy, and\nCython numerical packages. In addition, graphical output is provided by\nMatplotlib.  QuTiP aims to provide user-friendly and efficient numerical\nsimulations of a wide variety of quantum mechanical problems, including those\nwith Hamiltonians and/or collapse operators with arbitrary time-dependence,\ncommonly found in a wide range of physics applications. QuTiP is freely\navailable for use and/or modification on all common platforms. Being free of\nany licensing fees, QuTiP is ideal for exploring quantum mechanics in research\nas well as in the classroom.\n\"\"\"\n\nDOCLINES = __doc__.split('\\n')\n\nCLASSIFIERS = \"\"\"\\\nDevelopment Status :: 4 - Beta\nIntended Audience :: Science/Research\nLicense :: OSI Approved :: BSD License\nProgramming Language :: Python\nProgramming Language :: Python :: 3\nTopic :: Scientific/Engineering\nOperating System :: MacOS\nOperating System :: POSIX\nOperating System :: Unix\nOperating System :: Microsoft :: Windows\n\"\"\"\n\n# import statements\nimport os\nimport sys\n# The following is required to get unit tests up and running.\n# If the user doesn't have, then that's OK, we'll just skip unit tests.\ntry:\n    from setuptools import setup, Extension\n    TEST_SUITE = 'nose.collector'\n    TESTS_REQUIRE = ['nose']\n    EXTRA_KWARGS = {\n        'test_suite': TEST_SUITE,\n        'tests_require': TESTS_REQUIRE\n    }\nexcept:\n    from distutils.core import setup\n    from distutils.extension import Extension\n    EXTRA_KWARGS = {}\n\ntry:\n    import numpy as np\nexcept:\n    np = None\n\nfrom Cython.Build import cythonize\nfrom Cython.Distutils import build_ext\n\n# all information about QuTiP goes here\nMAJOR = 4\nMINOR = 4\nMICRO = 0\nISRELEASED = False\nVERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)\nREQUIRES = ['numpy (>=1.8)', 'scipy (>=0.15)', 'cython (>=0.21)']\nINSTALL_REQUIRES = ['numpy>=1.8', 'scipy>=0.15', 'cython>=0.21']\nPACKAGES = ['qutip', 'qutip/ui', 'qutip/cy', 'qutip/cy/src',\n            'qutip/qip', 'qutip/qip/models',\n            'qutip/qip/algorithms', 'qutip/control', 'qutip/nonmarkov',\n            'qutip/_mkl', 'qutip/tests', 'qutip/legacy',\n            'qutip/cy/openmp', 'qutip/cy/openmp/src']\nPACKAGE_DATA = {\n    'qutip': ['configspec.ini'],\n    'qutip/tests': ['*.ini'],\n    'qutip/cy': ['*.pxi', '*.pxd', '*.pyx'],\n    'qutip/cy/src': ['*.cpp', '*.hpp'],\n    'qutip/control': ['*.pyx'],\n    'qutip/cy/openmp': ['*.pxd', '*.pyx'],\n    'qutip/cy/openmp/src': ['*.cpp', '*.hpp']\n}\n# If we're missing numpy, exclude import directories until we can\n# figure them out properly.\nINCLUDE_DIRS = [np.get_include()] if np is not None else []\n# ajgpitch Mar 2017:\n# This HEADERS did not work, but I will leave it in anyway, as it is supposed to.\n# I had to do the nasty thing with PACKAGES and PACKAGE_DATA above.\nHEADERS = ['qutip/cy/src/zspmv.hpp', 'qutip/cy/openmp/src/zspmv_openmp.hpp']\nNAME = \"qutip\"\nAUTHOR = (\"Alexander Pitchford, Paul D. Nation, Robert J. Johansson, \"\n          \"Chris Granade, Arne Grimsmo\")\nAUTHOR_EMAIL = (\"alex.pitchford@gmail.com, nonhermitian@gmail.com, \"\n                \"jrjohansson@gmail.com, cgranade@cgranade.com, \"\n                \"arne.grimsmo@gmail.com\")\nLICENSE = \"BSD\"\nDESCRIPTION = DOCLINES[0]\nLONG_DESCRIPTION = \"\\n\".join(DOCLINES[2:])\nKEYWORDS = \"quantum physics dynamics\"\nURL = \"http://qutip.org\"\nCLASSIFIERS = [_f for _f in CLASSIFIERS.split('\\n') if _f]\nPLATFORMS = [\"Linux\", \"Mac OSX\", \"Unix\", \"Windows\"]\n\n\ndef git_short_hash():\n    try:\n        git_str = \"+\" + os.popen('git log -1 --format=\"%h\"').read().strip()\n    except:\n        git_str = \"\"\n    else:\n        if git_str == '+': #fixes setuptools PEP issues with versioning\n            git_str = ''\n    return git_str\n\nFULLVERSION = VERSION\nif not ISRELEASED:\n    FULLVERSION += '.dev'+str(MICRO)+git_short_hash()\n\n# NumPy's distutils reads in versions differently than\n# our fallback. To make sure that versions are added to\n# egg-info correctly, we need to add FULLVERSION to\n# EXTRA_KWARGS if NumPy wasn't imported correctly.\nif np is None:\n    EXTRA_KWARGS['version'] = FULLVERSION\n\n\ndef write_version_py(filename='qutip/version.py'):\n    cnt = \"\"\"\\\n# THIS FILE IS GENERATED FROM QUTIP SETUP.PY\nshort_version = '%(version)s'\nversion = '%(fullversion)s'\nrelease = %(isrelease)s\n\"\"\"\n    a = open(filename, 'w')\n    try:\n        a.write(cnt % {'version': VERSION, 'fullversion':\n                FULLVERSION, 'isrelease': str(ISRELEASED)})\n    finally:\n        a.close()\n\nlocal_path = os.path.dirname(os.path.abspath(sys.argv[0]))\nos.chdir(local_path)\nsys.path.insert(0, local_path)\nsys.path.insert(0, os.path.join(local_path, 'qutip'))  # to retrive _version\n\n# always rewrite _version\nif os.path.exists('qutip/version.py'):\n    os.remove('qutip/version.py')\n\nwrite_version_py()\n\n# Add Cython extensions here\ncy_exts = ['spmatfuncs', 'stochastic', 'sparse_utils', 'graph_utils', 'interpolate',\n           'spmath', 'heom', 'math', 'spconvert', 'ptrace', 'checks', 'brtools',\n           'brtools_checks', 'br_tensor', 'inter', 'cqobjevo', 'cqobjevo_factor', 'piqs']\n\n# Extra link args\n_link_flags = []\n\n# If on Win and Python version >= 3.5 and not in MSYS2 (i.e. Visual studio compile)\nif (sys.platform == 'win32' and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35\n    and os.environ.get('MSYSTEM') is None):\n    _compiler_flags = ['/w', '/Ox']\n# Everything else\nelse:\n    _compiler_flags = ['-w', '-O3', '-funroll-loops']\n    if sys.platform == 'darwin':\n        # These are needed for compiling on OSX 10.14+\n        _compiler_flags.append('-mmacosx-version-min=10.9')\n        _link_flags.append('-mmacosx-version-min=10.9')\n\n\n\nEXT_MODULES =[]\n# Add Cython files from qutip/cy\nfor ext in cy_exts:\n    _mod = Extension('qutip.cy.'+ext,\n            sources = ['qutip/cy/'+ext+'.pyx', 'qutip/cy/src/zspmv.cpp'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n# Add Cython files from qutip/control\n_mod = Extension('qutip.control.cy_grape',\n            sources = ['qutip/control/cy_grape.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\nEXT_MODULES.append(_mod)\n\n\n# Add optional ext modules here\nif \"--with-openmp\" in sys.argv:\n    sys.argv.remove(\"--with-openmp\")\n    if (sys.platform == 'win32'\n            and int(str(sys.version_info[0])+str(sys.version_info[1])) >= 35):\n        omp_flags = ['/openmp']\n        omp_args = []\n    else:\n        omp_flags = ['-fopenmp']\n        omp_args = omp_flags\n    _mod = Extension('qutip.cy.openmp.parfuncs',\n            sources = ['qutip/cy/openmp/parfuncs.pyx',\n                       'qutip/cy/openmp/src/zspmv_openmp.cpp'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags+omp_flags,\n            extra_link_args=omp_args+_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n    # Add benchmark pyx\n    _mod = Extension('qutip.cy.openmp.benchmark',\n            sources = ['qutip/cy/openmp/benchmark.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n    # Add brtools_omp\n    _mod = Extension('qutip.cy.openmp.br_omp',\n            sources = ['qutip/cy/openmp/br_omp.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags,\n            extra_link_args=_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n    # Add omp_sparse_utils\n    _mod = Extension('qutip.cy.openmp.omp_sparse_utils',\n            sources = ['qutip/cy/openmp/omp_sparse_utils.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags+omp_flags,\n            extra_link_args=omp_args+_link_flags,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n    # Add cqobjevo_omp\n    _mod = Extension('qutip.cy.openmp.cqobjevo_omp',\n            sources = ['qutip/cy/openmp/cqobjevo_omp.pyx'],\n            include_dirs = [np.get_include()],\n            extra_compile_args=_compiler_flags+omp_flags,\n            extra_link_args=omp_args,\n            language='c++')\n    EXT_MODULES.append(_mod)\n\n\n# Remove -Wstrict-prototypes from cflags\nimport distutils.sysconfig\ncfg_vars = distutils.sysconfig.get_config_vars()\nif \"CFLAGS\" in cfg_vars:\n    cfg_vars[\"CFLAGS\"] = cfg_vars[\"CFLAGS\"].replace(\"-Wstrict-prototypes\", \"\")\n\n\n# Setup commands go here\nsetup(\n    name = NAME,\n    version = FULLVERSION,\n    packages = PACKAGES,\n    include_package_data=True,\n    include_dirs = INCLUDE_DIRS,\n    headers = HEADERS,\n    ext_modules = cythonize(EXT_MODULES),\n    cmdclass = {'build_ext': build_ext},\n    author = AUTHOR,\n    author_email = AUTHOR_EMAIL,\n    license = LICENSE,\n    description = DESCRIPTION,\n    long_description = LONG_DESCRIPTION,\n    keywords = KEYWORDS,\n    url = URL,\n    classifiers = CLASSIFIERS,\n    platforms = PLATFORMS,\n    requires = REQUIRES,\n    package_data = PACKAGE_DATA,\n    zip_safe = False,\n    install_requires=INSTALL_REQUIRES,\n    **EXTRA_KWARGS\n)\n_cite = \"\"\"\\\n==============================================================================\nInstallation complete\nPlease cite QuTiP in your publication.\n==============================================================================\nFor your convenience a bibtex reference can be easily generated using\n`qutip.cite()`\"\"\"\nprint(_cite)\n", "path": "setup.py"}]}