John MacFrenz <macfr...@yandex.com> wrote on 10/09/2014 05:22:16 PM:
> From: John MacFrenz <macfr...@yandex.com>
> To: Mailing list for users of the X10 programming language <x10-
> us...@lists.sourceforge.net>
> Date: 10/09/2014 05:38 PM
> Subject: Re: [X10-users] Questions about distributed arrays
>
> > > Anyway, I will probably be implementing some containers is missing.
> > > I'm not really that good programmer, but would you still be
> > > interesting in getting patches?
> >
> > Sure. The preferred way would be to create an issue in our JIRA and
attach
> > the patch to it: http://jira.codehaus.org/browse/XTENLANG. You'll
need to
> > fill out a Contributors License Agreement as well and put it in JIRA
with
> > the patch
(http://x10-lang.org/x10-development/contributor-agreement.html).
>
> All right. So all container classes and interfaces should be in
> x10.util, right? Also I'll be probably implementing a deque, it
> doesn't matter that class with such name exists in x10.lang, does
> it? And should I add new files to some build file(s)?
>
It's not a great idea to have a class with the same name as one in x10.lang
(because we auto-import x10.lang). The Deque class in x10.lang probably
should not be public, as it is really an internal implementation class for
the X10 scheduler. To hack around this, maybe add an x10.util.Deque2 or
x10.util.MyDeque.
You don't need to add new files in x10.runtime/src-x10 to an explicit list.
The build process executes a find command to construct the list
dynamically.
>
> > > That is correct. X10 behaves just like Java in this respect:
> > > Arrays/Rails store references to Objects. An one-dimensional
Array/Rail
> > > is allocated as continuous block of memory in which the references
are
> > > stored. A multidimensional Array/Rail is an Array/Rail of
Arrays/Rails
> > > and therefore this memory may not be one continuous block.
> > >
> >
> > Thanks Marco! A little additional information...
> >
> > X10 has structs in addition to classes to provide the ability to avoid
this
> > indirection (in Native X10) for immutable data. Structs are primarily
> > intended for building "user-defined primitive types", for example K
doubles
> > representing a point in K-dimensional space. There's a struct example
in
> > x10.dist/samples/StructSpheres.x10.
> >
> > A minor enhancement to the other point. A Rail[Rail[double]] is indeed
a
> > C-style Rail of Rails, so the memory is very unlikely to be contiguous.
> > The x10.array and x10.regionarray Array classes support
multi-dimensional
> > arrays (row-major by default) using a single Rail as the backing
storage
> > for all of their data. So depending on what you want you can either
get
> > the array-of-arrays memory layout by using Rail[Rail[T]] or a single
piece
> > of backing storage into which all the data is placed and indexed by
using
> > Array[T].
>
> Okay, thanks for explanation. Would you also mind explaining what
> those functions in Unsafe do (for someone who comes from c/c++
> background...)? I looked at code of GrowableRail for reference and I
> don't quite understand why it's done the way it is... For example
> why sometimes allocRailUninitialized is used and other times
> allocRailZeroed , and why is clearRail called?
>
allocRailZeroed does an allocate followed by a memset
allocRailUninitialized does an allocate without the memset.
clearRail does a memset of a portion of a Rail.
We tend to use allocRailUninitialized as a performance optimization when we
know that we are "just about" to overwrite the allocated memory with
initial values. So, no point in first writing zeros, then writing some
other value.
In GrowableRail, you are seeing some accommodations for advanced features
of X10's type system. It is possible to define a type in X10 that does not
include zero (or null). We'd still like to be able to create GrowableRails
that contain values of these types, but the type doesn't have a zero/null
value for us to use to fill in the unused part of the Rail. So we use
methods in Unsafe like clearRail to allow us to write a zero bytes into the
Rail to clear a removed element even if that isn't legal at the level of
the X10 type system.
--dave
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users