Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[BUGFIX] Fix building when USE_BLAS option is not provided #19832

Merged
merged 2 commits into from
Feb 16, 2021

Conversation

akarbown
Copy link
Contributor

@akarbown akarbown commented Feb 3, 2021

Description

Fix building when USE_BLAS option is not provided in the compilation command line.

Comments

Overlooked in #19766 .

@mxnet-bot
Copy link

Hey @akarbown , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [unix-gpu, centos-gpu, edge, clang, windows-gpu, miscellaneous, unix-cpu, website, sanity, centos-cpu, windows-cpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@lanking520 lanking520 added the pr-work-in-progress PR is still work in progress label Feb 3, 2021
if(MKL_FOUND)
set(BLAS "MKL")
endif()
set(BLAS "MKL")
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this fail if MKL is not available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it'll fail. I need to rethink it.

Copy link
Contributor Author

@akarbown akarbown Feb 4, 2021

Choose a reason for hiding this comment

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

I think that now it's difficult to recreate the previous logic and what's more the USE_MKL_IF_AVAILABLE variable seems to be unnecessary. What do you think about removing the USE_MKL_IF_AVAILABLE for the whole project and as a consequence of that rely only on the USE_BLAS command line option?
Thus, when USE_BLAS will be set to 'mkl' and there will be no MKL libraries - the build should fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe I missed something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Line 18 above initializes set(BLAS "Open") and only if MKL can be found, it's overwritten to BLAS=MKL.
Do you agree? If so, I think the current PR isn't needed.

With respect to USE_MKL_IF_AVAILABLE, it's fine with me to remove the variable and just check for MKL by default. As long as user doesn't specify which BLAS library they want, I think it's reasonable for MXNet to check for BLAS libraries in MXNet specified order of priority (ie. 1st prio is MKL, if not available try OpenBlas and otherwise use whatever is available..)

Copy link
Contributor Author

@akarbown akarbown Feb 4, 2021

Choose a reason for hiding this comment

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

Line 18 above initializes set(BLAS "Open") and only if MKL can be found, it's overwritten to BLAS=MKL.
Do you agree? If so, I think the current PR isn't needed.

If there is no 'MKL' the following function: find_package(MKL) is looking for the MKL through FindMKL.cmake file and produce the following warning:

CMake Warning at cmake/ChooseBlas.cmake:26 (find_package):
  By not providing "FindMKL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "MKL", but
  CMake did not find one.

  Could not find a package configuration file provided by "MKL" with any of
  the following names:

    MKLConfig.cmake
    mkl-config.cmake

  Add the installation prefix of "MKL" to CMAKE_PREFIX_PATH or set "MKL_DIR"
  to a directory containing one of the above files.  If "MKL" provides a
  separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:312 (include)

I wanted to clear it out with that PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying. One option is to move the code from elseif(BLAS STREQUAL "MKL" OR BLAS STREQUAL "mkl") case up here to the beginning of the file and return from file immediately if MKL is found, or proceed to the other options if MKL isn't found. Another option as you mention is to remove USE_MKL_IF_AVAILABLE. Either is fine with me

@akarbown
Copy link
Contributor Author

akarbown commented Feb 9, 2021

@mxnet-bot run ci [unix-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-cpu]

@leezu
Copy link
Contributor

leezu commented Feb 9, 2021

@mxnet-bot run ci [unix-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-cpu]

@akarbown
Copy link
Contributor Author

@mxnet-bot run ci [unix-cpu, windows-gpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-cpu, windows-gpu]

@akarbown akarbown changed the title [WIP] Fix building when USE_BLAS option is not provided [BUGFIX] Fix building when USE_BLAS option is not provided Feb 15, 2021
@akarbown akarbown marked this pull request as ready for review February 15, 2021 18:16
@akarbown akarbown requested a review from szha as a code owner February 15, 2021 18:16
@leezu
Copy link
Contributor

leezu commented Feb 15, 2021

@mxnet-bot run ci [windows-gpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [windows-gpu]

@lanking520 lanking520 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Feb 15, 2021
@akarbown akarbown requested a review from leezu February 16, 2021 19:37
@leezu leezu merged commit e164cee into apache:master Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants