none
No performance improvement of Microsoft R Open over base R version in Centos 7 linux server RRS feed

  • Question

  • Hi

     

    I am using multiple R versions in different docker containers  running in the same server(centos 7), to compare the performance of Microsoft R Open(MRO) with MKL libraries over base R versions

     

    I used took same example as per MRO documentation

    Below are my test results:

    Mean calculation for base R versions: 

    system.time({ 

     foo <- rnorm(5e7)  

    mean(foo)

    })

    Time took to execute:

    R version 3.4.0

    user  system elapsed

    5.639   0.042   5.678 

    R version 3.5.0

    user  system elapsed

    5.372   0.061   5.433

    R version 4.0.2

    user  system elapsed

    5.171   0.113   5.280 

    Microsoft R Open 3.5.3

    Mean calculation: 

    setMKLthreads(4)

    system.time({ 

     foo <- rnorm(5e7)  

    mean(foo)

    })

    user  system elapsed

    6.349   0.000   6.347 

    Matrix Multiplication for base R versions:

    system.time({ 

     m <- matrix(runif(200000), nrow=10) 

     crossprod(m)

    })


    Time took to execute:

    R version 3.4.0

    user  system elapsed

     4.911   2.328   4.804

    R version 3.5.0

    user  system elapsed 

    6.244   1.303   5.870 

    R version 4.0.2

    user  system elapsed 

    4.147   1.563   3.948

    Microsoft R Open 3.5.3

    Matrix Multiplication:

    setMKLthreads(4)

    system.time({ 

     foo <- rnorm(5e7)  

    mean(foo)

    })

    user  system elapsed

    3.975   1.547   4.253 

    According to the above results there is no performance improvement of Microsoft R Open over other Base R versions,

    Kindly anyone  suggest am i missing anything to get multicore performance of MKL libraries using Microsoft R open

    i am sharing my session info of Microsoft R Open 3.5.3 as well

    R version 3.5.3 (2019-03-11)

    Platform: x86_64-pc-linux-gnu (64-bit)

    Running under: Ubuntu 18.04.2 LTS

    Matrix products: default

    BLAS: /opt/microsoft/ropen/3.5.3/lib64/R/lib/libRblas.so

    LAPACK: /opt/microsoft/ropen/3.5.3/lib64/R/lib/libRlapack.so

    locale:

     [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8      

     [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8  

     [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C             

    [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C      

    attached base packages:

    [1] stats     graphics  grDevices utils     datasets  methods   base    

    other attached packages:

    [1] RevoUtils_11.0.3     RevoUtilsMath_11.0.0

    loaded via a namespace (and not attached):

    [1] compiler_3.5.3 tools_3.5.3  


    Tuesday, August 4, 2020 4:59 PM

All replies

  • MKL will only run on Intel processors unless you use a workaround; my first and only thought is could your CPU is an AMD one?
    Tuesday, August 4, 2020 10:55 PM
  • Server CPU is intel 

    Here are the details about the server CPU I am using 
    cat /proc/cpuinfo | grep 'model name' | uniqmodel
    
    name	: Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz

    Wednesday, August 5, 2020 6:17 AM
  • A single calculation doesn't mean too much.

    try this:

    source('R-benchmark-25.R')

    I have three versions of R

    1) R 4.0.2 on WSL 2 default 

    2) R 4.0.2 on WSL 2 with MKL

    3) Microsoft R Open 3.5.3 for Windows

    My conclusion is: there is no need to wait for Microsoft R Open 4.0

    1)

    R 4.0.2 on WSL 2 (Ubuntu 20.04)

    default:

       R Benchmark 2.5
       ===============
    Number of times each test is run__________________________:  3

       I. Matrix calculation
       ---------------------
    Creation, transp., deformation of a 2500x2500 matrix (sec):  0.457666666666673
    2400x2400 normal distributed random matrix ^1000____ (sec):  0.189333333333337
    Sorting of 7,000,000 random values__________________ (sec):  0.615
    2800x2800 cross-product matrix (b = a' * a)_________ (sec):  11.915
    Linear regr. over a 3000x3000 matrix (c = a \ b')___ (sec):  5.58199999999998
                          --------------------------------------------
                     Trimmed geom. mean (2 extremes eliminated):  1.16253153774231

       II. Matrix functions
       --------------------
    FFT over 2,400,000 random values____________________ (sec):  0.196000000000007
    Eigenvalues of a 640x640 random matrix______________ (sec):  0.62766666666666
    Determinant of a 2500x2500 random matrix____________ (sec):  2.86533333333335
    Cholesky decomposition of a 3000x3000 matrix________ (sec):  4.71533333333334
    Inverse of a 1600x1600 random matrix________________ (sec):  2.61866666666666
                          --------------------------------------------
                    Trimmed geom. mean (2 extremes eliminated):  1.67620891375085

       III. Programmation
       ------------------
    3,500,000 Fibonacci numbers calculation (vector calc)(sec):  0.151333333333355
    Creation of a 3000x3000 Hilbert matrix (matrix calc) (sec):  0.126333333333321
    Grand common divisors of 400,000 pairs (recursion)__ (sec):  0.158333333333341
    Creation of a 500x500 Toeplitz matrix (loops)_______ (sec):  0.0326666666666711
    Escoufier's method on a 45x45 matrix (mixed)________ (sec):  0.242999999999995
                          --------------------------------------------
                    Trimmed geom. mean (2 extremes eliminated):  0.144657726777134


    Total time for all 15 tests_________________________ (sec):  30.4936666666667
    Overall mean (sum of I, II and III trimmed means/3)_ (sec):  0.655679353438026
                          --- End of test ---

    2)

    R 4.0.2 on WSL 2 (Ubuntu 20.04)

    with MKL



       R Benchmark 2.5
       ===============
    Number of times each test is run__________________________:  3

       I. Matrix calculation
       ---------------------
    Creation, transp., deformation of a 2500x2500 matrix (sec):  0.435
    2400x2400 normal distributed random matrix ^1000____ (sec):  0.174333333333334
    Sorting of 7,000,000 random values__________________ (sec):  0.597666666666668
    2800x2800 cross-product matrix (b = a' * a)_________ (sec):  0.185
    Linear regr. over a 3000x3000 matrix (c = a \ b')___ (sec):  0.108666666666667
                          --------------------------------------------
                     Trimmed geom. mean (2 extremes eliminated):  0.24118324819693

       II. Matrix functions
       --------------------
    FFT over 2,400,000 random values____________________ (sec):  0.173666666666667
    Eigenvalues of a 640x640 random matrix______________ (sec):  0.190666666666669
    Determinant of a 2500x2500 random matrix____________ (sec):  0.0893333333333336
    Cholesky decomposition of a 3000x3000 matrix________ (sec):  0.0986666666666665
    Inverse of a 1600x1600 random matrix________________ (sec):  0.0933333333333337
                          --------------------------------------------
                    Trimmed geom. mean (2 extremes eliminated):  0.11694309057013

       III. Programmation
       ------------------
    3,500,000 Fibonacci numbers calculation (vector calc)(sec):  0.157333333333334
    Creation of a 3000x3000 Hilbert matrix (matrix calc) (sec):  0.124666666666665
    Grand common divisors of 400,000 pairs (recursion)__ (sec):  0.130333333333333
    Creation of a 500x500 Toeplitz matrix (loops)_______ (sec):  0.0316666666666663
    Escoufier's method on a 45x45 matrix (mixed)________ (sec):  0.213000000000001
                          --------------------------------------------
                    Trimmed geom. mean (2 extremes eliminated):  0.136733689117147


    Total time for all 15 tests_________________________ (sec):  2.80333333333334
    Overall mean (sum of I, II and III trimmed means/3)_ (sec):  0.15681914419312
                          --- End of test ---

    3)

    Microsoft R Open 3.5.3 on Windows



       R Benchmark 2.5
       ===============
    Number of times each test is run__________________________:  3

       I. Matrix calculation
       ---------------------
    Creation, transp., deformation of a 2500x2500 matrix (sec):  0.623333333333333 
    2400x2400 normal distributed random matrix ^1000____ (sec):  0.766666666666666 
    Sorting of 7,000,000 random values__________________ (sec):  0.636666666666668 
    2800x2800 cross-product matrix (b = a' * a)_________ (sec):  0.176666666666669 
    Linear regr. over a 3000x3000 matrix (c = a \ b')___ (sec):  0.086666666666666 
                          --------------------------------------------
                     Trimmed geom. mean (2 extremes eliminated):  0.412346544740444 

       II. Matrix functions
       --------------------
    FFT over 2,400,000 random values____________________ (sec):  0.233333333333332 
    Eigenvalues of a 640x640 random matrix______________ (sec):  0.193333333333333 
    Determinant of a 2500x2500 random matrix____________ (sec):  0.0966666666666664 
    Cholesky decomposition of a 3000x3000 matrix________ (sec):  0.113333333333334 
    Inverse of a 1600x1600 random matrix________________ (sec):  0.0833333333333357 
                          --------------------------------------------
                    Trimmed geom. mean (2 extremes eliminated):  0.12842425295681 

       III. Programmation
       ------------------
    3,500,000 Fibonacci numbers calculation (vector calc)(sec):  0.513333333333333 
    Creation of a 3000x3000 Hilbert matrix (matrix calc) (sec):  0.18 
    Grand common divisors of 400,000 pairs (recursion)__ (sec):  0.256666666666665 
    Creation of a 500x500 Toeplitz matrix (loops)_______ (sec):  0.0400000000000015 
    Escoufier's method on a 45x45 matrix (mixed)________ (sec):  0.200000000000003 
                          --------------------------------------------
                    Trimmed geom. mean (2 extremes eliminated):  0.209841149712454 


    Total time for all 15 tests_________________________ (sec):  4.20000000000001 
    Overall mean (sum of I, II and III trimmed means/3)_ (sec):  0.223151608508149 
                          --- End of test ---

    Wednesday, August 12, 2020 4:21 AM