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

Add an example to see the effect of using BLAS libraries with either 32 or 64 bit indices.
m (Use Note template.)
(Add an example to see the effect of using BLAS libraries with either 32 or 64 bit indices.)
Line 13: Line 13:
* glpk
* glpk
* Qhull
* Qhull
To determine the integer size of the BLAS library used by Octave run one of the following lines:
<syntaxhighlight lang="Octave">
clear all; N = 2^31; a = b = ones (N, 1, "single"); c = a' * b  # ~ 8 GB RAM required!
clear all; N = 2^31; a = b = ones (N, 1);          c = a' * b  # ~16 GB RAM required!
</syntaxhighlight>
If the BLAS library uses '''32-bit integers''', an error will be thrown in both cases:
error: integer dimension or index out of range for Fortran INTEGER type
Otherwise, if the BLAS library uses '''64-bit integers''', the result is:
c = 2^31 = 2147483648
Note that the two test cases above would usually require twice the memory, if <code>a</code> and <code>b</code> differ and are not assigned by <code>a = b = ...</code>.
Note further, that the single precision data type has a precision of about 23 binary bits.
In this particular example no rounding errors occur.


===Versions prior to Octave 4.4===
===Versions prior to Octave 4.4===
Line 27: Line 46:
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 [http://wiki.octave.org/MXE 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>).
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>).


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