Exemple #1
0
def main():
    args = parse_cmd()

    # initialization YOU DIAN LUANG!

    conf = args.conf
    if not os.path.exists(conf):
        raise IOError("{0} cannot found".format(conf))

    conf_dict = ConfigObj(conf)
    SEQS, CDTS, TMPS, NUMS = get_sctn(args, conf_dict['systems'])

    h5filename = conf_dict['data']['h5filename']
    if not os.path.exists(h5filename):
        raise IOError("{0} cannot found".format(h5filename))

    ppty = args.ppty
    tpostproc = args.tpostproc                               # type of postprocess. i.e. ave, alx

    tpostproc_kwargs = conf_dict['postprocess'][tpostproc]

    rootUEP = os.path.join('/', ppty)

    # start dealing with the h5 file
    h5file = tables.openFile(h5filename, 'a', rootUEP=rootUEP)

    tpostproc_group_path = os.path.join('/', tpostproc)

    if h5file.__contains__(tpostproc_group_path):
        tpostproc_group = h5file.getNode(h5file.root, tpostproc)
    else:
        # meaning it's the first time to run tpostproc postprocess for this ppty
        tpostproc_group = h5file.createGroup(h5file.root, tpostproc)

    if args.tpostproc in ['ave', 'ave10']:
        loop_h5_ave(SEQS, CDTS, TMPS, NUMS, h5file, ppty, tpostproc_group, tpostproc_kwargs)
    if args.tpostproc == 'alx':
        loop_h5_alx(SEQS, CDTS, TMPS, NUMS, h5file, ppty, tpostproc_group, tpostproc_kwargs)
Exemple #2
0
# import system modules.
import multiprocessing
import xml.dom.minidom
import sys
import os

# Import application modules.
import mpipe
import util

# Configure and parse the command line.
NAME = os.path.basename(sys.argv[0])
ARGS = [('out_file', 'output file'),
        ('xml_dir', 'directory with XML files'),]
ARGS = util.parse_cmd(NAME, ARGS)

# Create a list of input files.
fnames = list()
for entry in os.listdir(ARGS['xml_dir']):
    fname = os.path.join(ARGS['xml_dir'], entry)
    if not os.path.isfile(fname):
        continue
    fnames.append(fname)

num_cpus = multiprocessing.cpu_count()
print('Parsing %d files on %d CPUs'%(len(fnames), num_cpus,))

# Parse files in a pipeline.
def parseFile(fname):
    """Parse the XML file looking for fully demangled class
Exemple #3
0
# Import system modules.
import multiprocessing
import subprocess
import sys
import os

# Import application modules.
import mpipe
import util

# Configure and parse the command line.
NAME = os.path.basename(sys.argv[0])
ARGS = [('out_dir', 'output directory'),
        ('wm5_inc', 'Wild Magic SDK include directory'),]
OPTS = [('-v', 'verbose', 'store_true', False, 'chatty output')]
ARGS,OPTS = util.parse_cmd(NAME, ARGS, OPTS)

# Create the output directory.
util.run('mkdir -p %s'%ARGS['out_dir'])

# Assemble a list of GCC-XML command strings 
# to delegate to worker processes.
commands = []
for entry in sorted(os.listdir(ARGS['wm5_inc'])):
    pos = entry.rfind('.')
    if pos == -1:
        continue
    suffix = entry[pos:]
    if suffix != '.h':
        continue    
    # Assemble the paths.
# Import system modules.
import sys
import os

# Import application modules.
import util

# Configure and parse the command line.
NAME = os.path.basename(sys.argv[0])
ARGS = [
    ('wm5_path', 'location of Wild Magic'),
    ('make_cmd', 'Make command used to build Wild Magic'),
]
OPTS = [('-d', 'dry_run', 'store_true', False,
         'dry run, don\'t actually do anything')]
ARGS, OPTS = util.parse_cmd(NAME, ARGS, OPTS)


def callMake(location, command):
    """Call the Make command at the given location.
    Location is relative to the current working directory.
    The Make command is appended "-n" (dry run mode) before being run.
    """

    # Descend into given location.
    saved = os.getcwd()
    os.chdir(location)

    # Run the Make command unconditionally (-B flag)
    # and in "dry run" mode (-n flag.)
    cmd = '%s -B -n' % command