[R-SIG-Mac] Large number calculations causing system crash (Carl Witthoft)

Matt Denwood md @end|ng |rom @und@ku@dk
Thu Feb 10 07:33:31 CET 2022


Hi both

Just to corroborate Simon's numbers, my M1 Max (MBP 14" with 64GB ram) gets the following for vecLib:

> source("CuriousResult.R")
matrix multiplication        2.07   0.527   1.571
tcrossprod                  2.328    0.55   1.688
transposition and reuse     5.898   0.844   6.743
elementwise after reshape   4.894   0.523   5.421
columnwise sapply     4.767   1.445   6.212
for loop over columns       4.489   1.908   6.398

Which compares to the following for R reference BLAS:

> source("CuriousResult.R")
matrix multiplication      37.511   0.762  38.282
tcrossprod                 37.519   0.737  38.254
transposition and reuse     5.858   0.909   6.767
elementwise after reshape   4.841   0.471   5.311
columnwise sapply     4.778   1.646   6.432
for loop over columns       4.485   1.948   6.434

Both on the arm64 version of R.

As an aside - I am extremely happy with this machine (albeit after only a few days of ownership) and would happily recommend it over the 2017 MBP that it has replaced.

Best,

Matt 




On 10/02/2022, 04:22, "R-SIG-Mac on behalf of Simon Urbanek" <r-sig-mac-bounces using r-project.org on behalf of simon.urbanek using R-project.org> wrote:

    Joe,

    are you sure you are using the native arm64 version of R with the Accelerate bindings (formerly vecLib)? The one really cool thing about M1 is that it is very much faster than any Intel Macs (in some examples more than 10x) so what you report doesn't look right. With your script on a first-generation M1 mac mini (so the slower one) I get:

    > source("CuriousResult.R")
    matrix multiplication       2.084   0.401   2.488 
    tcrossprod                  2.284   0.396    2.68 
    transposition and reuse     5.771   0.786   6.557 
    elementwise after reshape   4.974   0.586    5.56 
    columnwise sapply     5.675   1.451   7.127 
    for loop over columns       4.565   1.633   6.199 

    so I would suspect that you may be running Intel R emulated and without vecLib?

    Cheers,
    Simon


    > On Feb 10, 2022, at 12:44 PM, Joseph Kunkel <joe using bio.umass.edu> wrote:
    > 
    > Carl, I would not buy a Mac M1Mag with 64 GB of memory.  I just bought one and it is not as good as my 2013 MacBook Pro with 32 GB and 4 cores.
    > 
    > With my 2013 MacBook Pro I could configure R to do is matrix multiplication with the fast vecLib library and it would use core doubling so that I was using up to 800% of my resources to do my big math.
    > 
    > With my 2013 I could run the following benchmark and it would execute in 1/4 the time.
    > 
    >> source("https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.bio.umass.edu%2Fbiology%2Fkunkel%2Fpub%2FR%2FCuriousResult.R&data=04%7C01%7Cmd%40sund.ku.dk%7C0e47fdeeaf4849cfff8b08d9ec446514%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637800601372950867%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pgiqgJBJ5KY%2BTSIm43aZQWnyaMEwTvDua3y%2Fj6ThGt4%3D&reserved=0")
    > 
    > matrix multiplication      21.248   1.608   5.891 
    > tcrossprod                     20.346   1.454   5.39 
    > transposition and reuse    15.881   2.887  18.657 
    > elementwise after reshape   9.637   2.144  11.717 
    > columnwise sapply          13.447  11.982  25.241 
    > for loop over columns      12.435  10.14   22.44 
    > 
    > Now with R on the MacBook Pro with M1Max it takes longer to do the base multiplication and there is no accelerated option although it does the simpler non sectoral approaches faster …
    > 
    >> source("https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.bio.umass.edu%2Fbiology%2Fkunkel%2Fpub%2FR%2FCuriousResult.R&data=04%7C01%7Cmd%40sund.ku.dk%7C0e47fdeeaf4849cfff8b08d9ec446514%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637800601372950867%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pgiqgJBJ5KY%2BTSIm43aZQWnyaMEwTvDua3y%2Fj6ThGt4%3D&reserved=0") 
    > matrix multiplication      40.476   0.127  40.322 
    > tcrossprod                     40.347   0.056  40.282 
    > transposition and reuse     6.776   0.005    6.78 
    > elementwise after reshape   7.849   0.016   7.868 
    > columnwise sapply     4.481   0.114   4.592 
    > for loop over columns       4.282   0.271    4.55 
    > 
    > I am searching for why.
    > 
    > Joe Kunkel
    > -·.  .· ·.  .><((((º>·.  .· ·.  .><((((º>·.  .· ·.  .><((((º> .··.· >=-       =º}}}}}><
    > Joseph G. Kunkel, Emeritus Professor
    > Biology Department
    > UMass Amherst 
    > Amherst MA 01003
    > joe using bio.umass.edu
    > 
    > _______________________________________________
    > R-SIG-Mac mailing list
    > R-SIG-Mac using r-project.org
    > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&data=04%7C01%7Cmd%40sund.ku.dk%7C0e47fdeeaf4849cfff8b08d9ec446514%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637800601372950867%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KyIiMHlCxgI5DddZnABl1RWfHoxhV3VyILj5UbMn3JQ%3D&reserved=0
    > 

    _______________________________________________
    R-SIG-Mac mailing list
    R-SIG-Mac using r-project.org
    https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&data=04%7C01%7Cmd%40sund.ku.dk%7C0e47fdeeaf4849cfff8b08d9ec446514%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C637800601372950867%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=KyIiMHlCxgI5DddZnABl1RWfHoxhV3VyILj5UbMn3JQ%3D&reserved=0



More information about the R-SIG-Mac mailing list