Exemplo n.º 1
0
def parse_args_all_schemes(feature_str):
    _parser = OptionParser()
    _parser.add_option(
        '--scheme',
        '-s',
        action='callback',
        type='choice',
        choices=('cpu', 'cuda'),
        default='cpu',
        dest='scheme',
        callback=_check_scheme_all,
        help='specifies processing scheme, can be cpu [default], cuda')
    _parser.add_option(
        '--device-num',
        '-d',
        action='store',
        type='int',
        dest='devicenum',
        default=0,
        help='specifies a GPU device to use for CUDA, 0 by default')
    (_opt_list, _args) = _parser.parse_args()

    # Changing the optvalues to a dict makes them easier to read
    _options = vars(_opt_list)

    _scheme = _options['scheme']

    if _scheme == 'cpu':
        _context = CPUScheme()
    if _scheme == 'cuda':
        _context = CUDAScheme(device_num=_options['devicenum'])

    _scheme_dict = {'cpu': 'CPU', 'cuda': 'CUDA'}

    print(72 * '=')
    print("Running {0} unit tests for {1}:".format(_scheme_dict[_scheme],
                                                   feature_str))

    return [_scheme, _context]
Exemplo n.º 2
0
(options, args) = parser.parse_args()

template_sample_rate = options.filter_sample_rate
signal_sample_rate = options.filter_sample_rate

if options.template_sample_rate:
    template_sample_rate = options.template_sample_rate

if options.signal_sample_rate:
    template_sample_rate = options.signal_sample_rate

if options.psd and options.asd_file:
    parser.error("PSD and asd-file options are mututally exclusive")

if options.use_cuda:
    ctx = CUDAScheme()
else:
    ctx = DefaultScheme()

print("STARTING THE BANKSIM")

# Load in the template bank file
indoc = ligolw_utils.load_filename(options.bank_file, False)
try:
    template_table = table.get_table(indoc,
                                     lsctables.SnglInspiralTable.tableName)
except ValueError:
    template_table = table.get_table(indoc,
                                     lsctables.SimInspiralTable.tableName)

# open the output file where the max overlaps over the bank are stored