LISTSERV mailing list manager LISTSERV 16.0

Help for MASON-INTEREST-L Archives


MASON-INTEREST-L Archives

MASON-INTEREST-L Archives


MASON-INTEREST-L@LISTSERV.GMU.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Monospaced Font

LISTSERV Archives

LISTSERV Archives

MASON-INTEREST-L Home

MASON-INTEREST-L Home

MASON-INTEREST-L  May 2010

MASON-INTEREST-L May 2010

Subject:

Re: parallelizing objects using ParallelSequence

From:

Steven Saul <[log in to unmask]>

Reply-To:

MASON Multiagent Simulation Toolkit <[log in to unmask]>

Date:

Tue, 18 May 2010 15:41:32 -0400

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (149 lines)

Hi Sean,

thanks for the reply once again. It sounds like my agents don't have
quite as much info as those you referred to which each had a map in their
brains, I just need to make a lot of them because i'm modeling 5 species
of fish off of Florida, where each species abundance is about 5 million
fish (i.e. about 25 million fish agents). Each fish has about 16 int
parameters, 33 doubles, and a few booleans. The fish species don't
interact with one another, but instead are fished by a fishing fleet (~600
agents so no big deal). As a result, I'm thinking now that I should put
each of the 5 species in its own grid and run each species on a seperate
processor. In this way, in each step, I'll just wait until the fish are
finished being processed, and end the parallel portion of that step before
I do fishing so that the vessels and fish are not competing for the same
grid cell. Any thoughts on the best way to set up each species of fish
(type of agent) on its own thread? This would be analogous to having 5
different types of heat bugs and running the agents from each bug type on
their own thread/processor.

Also, I have studied the 16 StupidModel tutorials that were implemented in
MASON and noticed that they are setup kind of differently, where instead
of placing the methods of each agent (i.e. StupidBug) in the step method
call of that object, each method from the agent (StupidBug) was instead
called in its own steppable. Is there any advantage for setting up the
model this way verses the way you have set up the MASON tutorials and
examples?

Sorry to keep asking about this and thanks so much for your time!
Steve




> The double loop isn't really a big deal. But the overhead of
> parallelism may or may not be worth it to you depending on the amount
> of stuff you can do parallelized.
>
> One gotcha: we recently did a very heavily parallelized model with
> many agents which each kept big maps in their heads. And it turned
> out that our parallelized version was slower than a single-threaded
> version when we ran it on multi-core Intel boxes (as opposed to actual
> multi-CPU boxes, where it ran great). The reason: though the code was
> easily parallelized, the amount of data that each parallel process had
> to manipulate was larger than cache. This forced a lot of memory
> contention and though Intel's chips have multiple cores they only have
> one, generally crummy, memory controller, which turned out to be the
> big bottleneck. Long story short, you may or may not benefit from
> parallelization. You'll have to try and see.
>
> Do watch out for race conditions though: they're really fun to debug.
>
> Sean
>
> On May 13, 2010, at 12:21 PM, Steven Saul wrote:
>
>> Hi Sean,
>>
>> Thanks for your reply! From the reading I have recently done on
>> concurrent programming, that actually makes a lot of sense and
>> avoiding
>> race conditions are my primary concern. It seems like I don't have
>> much
>> of a choice but to parallelize my own simulation because it involves
>> modeling millions of individual fish that are fished by a fishing
>> fleet.
>> It sounds like I can process in parallel all of the things that each
>> fish
>> does itself without dependency on anything else i.e. (things like
>> growth,
>> maturity, etc.). From what you said, it also sounds like the fish
>> can go
>> through their movement algorithm in parallel (which tends to take some
>> processing juice), store their new x and y location, then within
>> that time
>> step, after all fish went through the parallel sequence, they can go
>> serial again at which point the fish are assigned to their new grid
>> location. I wonder if this would be computationally efficient as you
>> would kind of need to loop through the objects twice, right, once in
>> parallel and then once serially?
>>
>> Thanks,
>> Steve
>>
>>> On May 12, 2010, at 3:34 PM, Steven Saul wrote:
>>>
>>>> After looking at HeatBugs and the ThreadedDiffuser class, I was
>>>> wondering
>>>> if there was a way to use ParallelSequence to split the processing
>>>> of
>>>> agents (in this case the actual heat bugs) in each time step. For
>>>> example, if you have 800 heatbugs in any given time step, a computer
>>>> with
>>>> 8 cores would process 100 bugs on each core simultaneously in that
>>>> time
>>>> step.
>>>
>>> Sort of. You just schedule a ParallelSequence on the schedule. In
>>> the ParallelSequence you put, say, eight RandomSequences. Each of
>>> the
>>> RandomSequences
>>> holds 1/8 of all your bugs.
>>>
>>> However you have to be careful there. Each HeatBug reads
>>> information,
>>> moves, and writes information. This presents opportunities for race
>>> conditions. First, if one HeatBug is reading a location while
>>> another
>>> is writing the same location, you'll get messed up results. Second,
>>> if two HeatBugs access the SparseGrid2D at the same time to move,
>>> they'll break the hash table. This means that realistically you can
>>> only do the read portion of these operations in parallel. So you'd
>>> have the parallel sequence call step() methods which do the reads and
>>> internal computation for each bug in parallel; but after that you'd
>>> have to schedule the bugs serially (as before, maybe in a later
>>> priority) to move themselves and then write to the heat array.
>>>
>>> This is advanced threading stuff for people who are really familiar
>>> with the perils of threaded coding. If the above paragraph causes
>>> you
>>> to say "huh?", then the answer is NO, you SHOULD NOT parallelize your
>>> agents. :-)
>>>
>>> Sean
>>>
>>
>>
>> --
>> Steven Saul, M.A.
>> Graduate Assistant, Marine Biology and Fisheries
>> Cooperative Institute for Marine and Atmospheric Studies
>> Cooperative Unit for Fisheries Education and Research
>> University of Miami - RSMAS
>> 4600 Rickenbacker Cswy.
>> Miami, Florida 33149
>> + 1 305-421-4831
>> http://cufer.rsmas.miami.edu
>


--
Steven Saul, M.A.
Graduate Assistant, Marine Biology and Fisheries
Cooperative Institute for Marine and Atmospheric Studies
Cooperative Unit for Fisheries Education and Research
University of Miami - RSMAS
4600 Rickenbacker Cswy.
Miami, Florida 33149
+ 1 305-421-4831
http://cufer.rsmas.miami.edu

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

August 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
October 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
September 2017
June 2017
May 2017
March 2017
February 2017
January 2017
December 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
February 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
July 2004
May 2004
April 2004
March 2004

ATOM RSS1 RSS2



LISTSERV.GMU.EDU

CataList Email List Search Powered by the LISTSERV Email List Manager