Skip to content
Snippets Groups Projects
Unverified Commit 47669360 authored by Robin De Schepper's avatar Robin De Schepper Committed by GitHub
Browse files

Add Makejobs arg to setup.py (#1673)

parent 11ad487f
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ The easiest way to get Arbor is with
pip3 install arbor
.. note::
For other platforms, `pip` will build Arbor from source.
For other platforms, `pip` will build Arbor from source.
You will need to have some development packages installed in order to build Arbor this way.
* Ubuntu/Debian: `git cmake gcc python3-dev python3-pip libxml2-dev`
......@@ -84,6 +84,7 @@ The following optional flags can be used to configure the installation:
See :ref:`install-architecture` for details.
* ``--arch``: CPU micro-architecture to target. The advised default is ``native``.
See `here <https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html>`_ for a full list of options.
* ``--makejobs``: Specify the amount of jobs to ``make`` the project with for faster build times on multicore systems. By default set to ``2``.
**Vanilla install** with no additional features enabled:
......@@ -134,7 +135,7 @@ The following optional flags can be used to configure the installation:
it with the flags you need.
.. Note::
Detailed instructions on how to install using CMake are in the
Detailed instructions on how to install using CMake are in the
:ref:`Python configuration <install-python>` section of the :ref:`installation guide <in_build_install>`.
CMake is recommended if you need more control over compilation and installation, plan to use Arbor with C++,
or if you are integrating with package managers such as Spack and EasyBuild.
......
......@@ -27,7 +27,8 @@ class CL_opt:
'vec': False,
'arch': 'none',
'neuroml': True,
'bundled': True}
'bundled': True,
'makejobs': 2}
def settings(self):
return CL_opt.instance
......@@ -43,7 +44,8 @@ user_options_ = [
('vec', None, 'enable vectorization'),
('arch=', None, 'cpu architecture, e.g. haswell, skylake, armv8.2-a+sve, znver2 (default native).'),
('neuroml', None, 'enable parsing neuroml morphologies in Arbor (requires libxml)'),
('sysdeps', None, 'don\'t use bundled 3rd party C++ dependencies (pybind11 and json). This flag forces use of dependencies installed on the system.')
('sysdeps', None, 'don\'t use bundled 3rd party C++ dependencies (pybind11 and json). This flag forces use of dependencies installed on the system.'),
('makejobs=', None, 'the amount of jobs to run `make` with.')
]
# VERSION is in the same path as setup.py
......@@ -98,9 +100,18 @@ class _command_template:
self.vec = None
self.neuroml = None
self.sysdeps = None
self.makejobs = 2
def finalize_options(self):
super().finalize_options()
try:
self.makejobs = int(self.makejobs)
except ValueError:
err = True
else:
err = False
if err or self.makejobs < 1:
raise AssertionError('makejobs must be a strictly positive integer')
def run(self):
# The options are stored in global variables:
......@@ -118,6 +129,9 @@ class _command_template:
# bundled : use bundled/git-submoduled 3rd party libraries.
# By default use bundled libs.
opt['bundled'] = self.sysdeps is None
# makejobs : specify amount of jobs.
# By default 2.
opt['makejobs'] = int(self.makejobs)
super().run()
......@@ -169,7 +183,7 @@ class cmake_build(build_ext):
build_args = ['--config', 'Release']
# Assuming Makefiles
build_args += ['--', '-j2']
build_args += ['--', f'-j{opt["makejobs"]}']
env = os.environ.copy()
env['CXXFLAGS'] = '{}'.format(env.get('CXXFLAGS', ''))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment