{"id":97,"date":"2022-03-19T09:50:45","date_gmt":"2022-03-19T17:50:45","guid":{"rendered":"https:\/\/timkang.net\/wordpress\/?p=97"},"modified":"2022-08-23T09:53:31","modified_gmt":"2022-08-23T17:53:31","slug":"running-r-on-m1-macbook-pro","status":"publish","type":"post","link":"https:\/\/www.timkang.net\/wordpress\/?p=97","title":{"rendered":"Running R on M1 MacBook Pro"},"content":{"rendered":"\n<p>I have a 13&#8243; M1 MacBook Pro with 16 GB memory and 500GB storage. I saw this <a rel=\"noreferrer noopener\" href=\"https:\/\/www.reddit.com\/r\/rstats\/comments\/m3tx33\/apple_silicon_benchmark_update_using_the_the\/?utm_source=share&amp;utm_medium=ios_app&amp;utm_name=iossmf\" target=\"_blank\">Reddit posting<\/a> a few days ago and wondered how mine would perform. I updated R from 4.1.1 to R 4.1.3\u00a0binary for macOS 11 (Big Sur) and higher,\u00a0Apple silicon arm64\u00a0build, signed and notarized package. The results were almost similar, although it doesn&#8217;t use Rosetta anymore. Anyway, the results are as follows:<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<pre class=\"wp-block-preformatted\">R version 4.1.3 (2022-03-10) -- \"One Push-Up\"<br>Copyright (C) 2022 The R Foundation for Statistical Computing<br>Platform: aarch64-apple-darwin20 (64-bit)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">R is free software and comes with ABSOLUTELY NO WARRANTY.<br>You are welcome to redistribute it under certain conditions.<br>Type 'license()' or 'licence()' for distribution details.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Natural language support but running in an English locale<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">R is a collaborative project with many contributors.<br>Type 'contributors()' for more information and<br>'citation()' on how to cite R or R packages in publications.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Type 'demo()' for some demos, 'help()' for on-line help, or<br>'help.start()' for an HTML browser interface to help.<br>Type 'q()' to quit R.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">[R.app GUI 1.77 (8052) aarch64-apple-darwin20]<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; library(benchmarkme)\n&gt; asdf &lt;- benchmark_std()<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Programming benchmarks (5 tests):<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">3,500,000 Fibonacci numbers calculation (vector calc): 0.111 (sec).\nGrand common divisors of 1,000,000 pairs (recursion): 0.269 (sec).\nCreation of a 3,500 x 3,500 Hilbert matrix (matrix calc): 0.147 (sec).\nCreation of a 3,000 x 3,000 Toeplitz matrix (loops): 0.577 (sec).\nEscoufier's method on a 60 x 60 matrix (mixed): 0.588 (sec).<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Matrix calculation benchmarks (5 tests):<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">Creation, transp., deformation of a 5,000 x 5,000 matrix: 0.26 (sec).\n2,500 x 2,500 normal distributed random matrix^1,000: 0.113 (sec).\nSorting of 7,000,000 random values: 0.602 (sec).\n2,500 x 2,500 cross-product matrix (b = a' * a): 9.48 (sec).\nLinear regr. over a 5,000 x 500 matrix (c = a \\ b'): 0.792 (sec).<\/pre>\n\n\n\n<h6 class=\"wp-block-heading\">Matrix function benchmarks (5 tests):<\/h6>\n\n\n\n<pre class=\"wp-block-preformatted\">Cholesky decomposition of a 3,000 x 3,000 matrix: 5.19 (sec).\nDeterminant of a 2,500 x 2,500 random matrix: 1.74 (sec).\nEigenvalues of a 640 x 640 random matrix: 0.421 (sec).\nFFT over 2,500,000 random values: 0.0947 (sec).\nInverse of a 1,600 x 1,600 random matrix: 1.42 (sec).<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">&gt; plot(asdf)\nYou are ranked 1 out of 749 machines.\nPress return to get next plot\nYou are ranked 299 out of 747 machines.\nPress return to get next plot\nYou are ranked 174 out of 747 machines.<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"1024\" src=\"https:\/\/timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319-924x1024.jpg\" alt=\"\" class=\"wp-image-100\" srcset=\"https:\/\/www.timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319-924x1024.jpg 924w, https:\/\/www.timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319-271x300.jpg 271w, https:\/\/www.timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319-768x851.jpg 768w, https:\/\/www.timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319-1386x1536.jpg 1386w, https:\/\/www.timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319-1200x1330.jpg 1200w, https:\/\/www.timkang.net\/wordpress\/wp-content\/uploads\/2022\/03\/r_benchmarkme_20220319.jpg 1664w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><figcaption>Screencapture of the results<\/figcaption><\/figure>\n<\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a 13&#8243; M1 MacBook Pro with 16 GB memory and 500GB storage. I saw this Reddit posting a few days ago and wondered how mine would perform. I updated R from 4.1.1 to R 4.1.3\u00a0binary for macOS 11 (Big Sur) and higher,\u00a0Apple silicon arm64\u00a0build, signed and notarized package. The results were almost similar, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13,14],"tags":[17,16,15],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-programming","category-r","tag-benchmark","tag-m1-macbook-pro","tag-r"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":5,"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/115"}],"wp:attachment":[{"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.timkang.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}