Liaw, Andy
2005-Jun-11 00:35 UTC
[R] Performance difference between 32-bit build and 64-bit bu ild on Solaris 8
I'm not familiar with Solaris, so take this with appropriate dose of NaCl... For the 64-bit build, why not have the -O2 for gcc, since you have it for g77 and g++? If you just run vanilla configure for the 32-bit build, I believe it uses -O2 for all three compilers by default. If that's the difference, perhaps it's sufficient to explain the performance difference. The other thing is that solve(), and to some extent lm(), can benefit from an optimized BLAS. You might want to check if the two builds are using equivalent BLAS. Andy> From: Scott Gilpin > > Hi everyone - > > I'm seeing a 32-bit build perform significantly faster (up to 3x) than > a 64 bit build on Solaris 8. I'm running R version 2.1.0. Here are > some of my system details, and some resulting timings: > > >uname -a > SunOS lonetree 5.8 Generic_117350-16 sun4u sparc SUNW,Sun-Fire-V440 > > lonetree /home/sgilpin >gcc -v > Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.2/specs > Configured with: ../configure --with-as=/usr/ccs/bin/as > --with-ld=/usr/ccs/bin/ld --disable-nls > Thread model: posix > gcc version 3.4.2 > > I built the 32 bit version of R with no changes to config.site. I > built the 64 bit version with the following in config.site: > > CC="gcc -m64" > FFLAGS="-m64 -g -02" > LDFLAGS="-L/usr/local/lib/sparcv9 -L/usr/local/lib" > CXXFLAGS="-m64 -g -02" > > neither build uses a BLAS. Both builds are installed on the same > machine, and the same disk. The machine has virtually no load; R is > one of the only processes running during these timings: > > First comparison: solve on a large matrix > > >echo 'set.seed(1);M<-matrix(rnorm(9e6),3e3);system.time(solve(M))' | > /disk/loneres01/R-2.1.0-32bit/bin/R -q --vanilla > > set.seed(1);M<-matrix(rnorm(9e6),3e3);system.time(solve(M)) > [1] 713.45 0.38 713.93 0.00 0.00 > > > > >echo 'set.seed(1);M<-matrix(rnorm(9e6),3e3);system.time(solve(M))' | > /disk/loneres01/R-2.1.0-64bit/bin/R -q --vanilla > > set.seed(1);M<-matrix(rnorm(9e6),3e3);system.time(solve(M)) > [1] 2277.05 0.31 2278.38 0.00 0.00 > > > > Second comparison: linear regression > > lonetree /home/sgilpin/R >echo 'set.seed(1); > y<-matrix(rnorm(10000*500),500); > x<-matrix(runif(500*100),500); > system.time(fit<-lm(y~x))' | > /disk/loneres01/R-2.1.0-32bit/bin/R -q --vanilla > > > set.seed(1);y<-matrix(rnorm(10000*500),500);x<-matrix(runif(50 > 0*100),500);system.time(fit<-lm(y~x)) > [1] 23.34 0.80 24.17 0.00 0.00 > > > > lonetree /home/sgilpin/R >echo 'set.seed(1); > y<-matrix(rnorm(10000*500),500); > x<-matrix(runif(500*100),500); > system.time(fit<-lm(y~x))' | > /disk/loneres01/R-2.1.0-64bit/bin/R -q --vanilla > > > set.seed(1);y<-matrix(rnorm(10000*500),500);x<-matrix(runif(50 > 0*100),500);system.time(fit<-lm(y~x)) > [1] 55.34 0.70 56.21 0.00 0.00 > > > > Final comparison: stats-Ex.R (from R-devel) > lonetree /home/sgilpin/R >time /disk/loneres01/R-2.1.0-32bit/bin/R -q > --vanilla CMD BATCH stats-Ex.R > > real 1m4.042s > user 0m47.400s > sys 0m10.390s > lonetree /home/sgilpin/R >time /disk/loneres01/R-2.1.0-64bit/bin/R -q > --vanilla CMD BATCH stats-Ex.R > > real 1m20.017s > user 1m3.590s > sys 0m10.130s > > I've seen Prof. Ripley and others comment that a 64 bit build will be > a little slower because the pointers are larger, and gc() will take > longer, but these timings seem out of this range. > > Any thoughts? > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > >
Prof Brian Ripley
2005-Jun-11 07:31 UTC
[R] Performance difference between 32-bit build and 64-bit bu ild on Solaris 8
On Fri, 10 Jun 2005, Liaw, Andy wrote:> I'm not familiar with Solaris, so take this with appropriate dose of NaCl... > > For the 64-bit build, why not have the -O2 for gcc, since you have it for > g77 and g++? If you just run vanilla configure for the 32-bit build, I > believe it uses -O2 for all three compilers by default. If that's the > difference, perhaps it's sufficient to explain the performance difference.CFLAGS was not specified, so should default to "-g -O2". It is definitely worth checking, although almost all the time in these tests will be spent in Fortran code.> The other thing is that solve(), and to some extent lm(), can benefit from > an optimized BLAS. You might want to check if the two builds are using > equivalent BLAS.He said:>> neither build uses a BLAS.Well, they do, the one supplied with R (which is in Fortran). To supplement my timings earlier, with an optimized BLAS I gave 32-bit [1] 4.99 0.03 5.02 0.00 0.00 64-bit [1] 5.25 0.03 5.29 0.00 0.00 and for gcc 3.4.3 and the internal BLAS (which I had to build for these tests) I get 32-bit [1] 9.96 0.09 10.12 0.00 0.00 64-bit [1] 9.93 0.04 10.04 0.00 0.00 so I am not seeing anything like the same performance difference between 32- and 64-bit builds (but it could well depend on the particular Sparc chip). There are some problems in which the 64-bit builds _are_ much slower: complex matrix arithmetic is one (presumably because less effort has been spent on optimizing that).> > Andy > >> From: Scott Gilpin >> >> Hi everyone - >> >> I'm seeing a 32-bit build perform significantly faster (up to 3x) than >> a 64 bit build on Solaris 8. I'm running R version 2.1.0. Here are >> some of my system details, and some resulting timings: >> >>> uname -a >> SunOS lonetree 5.8 Generic_117350-16 sun4u sparc SUNW,Sun-Fire-V440 >> >> lonetree /home/sgilpin >gcc -v >> Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.2/specs >> Configured with: ../configure --with-as=/usr/ccs/bin/as >> --with-ld=/usr/ccs/bin/ld --disable-nls >> Thread model: posix >> gcc version 3.4.2 >> >> I built the 32 bit version of R with no changes to config.site. I >> built the 64 bit version with the following in config.site: >> >> CC="gcc -m64" >> FFLAGS="-m64 -g -02" >> LDFLAGS="-L/usr/local/lib/sparcv9 -L/usr/local/lib" >> CXXFLAGS="-m64 -g -02" >> >> neither build uses a BLAS. Both builds are installed on the same >> machine, and the same disk. The machine has virtually no load; R is >> one of the only processes running during these timings:-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Liaw, Andy
2005-Jun-12 02:56 UTC
[R] Performance difference between 32-bit build and 64-bit bu ild on Solaris 8
> From: Peter Dalgaard[snip]> While your setup is in place, you might want to play around with the > higher optimization levels. GCC on AMD64 sees a quite substantial > speedup from -O2 to -O3.On our SLES8 amd64 boxes, I had trouble with g77 -O3 (build failed). Have not tried with newer GCC. Andy> -- > O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B > c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K > (*) \(*) -- University of Copenhagen Denmark Ph: > (+45) 35327918 > ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: > (+45) 35327907 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > >