guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: propose deprecation of generalized-vector-*


From: Nelson H. F. Beebe
Subject: Re: propose deprecation of generalized-vector-*
Date: Thu, 28 Feb 2013 16:04:42 -0700 (MST)

If guile introduces full-fledged support of arrays for numeric
computing, and for communicating with external libraries, such as the
currently-moribund Guile-numerics interface to GNU Scientific Library
(GSL), libsndfile, FFTW, and LAPACK

        http://www.nongnu.org/guile-num/

please do not forget, as higher-level language programmers too often
do, that array storage order matters a GREAT DEAL for efficiency.

Modern processors operate in registers up to 500x faster than on
(DRAM) memory, and cache (SRAM) is about 10x to 50x faster than DRAM.
Thus, if you use Fortran column-major order (first subscript varying
most rapidly), it can be MUCH faster to compute down the columns than
to compute across rows.  The C/C++ languages use row-major order (last
subscript varying most rapidly), so for them, the situation is
reversed: row traversals are preferred over column traversals.

Java really screwed things up by using an arrays-of-arrays-of-...
storage model, so MxN rectangular matrix data are spread over M or N
separate contiguous vectors allocated at arbitrary locations in
memory.  With that arrangement, and Java's requirement that array
accesses must be accompanied by mandatory bounds checks, it is
difficult to make good use of cache.  That serious deficiency is why
IBM introduced new contiguous-array classes for Java, and why the
(seemingly-now-defunct) Java Grande project was started:

        http://www.javagrande.org/
        http://en.wikipedia.org/wiki/Criticism_of_Java

The bounds-checking overhead can be reduced at a lower level: see

        Implicit array bounds checking on 64-bit architectures
        http://doi.acm.org/10.1145/1187976.1187982

For any scripting language that wishes to communicate array data with
external libraries written in other languages, it seems desirable to
offer support for remapping of (possibly-associative) arrays in the
scripting language to contiguous arrays in both row-major and
column-major order, with user-specified initializers for unset
elements.  That way, huge amounts of library code in Fortran, C, and
C++ become accessible.  The reverse mappings back from the external
library to the scripting language are also needed. If arrays are
handled with some generality in the latter, the library return might
not even require copying any numerical data, just updating some
metadata that record how array elements are to be found.

The GNU gawk developers are currently working on similar extensions to
the code world outside the scripting language; it would make sense for
both gawk and guile groups to be aware of the efforts of the other:

        https://lists.gnu.org/mailman/listinfo/gawk-devel

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: address@hidden  -
- 155 S 1400 E RM 233                       address@hidden  address@hidden -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]