Stefan Scherfke | 1 Aug 10:53
Picon

Re: Simultaneous simulations

Moin moin,

I am planning to move the different classes to the following files:

Lister.py: (no changes)
- Lister

Simulation.py
- Process
- SimEvent
- Simulation (new, inherits from Lister)
- __Evlist
- Simerror
- FatalSimerror

Simulation*.py (one file for each special simulation type)
- Simulation* (each inherits from Simulation)

Resources.py
- Resource
- Buffer
- Level
- Store
- Queue
- FIFO
- PriorityQ

Recording.py
- Histogram
- Monitor
(Continue reading)

kgmuller | 1 Aug 11:14
Picon
Picon
Favicon

Re: Simultaneous simulations

Hi Stefan!
The refactoring looks good to me. Yes, we can get rid of Monitor.py

What about the user API documentation? Can we work with you on that? I think
that we need a separate manual (including a number of examples) for the
"parallel SimPy" API so that we don't clutter up the existing user manual.
What do you think?

Regards,

Klaus Müller

> -----Original Message-----
> From: simpy-users-bounces <at> lists.sourceforge.net 
> [mailto:simpy-users-bounces <at> lists.sourceforge.net] On Behalf 
> Of Stefan Scherfke
> Sent: Friday, August 01, 2008 10:54 AM
> To: simpy-users <at> lists.sourceforge.net
> Subject: Re: [Simpy-users] Simultaneous simulations
> 
> Moin moin,
> 
> I am planning to move the different classes to the following files:
> 
> Lister.py: (no changes)
> - Lister
> 
> Simulation.py
> - Process
> - SimEvent
(Continue reading)

kgmuller | 1 Aug 11:31
Picon
Picon
Favicon

Re: Simultaneous simulations

Stefan,
Just check out folder SimPy/SimPy from the CVS on SourceForge. I did some
minor work on SimulationRT.py since the 1.9.1 release.

Either a patch file or a package would be fine.

You will find file SimulationGUIDebug.py and GUIDebug.py in the same folder.
Ignore these for the time being, but we need to rework those at a later
stage so that they fit into the new structure. SimulationGUIDebug is a nice
GUI-based visualization/debugging tool which a group of Prof. Matloff's
students from U. Of California at Davis has contributed.

Regards and many thanks for your collaboration in SimPy!

Klaus Müller 

> -----Original Message-----
> From: simpy-users-bounces <at> lists.sourceforge.net 
> [mailto:simpy-users-bounces <at> lists.sourceforge.net] On Behalf 
> Of Stefan Scherfke
> Sent: Thursday, July 31, 2008 3:38 PM
> To: kgmuller; simpy-users <at> lists.sourceforge.net
> Subject: Re: [Simpy-users] Simultaneous simulations
> 
> Hello again!
> 
> How shall we implement our changes? Shall we checkout a 
> certain version from the repository or just take the released 
> version 1.9.1 as basis? Are you currently working on a new 
> version or is 1.9.1 still up to date? And shall we provide a 
(Continue reading)

kgmuller | 1 Aug 11:40
Picon
Picon
Favicon

Re: Simultaneous simulations

Stefan,
This is truly impressive and very significant! Finally, we can put the
multiple cores in our PCs to work on speeding up our simulations!

Klaus Müller 

> -----Original Message-----
> From: simpy-users-bounces <at> lists.sourceforge.net 
> [mailto:simpy-users-bounces <at> lists.sourceforge.net] On Behalf 
> Of Stefan Scherfke
> Sent: Thursday, July 31, 2008 2:29 PM
> To: simpy-users <at> lists.sourceforge.net
> Subject: Re: [Simpy-users] Simultaneous simulations
> 
> Moin moin,
> 
> I just run a test with 10001 processes. The standard SimPy needed
> ~25.7 seconds to run, our modified version did it in ~27.7 
> seconds, which is about 7–8% slower. I think for that large 
> number of processes, the overhead is not to big.
> 
> Furthermore, with our modification you can gain an enormous 
> speedup in combination with parallel python 
> (http://www.parallelpython.com/).  
> With ParallelPython using both cores of my pc, the same 10k 
> processes needed only ~13.5 seconds. And I can even use 
> others PCs for the simulation! With 2 cores of the local pc 
> and 2 cores from a pc in LAN, I can reduce runtime to ~8 seconds!
> 
> I think that is worth the 7% overhead for normal simulations. :-)
(Continue reading)

