Axel Naumann | 2 Jan 2011 11:56
Picon
Picon

Re: [ROOT] Python module for easy class generation

Hi,

the advantage now is that users immediately see what to remove when they
want to clean up all files, e.g. when something in their class changed
and ROOT didn't detect the dependencies correctly. And I'm not sure what
happens when writing to ~/ on batch / grid nodes. PWD is usually a safe bet.

Cheers, Axel.

On 1/1/11 9:06 PM, Noel Dawe wrote:
> Why not automatically place these dictionaries somewhere less invasive?
> Like /tmp or ~/.rootsys?
> 
> Noel
> 
> On Fri, Dec 31, 2010 at 2:22 AM, Axel Naumann <Axel.Naumann <at> cern.ch
> <mailto:Axel.Naumann <at> cern.ch>> wrote:
> 
>     Hi Noel,
> 
>     that's your dictionary :) You can remove it, but then ROOT will need to
>     regenerate it every time it needs the dictionary.
> 
>     Cheers, Axel.
> 
> 
>     On 12/31/10 5:10 AM, Noel Dawe wrote:
>     > When using GenerateDictionary in python I end up with a lot of
>     > AutoDict_vector_vector_float___.cxx* garbage that is not cleaned up. I
>     > suppose this is an easy fix?
(Continue reading)

Noel Dawe | 2 Jan 2011 21:28
Picon
Picon

Re: [ROOT] Python module for easy class generation

No problem then. I've modified my "classfactory" to keep the shared libraries in ~/.rootpy/dicts (now in my LD_LIBRARY_PATH). When I request a dictionary, it first checks for the library there (using a file containing a lookup table) and loads it, otherwise it compiles it there and adds it to the lookup table. No mess left behind, no bookkeeping required by the user, and no needless regeneration of the same dictionary by future requests.

Noel

On Sun, Jan 2, 2011 at 4:56 AM, Axel Naumann <Axel.Naumann <at> cern.ch> wrote:
Hi,

the advantage now is that users immediately see what to remove when they
want to clean up all files, e.g. when something in their class changed
and ROOT didn't detect the dependencies correctly. And I'm not sure what
happens when writing to ~/ on batch / grid nodes. PWD is usually a safe bet.

Cheers, Axel.

On 1/1/11 9:06 PM, Noel Dawe wrote:
> Why not automatically place these dictionaries somewhere less invasive?
> Like /tmp or ~/.rootsys?
>
> Noel
>
> On Fri, Dec 31, 2010 at 2:22 AM, Axel Naumann <Axel.Naumann <at> cern.ch
> <mailto:Axel.Naumann <at> cern.ch>> wrote:
>
>     Hi Noel,
>
>     that's your dictionary :) You can remove it, but then ROOT will need to
>     regenerate it every time it needs the dictionary.
>
>     Cheers, Axel.
>
>
>     On 12/31/10 5:10 AM, Noel Dawe wrote:
>     > When using GenerateDictionary in python I end up with a lot of
>     > AutoDict_vector_vector_float___.cxx* garbage that is not cleaned up. I
>     > suppose this is an easy fix?
>     >
>     > Noel
>     >
>     > On Thu, Dec 23, 2010 at 10:33 PM, Philippe Canal <pcanal <at> fnal.gov
>     <mailto:pcanal <at> fnal.gov>
>     > <mailto:pcanal <at> fnal.gov <mailto:pcanal <at> fnal.gov>>> wrote:
>     >
>     >     Hi Noel,
>     >
>     >     In newer version of ROOT you can simply your scripts by using
>     >
>     >        gInterpreter->GenerateDictionary("vector<vector<float> >",
>     "vector");
>     >
>     >     which does most of the work of your make_class.
>     >
>     >     Cheers,
>     >     Philippe.
>     >
>     >
>     >     On 12/22/10 4:29 PM, Noel Dawe wrote:
>     >
>     >         For all the python fans out there I've attached a simple
>     module
>     >         which may be used to generate classes in PyROOT which are not
>     >         available by default (like vector<vector<float> > etc.)
>     >
>     >         Example usage:
>     >
>     >         Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
>     >         [GCC 4.4.5] on linux2
>     >         Type "help", "copyright", "credits" or "license" for more
>     >         information.
>     >         >>> from classfactory import *
>     >         >>> make_class("vector<vector<float> >", "<vector>")
>     >         True
>     >         >>> ROOT.vector("vector<float>")()
>     >         <ROOT.vector<vector<float> > object at 0x2b1cf10>
>     >         >>> make_class("vector<TH1D>", "TH1D.h")
>     >         True
>     >         >>> ROOT.vector("TH1D")()
>     >         <ROOT.vector<TH1D> object at 0x2b2c160>
>     >         >>>
>     >
>     >         Suggestions/improvements are welcome.
>     >
>     >         Cheers,
>     >         Noel
>     >
>     >
>
>


