-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathsetup.py
More file actions
86 lines (70 loc) · 2.55 KB
/
Copy pathsetup.py
File metadata and controls
86 lines (70 loc) · 2.55 KB
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
from pathlib import Path
import platform
from setuptools import Extension, setup
X86_MACHINES = ["x86_64", "amd64", "x86", "i386", "i686", "AMD64"]
IS_X86 = platform.machine().lower() in X86_MACHINES
UNIX_CXXFLAGS = ["-std=c++17", "-ftree-vectorize"]
# x86-only flags for GCC, not supported by aarch64
UNIX_X86_CXXFLAGS = [
"-mavx2",
# GCP N2
"-march=haswell",
"-maes",
"-mno-pku",
"-mno-sgx",
"--param", "l1-cache-line-size=64",
"--param", "l1-cache-size=32",
"--param", "l2-cache-size=33792",
]
def unix_flags(*extra_x86):
"""Portable flags, plus the Haswell-tuned ones only where they mean something."""
flags = [*UNIX_CXXFLAGS]
if IS_X86:
flags += [*UNIX_X86_CXXFLAGS, *extra_x86]
return flags
CXX_ARGS = {
# "Darwin": [*UNIX_CXXFLAGS], not supported anymore due to M1, PRs welcome
"Linux": ["-fopenmp", *unix_flags("-mabm")],
"Windows": ["/openmp", "/std:c++latest", "/arch:AVX2"],
}
project_root = Path(__file__).parent
with open(project_root / "README.md", encoding="utf-8") as f:
long_description = f.read()
class get_numpy_include:
"""Defer numpy.get_include() until after numpy is installed."""
def __str__(self):
import numpy
return numpy.get_include()
setup(
name="lapjv",
description="Linear sum assignment problem solver using Jonker-Volgenant algorithm.",
long_description=long_description,
long_description_content_type="text/markdown",
version="1.3.29",
license="MIT",
author="Vadim Markovtsev",
author_email="gmarkhor@gmail.com",
url="https://github.com/src-d/lapjv",
download_url="https://github.com/src-d/lapjv",
ext_modules=[Extension("lapjv",
sources=["python.cc"],
extra_compile_args=CXX_ARGS[platform.system()],
include_dirs=[get_numpy_include()])],
install_requires=["numpy>=1.20.0"],
tests_require=["scipy>=1.6.0"],
setup_requires=["numpy>=1.21.0"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Topic :: Scientific/Engineering :: Information Analysis",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
)
# python3 setup.py bdist_wheel
# auditwheel repair -w dist dist/*
# twine upload dist/*manylinux*