none
MRO bug - large matrix multiply RRS feed

  • Question

  • I just installed MRO 3.3.1 and have discovered a problem with large matrix multiplication. The following is a minimal example of the problem (the matrix dimensions duplicate those in the script where the problem first arose): 

    P1 = matrix(runif(5184*72),5184,72);
    N2 = matrix(rnorm(5184*5184),5184,5184)
    F2 = matrix(rnorm(72*5184),72,5184);

    F2b = F2; N2b = N2; P1b = P1;

    R = F2 %*% (N2 %*% P1);
    Rb = F2b %*% (N2b %*% P1b);
    range(R-Rb);

    R and Rb should be identical, but what I get is:

    > range(R-Rb);
    [1] -33027.90  36040.98

    This problem does not occur in CRAN R on the same machine (side-by-side install). It also does not occur in MRO 3.2.5 or CRAN R on my other workstation. All of those give range(R-Rb)=0.

    The machine where the problem occurs is a Dell Precision, Windows 10 Enterprise 10.0.10240 Build 10240, Intel Xeon CPU E3-1270v5. MRO was downloaded and installed yesterday, October 5.

    Thanks,

    Steve Ellner (spe2@cornell.edu)

    Thursday, October 6, 2016 3:51 PM

Answers

  • Hi, Steve,

    Thanks for the update. We, too, have noticed that the bug seems to occur on some hardware configurations and not on others

    We have updated our Microsoft R Open 3.3.1 releases for Windows and Linux with the latest release of the Intel Math Kernel Library that includes a fix for this bug, and in our testing works correctly on all configurations--both those that previously showed the bug and those that did not.

    To try out the fix, please uninstall your previous 3.3.1 installation and re-install.

    Cheers,

    Rich Calaway

    Microsoft R Release Manager

    • Marked as answer by Stephen Ellner Saturday, October 29, 2016 1:53 AM
    Monday, October 24, 2016 11:39 PM

All replies

  • Hi Steve,

    It looks like you have found a bug in the matrix calculations in the MKL BLAS libraries included with Microsoft R Open. We are investigating the issue and pinpointing the problem.  Thanks for pointing out the issue, we should have more information on this issue soon. I very much agree with you that this is a bad bug, so this is a high priority bug for us to fix.

    As a workaround for now, you can swap out the MKL BLAS libraries with the default CRAN ones, which we ship as well with Microsoft R Open.

    To do so, do the following:

    1).  Backup the BLAS DLL's and rename the following files:

         Rename 'C:/Program Files/Microsoft/MRO-3.3.1/bin/x64/Rblas.dll' to Rblas.dll.old'.

         Rename 'C:/Program Files/Microsoft/MRO-3.3.1/bin/x64/Rlapack.dll' to Rlapack.dll.old'.

    2).  Rename the CRAN DLL's:

           Rename 'C:/Program Files/Microsoft/MRO-3.3.1/bin/x64/Rblas.dll_CRAN' to 'Rblas.dll'.

           Rename 'C:/Program Files/Microsoft/MRO-3.3.1/bin/x64/Rlapack.dll_CRAN' to 'Rlapack.dll'.

    3). Restart Microsoft R Open.  You should now get the correct results for the matrix computations.

     

    Stephen Weller

    Microsoft R Open Product Team

    Tuesday, October 11, 2016 8:39 PM
  • Stephen,

    thanks for looking into this. I'm replying to confirm that I do get the correct results when I swap in the CRAN dll's.

    Also, the bug seems to be either Xeon-specific or intel gen6-specific. On several older, core i7 PCs, the bug does not seem to occur.

    Steve

    Thursday, October 13, 2016 6:26 PM
  • Hi, Steve,

    Thanks for the update. We, too, have noticed that the bug seems to occur on some hardware configurations and not on others

    We have updated our Microsoft R Open 3.3.1 releases for Windows and Linux with the latest release of the Intel Math Kernel Library that includes a fix for this bug, and in our testing works correctly on all configurations--both those that previously showed the bug and those that did not.

    To try out the fix, please uninstall your previous 3.3.1 installation and re-install.

    Cheers,

    Rich Calaway

    Microsoft R Release Manager

    • Marked as answer by Stephen Ellner Saturday, October 29, 2016 1:53 AM
    Monday, October 24, 2016 11:39 PM
  • Rich,

    thank you all very much! I did an uninstall/reinstall, and now there's no sign of the problem - which is great for me, because several things I'm using R for now would be impossible without the much faster linear algebra that Microsoft R offers for Windows users.

    Steve


    Saturday, October 29, 2016 2:03 AM