sage 9.3 now available on Apple silicon through conda

593 views
Skip to first unread message

Isuru Fernando

unread,
Jun 9, 2021, 1:07:54 AM6/9/21
to sage-devel, kcrisman, William Stein
To get a native conda on Apple silicon, run the following

    curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh
    bash Mambaforge-$(uname)-$(uname -m).sh

Start a new session and then you can create a new environment with sage,

    mamba create -n sage sage python=3.9

This is largely untested as all the dependencies were cross compiled from macos-x86_64 to macos-arm64
except for NTL and pari which had to be compiled natively.

Let me know how it goes. You can run the tests by doing,

    mamba install conda-build -n base
    conda build -t ~/mambaforge/pkgs/<path-to-sage-conda-tarball>

Isuru

Isuru Fernando

unread,
Jun 20, 2021, 9:30:33 PM6/20/21
to sage-devel, kcrisman, William Stein
Is there anyone with a M1 Mac who can test this out? It'd be great to see how much of sage works.

Isuru

William Stein

unread,
Jun 20, 2021, 9:55:06 PM6/20/21
to Isuru Fernando, sage-devel, kcrisman
I have an M1 Macbook Pro. I just tried this out and:

(1) your install instruction process did not confuse me at all
(despite me never installing mamba before), and everything went
perfectly,

(2) Sage starts up fine and all the random "old favorite" commands I
tried worked fine.

(3) It's fast for the first thing I tried! Here's a little benchmark:

sage: a = random_matrix(GF(7),10000)
sage: %time b=a*a
CPU times: user 1min 2s, sys: 3.99 s, total: 1min 6s
Wall time: 10.9 s

vs my random remote intel server:

sage: a = random_matrix(GF(7),10000)
sage: %time b=a*a
....:
CPU times: user 18.8 s, sys: 543 ms, total: 19.3 s
Wall time: 22 s

But then strangely the next thing I tried it was WAY slower than my
remote Intel server:

# M1
sage: %time ModularSymbols(2*997, sign=1).fcp(3)
Wall time: 12.5 s

# Intel server
sage: %time ModularSymbols(2*997, sign=1).fcp(3)
Wall time: 753 ms

Wow, the M1 gets killed by an order of magnitude..
Both benchmarks involve linear algebra -- though different libraries
-- so I wonder if cross compilation messes that up.

Other things like 2d plots pop up just fine.

In any case, excellent work and many, many thanks!

I'll run the full test suite and report back.


On Sun, Jun 20, 2021 at 6:30 PM Isuru Fernando <isu...@gmail.com> wrote:
>
> Is there anyone with a M1 Mac who can test this out? It'd be great to see how much of sage works.
>
> Isuru



--

Best Regards,
William Stein

CEO, SageMath, Inc.
https://cocalc.com

William Stein

unread,
Jun 20, 2021, 9:57:35 PM6/20/21
to Isuru Fernando, sage-devel, kcrisman
I don't know how to run the test suite.

(sage) wstein@Williams-MBP sage % mamba install conda-build -n base


__ __ __ __

/ \ / \ / \ / \

/ \/ \/ \/ \

███████████████/ /██/ /██/ /██/ /████████████████████████

/ / \ / \ / \ / \ \____

/ / \_/ \_/ \_/ \ o \__,

/ _/ \_____/ `

|/

███╗ ███╗ █████╗ ███╗ ███╗██████╗ █████╗

████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗

██╔████╔██║███████║██╔████╔██║██████╔╝███████║

██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║

██║ ╚═╝ ██║██║ ██║██║ ╚═╝ ██║██████╔╝██║ ██║

╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝


mamba (0.14.0) supported by @QuantStack


GitHub: https://github.com/mamba-org/mamba

Twitter: https://twitter.com/QuantStack


█████████████████████████████████████████████████████████████



Looking for: ['conda-build']


conda-forge/osx-arm64 Using cache

conda-forge/noarch Using cache


Pinned packages:

- python 3.9.5


Transaction


Prefix: /Users/wstein/build/mambaforge


Updating specs:


- conda-build



Package Version Build Channel Size

──────────────────────────────────────────────────────────────────────────────────

Install:

──────────────────────────────────────────────────────────────────────────────────


beautifulsoup4 4.9.3 pyhb0f4dca_0 conda-forge/noarch 86 KB

conda-build 3.21.4 py39h2804cbe_0 conda-forge/osx-arm64 562 KB

filelock 3.0.12 pyh9f0ad1d_0 conda-forge/noarch 10 KB

glob2 0.7 py_0 conda-forge/noarch 11 KB

jinja2 3.0.1 pyhd8ed1ab_0 conda-forge/noarch Cached

liblief 0.11.5 hbdafb3b_0 conda-forge/osx-arm64 2 MB

markupsafe 2.0.1 py39h5161555_0 conda-forge/osx-arm64 Cached

pkginfo 1.7.0 pyhd8ed1ab_0 conda-forge/noarch 22 KB

psutil 5.8.0 py39h5161555_1 conda-forge/osx-arm64 Cached

py-lief 0.11.5 py39hfb83b0d_0 conda-forge/osx-arm64 1 MB

python-libarchive-c 3.1 py39h2804cbe_0 conda-forge/osx-arm64 57 KB

pytz 2021.1 pyhd8ed1ab_0 conda-forge/noarch Cached

pyyaml 5.4.1 py39h46acfd9_0 conda-forge/osx-arm64 170 KB

ripgrep 13.0.0 h822aac1_0 conda-forge/osx-arm64 1 MB

soupsieve 2.0.1 py_1 conda-forge/noarch 30 KB


Summary:


Install: 15 packages


Total download: 6 MB


──────────────────────────────────────────────────────────────────────────────────


Confirm changes: [Y/n] Y

Finished pyyaml (00m:00s)
170 KB 545 KB/s

Finished python-libarchive-c (00m:00s)
57 KB 122 KB/s

Finished glob2 (00m:00s)
11 KB 22 KB/s

Finished soupsieve (00m:00s)
30 KB 53 KB/s

Finished ripgrep (00m:00s)
1 MB 2 MB/s

Finished py-lief (00m:00s)
1 MB 2 MB/s

Finished liblief (00m:00s)
2 MB 3 MB/s

Finished beautifulsoup4 (00m:00s)
86 KB 135 KB/s

Finished filelock (00m:00s)
10 KB 15 KB/s

Finished pkginfo (00m:00s)
22 KB 34 KB/s

Finished conda-build (00m:00s)
562 KB 721 KB/s

Downloading [====================================================================================================]
(00m:00s) 6.99 MB/s

Extracting [====================================================================================================]
(00m:00s) 11 / 11

Preparing transaction: done

Verifying transaction: done

Executing transaction: done

(sage) wstein@Williams-MBP sage % #conda build -t
~/build/mambaforge/pkgs/sage-9.3-hd8ed1ab_1.tar.bz2

zsh: command not found: #conda

(sage) wstein@Williams-MBP sage % ls ~/build/mambaforge/pkgs/|grep sage

sage-9.3-hd8ed1ab_1

sage-9.3-hd8ed1ab_1.tar.bz2

sagelib-9.3-py39hc026e0e_4

sagelib-9.3-py39hc026e0e_4.tar.bz2

sagemath-db-combinatorial-designs-20140630-1

sagemath-db-combinatorial-designs-20140630-1.tar.bz2

sagemath-db-conway-polynomials-0.5.0-h4653dfc_1

sagemath-db-conway-polynomials-0.5.0-h4653dfc_1.tar.bz2

sagemath-db-elliptic-curves-0.8.1-hecc5488_0

sagemath-db-elliptic-curves-0.8.1-hecc5488_0.tar.bz2

sagemath-db-graphs-20210214-hd8ed1ab_0

sagemath-db-graphs-20210214-hd8ed1ab_0.tar.bz2

sagemath-db-polytopes-20170220-1

sagemath-db-polytopes-20170220-1.tar.bz2

sagetex-3.5-pyh9f0ad1d_0

sagetex-3.5-pyh9f0ad1d_0.tar.bz2

(sage) wstein@Williams-MBP sage % time conda build -t
~/build/mambaforge/pkgs/sage-9.3-hd8ed1ab_1.tar.bz2

TEST START: /Users/wstein/build/mambaforge/pkgs/sage-9.3-hd8ed1ab_1.tar.bz2

Copying package to conda-build croot. No packages otherwise alongside
yours will be available unless you specify -c local. To avoid this
warning, your package must reside in a channel structure with
platform-subfolders. See more info on what a valid channel is at
https://conda.io/docs/user-guide/tasks/create-custom-channels.html

WARNING:conda_build.build:Copying package to conda-build croot. No
packages otherwise alongside yours will be available unless you
specify -c local. To avoid this warning, your package must reside in
a channel structure with platform-subfolders. See more info on what a
valid channel is at
https://conda.io/docs/user-guide/tasks/create-custom-channels.html

No numpy version specified in conda_build_config.yaml. Falling back
to default numpy value of 1.16

WARNING:conda_build.metadata:No numpy version specified in
conda_build_config.yaml. Falling back to default numpy value of 1.16

Renaming work directory
'/Users/wstein/build/mambaforge/conda-bld/work' to
'/Users/wstein/build/mambaforge/conda-bld/sage_1624240596347/work_moved_sage-9.3-hd8ed1ab_1_noarch'

INFO:conda_build.utils:Renaming work directory
'/Users/wstein/build/mambaforge/conda-bld/work' to
'/Users/wstein/build/mambaforge/conda-bld/sage_1624240596347/work_moved_sage-9.3-hd8ed1ab_1_noarch'

shutil.move(work)=/Users/wstein/build/mambaforge/conda-bld/work,
dest=/Users/wstein/build/mambaforge/conda-bld/sage_1624240596347/work_moved_sage-9.3-hd8ed1ab_1_noarch)

INFO:conda_build.utils:shutil.move(work)=/Users/wstein/build/mambaforge/conda-bld/work,
dest=/Users/wstein/build/mambaforge/conda-bld/sage_1624240596347/work_moved_sage-9.3-hd8ed1ab_1_noarch)

Collecting package metadata (repodata.json): ...working... done

Solving environment: ...working... failed

failed to get install actions, retrying. exception was: Unsatisfiable
dependencies for platform noarch: {'bc'}

WARNING:conda_build.build:failed to get install actions, retrying.
exception was: Unsatisfiable dependencies for platform noarch: {'bc'}

WARNING conda_build.build:test(2859): failed to get install actions,
retrying. exception was: Unsatisfiable dependencies for platform
noarch: {'bc'}


Leaving build/test directories:

Work:

/Users/wstein/build/mambaforge/conda-bld/work

Test:

/Users/wstein/build/mambaforge/conda-bld/test_tmp

Leaving build/test environments:

Test:

source activate
/Users/wstein/build/mambaforge/conda-bld/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl

Build:

source activate /Users/wstein/build/mambaforge/conda-bld/_build_env



TESTS FAILED: sage-9.3-hd8ed1ab_1.tar.bz2

(sage) wstein@Williams-MBP sage %

Isuru Fernando

unread,
Jun 20, 2021, 10:50:16 PM6/20/21
to William Stein, sage-devel, kcrisman
Hi William,

Thanks for checking this.

> But then strangely the next thing I tried it was WAY slower than my
remote Intel server:

That is strange. If you can track this down to which spkg is responsible, I can have a look.


> I don't know how to run the test suite.

Thanks. That error message is useful. I'll fix it and let you know.

Isuru

Reply all
Reply to author
Forward
0 new messages