bitorch_engine.utils.cpp_extension.get_kwargs

bitorch_engine.utils.cpp_extension.get_kwargs() Dict[str, Any][source]

Generates keyword arguments for compilation settings, tailored for specific system architectures and operating systems.

This function configures compiler flags and arguments based on the operating system and CPU architecture. It ensures that the appropriate flags are used for MacOS, ARM architectures, and potentially checks for specific CPU instruction set support (commented out by default).

Returns:

  • include_dirs: A list of directories for the compiler to look for header files.

  • libraries: A list of libraries to link against. This varies between MacOS (omp) and other systems (gomp).

  • extra_compile_args: A list of additional arguments to pass to the compiler. This includes flags for warnings, OpenMP support, and architecture-specific optimizations.

Return type:

A dictionary containing

Note

  • The function checks if the operating system is MacOS and adjusts the compilation flags accordingly.

  • For ARM architectures on Linux (not MacOS), it adds flags for ARMv8.2-A features and sets the CPU model for further optimizations if the model is detected as ARM A55 or A76.

  • The commented code snippet shows how to conditionally add compilation flags based on CPU instruction support, such as AVX2.