简体   繁体   中英

How to know if Octave has full access to the 64 bit memory range

How can I know if Octave has full access to the 64 bit memory range?

Can I create a matrix which uses up more than 4GB of memory?

I realize the question is old but it's still quite relevant. On a Mac yes, I used homebrew and include an example of a matrix over 4GB below. Currently this procedure works:

Install homebrew and then run the following in a terminal window.

brew install hg
brew install --use-gcc --HEAD graphicsmagick
brew install gfortran
brew install --use-gcc gnuplot
brew install octave

Then add this to ~/.octaverc:

setenv GNUTERM 'x11'
graphics_toolkit("gnuplot")

Enjoy your 64-bit octave compile!

octave:1> a = zeros(500*2^10+1,2^10);
octave:2> whos
Variables in the current scope:

  Attr Name        Size                     Bytes  Class
  ==== ====        ====                     =====  ===== 
        a      512001x1024              4194312192  double
        ans         1x50                       498  cell

Total is 524289074 elements using 4194312690 bytes

I installed a 64-bit version of Octave (octave-devel) using MacPorts. Installation instructions are available at http://shifteleven.com/articles/2011/11/06/installing-octave-on-osx-with-macports .

However, it appears that the octave-devel package still uses Octave's 32-bit default indexing so I can't load arrays of 'int8' greater than 2GB. (ref: http://www.gnu.org/software/octave/doc/interpreter/Compiling-Octave-with-64_002dbit-Indexing.html ).

This may be caused by the octave-devel package not compiling 64-bit versions of the linear algebra packages that Octave depends on.

% Load a 3GB int8 vector (32-bit limits to 2GB)
octave:1> a = zeros(1024^3*3, 1, ‘int8′);
error: memory exhausted or requested size too large for range of Octave’s index type — trying to return to prompt

64bit everywhere's answer does not show a valid test because the default Octave's 32-bit indexing allows the creation of 'double' arrays up to 16GB.

我不知道这对你有帮助,但根据这个: http//wiki.octave.org/wiki.pl?EnableLargeArrays ,支持超过2 GB的内存用于阵列是实验性的。

There are two things that are relevant:

  • 64 bit pointers, allowing larger memory structures than 2 or 4GB

  • 64 bit integers for indexing arrays with more than 2^32 elements

For the first, compiling on a 64bit system should do. For the second, you need --enable64 in compiling octave, but more importantly, you need to link with 64bit integer indexing BLAS libraries. This is the hard part.

Back in 2008, I managed to compile a version of octave this way, using AMD blas libraries (the 64bit integer fortran version). However, since then, I have not been able to reproduce this, because the library updated and was not compatible with the Linux system we use (Ubunto 12.04). Compiling Octave and linking with a third party BLAS was simply too hard.

I work on 128 GB memory computers, but my octave scripts can still only tackle small problems. 2GB should be enough for anyone...

The Matlab/Octave package Psychtoolbox has a 64-bit MacOS version with 64-bit .mex files. As far as I know, any use of the .mex files will fail in 32-bit Octave, with messages like:

error: KbQueueReserve: /Applications/Psychtoolbox/PsychBasic/Octave3OSXFiles64/PsychHID.mex: failed to load: dlopen(/Applications/Psychtoolbox/PsychBasic/Octave3OSXFiles64/PsychHID.mex, 2): no suitable image found.  Did find: 
/Applications/Psychtoolbox/PsychBasic/Octave3OSXFiles64/PsychHID.mex: mach-o, but wrong architecture

Is there a version of Octave that can use 64-bit .mex files?

  • PsychHID.mex architecture is: x86_64
  • Octave 3.4.0 architectures are: i386 ppc
  • My system is: MacBook Pro 5,1 running MacOS 10.6.8

It is possible that this is a Psychtoolbox problem, since I see 3 architectures for Linux files ( Octave3LinuxFiles , Octave3LinuxFiles64 , Octave3LinuxFilesARM ) in /Applications/Psychtoolbox/PsychBasic , but only one for MacOS ( Octave3OSXFiles64 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM