-
Notifications
You must be signed in to change notification settings - Fork 47
/
setup.py
131 lines (113 loc) · 4.79 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
# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
# reserved. See files LICENSE and NOTICE for details.
#
# This file is part of CEED, a collection of benchmarks, miniapps, software
# libraries and APIs for efficient high-order finite element and spectral
# element discretizations for exascale applications. For more information and
# source code availability see http://github.com/ceed
#
# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
# a collaborative effort of two U.S. Department of Energy organizations (Office
# of Science and the National Nuclear Security Administration) responsible for
# the planning and preparation of a capable exascale ecosystem, including
# software, applications, hardware, advanced system engineering and early
# testbed platforms, in support of the nation"s exascale computing imperative.
# pylint: disable=no-name-in-module,import-error,unused-variable
import os
from setuptools import setup
from setuptools.command.build_ext import build_ext
# ------------------------------------------------------------------------------
# Setup
# ------------------------------------------------------------------------------
def version():
with open(os.path.abspath("ceed.pc.template")) as template:
ceed_version = [line.split("Version:", 1)[1].strip() for line in template if
line.startswith("Version: ")]
return ceed_version[0]
def requirements():
with open('requirements.txt') as f:
return f.readlines()
class libceed_build_ext(build_ext):
def run(self):
prefix = os.path.join(self.build_lib, 'libceed')
self.make_libceed_so(prefix)
build_ext.run(self)
def make_libceed_so(self, prefix):
import subprocess
if hasattr(os, 'sched_getaffinity'):
# number of available logical cores
nproc = len(os.sched_getaffinity(0))
else:
nproc = os.cpu_count()
subprocess.check_call([
'make',
'-j{}'.format(nproc),
'--always-make',
'install',
'prefix=' + prefix,
'FC=', # Don't try to find Fortran (unused library build/install)
])
description = """
libCEED: Code for Efficient Extensible Discretization
=====================================================
libCEED is a lightweight library for expressing and manipulating operators that
arise in high-order element-based discretization of partial differential
equations. libCEED's representations are much for efficient than assembled
sparse matrices, and can achieve very high performance on modern CPU and GPU
hardware. This approach is applicable to a broad range of linear and nonlinear
problems, and includes facilities for preconditioning. libCEED is meant to be
easy to incorporate into existing libraries and applications, and to build new
tools on top of.
libCEED has been developed as part of the DOE Exascale Computing Project
co-design Center for Efficient Exascale Discretizations (CEED).
"""
classifiers = """
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Operating System :: POSIX
Programming Language :: C
Programming Language :: C++
Programming Language :: Fortran
Programming Language :: Python
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3 :: Only
Topic :: Scientific/Engineering
Topic :: Software Development :: Libraries
"""
setup(name="libceed",
version=version(),
description="libCEED: Code for Efficient Extensible Discretization",
long_description=description,
long_description_content_type='text/x-rst',
classifiers=classifiers.split("\n")[1:-1],
keywords=["libCEED"],
platforms=["POSIX"],
license="BSD 2",
license_file='LICENSE',
url="https://libceed.org",
download_url="https://github.com/CEED/libCEED/releases",
project_urls={
"Bug Tracker": "https://github.com/CEED/libCEED/issues",
"Documentation": "https://libceed.org",
"Source Code": "https://github.com/CEED/libCEED",
},
author="libCEED Team",
author_email="[email protected]",
install_requires=requirements(),
packages=["libceed"],
package_dir={"libceed": "python"},
include_package_data=True,
setup_requires=["cffi"],
cffi_modules=["python/build_ceed_cffi.py:ffibuilder"],
cmdclass={'build_ext': libceed_build_ext},
extras_require={
'cuda': ['numba']
},
)
# ------------------------------------------------------------------------------