On 28/10/15 16:41, Backeljauw Franky wrote:
Hi Ward,
Op 28 okt. 2015, om 15:01 heeft Ward Poelmans <[email protected]> het
volgende geschreven:
On 28-10-15 14:36, Backeljauw Franky wrote:
Hello all,
Just a small question: in several Easyblock files there are tests for mpi, as
in:
if self.toolchain.options.get('usempi', None):
This actually implies that you don’t have to specify “usempi:True” in your
Easyconfig since it is implied to be the default.
In other words: does Easybuild build with mpi as a default? (That is, unless
you explicitly specify “usempi:False” in your Easyconfig file?)
If you don't specify anything, `usempi` will be False and $CC and
friends will be set to the compiler directly. If you put `usempi` to
True, they will be set to mpicc etc.
So by default EB does not use mpi and hence the if's in the easyblocks.
So do I get it right that EB explicitly sets ‘usempi: False’ somewhere?
Yes, False is the default value for the usempi toolchain option, see
https://github.com/hpcugent/easybuild-framework/blob/master/easybuild/tools/toolchain/mpi.py#L55
Let’s look at the Easyblock for MUMPS (mumps.py), this contains:
# pick a Makefile.inc template based on compiler family and MPI enabled
if self.toolchain.options.get('usempi', None):
make_inc_suff = 'PAR'
else:
make_inc_suff = 'SEQ'
If EB would not set `usempi:False` explicitly, then the test get(‘usempi’,None)
results in None which implies True so the parallel build will be made :-(
If on the other hand EB explicitly sets ‘usempi:False’, then wouldn’t it be
better to change this test to “if self.toolchain.options[‘usempi’] = False”
instead?
The only reason we use the self.toolchain.options.get('usempi', None)
construct is to avoid that the easyblock crashes if a compiler-only
toolchain (e.g., GCC) is used.
Because then, 'usempi' is not a known toolchain option; it's only
defined for toolchains that include an MPI component...
Furthermore, is there a check to make sure ‘usempi’ is either False or True (or
None)?
By default, it's False for toolchain that include MPI.
For compiler-only toolchain, you'll always get None (which is equivalent
to False in Python) using self.toolchain.options.get('usempi', None), or
a KeyError if you would use self.toolchain.options['usempi'].
If usempi is set to True in toolchainopts, it's True (surprise!).
You can also tell by looking at the value for e.g. $CC: if the usempi
toolchain option is set to True, it will have a value like 'mpicc'
(rather than 'gcc' or 'icc').
regards,
Kenneth