Package Biskit :: Package PVM
[hide private]
[frames] | no frames]

Source Code for Package Biskit.PVM

 1  ## 
 2  ## Biskit, a toolkit for the manipulation of macromolecular structures 
 3  ## Copyright (C) 2004-2005 Raik Gruenberg & Johan Leckner 
 4  ## 
 5  ## This program is free software; you can redistribute it and/or 
 6  ## modify it under the terms of the GNU General Public License as 
 7  ## published by the Free Software Foundation; either version 2 of the 
 8  ## License, or any later version. 
 9  ## 
10  ## This program is distributed in the hope that it will be useful, 
11  ## but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
13  ## General Public License for more details. 
14  ## 
15  ## You find a copy of the GNU General Public License in the file 
16  ## license.txt along with this program; if not, write to the Free 
17  ## Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
18  ## 
19  ## 
20  """ 
21  High-level parallelisation with PVM. 
22   
23  Python jobs can be distributed from a TrackingJobMaster to many 
24  JobSlaves running on different machines. The general mechanism is shown in 
25  ExampleMaster.py and ExampleSlave.py  
26   
27  The package depends on the pypvm_core c-library which has to be compiled 
28  in the package directory. With Python versions >= 2.3, platform specific 
29  compilations can be placed in subfolders. The name of this folder should 
30  be assembled from: 'py' + version + '_' + platform.machine() 
31  Where platform is a python module available since Python 2.3. 
32  See Biskit.tools.platformFolder! 
33   
34  The compilation of pypvm_core can be tricky on some architectures. In order 
35  to support installations that don't need parallelisation, only a warning is 
36  issued if pypvm_core is missing and the public classes are exported as 
37  Pseudo-classes. Pseudo classes are empty and raise an ImportError when you 
38  try to initialize them. See also L{Biskit.tools.tryImport}. 
39  """ 
40   
41  ## 
42  ## platform-dependent import of PVM core module 
43  ## Look for a folder ala py2.3_i686  
44  ## 
45  try: 
46      import Biskit.tools as T 
47   
48      __path__.insert( 0, T.platformFolder( __path__[0] ) ) 
49   
50  except ImportError, why: 
51      pass 
52   
53  ## 
54  ## error-tolerant export of public classes 
55  ## 
56  from Biskit import EHandler 
57  r = True 
58   
59  r = T.tryImport( 'TrackingJobMaster', 'TrackingJobMaster', namespace=globals()) 
60  r = T.tryImport( 'dispatcher', 'JobSlave', namespace=globals() ) and r 
61   
62  if not r: 
63      EHandler.warning('Could not import PVM modules.'+ 
64          ' Please check that the pypvm_core library is compiled!\n'+ 
65          '\tParallelisation is not available.') 
66   
67  ## 
68  ## clean up 
69  ## 
70  del r, EHandler 
71