-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Cmake blas #14028
Cmake blas #14028
Conversation
|
@mxnet-label-bot add [pr-awaiting-review, Build] @marcoabreu for review |
|
This is still a WIP, I will fix it as soon as possible. |
lebeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
| cp *.h /usr/include | ||
| cp libopenblas.a /usr/local/lib | ||
|
|
||
| # Ideally, a simple `make install` would do the job. However, OpenBLAS fails when running `make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you can set the PREFIX instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the problem is that the utility getarch which is invoked by the Makefile fails to execute. That would be another rabbit hole that I didn't want to get into.
| COPY install/android_arm64_openblas.sh /work/ | ||
| RUN /work/android_arm64_openblas.sh | ||
| ENV CPLUS_INCLUDE_PATH /work/deps/OpenBLAS | ||
| ENV OpenBLAS_HOME=/work/deps/OpenBLAS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change also relevant for the other arm builds? ok seems to diverge from ther others. Did you figure out if this affects anything downstream? and is it worth moving this change to a different PR for PR atomicity, etc. ok - now I see from the cmake code why it matters. All good! Safe to ignore this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you figure out if this affects anything downstream?
What do you mean by that? If any other image is using this docker image? I didn't check that, but it shouldn't affect any downstreams, unless they're depending on this, which would be depending on an undocumented hack.
and is it worth moving this change to a different PR for PR atomicity, etc.
The problem is that this change is required for this PR to be merged. Without this change it won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup - I saw that. All good! My bad, I didn't read to the end before commenting =P
aaronmarkham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add what the user might need to do to use this? Maybe it would be good in these spots:
https://mxnet.incubator.apache.org/versions/master/install/build_from_source.html
ttps://mxnet.incubator.apache.org/versions/master/install/ubuntu_setup.html#build-the-shared-library
Option 1 step 8 seems relevant. https://mxnet.incubator.apache.org/versions/master/install/windows_setup.html#build-from-source
https://mxnet.incubator.apache.org/versions/master/faq/env_var.html?highlight=environment
Or let us know needs updating and someone can loop through the docs to make sure setup references are updated.
|
Good points @aaronmarkham! I will take a look at the docs to see what can be updated. |
|
@edisongustavo ping to update the PR |
|
@anirudhacharya I will get back to this asap, probably tomorrow. |
|
@edisongustavo Thank you for your contributions! Can you please provide some updates in this PR? Thanks! |
larroy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@mxnet-label-bot update [Build, pr-awaiting-response] |
|
@edisongustavo Could you please provide an update on the PR? Thanks |
|
@abhinavs95 Yes, I will do that tomorrow. |
|
@edisongustavo Gentle ping... |
|
@edisongustavo Can you address Aaron's comments so that we can move forward with this PR? Thanks |
|
@mxnet-label-bot add [pr-work-in-progress] |
|
Hello all, sorry for taking so long to answer. Things have been very hectic at lately. Anyway, I've looked at the docs and the place that I see that could use an update is this part here (https://mxnet.incubator.apache.org/versions/master/install/windows_setup.html#build-from-source):
The problem is that the version of the OpenBLAS package compiled there is using Visual Studio 2008, which is not compatible with Visual Studio 2017. I have looked at all releases at the OpenBLAS sourceforge page and didn't find any releases with binaries on it. ProblemThe problem is: "find compiled binaries of OpenBLAS (for Visual Studio 2017) available for download on the web". Proposed solution 1A solution I could think of is to use the compiled package from conda-forge: https://anaconda.org/conda-forge/openblas In that page, the closest version The rewritten doc would look like this: 6. Download the [OpenBlas](https://anaconda.org/conda-forge/openblas/0.2.20/download/win-64/openblas-0.2.20-vc14_8.tar.bz2) package.
7. Untar the file. There will be a directory inside named `Library`, rename it to ```OpenBLAS``` and put it under `C:\utils`. You can place the unzipped files and folders in another directory if you wish.Would this be good enough @aaronmarkham ? |
|
People, I accidentally deleted my I've recreated the PR here: #14871 |
|
Closing in favor of #14871. |
Description
Eases the pain of linking with OpenBLAS using cmake.
This PR adds support to use the provided
OpenBLASConfig.cmake.Justification for the change
The standard way of linking with dependencies in CMake is via the
find_package()mechanism (docs). This mechanism provides 2 ways of finding the dependencies:OpenBLASConfig.cmake(oropenblas-config.cmake), which are provided by the dependency itself)FindOpenBLAS.cmake, which is provided by either cmake or the project compiling the dependency, mxnet in this case)The preferred way to find a dependency is if they provide their "Config" file, since the authors of the dependency are the ones who know best about the structure of their code and how they should be linked.
When I tried to compile MXNet on Windows it didn't work well. My setup was:
It failed because this binary package is compiled with a Visual Studio version prior to 2015. So I would get the error
unresolved external symbol __imp____iob_func. The reasons are explained here: https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2Then I tried to use the conda-forge package. This almost worked.
On further inspection of the FindOpenBLAS.cmake and the conda-forge package, I noticed that MXNet didn't use the provided "cmake Config mode" files (
OpenBLASConfig.cmake). It tried to find the library all by itself, which is an "anti-pattern" when using cmake. So I thought that this could be an opportunity to be able to contribute to the project by improving this module.Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
I have tested this by compiling it on Windows and Linux.
To provide OpenBLAS I have tried:
On Linux:
On Windows:
Comments