-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[build] Fix configure breakage from #3194 MKL switch #3216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Establish MATHLIB as the single ground-truth source for the chosen matrix algebra library.
Quick tests with MKL and ATLAS(OPENBLAS will be run on Travis, and CLAPACK is too generic): --mathlib=ATLAS, libatlas-dev not installed
Inastall libatlas-dev, use --mathlib=ATLAS
No args, MKL present, ATLAS removed.
|
unset CLAPACKROOT | ||
unset OPENBLASROOT | ||
unset MKLLIBDIR | ||
#TODO(kkm): Maybe allow env vars to provide defaults? |
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.
i would definitely consider allowing these from the environment.
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.
I agree. I'm wondering what implications would be for different user's setups in the wild. Anything that was not there before is potentially breaking. There is anoter large pending rework of configure on my plate (disabling multithreaded math options, they are useless, basically), so I left this decision till then.
# Define default library roots where known (others may be found by probing). | ||
case $MATHLIB in | ||
MKL) [[ ! $MKLLIBDIR && ! $MKLROOT ]] && MKLROOT=/opt/intel/mkl ;; | ||
ATLAS) : ${ATLASROOT:=$(rel2abs ../tools/ATLAS_headers/)} ;; |
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.
If we are expecting atlas to be in ../tools/ then we should restore the scripts which download and install it there.
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.
The headers are borked on Ubuntu packages since 16.04, so we supply our own copy. The rest "just works" if you have the libatlas-dev package installed, as I confirmed (see the test log), first two sections.
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.
Please make sure the most common error condition has a clear error message that tells the user the most likely fix.
I expect this most common condition will be when MKL is not installed in /opt/intel/mkl. E.g. maybe encourage the user to try --mathlib=ATLAS or whatever the option is.
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.
In this case, I'd rather encourage the user to install MKL, really. In fact, check_dependencies already does that. There is an argument over OpenBLAS vs MKL on AMD, but ATLAS is a non-contended w.r.t. performance, I believe.
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.
Using ATLAS as the linear algebra library.
Could not find libatlas.a in any of the generic-Linux places, but we'll try other stuff...
** Failed to configure ATLAS libraries ***
** ERROR **
** Configure cannot proceed automatically.
** If you know that you have ATLAS installed somewhere on your machine, you
** may be able to proceed by replacing [somewhere] in kaldi.mk with a directory.
** If you have sudo (root) access you could install the ATLAS package on your
** machine, e.g. 'sudo apt-get install libatlas-dev libatlas-base-dev' or
** 'sudo yum install atlas.x86_64' or 'sudo zypper install libatlas3-devel',
** or on cygwin, install atlas from the installer GUI; and then run ./configure
** again.
**
** Otherwise (or if you prefer OpenBLAS for speed), you could go the OpenBLAS
** route: cd to ../tools, type 'extras/install_openblas.sh', cd back to here,
** and type './configure --openblas-root=../tools/OpenBLAS/install'
I think I'd rather s/OpenBLAS/MKL/ here. No objection? OpenBLAS has been a bear to configure recently.
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.
But maybe better as part of a bigger rework #3192. Users are broken now, and this is a hotfix.
# # support for 64bit ARMv8(AArch64) architecture in Android. | ||
|
||
# This should be incremented after any significant change to the configure | ||
# script, i.e. any change affecting kaldi.mk or the build system as a whole. |
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.
General comment.
We either need to re-add ATLAS support into tools at expected paths or support the canonical paths on different systems. On Ubuntu 16.04 atlas installs to /usr/[lib|include]/atlas but we only allow $ATLASROOT/[lib|include]. We should either let the inc/lib paths be set separately or search both $ATLASROOT/[lib|include] and $ATLASROOT[lib|include]/atlas/
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.
The sad thing is the includes for different algebra libs have been renamed in Ubuntu, like atlas-cblas.h
, openblas-cblas.h
etc. In particular, atlas has 2 headers (forgot what was the second), and one of them includes the other as <cblas.h>
, so they cannot be used as is, without either symlinking or adding our own directory to the end of the compiler's system include path, where a file named cblas.h would be just a one-liner #include <atlas-cblas.h>
. The /usr/include/atlas
is "internal", the atlas-*.h includes in /usr/include use them, but they are not for the end-user consumption.
14.04 and before did not rename the file cblas.h, but rather declared package conflicts, so you could not have e. g. both libatlas-dev and libopenblas-dev installed at the same time. Now they chose a different route, but introduced a bug. The fact that it's been there unreported and unfixed for may years tells us something about the way people use ATLAS...
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.
I think Dan's approach is the safest: cblas headers do not depend on an implementation¹, so we can carry our own, always possible to #include.
¹ This is not exactly true, as the bitness of ints for row/column indices may vary. But in practice, it's 32 for all packaged BLAS variants, except MKL, where you have a compile/link choice between 32 and 64. Since we are unlikely to go over 4 billion columns or rows, we also use 32-bit indexing with the MKL.
As long as you are confident that this patch would be a clear improvement in ease of installation without breaking anything that works right now, go ahead and merge it. BTW, @luitjens, the ATLASROOT variable is kind of misleading in the script right now-- we should fix it eventually, maybe in a major rewrite. Right now I think it just points to the location of the headers. But the script does find the system locations of ATLAS quite well as-is. |
Yes, I'll merge, as the users are waiting. I added notes to myself to #3192, please add more if you can think of anything. Wondering if we should work out an option of a non-root MKL install (either with the installers or by downloading packaged). I'll test MKL under Windows LSW when I'm bored. I do not see why should not it work, but I'll test. The LSW does not support CUDA, tho, so there's no so much practical value in this currently. |
Thanks, yes, a non-root install would be nice if easy, but it seems MKL is
very heavyweight with lots of dependencies, so I wonder whether that would
be easy to do.
A lot of people just want the installation to work and won't care about the
exact performance numbers because the most time-consuming thing is the CUDA
part anyway. So for me that's a big priority too (easy installation,
regardless of performance).
…On Tue, Apr 9, 2019 at 10:15 AM kkm (aka Kirill Katsnelson) < ***@***.***> wrote:
Merged #3216 <#3216> into master.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3216 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADJVu5p64uGlO4LTOp5EtcLHrPxqjtVMks5vfPTJgaJpZM4ck40P>
.
|
Actually, to me, MKL has always been the easiest option. It does not have any dependencies that are not its own--it is split into multiple packages, true, but it just pulls and installs them all together. It's 1.8G as set up here (I'm surprised it was only 0.5G on the Mac). I do not really know when the size would be a concern though. Compared to the amounts of data we normally churn it is still not very significant. And CUDA is nearly twice as larger anyway (3.0G for 10.0) Does CUDA always require root to set up (not including drivers)? I'd think so. At the very least, setting up the per-process GPU mode does.
I remember for a full librispeech run it was about half and half in my single-machine configuration. I had a less capable box back then, but only 1 (and slower) GPU, so I do not expect a huge change in the proportion if I did it on the current upgraded machine with 16 AVX512 cores and 2 much better GPUs. On a cluster, the GMM bootstrap part likely parallelizes significantly better that the GPU training. I'm looking at my logs; training an i-vector extractor on 400hrs (perhaps an overkill) took 80min, this is with MKL and with AVX512 support in CPU; this would be 4hrs with OpenBLAS, If I am to believe those benchmarks (I'll dig up the link); I do not know how much it was optimized for the AVX512 units since then, too. GPU training in the same experiment took some 9hrs. Longer, but of the same order of magnitude. I think there is a reason to make matrix math faster on CPU, and especially for the people who want to start getting real results on a single machine. |
Extend the validation of mutual consistency between mathlib-root
switches, and establish MATHLIB as the single ground-truth value
of the chosen matrix algebra library for the remainder of the script.
Fixes #3217.