Giter Site home page Giter Site logo

Comments (10)

radfordneal avatar radfordneal commented on July 3, 2024

Thanks for trying it out on a Mac. It's encouraging that it works without helper threads. The speed up on the matrix multiply test is a result of pqR using C routines that are a bit more sophisticated than the BLAS supplied with R-2.15.0. I'll be writing a blog post on matrix multiplies in pqR soon.

The problem when helper threads are enabled appears to be that openMP is not fully implemented with your toolset on the Mac, which surprises me. A bit of a search revealed a thread at http://openmp.org/forum/viewtopic.php?f=3&t=698 about this. It seems that there are solutions, but not having gotten into Mac's development environment yet, I can't say much more.

from pqr.

randy3k avatar randy3k commented on July 3, 2024

Thanks. The thread solves my problem! The Apple gcc compiler doesn't work but GNU gcc compiler does!

screen shot 2013-06-23 at 6 20 08 pm

from pqr.

radfordneal avatar radfordneal commented on July 3, 2024

Great! I guess the new compiler must also generate better code, since the test has speeded up!

You can try something like the following to see if the helper threads are actually working:

A <- matrix(1.1,1000,1000)
B <- matrix(2.2,1000,1000)
system.time({ X <- A %*% B + B %*% A; print(X[1000,1000]) })
system.time({ X <- A %*% B + B %*% A; print(X[1000,1000]) })

You can compare results with and without a --helpers=1 argument to the R command. You should see a "Using 1 helper threads" line printed in the startup message with the --helpers=1 argument. The first system.time may be different from later times, both because memory allocation may not have settled down, and because of a somewhat strange feature of pqR (which I may eliminate so I won't feel a need to explain it...).

Don't try it without the "print", since then pqR will see no need to wait for anything to actually finish before the system.time is done. (Maybe I should change system.time to wait...?)

from pqr.

randy3k avatar randy3k commented on July 3, 2024

I compared the R, pqR and pqR -- helpers==1 with the below example.

The time elapsed are 18.823,12.836 and 9.928 respectively.

f = function(n){
    for(i in 1:n){
    A = matrix(rnorm(1000^2), 1000,1000)
    B = matrix(rnorm(1000^2), 1000,1000)
    list(A%*%B,B%*%A)
    }
}
system.time(f(10))

Very promising!

screen shot 2013-06-23 at 7 52 14 pm

from pqr.

sritchie73 avatar sritchie73 commented on July 3, 2024

@randy3k What did you have to do to get it to compile on Mac OSX? I'm also interested in trying it out

from pqr.

randy3k avatar randy3k commented on July 3, 2024

I am also able to compile the R GUI for the non-helper distribution.
screen shot 2013-06-23 at 9 33 17 pm

But for the helper distribution,
I got a runtime error. Same problem? #2
screen shot 2013-06-23 at 10 29 07 pm

from pqr.

randy3k avatar randy3k commented on July 3, 2024

For the non-helper distribution

  1. Get any gcc compiler, either from Xcode or GNU.
  2. follow http://radfordneal.github.io/pqR/R-admin.html#Installing-R-under-Unix_002dalikes
./configure --disable-helper-threads

For the helper distribution

  1. First get a GNU gcc compiler.
  2. follow http://radfordneal.github.io/pqR/R-admin.html#Installing-R-under-Unix_002dalikes
./configure CC=/path/to/GNU/gcc

from pqr.

sritchie73 avatar sritchie73 commented on July 3, 2024

What version of gcc did you use? I downloaded gcc-4.9 through homebrew and got the following error:

arima.c: In function 'getQ0':
arima.c:819:6: internal compiler error: Segmentation fault: 11
SEXP getQ0(SEXP sPhi, SEXP sTheta)
^

arima.c:819:6: internal compiler error: Abort trap: 6

from pqr.

randy3k avatar randy3k commented on July 3, 2024

i am using gcc4.8, also from homebrew.

rmbp:~ Randy$ brew list gcc48
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-gcc-ranlib-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-gcc-nm-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-gcc-ar-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-gcc-4.8.1
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-gcc-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-g++-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/x86_64-apple-darwin12.4.0-c++-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/gcov-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/gcc-ranlib-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/gcc-nm-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/gcc-ar-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/gcc-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/g++-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/cpp-4.8
/usr/local/Cellar/gcc48/4.8.1/bin/c++-4.8
/usr/local/Cellar/gcc48/4.8.1/gcc/include/ (669 files)
/usr/local/Cellar/gcc48/4.8.1/gcc/lib/ (268 files)
/usr/local/Cellar/gcc48/4.8.1/gcc/libexec/ (10 files)
/usr/local/Cellar/gcc48/4.8.1/share/gcc-4.8.1/ (3 files)
/usr/local/Cellar/gcc48/4.8.1/share/man/ (4 files)

In particularly, I used
./configure CC=/usr/local/Cellar/gcc48/4.8.1/bin/gcc-4.8

from pqr.

sritchie73 avatar sritchie73 commented on July 3, 2024

Confirming that I've successfully been able to install using gcc-4.4 and make check comes up fine. Speed tests are as follows for the function above:

>pqR - no helpers:
   user  system elapsed 
 13.421   0.102  13.523 

> pqR - 1 helper
   user  system elapsed 
 18.758   0.092  10.126 

> R 3.0.1
   user  system elapsed 
 85.334   0.178  85.618 

from pqr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.