[Beowulf] Stroustrup regarding multicore

Perry E. Metzger perry at piermont.com
Tue Aug 26 14:51:40 PDT 2008


"Robert G. Brown" <rgb at phy.duke.edu> writes:
> I think that matrix allocation per se is contiguous because of how and
> where it occurs at the compiler level.  Immediate matrices allocated
> like a[10][10] are just translated into displacements relative to the
> stack pointer, are they not?

It depends. You're not guaranteed per se that they'll be allocated on
the stack, though in practice they are.

> Global/external matrices at the a[10][10]
> are prespecified in the data segment of the program,

Depending on the particular OS. Certainly that's the usual model.

> The only place where it might not be true is when one dynamically
> allocates memory for a **matrix.  There, if you loop through malloc
> calls, there is no guarantee that they return contiguous blocks

An vector of pointers to vectors is not a matrix. :)

It acts a bit like one, but that's guaranteed NOT to be contiguous
allocation because malloc will at the very least add the (invisible to
the programmer) malloc headers etc.



-- 
Perry E. Metzger		perry at piermont.com



More information about the Beowulf mailing list