M2 on ARM

864 views
Skip to first unread message

Thomas Kahle

unread,
Dec 5, 2020, 5:04:54 AM12/5/20
to Macaulay2
Hi,

Apple is making some big performance claims with their new ARM laptop chips. In my impression, single core performance (which seems most relevant for what we do in M2) has been stagnant for years. I just ran a little benchmark from my Binomials package. On a 2020 Intel Core i7 it is about 15% faster than on whatever laptop I had in 2012. Hooray!

Has anybody got M2 to run on a modern ARM CPU (= Apple M1)? How does M2 performance look like? What are the times returned for the attached M2 code?

Cheers,
Thomas





--
Thomas Kahle
https://www.thomas-kahle.de
benchmark.m2
signature.asc

Doug Torrance

unread,
Dec 5, 2020, 8:51:25 PM12/5/20
to Macaulay2
I'm currently not able to get Macaulay2 to build on arm64, at least in Debian [1].

Thomas Kahle

unread,
Jan 19, 2021, 11:53:04 AM1/19/21
to Macaulay2
Hi again,

On 5 Dec 2020, at 11:04, Thomas Kahle wrote:
> Apple is making some big performance claims with their new ARM laptop chips. In my impression, single core performance (which seems most relevant for what we do in M2) has been stagnant for years. I just ran a little benchmark from my Binomials package. On a 2020 Intel Core i7 it is about 15% faster than on whatever laptop I had in 2012. Hooray!
>
> Has anybody got M2 to run on a modern ARM CPU (= Apple M1)? How does M2 performance look like? What are the times returned for the attached M2 code?

I got the cheapest Mac mini they have and compiled a native M2 on it (Thanks Mahrud!!!). Then I ran my binomial primary decomposition benchmark. Here are there results:

Very hot and expensive Intel Core i7 from 2020:
1 -- used 43.9704 seconds
2 -- used 1.02189 seconds
3 -- used 47.5518 seconds
4 -- used 1.17522 seconds

Very cheap totally silent and cool Mac Mini:
1 -- used 23.4343 seconds
2 -- used 0.488787 seconds
3 -- used 26.796 seconds
4 -- used 0.668099 seconds

I think this is mostly single core performance and the Mac mini seems to be about twice as fast as my 2020 Intel Macbook Pro. The power consumption of the Mac mini is very low, much lower than that of the Macbook. If you still have Intel stock, I’d suggest to sell (This is not financial advice!).
signature.asc

Daniel R. Grayson

unread,
Jan 20, 2021, 9:43:45 AM1/20/21
to Macaulay2
That's impressive!

Andrew P. Staal

unread,
Mar 25, 2021, 3:33:13 PM3/25/21
to Macaulay2
Hi,

would anyone have pointers for installing/compiling native M2 on M1?  I just made a (naive) attempt following the macOS instructions in the "M2/INSTALL" file, but failed at the first "make" command (when checking "tbb").

So far I only have the native Brew installation at its new default location "/opt/homebrew/".

Output is below, in case anyone is curious. 

Cheers,
Andrew

% gmake
gmake: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2'
gmake -C . -f Makefile
gmake[1]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2'
GNU make version okay
GNU autoconf version okay
autoconf
autoheader
touch "include/M2/config.h.in.stamp"
GNU automake version okay
gmake[2]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2' =============================================================================
error: the libtool program installed on your system (libtool is /Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/libtool) is not GNU.
Please install or update libtool: the version should be at least 2.4.4. gmake[3]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2' gmake[3]: *** No rule to make target 'alternative-msg'. Stop.
gmake[3]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2' gmake[2]: *** [Makefile:111: libtool-msg] Error 2
gmake[2]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2' gmake[1]: *** [Makefile:84: check-libtool] Error 2
gmake[1]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2' gmake: *** [GNUmakefile:234: configure] Error 2
gmake: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2'

% type libtool
libtool is /usr/bin/libtool

% type glibtool
glibtool is /opt/homebrew/bin/glibtool

