Skip to content

64 bit version for linux and build huge matrix

5 messages · Shengyun Peng, Rich Shepard, Steve Lianoglou +2 more

#
On Fri, 16 Mar 2012, Shengyun Peng wrote:

            
If your system has a 64-bit version of the distribution installed then
that's how applications are built. You start it by typing 'R' (without the
quotes) on the command line. Linux is not Microsoft.
How much memory do you have installed?

Rich
#
Hi,
On Thu, Mar 15, 2012 at 4:02 PM, Shengyun Peng <psy106616 at 163.com> wrote:
Are you sure it's not running 64bit already?

What is the value of `.Machine$sizeof.pointer`? If it's 8, then your
work is done.

-steve
#
On Mar 15, 2012, at 3:19 PM, Rich Shepard wrote:

            
Windows and OSX pre-compiled binaries on CRAN are built with both 32 bit and 64 bit executables. Building from source will typically default to your system architecture.
To verify, use:

.Machine$sizeof.pointer

If it comes back with 8, you are running 64 bit R.
That won't matter here. R uses signed 32 bit signed integers for indexing and a matrix, more generally an array, is essentially a vector with dimensions. Thus, you can only have (2^31) - 1 elements in a vector/matrix/array and 64k^2 is larger than that...It is the case whether you are running 32 bit or 64 bit R.
[1] FALSE

There are others here with hands-on experience that can comment, but a starting place to look for potential solutions would be the High Performance Computing Task View (http://cran.r-project.org/web/views/HighPerformanceComputing.html) under "Large memory and out-of-memory data".

HTH,

Marc Schwartz
#
The problem is not the amount of memory, it is the number of elements you are trying to put in the matrix (as the error message states).  A matrix is just a vector with a dimension attribute.  The maximum length of a vector or a list is 2^31-1.  You are trying to put twice that many elements in the matrix.  It is not going to happen regardless of the amount of memory available.  You will need to solve your problem in some other way.  If your matrix is sparse, you may be able to use techniques for manipulating sparse matrices.

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204