Editing Enable large arrays: Build octave such that it can use arrays larger than 2Gb.
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 14: | Line 14: | ||
* Qhull | * Qhull | ||
To determine the integer size of the BLAS library used by Octave run one of the following lines: | |||
To determine the integer size of the BLAS library used by Octave | |||
<syntaxhighlight lang="Octave"> | <syntaxhighlight lang="Octave"> | ||
clear all; | clear all; N = 2^31; a = b = ones (N, 1, "single"); c = a' * b # ~ 8 GB RAM required! | ||
N = 2^31; | clear all; N = 2^31; a = b = ones (N, 1); c = a' * b # ~16 GB RAM required! | ||
# | |||
a = b = ones (N, 1 | |||
c = a' * b | |||
</syntaxhighlight> | </syntaxhighlight> | ||
If the BLAS library uses '''32-bit integers''', an error will be thrown: | 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 | error: integer dimension or index out of range for Fortran INTEGER type | ||
Line 34: | Line 29: | ||
c = 2^31 = 2147483648 | c = 2^31 = 2147483648 | ||
Note that the test | 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 data type | Note further, that the single precision data type has a precision of about 23 binary bits. | ||
In this particular example no rounding errors occur. | In this particular example no rounding errors occur. | ||
===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 | 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: | ||
<pre> | <pre> | ||
Line 46: | Line 41: | ||
</pre> | </pre> | ||
You will obtain this error even if your system has enough RAM to create this array ( | You will obtain this error even if your system has enough RAM to create this array (4 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>). | |||
[[Category:Building]] | [[Category:Building]] |