Sebastien Binet | 3 Jan 2011 00:26
Picon
Picon
Gravatar

Re: [ROOT] Python module for easy class generation

On Sun, 2 Jan 2011 14:28:37 -0600, Noel Dawe <Noel.Dawe <at> cern.ch> wrote:
> No problem then. I've modified my "classfactory" to keep the shared
> libraries in ~/.rootpy/dicts (now in my LD_LIBRARY_PATH). When I request a
> dictionary, it first checks for the library there (using a file containing a
> lookup table) and loads it, otherwise it compiles it there and adds it to
> the lookup table. No mess left behind, no bookkeeping required by the user,
> and no needless regeneration of the same dictionary by future
> requests.

you probably want to have a ROOT-version dependent directory.
also, in well behaved systems (ie: POSIX conformant) putting temporary
files under $TMPDIR (or with tempfile.tempdir in python) should do the
trick of not cluttering $PWD. batch systems not honouring $TMPDIR should
be fixed.

my 2 euro-cents,
sebastien.

> 
> Noel
> 
> On Sun, Jan 2, 2011 at 4:56 AM, Axel Naumann <Axel.Naumann <at> cern.ch> wrote:
> 
> > Hi,
> >
> > the advantage now is that users immediately see what to remove when they
> > want to clean up all files, e.g. when something in their class changed
> > and ROOT didn't detect the dependencies correctly. And I'm not sure what
> > happens when writing to ~/ on batch / grid nodes. PWD is usually a safe
> > bet.
> >
> > Cheers, Axel.
> >
> > On 1/1/11 9:06 PM, Noel Dawe wrote:
> > > Why not automatically place these dictionaries somewhere less invasive?
> > > Like /tmp or ~/.rootsys?
> > >
> > > Noel
> > >
> > > On Fri, Dec 31, 2010 at 2:22 AM, Axel Naumann <Axel.Naumann <at> cern.ch
> > > <mailto:Axel.Naumann <at> cern.ch>> wrote:
> > >
> > >     Hi Noel,
> > >
> > >     that's your dictionary :) You can remove it, but then ROOT will need
> > to
> > >     regenerate it every time it needs the dictionary.
> > >
> > >     Cheers, Axel.
> > >
> > >
> > >     On 12/31/10 5:10 AM, Noel Dawe wrote:
> > >     > When using GenerateDictionary in python I end up with a lot of
> > >     > AutoDict_vector_vector_float___.cxx* garbage that is not cleaned
> > up. I
> > >     > suppose this is an easy fix?
> > >     >
> > >     > Noel
> > >     >
> > >     > On Thu, Dec 23, 2010 at 10:33 PM, Philippe Canal <pcanal <at> fnal.gov
> > >     <mailto:pcanal <at> fnal.gov>
> > >     > <mailto:pcanal <at> fnal.gov <mailto:pcanal <at> fnal.gov>>> wrote:
> > >     >
> > >     >     Hi Noel,
> > >     >
> > >     >     In newer version of ROOT you can simply your scripts by using
> > >     >
> > >     >        gInterpreter->GenerateDictionary("vector<vector<float> >",
> > >     "vector");
> > >     >
> > >     >     which does most of the work of your make_class.
> > >     >
> > >     >     Cheers,
> > >     >     Philippe.
> > >     >
> > >     >
> > >     >     On 12/22/10 4:29 PM, Noel Dawe wrote:
> > >     >
> > >     >         For all the python fans out there I've attached a simple
> > >     module
> > >     >         which may be used to generate classes in PyROOT which are
> > not
> > >     >         available by default (like vector<vector<float> > etc.)
> > >     >
> > >     >         Example usage:
> > >     >
> > >     >         Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
> > >     >         [GCC 4.4.5] on linux2
> > >     >         Type "help", "copyright", "credits" or "license" for more
> > >     >         information.
> > >     >         >>> from classfactory import *
> > >     >         >>> make_class("vector<vector<float> >", "<vector>")
> > >     >         True
> > >     >         >>> ROOT.vector("vector<float>")()
> > >     >         <ROOT.vector<vector<float> > object at 0x2b1cf10>
> > >     >         >>> make_class("vector<TH1D>", "TH1D.h")
> > >     >         True
> > >     >         >>> ROOT.vector("TH1D")()
> > >     >         <ROOT.vector<TH1D> object at 0x2b2c160>
> > >     >         >>>
> > >     >
> > >     >         Suggestions/improvements are welcome.
> > >     >
> > >     >         Cheers,
> > >     >         Noel
> > >     >
> > >     >
> > >
> > >
> >
> >
Non-text part: text/html

--

-- 
#########################################
# Dr. Sebastien Binet
# Laboratoire de l'Accelerateur Lineaire
# Universite Paris-Sud XI
# Batiment 200
# 91898 Orsay
#########################################

Gmane