xref: /libCEED/setup.py (revision cc132f9a20f00d9393835714dbcdd5760a8efede)
1# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3# reserved. See files LICENSE and NOTICE for details.
4#
5# This file is part of CEED, a collection of benchmarks, miniapps, software
6# libraries and APIs for efficient high-order finite element and spectral
7# element discretizations for exascale applications. For more information and
8# source code availability see http://github.com/ceed.
9#
10# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11# a collaborative effort of two U.S. Department of Energy organizations (Office
12# of Science and the National Nuclear Security Administration) responsible for
13# the planning and preparation of a capable exascale ecosystem, including
14# software, applications, hardware, advanced system engineering and early
15# testbed platforms, in support of the nation"s exascale computing imperative.
16# pylint: disable=no-name-in-module,import-error,unused-variable
17import os
18from setuptools import setup
19from setuptools.command.build_ext import build_ext
20
21# ------------------------------------------------------------------------------
22# Setup
23# ------------------------------------------------------------------------------
24
25
26def version():
27    with open(os.path.abspath("ceed.pc.template")) as template:
28        ceed_version = [line.split("Version:", 1)[1].strip() for line in template if
29                        line.startswith("Version: ")]
30    return ceed_version[0]
31
32
33def requirements():
34    with open('requirements.txt') as f:
35        return f.readlines()
36
37
38class libceed_build_ext(build_ext):
39    def run(self):
40        self.make_libceed_so()
41        build_ext.run(self)
42
43    def make_libceed_so(self):
44        import subprocess
45        if hasattr(os, 'sched_getaffinity'):
46            # number of available logical cores
47            nproc = len(os.sched_getaffinity(0))
48        else:
49            nproc = os.cpu_count()
50        subprocess.check_call([
51            'make',
52            '-j{}'.format(nproc),
53            '--always-make',
54            'install',
55            'prefix=' + os.path.join(self.build_lib, 'libceed'),
56            'FC=',  # Don't try to find Fortran (unused library build/install)
57        ])
58
59
60description = """
61libCEED: Code for Efficient Extensible Discretization
62=====================================================
63
64libCEED is a lightweight library for expressing and manipulating operators that
65arise in high-order element-based discretization of partial differential
66equations.  libCEED's representations are much for efficient than assembled
67sparse matrices, and can achieve very high performance on modern CPU and GPU
68hardware.  This approach is applicable to a broad range of linear and nonlinear
69problems, and includes facilities for preconditioning.  libCEED is meant to be
70easy to incorporate into existing libraries and applications, and to build new
71tools on top of.
72
73libCEED has been developed as part of the DOE Exascale Computing Project
74co-design Center for Efficient Exascale Discretizations (CEED).
75"""
76
77classifiers = """
78Development Status :: 4 - Beta
79Intended Audience :: Developers
80Intended Audience :: Science/Research
81License :: OSI Approved :: BSD License
82Operating System :: POSIX
83Programming Language :: C
84Programming Language :: C++
85Programming Language :: Fortran
86Programming Language :: Python
87Programming Language :: Python :: 3.5
88Programming Language :: Python :: 3.6
89Programming Language :: Python :: 3.7
90Programming Language :: Python :: 3.8
91Programming Language :: Python :: 3 :: Only
92Topic :: Scientific/Engineering
93Topic :: Software Development :: Libraries
94"""
95
96setup(name="libceed",
97      version=version(),
98      description="libCEED: Code for Efficient Extensible Discretization",
99      long_description=description,
100      long_description_content_type='text/x-rst',
101      classifiers=classifiers.split("\n")[1:-1],
102      keywords=["libCEED"],
103      platforms=["POSIX"],
104      license="BSD 2",
105      license_file='LICENSE',
106      url="https://libceed.org",
107      download_url="https://github.com/CEED/libCEED/releases",
108      project_urls={
109          "Bug Tracker": "https://github.com/CEED/libCEED/issues",
110          "Documentation": "https://libceed.org",
111          "Source Code": "https://github.com/CEED/libCEED",
112      },
113      author="libCEED Team",
114      author_email="ceed-users@llnl.gov",
115
116      install_requires=requirements(),
117      packages=["libceed"],
118      package_dir={"libceed": "python"},
119      include_package_data=True,
120
121      setup_requires=["cffi"],
122      cffi_modules=["python/build_ceed_cffi.py:ffibuilder"],
123      cmdclass={'build_ext': libceed_build_ext},
124
125      extras_require={
126          'cuda': ['numba']
127      },
128      )
129
130# ------------------------------------------------------------------------------
131