Skip to content

[CMake] Correctly handle tmva-cpu=ON use_gsl_cblas=OFF case#22044

Open
guitargeek wants to merge 1 commit intoroot-project:masterfrom
guitargeek:issue-22020
Open

[CMake] Correctly handle tmva-cpu=ON use_gsl_cblas=OFF case#22044
guitargeek wants to merge 1 commit intoroot-project:masterfrom
guitargeek:issue-22020

Conversation

@guitargeek
Copy link
Copy Markdown
Contributor

If the BLAS library is not found at configuration time, we should try to fallback to the GSL CBLAS library, and if it still can't be found, error out in the configuration. The branch that handles the error was already there, but the GSL fallback was not implemented correctly.

Closes #22020.

Copy link
Copy Markdown
Collaborator

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

Comment thread cmake/modules/SearchInstalledSoftware.cmake Outdated
Comment thread cmake/modules/SearchInstalledSoftware.cmake Outdated
message(SEND_ERROR "Option tmva-cpu requires a BLAS library, but none could be found on the system. Either install a BLAS library like OpenBLAS (preferred), or set use_gsl_cblas=ON (possibly also builtin_gsl=ON if GSL not installed on the system).")
else()
set(use_gsl_cblas ON CACHE BOOL "Using GSL CBLAS for TMVA as find_package(BLAS) didn't find anything" FORCE)
endif()
Copy link
Copy Markdown
Collaborator

@ferdymercury ferdymercury Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
endif()
if(NOT builtin_gsl)
find_package(GSL)
if (NOT GSL_FOUND)
set(builtin_gsl ON CACHE BOOL "Using builtin GSL since CBLAS for TMVA required us to use GSL-CBLAS and no system GSL was found" FORCE)
message(STATUS "Enabling builtin_GSL for TMVA-cpu gsl-CBLAS [GPL]")
endif()
endif()

shouldn't this be also auto-enabled in cascade? Otherwise we might fail later on

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, that's right. I need to go back to the drawing board and see how to handle builtin_gsl.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal opinion:
I'd wish fail-on-missing wouldn't exist and would be always mandatorily ON. I'd would save a ton of headaches and issues xD
it's faster to type -DbuiltinXX=ON by the user than to handle all these casuistic by the devs.
and avoid weird things such as https://its.cern.ch/jira/browse/ROOT-10743
Auto-enabling is dangerous and developer-time-consuming. Most users download binaries, people who build can afford typing a bit what they want ;) So my vote for removing fail-on-missing and simplifying this overly complex builtin mechanism nightmare.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I vote for this for years 😆 But I forgot who was actually against it at this point. I'll bring it up again in the meetings (tagging also @hageboeck, the ROOT 7 planner).

If the BLAS library is not found at configuration time, we should try to
fallback to the GSL CBLAS library, and if it still can't be found, error
out in the configuration. The branch that handles the error was already
there, but the GSL fallback was not implemented correctly.

The GSL fallback also needs to consider `builtin_gsl` correctly, and to
achieve this, finding GSL is not done after checking the required BLAS
library for TMVA CPU.

Closes root-project#22020.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TMVA fails to link without BLAS

2 participants