Configuration#

Build Configuration#

SweepGen learns its configuration from the waLBerla build system and passes it on to the pystencils code generation system. This includes information about the target architecture (CPU, CUDA, HIP, …) and optimization options (OpenMP, vectorization). For all options passed this way, refer to WalberlaBuildConfig.

The configuration object controlling a running generator script is maintained in the pystencils-sfg session context. You can get a reference to the configuration using WalberlaBuildConfig.from_sfg and use it to override certain configuration options, such as the code generation target.

class sweepgen.build_config.WalberlaBuildConfig(c_compiler_id, cxx_compiler_id, use_double_precision, optimize_for_localhost, mpi_enabled, openmp_enabled, cuda_enabled, hip_enabled, likwid_enabled, override=<factory>)#

Represents a waLBerla build system configuration.

Objects of this class represent the build settings which the waLBerla CMake system was configured with. It provides the appropriate code generator settings for pystencils via get_pystencils_config.

The following settings can be overridden for the current code generation script:

  • target, to generate code for a different than the default hardware target

Parameters:
c_compiler_id: str#

Value of CMAKE_C_COMPILER_ID.

cxx_compiler_id: str#

Value of CMAKE_CXX_COMPILER_ID.

use_double_precision: bool#

Value of WALBERLA_DOUBLE_ACCURACY

optimize_for_localhost: bool#

Value of WALBERLA_OPTIMIZE_FOR_LOCALHOST.

mpi_enabled: bool#

Value of WALBERLA_BUILD_WITH_MPI.

openmp_enabled: bool#

Value of WALBERLA_BUILD_WITH_OPENMP.

cuda_enabled: bool#

Value of WALBERLA_BUILD_WITH_CUDA.

hip_enabled: bool#

Value of WALBERLA_BUILD_WITH_HIP.

likwid_enabled: bool#

Value of WALBERLA_BUILD_WITH_LIKWID_MARKERS

override: ConfigOverrides#

Override code generator options that would otherwise be inferred from the build system.

static from_sfg(sfg)#

Retrieve the build configuration object from the pystencils-sfg session context.

Parameters:

sfg (SfgContext | SfgIComposer)

Return type:

WalberlaBuildConfig

property target: Target#

Return or override the actual target used for code generation

get_pystencils_config()#

Get the pystencils code generator configuration from this build configuration.

Return type:

CreateKernelConfig

class sweepgen.build_config.ConfigOverrides(target: 'Target | None' = None)#
Parameters:

target (Target | None)

target: Target | None = None#

Override code generation target

Mock the Build System for Debugging#

When run outside of waLBerla’s build system for debugging, SweepGen falls back to a mockup build configuration set through the sweepgen.build_config.DEBUG class:

class sweepgen.build_config.DEBUG#

Settings for debugging generator script outside of the waLBerla build system

BUILD_CONFIG: WalberlaBuildConfig | None = None#

The mockup build config to be used when running outside of the build system.

static use_cpu_default()#

Mimic a default CPU build configuration

static use_cuda_default()#

Mimic a default build configuration with CUDA enabled

static use_hip_default()#

Mimic a default build configuration with HIP enabled