Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ReFrame will invoke ``make`` as follows:

.. code::

make -j CC='cc' CXX='CC' FC='ftn' NVCC='nvcc' CPPFLAGS='-DMESSAGE'
make -j 1 CC='cc' CXX='CC' FC='ftn' NVCC='nvcc' CPPFLAGS='-DMESSAGE'

The compiler variables (``CC``, ``CXX`` etc.) are set based on the corresponding values specified in the `coniguration of the current environment <configure.html#environments-configuration>`__.
You may instruct the build system to ignore the default values from the environment by setting the following:
Expand All @@ -65,15 +65,17 @@ In this case, ``make`` will be invoked as follows:

.. code::

make -j CPPFLAGS='-DMESSAGE'
make -j 1 CPPFLAGS='-DMESSAGE'

Notice that the ``-j`` option is always generated.
If you want to limit build concurrency, you can do it as follows:
Notice that the ``-j 1`` option is always generated.
You may change the maximum build concurrency as follows:

.. code-block:: python

self.build_system.max_concurrency = 4

By setting :attr:`max_concurrency <reframe.core.buildsystems.Make.max_concurrency>` to :class:`None`, no limit for concurrent parallel jobs will be placed.
This means that ``make -j`` will be used for building.

Finally, you may also customize the name of the ``Makefile``.
You can achieve that by setting the corresponding variable of the :class:`Make <reframe.core.buildsystems.Make>` build system:
Expand Down Expand Up @@ -140,7 +142,7 @@ The generated build script then will have the following lines:
.. code-block:: bash

./custom_configure -with-mylib
make -j CPPFLAGS='-DHAVE_FOO'
make -j 1 CPPFLAGS='-DHAVE_FOO'


Implementing a Run-Only Regression Test
Expand Down
12 changes: 8 additions & 4 deletions reframe/core/buildsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,19 @@ class Make(BuildSystem):
#: Otherwise, it will invoked as ``make -j``.
#:
#: :type: integer
#: :default: :class:`None`
#: :default: ``1``
#:
#: .. note::
#: .. versionchanged:: 2.19
#: The default value is now ``1``
max_concurrency = fields.TypedField('max_concurrency', int, type(None))

def __init__(self):
super().__init__()
self.options = []
self.makefile = None
self.srcdir = None
self.max_concurrency = None
self.max_concurrency = 1

def emit_build_commands(self, environ):
cmd_parts = ['make']
Expand Down Expand Up @@ -467,7 +471,7 @@ class ConfigureBasedBuildSystem(BuildSystem):
#: Same as for the :attr:`Make` build system.
#:
#: :type: integer
#: :default: :class:`None`
#: :default: ``1``
max_concurrency = fields.TypedField('max_concurrency', int, type(None))

def __init__(self):
Expand All @@ -476,7 +480,7 @@ def __init__(self):
self.builddir = None
self.config_opts = []
self.make_opts = []
self.max_concurrency = None
self.max_concurrency = 1


class CMake(ConfigureBasedBuildSystem):
Expand Down
6 changes: 3 additions & 3 deletions unittests/test_buildsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_emit_from_buildsystem(self):

def test_emit_no_env_defaults(self):
self.build_system.flags_from_environ = False
self.assertEqual(['make -j'],
self.assertEqual(['make -j 1'],
self.build_system.emit_build_commands(self.environ))


Expand Down Expand Up @@ -124,7 +124,7 @@ def test_emit_from_buildsystem(self):

def test_emit_no_env_defaults(self):
self.build_system.flags_from_environ = False
self.assertEqual(['cmake .', 'make -j'],
self.assertEqual(['cmake .', 'make -j 1'],
self.build_system.emit_build_commands(self.environ))


Expand Down Expand Up @@ -173,7 +173,7 @@ def test_emit_from_buildsystem(self):

def test_emit_no_env_defaults(self):
self.build_system.flags_from_environ = False
self.assertEqual(['./configure', 'make -j'],
self.assertEqual(['./configure', 'make -j 1'],
self.build_system.emit_build_commands(self.environ))


Expand Down