Favicon

Re: Simultaneous simulations

Klaus,
 
You replied to Stefan:
"The refactoring looks good to me. Yes, we can get rid of Monitor.py
I'm sorry that I am coming in the middle of this conversation (I am a new subscriber), but how do you record a time-series of observations without Monitor?  Is there another facility or must you write your own?
 
Thanks,
 
 - Kevin
 
Kevin McKiou
 
+1 630 979 2577
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Simpy-users mailing list
Simpy-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
kgmuller | 1 Aug 16:16
Picon
Picon
Favicon

Re: Simultaneous simulations

xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

Kevin,

No, don’t worry. Monitor.py is just a dummy file which is there for backward compatibility. When you open it, you see:

 

"""Monitor 1.9. This dummy module is only provided for backward compatibility.

It does nothing. class Monitor is now part of Simulation

and SimulationXXX."""

 

Of course will there be a class Monitor!

 

Klaus Müller

 

From: simpy-users-bounces <at> lists.sourceforge.net [mailto:simpy-users-bounces <at> lists.sourceforge.net] On Behalf Of McKiou, Kevin W (Kevin)
Sent: Freitag, 1. August 2008 15:50
To: simpy-users <at> lists.sourceforge.net
Subject: Re: [Simpy-users] Simultaneous simulations

 

Klaus,

 

You replied to Stefan:

"The refactoring looks good to me. Yes, we can get rid of Monitor.py

I'm sorry that I am coming in the middle of this conversation (I am a new subscriber), but how do you record a time-series of observations without Monitor?  Is there another facility or must you write your own?

 

Thanks,

 

 - Kevin

 

Kevin McKiou

 

+1 630 979 2577

kmckiou <at> alcatel-lucent.com

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Simpy-users mailing list
Simpy-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
Stefan Scherfke | 3 Aug 19:02
Picon

Re: Simultaneous simulations

Hi,

while refactoring some stuff, I noticed a few other things I’d like to  
refactor:

1. Remove missing whitespaces around operators (e.g. change a=1 to a =  
1)
2. Homogenize the usage of ' and " for strings (change all to '...')
3. Change from space indentation to tab indentation – it’s more common  
and I personally favour tabs over spaces. ;-)
4. Let Simulation.__init__() do the stuff currently done by  
initialize().

Point three is not as important to me as one and two, but it would  
make life a bit easier for me. Point four just moves some logic to  
another function so that user only need to write "sim =  
Simulation(); ..." instead of "sim = Simulation();  
sim.initialize(); ...". The old way – initilize() – will still work  
for compatibiltiy reason.
What’s your opinion about that?

Regards,
Stefan

Am 31.07.2008 um 10:07 schrieb kgmuller:

> All:
> I am perfectly happy with refactoring and going to one base module  
> from
> which all Simulation*.py can inherit. So far, I had no difficulties
> /significant overhead in maintaining the four libraries.
>
> I feel strongly for maintaining SimPlot and SimGUI in SimPy, though.  
> They
> are NOT part of the core simulation libraries, but they are useful,  
> "out of
> the box" utilities. Without installing any other library, you  
> immediately
> have (default) plotting and GUI capabilities, once you have  
> installed SimPy.
>
> Of course there are more powerful libaries out there. We recommend  
> already
> the use of matplotlib for publication-qulaity plotting.
>
> What we should do is offer well-documented interfaces to other
> graphics/plotting/statistics packages, like wxPython, matplotlib and  
> R,
> without removing SimPlot or SimGUI. The packages we choose to  
> interface to
> should be mainstream packages, i.e., packages which are well  
> documented and
> used by many users. Which packages should we choose here? Suggestions?
>
> I would also be happy to hear ideas for how best to offer these  
> interfaces,
> without sacrificing the "batteries included" plotting and GUI  
> capabilities
> now provided by SimPy.
>
> Klaus Müller
>
> -----Original Message-----
> From: simpy-users-bounces <at> lists.sourceforge.net
> [mailto:simpy-users-bounces <at> lists.sourceforge.net] On Behalf Of Vikas
> Kawadia
> Sent: Freitag, 25. Juli 2008 13:53
> To: simpy-users <at> lists.sourceforge.net
> Subject: Re: [Simpy-users] Simultaneous simulations
>
> Stefan,
> I second the proposal to refactor the code as you suggest. I would  
> also
> suggest
> separating the plotting and GUI code out of the core simulation  
> classes.
> There
> are other capable packages like pylab/matplotlib and pyx which are  
> great at
> plotting and if SimPy were to focus on its core goal of discrete event
> simulation, it would make a better case of being accepted as a core  
> python
> module.
> -vikas
>
> Stefan Scherfke wrote:
>> Hello everyone,
>>
>> on a first glimpse there doesn’t seem to be performance overhead, but
>> I’ll test it with a larger example next week to get more reliable
>> information about that.
>>
>> I also took a first closer look at the other Simulation*.py files and
>> they are 80–95 % the same code as Simulation.py. I think before I
>> start to transfer our changes from Simulation.py to 3*2500 lines of
>> nearly the same code, we should consider refactoring everything. Most
>> of the changes in the other simulations add only a few extra lines or
>> methods.
>>
>> In my opinion it should be possible to extract classes like Process
>> and implement a default Simulation class from which SimulationRT and
>> the others will inherit. With that, we might reduce the LOC from ~10k
>> to maybe ~3k and remove dublicate code which will improve further
>> development and maintenance drastically.
>>
>> How do you feel about this?
>>
>> Regards,
>> Stefan
>>
>>
>>
>> Am 13.07.2008 um 18:24 schrieb kgmuller:
>>
>>> Stefan,
>>> This is promising and definitely wanted for future versions of
>>> SimPy. The
>>> one thing which needs to be looked at is the performance overhead of
>>> the
>>> extra function call, e.g.
>>>
>>> def now():
>>>  global sim
>>>  return sim.now()
>>>
>>>
>>> Re: If you’d like
>>> to add this to the develoment version, we could clean up our changes
>>> and apply them to Simulation*.py as well.
>>>
>>> Yes, please, do!
>>>
>>> Klaus Müller
>>>
>>> -----Original Message-----
>>> From: simpy-users-bounces <at> lists.sourceforge.net
>>> [mailto:simpy-users-bounces <at> lists.sourceforge.net] On Behalf Of  
>>> Stefan
>>> Scherfke
>>> Sent: Donnerstag, 10. Juli 2008 15:48
>>> To: simpy-users <at> lists.sourceforge.net
>>> Subject: [Simpy-users] Simultaneous simulations
>>>
>>> Hi everyone,
>>>
>>> in April 08, Ontje suggested simultaneous simulations for SimPy. A
>>> Simulation-class should encapsulate all the global stuff needed  
>>> for a
>>> simulation (initialize(), activate(), now(),
) so that you can run
>>> multiple simulations concurrently (e.g. in different threads) by
>>> calling simA.initialize()
simA.simulate()simX.initialize()
>>> See
>>>
> http://sourceforge.net/mailarchive/forum.php?thread_name=200804091432.55594
>>> .
>>> The_COM%40gmx.de&forum_name=simpy-users
>>> for details.
>>>
>>> Meanwhile we have implemented that for Simulation.py and are
>>> considering to release our changes as a patch for 1.9.1. If you’d  
>>> like
>>> to add this to the develoment version, we could clean up our changes
>>> and apply them to Simulation*.py as well.
>>>
>>> I have attached our current modifications so that you can see what  
>>> we
>>> want to do, testSimPy.py still runs. :-)
>>>
>>> Regards,
>>> Stefan
>>>
>>>
>>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
>> Build the coolest Linux based applications with Moblin SDK & win  
>> great
> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Simpy-users mailing list
>> Simpy-users <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/simpy-users
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simpy-users mailing list
> Simpy-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simpy-users
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simpy-users mailing list
> Simpy-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simpy-users
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Tony Vignaux | 3 Aug 21:33
Picon
Gravatar

Re: Simultaneous simulations

On your point 3, the standard practice is spaces, I understand. I am sure I have read it somewhere.
Your point 4 is interesting. If it is accepted I will have to change the documentation yet again.

Tony

On Mon, Aug 4, 2008 at 5:02 AM, Stefan Scherfke <stefan.scherfke <at> uni-oldenburg.de> wrote:
Hi,

while refactoring some stuff, I noticed a few other things I'd like to
refactor:

1. Remove missing whitespaces around operators (e.g. change a=1 to a =
1)
2. Homogenize the usage of ' and " for strings (change all to '...')
3. Change from space indentation to tab indentation – it's more common
and I personally favour tabs over spaces. ;-)
4. Let Simulation.__init__() do the stuff currently done by
initialize().

Point three is not as important to me as one and two, but it would
make life a bit easier for me. Point four just moves some logic to
another function so that user only need to write "sim =
Simulation(); ..." instead of "sim = Simulation();
sim.initialize(); ...". The old way – initilize() – will still work
for compatibiltiy reason.
What's your opinion about that?

Regards,
Stefan



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Simpy-users mailing list
Simpy-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
Wavy Davy | 4 Aug 00:56
Picon
Gravatar

Re: Simultaneous simulations

Hi all

I am glad the code base is being refactored to avoid duplication.
Thought I'd chime in on a few points.

2008/8/3 Tony Vignaux <vignaux <at> gmail.com>:
> On your point 3, the standard practice is spaces, I understand. I am sure I
> have read it somewhere.

http://www.python.org/dev/peps/pep-0008/

The standard is 4 spaces. Almost all 3rd party python code I have used
seen is 4 spaces.

[snip]
> On Mon, Aug 4, 2008 at 5:02 AM, Stefan Scherfke
> <stefan.scherfke <at> uni-oldenburg.de> wrote:
>>
>> Hi,
>>
>> while refactoring some stuff, I noticed a few other things I'd like to
>> refactor:
>>
>> 1. Remove missing whitespaces around operators (e.g. change a=1 to a =
>> 1)

I am in favour of including spaces around operators, as that is the
PEP8 standard.

>> 2. Homogenize the usage of ' and " for strings (change all to '...')
>> 3. Change from space indentation to tab indentation – it's more common
>> and I personally favour tabs over spaces. ;-)

See above - I don't believe its more common (in fact, my experience is
the complete opposite), and in against the PEP8 standard. But this is
one of the hacker holy wars, so its not worth falling out over :)

[snip]

If an eventual goal is to be included in the standard python library,
then adopting PEP8 styling conventions will be a must. If not, then
whatever make the most people happy :)

--

-- 
Simon
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Simpy-users mailing list
Simpy-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
kgmuller | 4 Aug 10:41
Picon
Picon
Favicon

Re: Simultaneous simulations


Stefan,

> 1. Remove missing whitespaces around operators (e.g. change a=1 to a =
> 1)

Ok.

> 2. Homogenize the usage of ' and " for strings (change all to 
> '...') 

Ok.

3. Change from space indentation to tab indentation – 
> it’s more common and I personally favour tabs over spaces. 
> ;-) 

No, please, don't. This is what PEP 8 (Python Style Guide,
http://www.python.org/dev/peps/pep-0008/) says:

 Code lay-out

  Indentation

    Use 4 spaces per indentation level.

    For really old code that you don't want to mess up, you can continue to
    use 8-space tabs.

  Tabs or Spaces?

    Never mix tabs and spaces.

    The most popular way of indenting Python is with spaces only.  The
    second-most popular way is with tabs only.  Code indented with a mixture
    of tabs and spaces should be converted to using spaces exclusively.
When
    invoking the Python command line interpreter with the -t option, it
issues
    warnings about code that illegally mixes tabs and spaces.  When using
-tt
    these warnings become errors.  These options are highly recommended!

    For new projects, spaces-only are strongly recommended over tabs.  Most
    editors have features that make this easy to do.

4. Let Simulation.__init__() do the stuff currently done 
> by initialize().
> 
> Point three is not as important to me as one and two, but it 
> would make life a bit easier for me. Point four just moves 
> some logic to another function so that user only need to 
> write "sim = Simulation(); ..." instead of "sim = 
> Simulation(); sim.initialize(); ...". The old way – 
> initilize() – will still work for compatibiltiy reason.
> What’s your opinion about that?

As the OO form "sim = Simulation()" will only be an optional form and the
other (current) form will still be maintained, that change is ok with me.
Backward compatibility in API and documentation is a must.

Regards,

Klaus Müller

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Gmane