% gmake -f Makefile get-tools
gmake -C usr-build -f Makefile.pkg LIBNAME=m4 VERSION=1.4.18
gmake[1]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake -C usr-build -f Makefile.pkg LIBNAME=autoconf VERSION=2.69
gmake[1]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake -C usr-build -f Makefile.pkg LIBNAME=automake VERSION=1.16.1
gmake[1]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake -C usr-build -f Makefile.pkg LIBNAME=libtool VERSION=2.4.6
gmake[1]: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2/usr-build'
echo export ACLOCAL_PATH:="`usr-build/bin/aclocal --print-ac-dir`":'$(ACLOCAL_PATH)' >usr-build/aclocal-path2
m4:
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/m4
autoconf:
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/autoconf
autoconf (GNU Autoconf) 2.69
automake:
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/automake
automake (GNU automake) 1.16.1
libtool:
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/libtool
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/libtool: line 923: /usr/local/bin/gsed: No such file or directory
 (GNU libtool) 2.4.6
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/bin/libtool: line 2458: /usr/local/bin/gsed: No such file or directory
aclocal-path:
export ACLOCAL_PATH:=/usr/local/Cellar/automake/1.16.3/share/aclocal:$(ACLOCAL_PATH)
aclocal-path2:
export ACLOCAL_PATH:=/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/share/aclocal:$(ACLOCAL_PATH)
aclocal_--print:
/Users/andrew/Repositories/Macaulay2Work/M2/usr-build/share/aclocal

% gmake
gmake: Entering directory '/Users/andrew/Repositories/Macaulay2Work/M2'
=== remaking config.status in M2 :
===   -rwxr-xr-x  1 andrew  staff  64365  2 Mar 00:05 config.status
===   -rwxr-xr-x  1 andrew  staff  498500 25 Mar 14:05 configure
./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --enable-download --enable-build-libraries=readline AR=/usr/bin/ar RANLIB=/usr/bin/ranlib --no-create --no-recursion
configure: configuring Macaulay2 version 1.17.2.1
relevant environment variable values, if any:
   AR = /usr/bin/ar
configure: unrecognized issue: macOS
configure: operating system information:
   OS    = Darwin
   ISSUE = macOS-11.2.3
checking for gmake... gmake
checking for pkg-config... pkg-config
checking for etags... etags
checking for lintian... no
checking for otool... otool
checking for rpmlint... no
checking for gtar... gtar
checking for gfind... no
checking for find... find
checking for objdump... objdump
checking for objcopy... no
checking for ldd... no
checking for git... git
checking for ar... /usr/bin/ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for strip... strip
checking whether strip accepts the remove-section option... no
checking whether gmake is GNU make... yes
checking whether GNU make is recent enough... yes
checking whether gtar is GNU tar... yes
checking build system type... arm-apple-darwin20.3.0
checking host system type... arm-apple-darwin20.3.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for bison... bison -y
checking for ranlib... /usr/bin/ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
configure: checking for C compiler for build environment...
checking how to run the C preprocessor... gcc -E
checking for gcc... gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
configure: checking for C compiler for build environment... done
checking for gcc version... 12.0.0
checking whether exceptions are caught... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of int *... 8
checking size of long... 8
checking whether time.h and sys/time.h may both be included... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking io.h usability... no
checking io.h presence... no
checking for io.h... no
checking linux/personality.h usability... no
checking linux/personality.h presence... no
checking for linux/personality.h... no
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking elf.h usability... no
checking elf.h presence... no
checking for elf.h... no
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking for stdlib.h... (cached) yes
checking syscall.h usability... no
checking syscall.h presence... no
checking for syscall.h... no
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for unistd.h... (cached) yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking for library containing clock_gettime... none required
checking for library containing socket... none required
checking for library containing hstrerror... none required
checking for library containing dlopen... none required
checking for library containing gethostbyname... none required
checking tbb/tbb.h usability... no
checking tbb/tbb.h presence... no
checking for tbb/tbb.h... no
configure: error: tbb include file (tbb.h) not found
gmake: *** [GNUmakefile:237: config.status] Error 1
gmake: Leaving directory '/Users/andrew/Repositories/Macaulay2Work/M2'

% type tbb
tbb not found

On Wednesday, January 20, 2021 at 9:43:45 a.m. UTC-5 danielrich...@gmail.com wrote:
That's impressive!

Doug Torrance

