How rrze-hpc/likwid works
Main components/modules
• Library/Daemon Layer:
– The “src” directory shows major source files implementing the core functionality. In particular, components such as the access daemon (src/access-daemon, which installs hardware access functions), access routines (access_x86, access_client, etc.), and various performance monitoring routines are central.
– The system also contains hardware-specific modules (e.g., different “access_x86…” and “sysFeatures” files) which encapsulate interfacing with different hardware architectures.
• Command Line Tools & Applications:
– Individual executables such as likwid-topology, likwid-perfctr, likwid-pin, likwid-powermeter, likwid-bench, likwid-genTopoCfg, and others (located in src/applications or built separately) wrap around the library calls to offer user-facing functionality.
• Benchmarking Component:
– The “bench” directory contains micro benchmark scripts and source files (e.g., various benchmark patterns for different architectures – x86, ARMv7, ARMv8, POWER, etc.) to test performance metrics.
• External Dependencies & Utilities:
– External libraries and tools integrated into the project (located under “ext”) include GOTCHA (for function interception), hwloc (for hardware locality and topology), and Lua (for configuration and scripting interfaces).
– Additionally, support files like “groups”, “filters”, and “doc” add event groups, filtering mechanisms, and documentation.
• Build & Packaging System:
– The “Makefile”, “config.mk”, “packaging”, “.github” workflows, and “gitlab-ci.yml” files represent the build configuration, continuous integration, and distribution preparation.
Relationships and interactions
• At the lowest level is the Hardware Interface Layer that directly interacts with CPU registers/performance counters, possibly using the operating system’s APIs or direct MSR access.
• The Library/Daemon Layer (including components in src/access-daemon and related files) abstracts hardware-specific details and provides APIs for higher-level tools.
• The CLI tools (such as likwid-topology or likwid-perfctr) call the library routines to retrieve system and performance data. They may also use the Marker API, allowing applications to embed performance markers.
• The benchmarking suite (in bench) calls both library functions and specific benchmark kernels to evaluate performance on various platforms.
• External dependencies (hwloc, GOTCHA, Lua) are used by the library and tools to fetch additional system information, intercept function calls, or provide scripting support.
Important architectural patterns and design principles
• Modularity: LIKWID is divided into clearly separated components (the core library, the daemon, and multiple tools) to keep concerns separate.
• Hardware Abstraction: There is a strong emphasis on abstracting away differences across various architectures using different source modules and configuration files.
• Extensibility: With clearly defined event groups and external interfaces (e.g., Marker API), new functionalities or bindings (for Python, Java, Julia) can easily plug into the existing framework.
• Build & Integration: The project’s use of standardized build systems (Makefiles, CMake config files in ext directories) and packaging scripts shows attention to easy installation and CI automation.
Relevant technologies/frameworks
• Programming Language: Mainly C (with some Fortran and Perl utilities) for performance-critical code.
• External Libraries: hwloc for topology discovery, GOTCHA for interposition (e.g., for runtime instrumentation), Lua for scripting interfaces, and possibly MPI/OpenMP integration for multiprocess/parallel testing.
• Build System: Traditional Unix Makefiles, enhanced by CMake (in ext directories and “make” folder), and CI/CD workflows (.github/workflows, .gitlab-ci.yml).
Specific elements
• Use clear labels for each component: e.g., “Hardware Interface Layer”, “Access Daemon & Core Library”, “CLI Tools (topology, perfctr, pin…)”, “Benchmark Suite”, “External Libraries (hwloc, GOTCHA, Lua)”, “Build/CI/Packaging”.
– User Commands → CLI Tools → Core Library/Daemon → Hardware/OS
– Benchmark suite → Core Library → Performance Counters/Hardware
– Integration of external libraries (e.g., hwloc providing system topology to both the core library and CLI tools)
• Build pipeline and test/packaging components as a separate side block that interacts with the source code and documentation.