12 ms·
A similar issue has come up for codes that I write. Among other things, I write low level mathematical optimization codes that need fast linear algebra to run
by kxyvr 6y ago
A similar issue has come up for codes that I write. Among other things, I write low level mathematical optimization codes that need fast linear algebra to run effectively. While there's a lot of emphasis on BLAS/LAPACK, those libraries work on dense linear algebra. In the sparse world, there are fewer good options. For things like sparse QR and Choleski, the two fastest codes that I know about are out of SuiteSparse and Intel MKL. I've not tried it, but the SuiteSparse routines will probably work fine on ARM chips, but they're dual licensed GPL/commercial and the commercial license is incredibly expensive. MKL has faster routines and is completely free, but it won't work on ARM. Note, it works fantastically well on AMD chips. Anyway, it's not that I can't make my codes work on the new Apple chips, but I'd have to explain to my commercial clients that there's another $50-100k upcharge due to the architecture change and licensing costs due to GPL restrictions. That's a lot to stomach.
- bachmeier 6y ago> I'd have to explain to my commercial clients that there's another $50-100k upcharge due to the architecture change and licensing costs due to GPL restrictions. Your complaint is kind of strange. You're blaming "GPL restrictions" but the cost is for a commercial license.
- coldtea 6y agoWell, if the FOSS license used was e.g. MIT he wouldn't have to buy a commercial license, that's the parent's point. With GPL, he does, because else his clients have to make their own code/project conformant...
- bachmeier 6y agoOh, so it's terrible to pay for software? How awful! Especially ironic because I'm sure the parent isn't working for free.
- kxyvr 6y agoWe all pay for software, but it's the amount that really shapes decisions. Most organizations have a dollar limit where we can just charge a purchase card and when they have to seek approval. In this particular case, the software costs are higher than what can likely go onto a p-card, so now it becomes a real pain to acquire. In fact, the software is so expensive that it's cost would like eclipse the cost of the computer itself. So basically, we're looking at a decision where the client can use a more performant library and save $100k as long as they stay off of Apple silicon. That's really the point I'm trying to make and not to criticize anyone for using a GPL license. Moving to these new chips, in many cases, will be a much larger cost to an organization than just the cost of the computer.
- coldtea 6y ago>Oh, so it's terrible to pay for software? Compared to not paying for it? Yes. >Especially ironic because I'm sure the parent isn't working for free. So? Who said that when you get paid yourself it stops being awful to have to pay for things?
- kxyvr 6y agoYes, that's correct. I write open source software as well and I don't begrudge anyone for licensing under GPL. And, I'm perfectly willing to obtain a commercial license, but I'm going to pass that cost on to my customers. In this particular case, though, the question for them is whether they want Apple silicon bad enough to pay an additional $50-100k in software licensing costs to keep their code private or to just buy an Intel or AMD chip. I know where I'd spend my money.
- bachmeier 6y agoYou were pretty specific that it was entirely the fault of the GPL: > I'd have to explain to my commercial clients that there's another $50-100k upcharge due to the architecture change and licensing costs due to GPL restrictions.
- epistasis 6y agoWhat point are you trying to make here? The poster has been very clear on the mechanics, which are quite understandable, but I don't understand what you are trying to say. Is it just that you think it does not put the GPL in a positive enough light? I don't mean to put words in your mouth but that's my current best guess
- chipotle_coyote 6y agoIt seems clear enough from context that the "GPL restrictions" are that if they used the GPL-licensed compiler, the commercial clients might run into legal issues with their use of it, necessitating that they purchase the commercial license. It's not uncommon for businesses to have a prohibition against using GPL software in not only their shipping products but anywhere in their toolchain. (You can argue that's a counterproductive prohibition, but "your legal department just needs to change their mind on this" may not be an argument a vendor can effectively make.)
- foolmeonce 6y agoI would not make an argument even if I thought a client would accept it. If they are incompetent they will decide to use the GPL code with sloppy oversight, violate the terms of the GPL, then they will hold a little grudge against you for the advice that got them in trouble. Sloppy companies have no internal accountability, so it's your fault. I use GPL code all the time at home and I would license many things GPL, but there's no reason to push GPL software at corporations. They should have limited options and spend money, possibly expanding MIT code, possibly just raising the price of engineers by keeping engineers occupied.
- bawolff 6y agoThat's still pretty silly. If the thing wasn't open source at all, you would still have to buy a license. If your complaint is boo hoo, some people charge for software...well consider me unsympathetic.
- smnrchrds 6y agoI imagine the conversation with the clients will go like this: - Here is a quote for 100k for adding SuiteSparse to the code. - 100k‽ But I have found on the internet that SuiteSparse is free! Justify your quote. At that point, they will have to explain to the client what GPL is and why they cannot use the free version.
- coldtea 6y ago>MKL has faster routines and is completely free, but it won't work on ARM. It will probably be ported though, if there's a demand...
- stabbles 6y agoMKL is heavily optimized for Intel microarchs and purposely crippled on AMD (I believe dgemm is fast, sgemm slow). I don't think MKL benefits from optimizing it for Apple Silicon, especially considering Apple ditched Intel's hardware.
- fxtentacle 6y agoNo it won't. Mkl is an Intel toolkit, so they will surely not support Apple's move to dump Intel processors.
- pinewurst 6y agoIn what world will Intel port MKL - Intel intellectual property - to ARM? The whole purpose of Intel's software tools is as an enabler and differentiator for their architecture and specifically their parts.
- coldtea 6y agoIn a world where Intel already had licensed ARM and built it in the past: https://newsroom.intel.com/editorials/accelerating-foundry-innovation-smart-connected-world/#gs.kn9elz https://newsroom.intel.com/editorials/accelerating-foundry-i...
- chipotle_coyote 6y agoThat linked article from 2016 is about Intel's Custom Foundry program, which I'm fairly sure is for building chips under contract to other companies. It promotes that they have "access to ARM Artisan IP," but doesn't specifically mention an ARM version of MKL that I see. The list of compatible hardware Intel's page on MKL itself lists compatible processors and ARM is conspicuously absent: https://software.intel.com/content/www/us/en/develop/tools/math-kernel-library.html https://software.intel.com/content/www/us/en/develop/tools/m... And, this question on Intel's own forums from 2016 at least suggests that there wasn't an MKL version for ARM in the time frame of the article you're linking to, either: https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/MKL-gfortran-on-ARM-processors-e-g-Raspberry-Pi-3-quad-core/td-p/1086157 https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Libr... So, from what I can tell, while Intel is an ARM licensee and made ARM CPUs in the past, they haven't made their own ARM CPUs for years and there's no sign they ever made MKL for any ARM platform. Never say never, but I think the OP is basically right -- there's not a lot of incentive for Intel to produce one.
- brundolf 6y agoWould their workflow allow just keeping a server on hand to do the number crunching, and still getting to use Apple Silicon on a relatively thin client?
- semi-extrinsic 6y agoHave you tried PETSc? It does sparse (and dense) LU and Cholesky, plus a wide variety of Krylov methods with preconditioners. It can be compiled to use MKL, MUMPS, or SuiteSparse if available, but also has its own implementations. So you could easily use it as a wrapper to give you freedom to write code that you could compile on many targets with varying degree of library support.
- kxyvr 6y agoI like PETSc, but how do its internal algorithms compare on shared memory architectures? I'd be curious if anyone has updated benchmarks between the libraries. I suppose I ought to run some in my copious amount of free time. Sadly, the factorization I personally need the most is a sparse QR factorization and PETSc doesn't really support that according to their documentation [1]. Or, really, if anyone knows a good rank-revealing factorization of A A'. I don't really need Q in the QR factorization, but I do need the rank-revealing feature. [1] https://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html https://www.mcs.anl.gov/petsc/documentation/linearsolvertabl...
- jedbrown 6y agoPETSc developer here. You're correct that we don't have a sparse QR. I'm curious about the shapes in your problem and how you use the rank-revealed factors. If you're a heavy user of SuiteSparse and upset about the license, you might want to check out Catamari (https://gitlab.com/hodge_star/catamari https://gitlab.com/hodge_star/catamari), which is MPLv2 and on-par to faster than CHOLMOD (especially in multithreaded performance). As for PETSc's preference for processes over threads, we've found it to be every bit as fast as threads while offering more reliable placement/affinity and less opportunity for confusing user errors. OpenMP fork-join/barriers incur a similar latency cost to messaging, but accidental sharing is a concern and OpenMP applications are rarely written to minimize synchronization overhead as effectively as is common with MPI. PETSc can share memory between processes internally (e.g, MPI_Win_allocate_shared) to bypass the MPI stack within a node.
- kxyvr 6y ago
- roseway4 6y agoApple's own Accelerate Framework offers both BLAS/LAPACK and a set of sparse solvers that include Cholesky and QR. https://developer.apple.com/documentation/accelerate/sparse_solvers https://developer.apple.com/documentation/accelerate/sparse_... Accelerate is highly performant on Apple hardware (the current Intel arch). I expect Apple to ensure same for their M-series CPUs, potentially even taking advantage of the tensor and GPGPU capabilities available in the SoC.
- kxyvr 6y agoHuh, this actually may end up solving many of my issues, so thanks for finding that! Outside of their documentation being terrible, they do claim the correct algorithms, so it's something to at least investigate. By the way, if anyone at Apple reads this, thanks for the library, but, you know, calling conventions, algorithm, and options would really help on pages like this: https://developer.apple.com/documentation/accelerate/sparsefactorization_t/sparsefactorizationcholeskyata?language=objc https://developer.apple.com/documentation/accelerate/sparsef...
- stephencanon 6y agoThat's the documentation page for an enumeration value, not a factorization routine (hence there are no calling conventions, etc, to document; it's just a constant). Start here: https://developer.apple.com/documentation/accelerate/solving_systems_using_direct_methods https://developer.apple.com/documentation/accelerate/solving... and also watch the WWDC session from 2017 https://developer.apple.com/videos/play/wwdc2017/711/ https://developer.apple.com/videos/play/wwdc2017/711/ (the section on sparse begins around 21:00). There is also _extensive_ documentation in the Accelerate headers, maintained by the Accelerate team rather than a documentation team, which should always be considered ground truth. Start with Accelerate/vecLib/Sparse/Solve.h (for a normal Xcode install, that's in the file system here): /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h
- m0zg 6y agoAccelerate is also available (and highly performant) on ARM as well. I was not able to beat it with anything on ARM, including hand-coded assembly, at least for sgemm and simple dot products, which are bread and butter of deep learning. It actually baffles me that Microsoft is not offering linear algebra and DSP acceleration in Windows out of the box. This creates friction, and most devs don't give a shit, so Windows users end up with worse perf on essentially the same hardware.
- gnufx 6y agoI've made the point that GCC and free linear algebra is infinitely faster on platforms of interest (geometric mean of x86_64, aarch64, ppc64le) while still having similar performance on x86_64. I thought MKL used suitesparse, or is that just matlab?
- kxyvr 6y agoAs far as I know, MKL has its own implementation. As some evidence of this, here's an article comparing their sparse QR factorization to SPQR, which is part of SuiteSparse [1]. As far as MATLAB, I believe it uses both. I've a MATLAB license and it definitely contains a copy of MKL along with the other libraries. At the same time, their sparse QR factorization definitely uses SPQR, which is part of SuiteSparse. In fact, there are some undocumented options to tune that algorithm directly from MATLAB such as spparms('spqrtol', tol). As a minor aside, this is actually one of the benefits of a MATLAB license since they have purchased the requisite commercial licenses for SuiteSparse codes, it makes it easier to deal with some commercial clients who need this capability at a lower price than a direct license itself. This, of course, means using MATLAB and not calling the library directly. It's one of the challenges to using, for example, Julia, which I believe does not bundle with the commercial license, but instead relies on GPL. https://software.intel.com/content/www/us/en/develop/articles/intel-mkl-sparse-qr-solver-multifrontal-sparse-qr-factorization-method-for-solving-a-sparse.html https://software.intel.com/content/www/us/en/develop/article...
- mturmon 6y agoJust a note in support of Matlab's sparse capabilities. For the last couple of years, I used Matlab successfully on large, sparse multiplication and factorization problems. A friend who was using R simply could not approach the scale I was able to work at, and I assume it's due to weak sparse support. I was multiplying and inverting sparse triangular matrices of size 650K x 650K with Matlab, on a laptop. Just amazing.
- gnufx 6y agoI'm surprised there doesn't seem to be anything in CRAN using SuiteSparse. It could presumably run at petascale, similarly to the dense support, if someone did similar work.
- jjgreen 6y agoSuiteSparse switched from GPL to LGPL about a year ago if that makes a difference (for the couple of components I was looking at anyway).
- kxyvr 6y agoVery cool and thanks for the heads up. I just went and checked and here's where it's at: SLIP_LU: GPL or LPGL AMD: BSD3 BTF: LGPL CAMD: BSD3 CCOLAMD: BSD3 CHOLMOD Check: LGPL CHOLMOD Cholesky: LGPL CHOLMOD Core: LGPL CHOLMOD Demo: GPL CHOLMOD Include: Various (mostly LGPL) CHOLMOD MATLAB: GPL CHOLMOD MatrixOps: GPL CHOLMOD Modify: GPL CHOLMOD Partition: LGPL CHOLMOD Supernodal: GPL CHOLMOD Tcov: GPL CHOLMOD Valgrind: GPL CHOLMOD COLAMD: BSD3 CPsarse: LGPL CXSparse LGPL GPUQREngine: GPL KLU: LGPL LDL: LGPL MATLAB_Tools: BSD3 SuiteSparseCollection: GPL SSMULT: GPL RBio: GPL SPQR: GPL SuiteSparse_GPURuntime: GPL UMFPACK: GPL CSparse/ssget: BSD3 CXSparse/ssget: BSD3 GraphBLAS: Apache2 Mongoose: GPL There's probably a bunch of mistakes in there, but that's what I found scraping things moderately quickly. Selfishly, I'd love SPQR to be LGPL, but everyone is free to choose a license as they see fit.
- neolog 6y ago> optimization codes I'm curious do people in numerical specialties say "codes" (instead of "code")? I don't often hear it that way but I'm not in that specialty.
- xiii1408 6y agoYes. e.g., "I work on multiphysics codes." software => codes
- samatman 6y agoYes, this is a Fortran-ism which persists unto the present day.
- mturmon 6y agoReally common usage in science/numerical computing. I was trying to identify when, in normal usage, you'd say "numerical codes" rather than "numerical software" or just "numerical code". It seems a bit slippery! Some contexts where it's prevalent: supercomputing, Fortran, national labs, large or multifaceted software. I also associate it with manager-speak ("our team has ported 77% of the simulation codes to HPSS").
- hobby-coder-guy 6y agoCode not codes