unread,
Mar 25, 2021, 3:38:55 PM3/25/21
to Macaulay2
I'm assuming you're working from a relatively recent git branch, since I don't think the tbb dependency has made it into a stable release yet (and so it hasn't been documented in M2/INSTALL yet).  You might try checking out the last stable tag and then starting the build over:

git checkout release-1.17.2



Andrew P. Staal

unread,
Mar 25, 2021, 3:48:56 PM3/25/21
to Macaulay2
Ah, thanks for the suggestion Doug, I'll try that out!

Mahrud Sayrafi

unread,
Mar 25, 2021, 3:53:50 PM3/25/21
to maca...@googlegroups.com
Hi Andrew,

The following worked for Thomas and Frank:
brew tap macaulay2/tap
brew install $(brew deps --1 --include-build macaulay2/tap/M2)
deps=$(brew deps --1 --include-optional macaulay2/tap/M2 | tr '\n' ';')
paths=$HOMEBREW_PREFIX/opt/${deps//;/;$HOMEBREW_PREFIX/opt/}
cmake -GNinja -S M2/M2 -B M2/M2/BUILD/build \
      -DBUILD_NATIVE=OFF \
      -DCMAKE_PREFIX_PATH=$paths \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr
Then run ninja. This page has more info on building with CMake.

I saved this stub on this wiki page. Would be good to expand on it for others trying to build on M1.

Best,
Mahrud

--
You received this message because you are subscribed to the Google Groups "Macaulay2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to macaulay2+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/macaulay2/94b77daf-1172-4de3-bb71-8e75abb189can%40googlegroups.com.

Andrew P. Staal

unread,
Mar 25, 2021, 7:03:00 PM3/25/21
to Macaulay2
Hi Mahrud, 

I tried your commands, ran into difficulty with "make clean distclean" ("clang: error: the clang compiler does not support '-march=native'"), but I re-cloned into another folder and that problem went away.

Now I've got a problem at the "build-ninja" stage that I haven't figured out yet (below).  I'll have another crack at it soon.

Thanks again for the help,
Andrew

% ninja build-libraries
[0/1] Re-running CMake...
## Configure Macaulay2
     M2 version        = 1.17.2.1
     Git description   = version-1.17.2.1-574-f262e9a41
     Install prefix    = /usr

     CMAKE_BUILD_TYPE  = Release
     BUILD_NATIVE      = OFF
     BUILD_SHARED_LIBS = OFF
     BUILD_TESTING     = ON
     BUILD_DOCS        = OFF

     COVERAGE          = OFF
     MEMDEBUG          = OFF
     PROFILING         = OFF

     DEVELOPMENT       = OFF
     EXPERIMENT        = OFF
## could not recognize issue flavor: macOS

## Host OS information
     ISSUE             = macOS-11.2.3
     NODENAME          = APSMBP3.local
     OS REL            = Darwin 20.3.0
     ARCH              = arm64
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:161 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:161 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:161 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.20.0/share/cmake/Modules/GNUInstallDirs.cmake:354 (message):
  GNUInstallDirs_get_absolute_install_dir called without third argument.
  Using ${dir} from the caller's scope for compatibility with CMake 3.19 and
  below.
Call Stack (most recent call first):
  cmake/configure.cmake:167 (GNUInstallDirs_get_absolute_install_dir)
  CMakeLists.txt:69 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.


## Staging area prefixes
     usr-host          = /Users/andrew/Repositories/Macaulay2Source/M2/M2/BUILD/build/usr-host
     common            = /Users/andrew/Repositories/Macaulay2Source/M2/M2/BUILD/build/usr-dist/common
     exec              = /Users/andrew/Repositories/Macaulay2Source/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3

## Compiler information
     C                 = AppleClang 12.0.0.12000032 (/Library/Developer/CommandLineTools/usr/bin/cc)
     C++               = AppleClang 12.0.0.12000032 (/Library/Developer/CommandLineTools/usr/bin/c++)
     Ccache            = /opt/homebrew/bin/ccache

--  Checking for existing libraries and programs
--  Checking library compatibility
--  Checking library compatibility -  Libraries are compatible!
-- Submodule update
--  Checking for existing libraries and programs -  Everything is in order! 🎉
## External components
     Need to build:
       Libraries       = N/A
       Programs        = N/A
     Already built:
       Libraries       = GTest
       Programs        = N/A

## Library information
     Linear Algebra    = /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Accelerate.framework;-lm;-ldl
     MP Arithmetic     = /opt/homebrew/opt/gmp/lib/libgmpxx.dylib;/opt/homebrew/opt/gmp/lib/libgmp.dylib

-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/Users/andrew/Repositories/Macaulay2Source/M2/M2/Macaulay2/e/GTEST_INCLUDE_DIR
   used as include directory in directory /Users/andrew/Repositories/Macaulay2Source/M2/M2/Macaulay2/e

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
FAILED: build.ninja
/opt/homebrew/Cellar/cmake/3.20.0/bin/cmake --regenerate-during-build -S/Users/andrew/Repositories/Macaulay2Source/M2/M2 -B/Users/andrew/Repositories/Macaulay2Source/M2/M2/BUILD/build
ninja: error: rebuilding 'build.ninja': subcommand failed

Andrew P. Staal

unread,
Mar 27, 2021, 7:06:57 PM3/27/21
to Macaulay2
Update:  the previous problem went away with Doug's suggestion to "checkout release-1.17.2", which I had neglected to do before trying Mahrud's steps.  Following those steps led to the following errors when building packages:

[154/221] Installing package gfanInterface
FAILED: Macaulay2/packages/CMakeFiles/install-gfanInterface usr-dist/arm64-Darwin-macOS-11.2.3/lib/Macaulay2/gfanInterface/.installed
cd /Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/Macaulay2/packages && /Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2 -q --stop --silent --no-preload --no-threads -e errorDepth=3 -e debugLevel=0 -e "installPackage(\"gfanInterface\", Verbose => false, RerunExamples => false, CheckDocumentation => true, IgnoreExampleErrors => false, RemakeAllDocumentation => false, InstallPrefix => \"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/\", UserMode => false, SeparateExec => true, DebuggingMode => true)" -e "\"info-\"|\"gfanInterface\" << gfanInterface#\"test number\" << close" -e "exit 0" && gzip -nf9 /Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/info/gfanInterface.info
 -- making example results for "gfanFanLink"                                 -- 0.735073 seconds elapsed
 -- making example results for "gfanDoesIdealContain"                        -- 0.73187 seconds elapsed
 -- making example results for "gfanKrullDimension"                          -- 0.728303 seconds elapsed
 -- making example results for "gfanSubstitute"                              -- 0.72935 seconds elapsed
 -- making example results for "gfanTropicalFunction"                       
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/91-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("gfanInterface",Reload=>true,FileName=>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/Macaulay2/packages/gfanInterface.m2")' <"/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Tropical__Function.m2" >>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Tropical__Function.errors" 2>&1
/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Tropical__Function.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Tropical__Function.m2:0:1: (input file)
M2: *** Error 1
 -- 0.716085 seconds elapsed
 -- making example results for "gfanFanProduct"                              -- 0.740821 seconds elapsed
 -- making example results for "gfanBuchberger"                              -- 0.737668 seconds elapsed
 -- making example results for "gfanMixedVolume"                             -- 0.726932 seconds elapsed
 -- making example results for "gfanToPolyhedralFan"                         -- 0.729482 seconds elapsed
 -- making example results for "gfanMinors"                                  -- 0.722532 seconds elapsed
 -- making example results for "gfan"                                       
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/97-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("gfanInterface",Reload=>true,FileName=>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/Macaulay2/packages/gfanInterface.m2")' <"/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan.m2" >>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan.errors" 2>&1
/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan.m2:0:1: (input file)
M2: *** Error 1
 -- 0.725967 seconds elapsed
 -- making example results for "gfanLeadingTerms"                            -- 0.743351 seconds elapsed
 -- making example results for "gfanTropicalBasis"                           -- 0.724307 seconds elapsed
 -- making example results for "gfanTropicalHyperSurface"                    -- 0.722399 seconds elapsed
 -- making example results for "gfanOverIntegers"                           
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/101-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("gfanInterface",Reload=>true,FileName=>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/Macaulay2/packages/gfanInterface.m2")' <"/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Over__Integers.m2" >>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Over__Integers.errors" 2>&1
/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Over__Integers.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Over__Integers.m2:0:1: (input file)
M2: *** Error 1
 -- 0.714033 seconds elapsed
 -- making example results for "MPLConverter"                                -- 0.726002 seconds elapsed
 -- making example results for "gfanHomogenize"                              -- 0.724482 seconds elapsed
 -- making example results for "gfanTropicalRank"                            -- 0.722893 seconds elapsed
 -- making example results for "gfanFanCommonRefinement"                     -- 0.76519 seconds elapsed
 -- making example results for "markedPolynomialList"                        -- 0.719434 seconds elapsed
 -- making example results for "gfanTropicalTraverse"                       
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/107-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("gfanInterface",Reload=>true,FileName=>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/Macaulay2/packages/gfanInterface.m2")' <"/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Tropical__Traverse.m2" >>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Tropical__Traverse.errors" 2>&1
/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Tropical__Traverse.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Tropical__Traverse.m2:0:1: (input file)
M2: *** Error 1
 -- 0.724091 seconds elapsed
 -- making example results for "gfanHomogeneitySpace"                        -- 0.723011 seconds elapsed
 -- making example results for "gfanIsMarkedGroebnerBasis"                   -- 0.724289 seconds elapsed
 -- making example results for "Conventions for calling methods with options"
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/110-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("gfanInterface",Reload=>true,FileName=>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/Macaulay2/packages/gfanInterface.m2")' <"/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86___Conventions_spfor_spcalling_spmethods_spwith_spoptions.m2" >>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/___Conventions_spfor_spcalling_spmethods_spwith_spoptions.errors" 2>&1
/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/___Conventions_spfor_spcalling_spmethods_spwith_spoptions.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86___Conventions_spfor_spcalling_spmethods_spwith_spoptions.m2:0:1: (input file)
M2: *** Error 1
 -- 0.751629 seconds elapsed
 -- making example results for "gfanTropicalBruteForce"                      -- 1.97213 seconds elapsed
 -- making example results for "gfanMinkowskiSum"                            -- 0.733992 seconds elapsed
 -- making example results for "gfanGroebnerCone"                            -- 0.724799 seconds elapsed
 -- making example results for "gfanToLatex"                                 -- 0.738635 seconds elapsed
 -- making example results for "gfanSecondaryFan"                           
 ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512;  cd /var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/115-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("gfanInterface",Reload=>true,FileName=>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/Macaulay2/packages/gfanInterface.m2")' <"/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Secondary__Fan.m2" >>"/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Secondary__Fan.errors" 2>&1
/Users/andrew/Repositories/Macaulay2Direct/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/gfanInterface/example-output/_gfan__Secondary__Fan.errors:0:1: (output file) error: Macaulay2 exited with status code 1
/var/folders/_8/jjh50gt94jn4k4npz9dw05v40000gn/T/M2-23237-0/86_gfan__Secondary__Fan.m2:0:1: (input file)
M2: *** Error 1
 -- 0.712503 seconds elapsed
 -- making example results for "gfanLatticeIdeal"                            -- 0.725115 seconds elapsed
 -- making example results for "gfanTropicalEvaluation"                      -- 0.72365 seconds elapsed
 -- making example results for "gfanPolynomialSetUnion"                      -- 0.727443 seconds elapsed
 -- making example results for "gfanTropicalLinearSpace"                     -- 0.717005 seconds elapsed
 -- making example results for "gfanTropicalStartingCone"                    -- 0.73294 seconds elapsed
 -- making example results for "gfanStats"                                   -- 0.723495 seconds elapsed
 -- making example results for "gfanMarkPolynomialSet"                       -- 0.722701 seconds elapsed
 -- making example results for "gfanInitialForms"                            -- 0.734493 seconds elapsed
 -- making example results for "gfanTropicalIntersection"                    -- 0.737244 seconds elapsed
 -- making example results for "gfanTropicalWeilDivisor"                     -- 0.72732 seconds elapsed
 -- making example results for "Installation and Configuration of gfanInterface" -- 1.45995 seconds elapsed
 -- making example results for "gfanSaturation"                              -- 0.721176 seconds elapsed
 -- making example results for "MarkedPolynomialList"                        -- 0.719795 seconds elapsed
currentString:1:1:(3):[2]: error: installPackage: 6 error(s) occurred running examples for package gfanInterface
ninja: build stopped: subcommand failed.

This looks similar to the issue raised here: https://github.com/Macaulay2/M2/issues/1503 (the behaviour was similar, the command "build-packages" would abruptly stop partway, but not necessarily right after trying to install "gfanInterface".  I tried some of the suggestions in the link, but what finally resolved this problem is running "ninja build-gfan".  (For whatever reason, doing "ninja build-programs" always returned "ninja: no work to do.")

Then I ran "ctest --build-and-test" and in the end have "91% tests passed, 37 tests failed out of 405"—not sure whether that's normal.  Next, running "ninja install" gave the error:

[249/250] Install the project...
-- Install configuration: "Release"
-- Installing: /usr/bin/M2-binary
CMake Error at Macaulay2/bin/cmake_install.cmake:41 (file):
  file INSTALL cannot copy file
  "/Users/andrew/Repositories/Macaulay2Again/M2/M2/BUILD/build/usr-dist/arm64-Darwin-macOS-11.2.3/bin/M2-binary"
  to "/usr/bin/M2-binary": Operation not permitted.

Call Stack (most recent call first):
  Macaulay2/cmake_install.cmake:62 (include)
  cmake_install.cmake:42 (include)


FAILED: CMakeFiles/install.util
cd /Users/andrew/Repositories/Macaulay2Again/M2/M2/BUILD/build && /opt/homebrew/Cellar/cmake/3.20.0/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.

I vaguely remember having permission problems before when trying to write to "/usr/bin" due to macOS SIP, so got rid of " -DCMAKE_INSTALL_PREFIX=/usr" in Mahrud's M2 on M1 snippet and did "sudo chown -R $(whoami) /usr/local/*".  But now I have the error:

[247/248] Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/bin/M2-binary
-- Installing: /usr/local/bin/M2
-- Installing: /usr/local/lib/Macaulay2/lib
CMake Error at Macaulay2/cmake_install.cmake:90 (file):
  file INSTALL cannot make directory "/usr/local/lib/Macaulay2/lib": No such
  file or directory.

Call Stack (most recent call first):
  cmake_install.cmake:42 (include)


FAILED: CMakeFiles/install.util
cd /Users/andrew/Repositories/M2Source/M2/M2/BUILD/build && /opt/homebrew/Cellar/cmake/3.20.0/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.

I'm not sure what to make of this particular error at the moment, so if anyone's read this far and has a suggestion, I'd be grateful. 

Thanks again for the help (and documentation).

P.S.  Is this the kind of thing that should be posted instead as a github issue?  I tend to think of the google group as a "get help using M2" thread and the github page as a "I know something is wonky with the program" thread, but I have a hard time telling which is which when it comes to installation questions.  Or perhaps to github Discussions?

Andrew P. Staal

unread,
Mar 28, 2021, 7:18:16 PM3/28/21
to Macaulay2
"sudo ninja install" worked :-)

Xiaowen Hu

unread,
Aug 15, 2021, 1:53:13 PM8/15/21
to Macaulay2
I ran your binomial primary decomposition benchmark on my Mac Mini 2018 and MacBook Air M1. 
System information:
Mac mini 2018: CPU=i7-8700B 3.20GHz, Memory=64G, Macaulay2-1.16 and Macaulay2-1.17, OS=Catalina 10.15.7.
MacBook Air M1: CPU=M1, Memory=16G, Macaulay2-1.16 and Macaulay2-1.17, OS=Big Sur 11.3.1.
I have not succeeded to install Macaulay2-1.18 via homebrew on MacBook Air M1. The version I am using on it should be a non-native one (in the Activity Monitor, the Architecture of the M2 process is Intel). 

Results in Mac mini 2018:
1 -used 29.3995 seconds in Macaulay2-1.16, and 37.9538 seconds in Macaulay2-1.17
2 -used 0.759914 seconds in Macaulay2-1.16, and 0.918017 seconds in Macaulay2-1.17
3 -used 31.9823 seconds in Macaulay2-1.16, and 44.33 seconds in Macaulay2-1.17
4 showed an error in Macaulay2-1.16, and 1.13579 seconds Macaulay2-1.17

 I ran the commands several times and the results differ less than 0.2 second. It seems that Macaulay2-1.16 is faster than Macaulay2-1.17.

The time command on the two versions of Macaulay2 on MacBook Air differs very far from the actual running time (Is this a bug?). So I had to record the  time manually. The timer by hands has about an inaccuracy of, I think,  about 1 second. So I only state the manual timing results in the 1st and 3rd cases.
Results in MacBook Air M1:
1-- used 0.654603 seconds, manual timing  27.82 seconds  In Macaulay2-1.16, 
   and -- used 0.84091 seconds,  manual timing  36.08 seconds in Macaulay2-1.17
3 -used 0.750976 seconds, manual timing  32.12 seconds in Macaulay2-1.16
 and - used 0.988491 seconds,manual timing  41.92 seconds in Macaulay2-1.17. 

(Again  Macaulay2-1.16 performs better than Macaulay2-1.17. )
I also ran some personal benchmarks on both computers. In the same version of Macaulay2, when the running time is not long, two computers' performances are quite close. Due to the no-fans design of the MacBook Air, I am not sure about its long time performance. It is hard to manually time if the actual running time is large. But from experiences the actual running time is about 40 times the result of the time command. In one of my benchmark, the result in Mac mini 2018 is about 2400 seconds, and the result in MacBook Air is about 60 seconds. So I guess the actual running time of Macbook 
Air M1 is still very close to that of Mac mini 2018. 

I wish that I can install a native Macaulay2 in MacBook Air  M1 in the future, and find an accurate running time on it. By the way, after a long time (e.g. 10 minutes) running of Macaulay2, the MBA M1 will be rather warm. 

Two questions to Thomas:
1.  Which version of Macaulay2 did you run your benchmark in? (So that I can compare the results in my Mac mini 2018 to your Mac Mini M1). 
2. Are you sure that your Macaulay2 ran natively? You can check it in Activity Monitor ->Architecture.

Thomas Kahle

unread,
Aug 15, 2021, 4:21:21 PM8/15/21
to Macaulay2

Hi,

On 15 Aug 2021, at 19:20, Xiaowen Hu wrote:

I ran your binomial primary decomposition benchmark on my Mac Mini 2018 and
MacBook Air M1.

This is interesting, thanks. I cannot repeat my experiments since I got rid of the M1 already (I got it only to do some tests and it did not have enough RAM for me). I’m now waiting to run M2 on the M2 machines.

Yes, I was definitely running a native ARM version that I compiled from git. Mahrud Sayrafi helped me with some libraries and there are some discussions regarding the build on this mailing list and GitHub issues. My Macaulay2 version was whatever was up to date on GitHub back in December 2020. I think it was shortly before the 1.17 release, probably close to 1.17.

I had no issues with the time command as you are experiencing. This is strange and may be related to Rosetta emulation? I think it is still quite amazing that M2 runs about as fast in an emulator on M1 as it does natively on Intel. A 2x speedup when run natively on M1 seems plausible.

Cheers,
Thomas

--
You received this message because you are subscribed to the Google Groups "Macaulay2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to macaulay2+...@googlegroups.com.

Daniel R. Grayson

unread,
Aug 15, 2021, 4:29:16 PM8/15/21
to Macaulay2
On Sunday, August 15, 2021 at 4:21:21 PM UTC-4 Thomas Kahle wrote:

 I’m now waiting to run M2 on the M2 machines.


It's good to hear that someone has designed a CPU expressly for Macaulay2!

 

Youngsu

unread,
Oct 20, 2021, 8:46:46 PM10/20/21
to Macaulay2
With the help of Mahrud and Nobuki, I could install M2V1.18.0.1 on my iMac 24-in. My result was similar to Thomas'. While running it, I noticed that the performance cores were not fully loaded. Out of curiosity, I run two benchmarks concurrently. The results were pretty close. 

One/Two
-- used 26.0056 seconds / -- used 25.7857 seconds 
-- used 0.522214 seconds / -- used 0.507355 seconds 
-- used 29.7108 seconds / -- used 29.6867 seconds 
-- used 0.69482 seconds / -- used 0.745032 seconds

Even running two, the CPUs were not fully loaded.

Reply all
Reply to author
Forward
0 new messages