Open d-torrance opened 3 years ago
Oops, we may have to roll that back, unless Anton can quickly figure it out. @antonleykin ?
(There's no reason for as
to use 1.2 gb of RAM.)
Unfortunately, it does take quite a bit of RAM to compile eigen
. It takes even more RAM, if we NO_LAPACK
flag is on --- this unleashes eigen
for machine precision (which is adds even more templates to resolve).
Perhaps, you can find a way to reduce RAM usage by turning off some optimizations?
... that would be done by overriding make-variables on a file-by-file basis, e.g., by appending -O0
to CXXFLAGS
.
The only file in play is e/eigen.cpp
.
I'd be able to attempt fixing this only on Monday night...
On Fri, Sep 3, 2021, 3:44 PM Daniel R. Grayson @.***> wrote:
... that would be done by overriding make-variables on a file-by-file basis, e.g., by appending -O0 to CXXFLAGS.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/2223#issuecomment-912770486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANPI3FECMYVXSXWNQ3K5ATUAEQSDANCNFSM5DMBXTTQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
The configure script accepts an option --disable-optimize
, which disables all optimization. Maybe Doug could add that downstream. I'd like not to disable optimization upstream unless we have to. Alternatively, Doug could add the line eigen.o : CXXFLAGS += -O0
to e/Makefile.in
.
Doug, Anton tried an experiment with adding -O0 to that line, and compiling eigen.cpp still takes a lot of time and a lot of memory.
The file is only 560 lines long, so splitting it up might not be fruitful.
Doug, can you somehow get more memory for those PPA builds?
Do we have any users on those architectures?
Maybe we should forget about eigen and switch to MPLAPACK: https://github.com/nakatamaho/mplapack
Here's a discussion that says clang does better than g++ at compiling eigen.
Doug, can you somehow get more memory for those PPA builds?
I don't think so.
Do we have any users on those architectures?
ppc64el, probably not, but arm64, maybe. I believe the newer Raspberry Pis are 64 bit, and I imagine some folks may want to install a Debian-based Linux on an Apple Silicon machine.
Here's a discussion that says clang does better than g++ at compiling eigen.
This link also mentions that newer versions of GCC are better, too. And indeed, there haven't been any problems compiling eigen.cpp on any architecture in Ubuntu 21.10, which has GCC 11 as the default.
gcc-11 is available, at least, on 21.04.
My experiment with clang
(ver. 1.0.0-4ubuntu1) on ubuntu 20.04
shows some improvement. At least, it is faster than gcc
(ver. 9.3.0).
The following still fails if 4(Gb) is changed to 3.
aleykin3@cos-3m2467:~/M2repos/anton-LAcore/M2/BUILD/anton/builds.tmp/auto-clang/Macaulay2/e$ touch ../../../../../../Macaulay2/e/eigen.c\
pp; ulimit -Sv 4000000; time make
make: Entering directory '/home/aleykin3/M2repos/anton-LAcore/M2/BUILD/anton/builds.tmp/auto-clang/Macaulay2/e'
MKDEP eigen.cpp
** making TAGS file
CXX eigen.cpp
make: Leaving directory '/home/aleykin3/M2repos/anton-LAcore/M2/BUILD/anton/builds.tmp/auto-clang/Macaulay2/e'
real 0m51.017s
user 0m49.006s
sys 0m1.943s
I just had to increase the RAM assigned to my Debian virtual machine from 2.4GB to 6GB, just to compile this one file (eigen. cpp). A solution would be good.
The latest mipsel build of the Debian package failed at this step:
g++ -pipe -Wall -Wno-shadow -Wcast-qual -Wno-sign-conversion -Wno-sign-compare -Wno-parentheses -Wno-sign-compare -Wuninitialized -I/usr/include -Wno-error=pragmas -std=gnu++14 -g -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -g3 -O2 -Wno-mismatched-tags -Wno-unused-local-typedefs -Wno-unknown-pragmas -std=gnu++17 -Wno-mismatched-tags -I. -DNDEBUG -I/<<PKGBUILDDIR>>/M2/include -I/<<PKGBUILDDIR>>/M2/include -I/<<PKGBUILDDIR>>/M2/usr-host/include -I/<<PKGBUILDDIR>>/M2/include -I/<<PKGBUILDDIR>>/M2/include -I/<<PKGBUILDDIR>>/M2/usr-host/include -I/<<PKGBUILDDIR>>/M2/include -I/<<PKGBUILDDIR>>/M2/include -I/<<PKGBUILDDIR>>/M2/usr-host/include -Wdate-time -D_FORTIFY_SOURCE=2 -isystem /usr/include/libxml2 -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/src/gtest -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG -I/usr/include/cddlib -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include/python3.9 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2 -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/src/gtest -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG -I/usr/include/cddlib -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include/python3.9 -I/usr/include -DBOOST_STACKTRACE_LINK -isystem /usr/include/libxml2 -DSING_NDEBUG -DOM_NDEBUG -DSING_NDEBUG -DOM_NDEBUG -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/include/mipsel-linux-gnu/singular -I/usr/include/singular -I/usr/src/gtest -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG -I/usr/include/cddlib -I/usr/include/cdd -I/usr/include/eigen3 -I/usr/include/python3.9 -I/usr/include -DBOOST_STACKTRACE_LINK -I../d -I./../c -I./../d -Wno-fatal-errors -Wno-unused-variable -I./memtailor -I./mathic -I./mathicgb -c -Wno-cast-qual eigen.cpp -o eigen.o
cc1plus: out of memory allocating 7000048 bytes after a total of 20054016 bytes
make[3]: *** [Makefile.common:33: eigen.o] Error 1
Doug, this is preventing the release of M2 on various architectures, right? ( @antonleykin )
One idea is to divide the code in eigen.cpp into 4 separate files. Another idea would be to compile without any optimization.
Doug, this is preventing the release of M2 on various architectures, right?
Just on mipsel, which it's never successfully built on, so this isn't super critical.
Following up on the idea of breaking eigen.cpp
into smaller pieces, here is approximate RAM consumption on Ubuntu 20.04 with gcc
.
eigen.cpp
(btw, on Debian it is ~2.9g)Compile time/RAM don't seem to be affected much by going down from -O2
to -O0
. Compile times are not additive: if we break up eigen.cpp
function by function the compile time will definitely grow (it wouldn't be dramatic, but it may double).
After #2221 was merged, there have been some errors compiling eigen.cpp for various PPA builds:
Ubuntu 20.04 arm64
(full log)
Ubuntu 21.04 arm64
(full log)
Ubuntu 20.04 ppc64el
(full log)