Enable large arrays: Build octave such that it can use arrays larger than 2Gb.: Difference between revisions

Jump to navigation Jump to search
Add a note to see also section.
m (Improve text and example.)
(Add a note to see also section.)
 
(4 intermediate revisions by 3 users not shown)
Line 13: Line 13:
* glpk
* glpk
* Qhull
* Qhull
Useful information and projects are listed below in the [[#See also|See also]] section.


To determine the integer size of the BLAS library used by Octave, the following code can be executed:
To determine the integer size of the BLAS library used by Octave, the following code can be executed:
Line 37: Line 39:


===Versions prior to Octave 4.4===
===Versions prior to Octave 4.4===
On previous versions of Octave, the default is that the size of a single Octave array cannot exceed 2 GB of memory. Trying to create one will produce the following error:
On previous versions of Octave, the default is that the size of a single Octave array cannot have more than approximately 2^31 elements, even on systems that use 64-bit pointers. This is because array indices were limited to 32-bit signed integers by default.  Trying to create one will produce the following error:


<pre>
<pre>
Line 44: Line 46:
</pre>
</pre>


You will obtain this error even if your system has enough RAM to create this array (4 GB in the above case).
You will obtain this error even if your system has enough RAM to create this array (3 GB in the above case).


To use arrays with more than (approximately) <math>2^{31}</math> elements, Octave has to be configured with the option <code>--enable-64</code>. This option is experimental and you are (as always) encouraged to submit bug reports if you find a problem.  
To use arrays with more than (approximately) <math>2^{31}</math> elements, Octave has to be configured with the option <code>--enable-64</code>. This option is experimental and you are (as always) encouraged to submit bug reports if you find a problem.  
With this option, Octave will use internally 64-bit integers for array dimensions and indexing. However, '''all numerical libraries''' used by Octave will need to use also 64-bit integers for array dimensions and indexing, and in most cases they need to be compiled from source.
With this option, Octave will use internally 64-bit integers for array dimensions and indexing. However, '''all numerical libraries''' used by Octave will need to use also 64-bit integers for array dimensions and indexing, and in most cases they need to be compiled from source.


For details about how to compile these libraries please read the [http://www.gnu.org/software/octave/doc/interpreter/Compiling-Octave-with-64_002dbit-Indexing.html#Compiling-Octave-with-64_002dbit-Indexing GNU Octave manual], or alternatively you can use [[MXE]] (M Cross Environment) which takes care of the different packages automatically (especially the configure flags <code>--enable-64</code> and <code>--enable-fortran-int64</code>).
===See also===
 
* [https://octave.org/doc/interpreter/Compiling-Octave-with-64_002dbit-Indexing.html GNU Octave manual] -- Details on how to compile some of Octave's library dependencies for 64-bit indices.
* [[MXE]] (M Cross Environment) which takes care to compile Octave's library dependencies for 64-bit indices.
 
Two more lightweight solutions compared to [[MXE]] to compile Octave's library dependencies for 64-bit indices.
* https://gitlab.com/mtmiller/octave-blas64-builder
* https://github.com/octave-de/GNU-Octave-enable-64


[[Category:Building]]
[[Category:Building]]

Navigation menu