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

m
Improve text and example.
(Add an example to see the effect of using BLAS libraries with either 32 or 64 bit indices.)
m (Improve text and example.)
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, the following code can be executed:


<syntaxhighlight lang="Octave">
<syntaxhighlight lang="Octave">
clear all; N = 2^31; a = b = ones (N, 1, "single"); c = a' * b  # ~ 8 GB RAM required!
clear all;
clear all; N = 2^31; a = b = ones (N, 1);           c = a' * b # ~16 GB RAM required!
N = 2^31;
## The following line requires about 8 GB of RAM!
a = b = ones (N, 1, "single");
c = a' * b
</syntaxhighlight>
</syntaxhighlight>


If the BLAS library uses '''32-bit integers''', an error will be thrown in both cases:
If the BLAS library uses '''32-bit integers''', an error will be thrown:


  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 29: Line 32:
  c = 2^31 = 2147483648
  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 that the test case above usually requires twice the memory, if <code>a</code> and <code>b</code> are not assigned by <code>a = b = ...</code>.
Note further, that the single precision data type has a precision of about 23 binary bits.
Note further, that the data type "single" has a precision of about 23 binary bits.
In this particular example no rounding errors occur.
In this particular example no rounding errors occur.