Skip to content

Allow benchmark targets to link against a user-specified OpenBLAS library - #5953

Open
naoto-aoki-fy wants to merge 5 commits into
OpenMathLib:developfrom
naoto-aoki-fy:benchmark-link-lib
Open

Allow benchmark targets to link against a user-specified OpenBLAS library#5953
naoto-aoki-fy wants to merge 5 commits into
OpenMathLib:developfrom
naoto-aoki-fy:benchmark-link-lib

Conversation

@naoto-aoki-fy

Copy link
Copy Markdown

Summary

This pull request allows benchmark binaries to be linked against a user-specified OpenBLAS library.

It separates the OpenBLAS link argument from the corresponding Make dependency:

  • OPENBLAS_LIB specifies the library or linker argument used when linking benchmark binaries.
  • OPENBLAS_LIB_DEP specifies the file dependency used by Make when building against the in-tree OpenBLAS library.

By default, benchmark targets continue to link against ../$(LIBNAME). When OPENBLAS_LIB is overridden, the in-tree library dependency is omitted so that linker arguments such as -lopenblaso-r0.3.29 are not treated as file prerequisites.

Motivation

The benchmark targets currently link directly against ../$(LIBNAME). This makes it difficult to build them against OpenBLAS packages supplied by Linux distributions or against other externally installed OpenBLAS libraries.

Making the link argument configurable allows downstream packagers and users to build benchmark binaries against a system-provided OpenBLAS installation, including shared libraries.

For example:

make OPENBLAS_LIB=-lopenblaso-r0.3.29

When OPENBLAS_LIB is not overridden, the existing build behavior is preserved.

Changes

  • Define OPENBLAS_LIB_DEP as ../$(LIBNAME) when OPENBLAS_LIB is not explicitly set.
  • Use $(OPENBLAS_LIB_DEP) as the Make prerequisite for .goto benchmark targets.
  • Use $(OPENBLAS_LIB) as the OpenBLAS link argument.
  • Support externally installed libraries specified through the OPENBLAS_LIB command-line variable.
  • Preserve the existing in-tree linkage behavior by default.

Additional notes

- Add OPENBLAS_LIB with the existing library path as the default
- Replace direct ../$(LIBNAME) dependencies across benchmark .goto targets
- Add OPENBLAS_LIB_DEP for the default in-tree library dependency
- Use OPENBLAS_LIB only on linker command lines
- Avoid treating command-line library flags such as -lopenblaso as files
- Include OPENBLAS_LIB_DEP in the smallscaling linker command
- Resolve unresolved BLAS symbol references
- Replace the dependency variable with the actual OpenBLAS library variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant