[SciPy-User] "profiling" a function

Askey, Scott A Capt USAF AETC AFIT/ENY Scott.Askey@afit....
Mon Nov 30 15:52:32 CST 2009


What are the tools available in Scipy for evaluating the (computational) cost of a function call?   

 

In particular I am solving nonlinear systems (with fsolve) and considering exact versus approximate Jacobians
and trig functions versus their approximations.

V/R

Scott  

 

-----Original Message-----
From: scipy-user-bounces@scipy.org on behalf of scipy-user-request@scipy.org
Sent: Mon 11/30/2009 1:00 PM
To: scipy-user@scipy.org
Subject: SciPy-User Digest, Vol 75, Issue 70
 
Send SciPy-User mailing list submissions to
	scipy-user@scipy.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://mail.scipy.org/mailman/listinfo/scipy-user
or, via email, send a message with subject or body 'help' to
	scipy-user-request@scipy.org

You can reach the person managing the list at
	scipy-user-owner@scipy.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of SciPy-User digest..."


Today's Topics:

   1. chebfun (josef.pktd@gmail.com)
   2. ANN: visvis (Almar Klein)
   3. Parallel code (Jose Gomez-Dans)
   4. Re: Parallel code (Robin)
   5. Re: Parallel code (Sturla Molden)
   6. Re: Parallel code (Sturla Molden)


----------------------------------------------------------------------

Message: 1
Date: Sun, 29 Nov 2009 20:42:08 -0500
From: josef.pktd@gmail.com
Subject: [SciPy-User] chebfun
To: SciPy Users List <scipy-user@scipy.org>
Message-ID:
	<1cd32cbb0911291742m1d3f3ab8r886009c7fba3cab9@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I just came by chance across this (for matlab)

http://www2.maths.ox.ac.uk/chebfun/index.html

http://www2.maths.ox.ac.uk/chebfun/license.html

The documentation looks helpful for someone like me who doesn't know
enough about what Chebyshev polynomials are good for.

Josef


------------------------------

Message: 2
Date: Mon, 30 Nov 2009 10:05:23 +0100
From: Almar Klein <almar.klein@gmail.com>
Subject: [SciPy-User] ANN: visvis
To: SciPy Users List <scipy-user@scipy.org>
Message-ID:
	<cc38d75f0911300105x5e7b8754gf0c6b21547de95d1@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi all,

I am pleased to announce the first release of visvis, a Python
visualization library for of 1D to 4D data.

Website: http://code.google.com/p/visvis/
Discussion group: http://groups.google.com/group/visvis/

Since this is the first release, it hasn't been tested on a large
scale yet. Therefore I'm specifically interested to know whether it
works for everyone.

=== Description ===

Visvis is a pure Python visualization library that uses OpenGl to
display 1D to 4D data; it can be used from simple plotting tasks to
rendering 3D volumetric data that moves in time.

Visvis can be used in Python scripts, interactive Python sessions (as
with IPython or IEP) and can be embedded in applications.

Visvis employs an object oriented structure; each object being
visualized (e.g. a line or a texture) has various properties that can
be modified to change its behaviour or appearance. A Matlab-like
interface in the form of a set of functions allows easy creation of
these objects (e.g. plot(), imshow(), volshow()).

Regards,
  Almar


------------------------------

Message: 3
Date: Mon, 30 Nov 2009 12:05:57 +0000
From: Jose Gomez-Dans <jgomezdans@gmail.com>
Subject: [SciPy-User] Parallel code
To: SciPy Users List <scipy-user@scipy.org>
Message-ID:
	<91d218430911300405w34759867x7145cab01938d6bd@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi!
I want to run some code in parallel, and I have toyed with the idea of
either using the multiprocessing module, or using ipython (which is quite
easy to use). The main idea is to run a number of class methods in parallel
(unsurprisingly!), fed with some arguments. However, these methods will need
(read-)access to a rather large numpy array. Ideally (and since this is
running on a SMP box), this could be a chunk of shared memory. I am aware of
Sturla Molden's suggestion of using ctypes, but I guess that I was wondering
whether some magic simple stuff is available off the shelf for this shared
memory business?

Thanks!
J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091130/38449a81/attachment-0001.html 

------------------------------

Message: 4
Date: Mon, 30 Nov 2009 12:39:41 +0000
From: Robin <robince@gmail.com>
Subject: Re: [SciPy-User] Parallel code
To: SciPy Users List <scipy-user@scipy.org>
Message-ID:
	<2d5132a50911300439g2d406ee7wb244217f39a30e16@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

If it is read only and you are on a platform with fork (ie not
windows) that multiprocessing is great for this sort of situation...
as long as the data is loaded before the fork, all the children can
read it fine (but be sure not to write to it - on write the page will
be copied for the child process leading to more memory use and changes
not visible between children).

Usually I put the variable to share in a module before calling pool... ie:

import mymodule # a blank module

mymodule.d = big_data_array

p = Pool(8)
p.map(function_which_does_something_to_mymodule.d, list_of_paraters)
p.close()

Cheers

Robin

On Mon, Nov 30, 2009 at 12:05 PM, Jose Gomez-Dans <jgomezdans@gmail.com> wrote:
> Hi!
> I want to run some code in parallel, and I have toyed with the idea of
> either using the multiprocessing module, or using ipython (which is quite
> easy to use). The main idea is to run a number of class methods in parallel
> (unsurprisingly!), fed with some arguments. However, these methods will need
> (read-)access to a rather large numpy array. Ideally (and since this is
> running on a SMP box), this could be a chunk of shared memory. I am aware of
> Sturla Molden's suggestion of using ctypes, but I guess that I was wondering
> whether some magic simple stuff is available off the shelf for this shared
> memory business?
>
> Thanks!
> J
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>


------------------------------

Message: 5
Date: Mon, 30 Nov 2009 14:28:56 +0100
From: Sturla Molden <sturla@molden.no>
Subject: Re: [SciPy-User] Parallel code
To: SciPy Users List <scipy-user@scipy.org>
Message-ID: <4B13C898.7030407@molden.no>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

What do you mean by my suggestion using ctypes?

Why don't you use shared memory? Ga?l Varoquaux and I wrote a shared 
memory backend for ndarrays earlier this year.


Sturla





Jose Gomez-Dans skrev:
> Hi!
> I want to run some code in parallel, and I have toyed with the idea of 
> either using the multiprocessing module, or using ipython (which is 
> quite easy to use). The main idea is to run a number of class methods 
> in parallel (unsurprisingly!), fed with some arguments. However, these 
> methods will need (read-)access to a rather large numpy array. Ideally 
> (and since this is running on a SMP box), this could be a chunk of 
> shared memory. I am aware of Sturla Molden's suggestion of using 
> ctypes, but I guess that I was wondering whether some magic simple 
> stuff is available off the shelf for this shared memory business?
>
> Thanks!
> J
> ------------------------------------------------------------------------
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>   



------------------------------

Message: 6
Date: Mon, 30 Nov 2009 14:37:41 +0100
From: Sturla Molden <sturla@molden.no>
Subject: Re: [SciPy-User] Parallel code
To: SciPy Users List <scipy-user@scipy.org>
Message-ID: <4B13CAA5.7050102@molden.no>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Robin skrev:
> If it is read only and you are on a platform with fork (ie not
> windows) that multiprocessing is great for this sort of situation...
> as long as the data is loaded before the fork, all the children canread it fine 

On a system with a copy-on-write optimized os.fork (i.e. almost anything 
but Cygwin), no shared memory are needed for shared read-only access.

Anonymous shared memory (multiprocessing.Array) will work on Windows as 
well, as handles can be inherited. This must be instantiated prior to 
process creation.

Named shared memory can be used for read-write access to shared memory 
created before of after forking.


Sturla


------------------------------

_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user


End of SciPy-User Digest, Vol 75, Issue 70
******************************************



More information about the SciPy-User mailing list