Package SloppyCell
[hide private]

Source Code for Package SloppyCell

 1  _VERSION = 'Wed Jun  3 10:14:54 2009' 
 2  import os 
 3  _TEMP_DIR = os.path.join(os.getcwd(), '.SloppyCell') 
 4   
 5  import logging 
 6  logging.basicConfig() 
 7  logger = logging.getLogger('__init__') 
 8   
 9  # Check for debugging option. I tried using optparse for this, but ran into 
10  # issues with ipython and mpirun, both of which pollute sys.argv. 
11  disable_c = False 
12  import sys 
13  args_to_remove = [] 
14  for arg in sys.argv: 
15      if arg.startswith('--debugSC'): 
16          words = arg.split('=') 
17          import Utility 
18          if len(words) == 2: 
19              Utility.enable_debugging_msgs(words[1]) 
20          else: 
21              Utility.enable_debugging_msgs(None) 
22          args_to_remove.append(arg) 
23      elif arg.startswith('--disableC'): 
24          disable_c = True 
25          args_to_remove.append(arg) 
26  currdir = os.getcwd() 
27  # We need to remove these arguments from the list before they get to uniitest 
28  #  or it will complain. 
29  for arg in args_to_remove: 
30      sys.argv.remove(arg) 
31               
32  try: 
33      import pypar 
34      os.chdir(currdir) 
35      HAVE_PYPAR = True 
36      num_procs = pypar.size() 
37      my_rank = pypar.rank() 
38      my_host = pypar.get_processor_name() 
39      import atexit 
40      atexit.register(pypar.finalize) 
41  except ImportError: 
42      os.chdir(currdir) 
43      HAVE_PYPAR = False 
44      num_procs = 1 
45      my_rank = 0 
46      import socket 
47      my_host = socket.gethostname() 
48  logger.debug('Node %i is on host %s.' % (my_rank, my_host)) 
49   
50  if my_rank == 0 and not os.path.isdir(_TEMP_DIR):  
51      os.mkdir(_TEMP_DIR) 
52   
53  import OldScipySupport 
54