Blaze_Config forgets to set SMP compile time switch

Issue #330 closed
Tim Zimmermann created an issue

Hi,

I believe there is a small bug in the newly added ‘Blaze_Config’ cmake module introduced with pull request #34 (see also #275). If the user explicitly disables threading via

Blaze_Config{
    Threading   off
}

no compile definition is added to the target. In particular, if blaze was configured to use shared memory parallelisation during installation (which is the default) blaze might still use the default SMP configuration which is not what the user expects in this case.

I believe adding

target_compile_definitions(Blaze INTERFACE BLAZE_USE_SHARED_MEMORY_PARALLELIZATION=0)

at line 253 in Blaze_Config.cmake solves the problem.

Tim

Comments (4)

  1. Klaus Iglberger

    Hi Tim!

    Thanks a lot for pointing out this defect. Since you have already suggested a fix, you are cordially invited to create a pull request. As a bonus you would be added to the list of contributors on the main page. Thanks,

    Best regards,

    Klaus!

  2. Tim Zimmermann reporter

    Hi Klaus,

    actually, I missinterpreted the use case of Blaze_Config. If I understand #275 correctly, the idea is to use blaze in an unexported state. Under these circumstances, you don’t start from a target with OpenMP support enabled. Since you need to set BLAZE_USE_SHARED_MEMORY_PARALLELIZATION=1 and set the appropriate compile time switch for all non-serial execution modes to get a threaded execution, doing nothing for Threading=”off” (in particular not setting BLAZE_USE_SHARED_MEMORY_PARALLELIZATION=0) is enough for serial execution even if BLAZE_USE_SHARED_MEMORY_PARALLELIZATION=1 by default.

    Sorry if I caused any confusion,

    Tim

  3. Log in to comment