Provide an advanced configuration approach

Issue #104 resolved
Klaus Iglberger created an issue

Description

In order to maximize the performance of the Blaze library for every possible target platform, Blaze provides several configuration files containing dozens of configuration switches. Amongst others, these switches allow for instance to configure the used BLAS library (via several switches in the <blaze/config/BLAS.h> header), the available cache size (cacheSize in the <blaze/config/CacheSize.h> header file), and the use of padding (usePadding in the <blaze/config/Optimizations.h> header file). However, this form of configuring the library is limited to environments where it is possible to adapt the configuration files. Unfortunately, it does not work in environments, where users cannot modify the configuration files (e.g. environments where Blaze is provided as a package or where Blaze is pre-installed).

The goal of this task is to provide means to configure the library externally, i.e. without the need to adapt Blaze header files. The final approach must ...

  • ... work in every possible environment;
  • ... allow to configure individual settings;
  • ... allow to configure via the command line;
  • ... allow the configuration via user-specific file(s);
  • ... must not create dependencies into the library;
  • ... must not restrict future changes to the library.

Tasks

  • Implement an advanced configuration approach fulfilling the given requirements
  • Provide a complete documentation of the feature

Comments (3)

  1. Klaus Iglberger reporter

    Summary

    The feature has been implemented, tested, and documented as required. It is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.2.

    Details

    It is now possible to individually specify each configuration value via command line or #define. The following gives an impression by demonstrating the new functionality for the customization of the BLAS mode and the cache size.

    BLAS Mode

    In order to achieve maximum performance for multiplications with dense matrices, Blaze can be configured to use a BLAS library. Via the following compilation switch in the configuration file ./blaze/config/BLAS.h BLAS can be enabled:

    #define BLAZE_BLAS_MODE 1
    

    In case the selected BLAS library provides parallel execution, the BLAZE_BLAS_IS_PARALLEL switch should be activated to prevent Blaze from parallelizing on its own:

    #define BLAZE_BLAS_IS_PARALLEL 1
    

    Alternatively, both settings can be specified via command line or by defining the symbols manually before including any Blaze header file:

    #define BLAZE_BLAS_MODE 1
    #define BLAZE_BLAS_IS_PARALLEL 1
    #include <blaze/Blaze.h>
    

    In case no BLAS library is available, Blaze will still work and will not be reduced in functionality, but performance may be limited.

    Cache Size

    The optimization of several Blaze compute kernels depends on the cache size of the target architecture. By default, Blaze assumes a cache size of 3 MiByte. However, for optimal speed the exact cache size of the system should be provided via the cacheSize value in the ./blaze/config/CacheSize.h configuration file:

    #define BLAZE_CACHE_SIZE 3145728UL;
    

    The cache size can also be specified via command line or by defining this symbol manually before including any Blaze header file:

    #define BLAZE_CACHE_SIZE 3145728UL
    #include <blaze/Blaze.h>
    
  2. Log in to comment