[Beowulf] programming guidence request
michf at post.tau.ac.il
Fri Jan 23 02:47:17 PST 2009
On Thu, 22 Jan 2009 22:40:25 -0800
Greg Lindahl <lindahl at pbm.com> wrote:
> On Fri, Jan 23, 2009 at 11:03:46AM +0500, amjad ali wrote:
> > (1) Which debugger would be easy and effective to use for above?
> print *,
openmpi spawns several processes so you options are pretty much print or
pausing you programs at startup and attaching the debugger to a running program
(problematic). Note though that with print you may miss timing issues.
> > (2) Which of the folliwng two ways of using arrays is more efficient
> > with respect to memory and function-call-overheads or other overheads:
> > (i) We should keep the arrays ALLOCATABLE and then
> > before return from the subroutines, DEALLOCATE the local arrays.
> > or (ii) We should keep the local arrays fix-sized as
> > much as we can. (Will the memory is deallaocated/freed automatically
> > on return from the subroutine?).
The problem with (ii) is that the arrays are allocated on the stack which is
of limited size. If the arrays are very large this may cause problems.
> In general (ii) is faster: the compiler can generate better code if it
> knows the size of the arrays. This is always possible with (ii) and
> only sometimes with (i).
If you use loops with constant number of iterations the same speedup can also
usually be achieved (I've seen dramatic differences due to dropping the
conditional at each loop iteration)
> With (ii) the memory will be freed on return from the subroutine, with
> most modern compilers. With (i) the arrays will also be automagically
> freed on exit from the subroutine.
> -- greg
> Beowulf mailing list, Beowulf at beowulf.org
> To change your subscription (digest mode or unsubscribe) visit
More information about the Beowulf