Пример #1
0
def test_unit_no_params_bad(cluster, dirname):
    print('TESTING: run lbann with no params; lbann should throw exception\n')
    (output_file_name,
     error_file_name) = get_file_names(dirname, 'no_params_bad')
    command = tools.get_command(cluster=cluster,
                                exit_after_setup=True,
                                num_processes=1,
                                output_file_name=output_file_name,
                                error_file_name=error_file_name)
    return_code = os.system(command)
    tools.assert_failure(return_code, 'Failed to load any prototext files',
                         error_file_name)
Пример #2
0
def test_unit_two_models(cluster, dirname):
    print('TESTING: run lbann with two models; lbann should throw exception\n')
    (data_reader_path, model_path,
     optimizer_path) = get_default_parameters(dirname)
    (output_file_name, error_file_name) = get_file_names(dirname, 'two_models')
    command = tools.get_command(
        cluster=cluster,
        data_reader_path=data_reader_path,
        data_filedir_default='/p/lscratchh/brainusr/datasets/MNIST',
        exit_after_setup=True,
        model_path=model_path,
        optimizer_path=optimizer_path,
        num_processes=1,
        output_file_name=output_file_name,
        error_file_name=error_file_name)
    return_code = os.system(command)
    tools.assert_failure(return_code, 'Arguments could not be parsed.',
                         error_file_name)
Пример #3
0
def test_unit_one_model_bad(cluster, dirname):
    print(
        'TESTING: run lbann with no optimizer or reader; lbann should throw exception\n'
    )
    (_, model_path, _) = get_default_parameters(dirname, two_models=False)
    (output_file_name,
     error_file_name) = get_file_names(dirname, 'one_model_bad')
    command = tools.get_command(cluster=cluster,
                                exit_after_setup=True,
                                model_path=model_path,
                                num_processes=1,
                                output_file_name=output_file_name,
                                error_file_name=error_file_name)
    return_code = os.system(command)
    tools.assert_failure(
        return_code,
        'you specified 1 model filenames, and 0 optimizer filenames; you must specify 1 optimizer filenames',
        error_file_name)
Пример #4
0
def test_unit_two_models_bad(cluster, dirname, exes):
    if isinstance(exes, dict):
        exe = exes['gcc7']
    else:
        exe = exes
    print('TESTING: run lbann with two models but no optimizer or reader; lbann should throw exception\n')
    (_, model_path, _) = get_default_parameters(dirname)
    (output_file_name, error_file_name) = get_file_names(dirname, 'two_models_bad')
    command = tools.get_command(
        cluster=cluster, executable=exe,
        exit_after_setup=True,
        model_path=model_path,
        num_processes=1,
        output_file_name=output_file_name,
        error_file_name=error_file_name
    )
    return_code = os.system(command)
    tools.assert_failure(return_code,
                         'you specified 2 model filenames, and 0 optimizer filenames; you must specify either one or 2 optimizer filenames',
                         error_file_name)
Пример #5
0
def test_unit_two_models_bad2(cluster, dirname, exes):
    if isinstance(exes, dict):
        exe = exes['gcc7']
    else:
        exe = exes
    print('TESTING: run lbann with two models with missing {; lbann should throw exception\n')
    (_, model_path, _) = get_default_parameters(dirname, two_models=False)
    model_path = '{mp},{mp}}}'.format(mp=model_path)
    (output_file_name, error_file_name) = get_file_names(dirname, 'two_models_bad2')
    command = tools.get_command(
        cluster=cluster, executable=exe,
        exit_after_setup=True,
        model_path=model_path,
        num_processes=1,
        output_file_name=output_file_name,
        error_file_name=error_file_name
    )
    return_code = os.system(command)
    tools.assert_failure(return_code,
                         "possibly you left out '{' or '}' or both",
                         error_file_name)
Пример #6
0
def test_unit_missing_optimizer(cluster, dirname, exes):
    if isinstance(exes, dict):
        exe = exes['gcc7']
    else:
        exe = exes
    print('TESTING: run lbann with two models, reader, but no optimizer; lbann should throw exception\n')
    (data_reader_path, model_path, _) = get_default_parameters(dirname)
    (output_file_name, error_file_name) = get_file_names(dirname, 'missing_optimizer')
    command = tools.get_command(
        cluster=cluster, executable=exe,
        data_reader_path=data_reader_path,
        data_filedir_default='/p/lscratchh/brainusr/datasets/MNIST',
        exit_after_setup=True, model_path=model_path,
        num_processes=1,
        output_file_name=output_file_name,
        error_file_name=error_file_name
    )
    return_code = os.system(command)
    tools.assert_failure(return_code,
                         'you specified 2 model filenames, and 0 optimizer filenames; you must specify either one or 2 optimizer filenames',
                         error_file_name)
Пример #7
0
def test_unit_bad_params(cluster, dirname, exes):
    if isinstance(exes, dict):
        exe = exes['gcc7']
    else:
        exe = exes
    print('TESTING: run lbann with ill-formed param (exit_after_setup should have `--` not `-`) lbann should throw exception\n')
    (data_reader_path, model_path, optimizer_path) = get_default_parameters(
        dirname)
    (command_allocate, command_run, _, _) = tools.get_command(
        cluster=cluster, executable=exe,
        num_processes=1,
        return_tuple=True)
    (output_file_name, error_file_name) = get_file_names(dirname, 'bad_params')
    command_string = '{ca}{cr} {e} -exit_after_setup --reader={d} --model={m} --optimizer={o} > {ofn} 2> {efn}'.format(
        ca=command_allocate, cr=command_run, e=exe,
        d=data_reader_path, m=model_path, o=optimizer_path,
        ofn=output_file_name, efn=error_file_name
    )
    return_code = os.system(command_string)
    tools.assert_failure(return_code,
                         "badly formed cmd line param; must begin with '--': -exit_after_setup",
                         error_file_name)
Пример #8
0
def test_unit_missing_optimizer(cluster, dirname):
    print(
        'TESTING: run lbann with model, reader, but no optimizer; lbann should throw exception\n'
    )
    (data_reader_path, model_path,
     _) = get_default_parameters(dirname, two_models=False)
    (output_file_name,
     error_file_name) = get_file_names(dirname, 'missing_optimizer')
    command = tools.get_command(
        cluster=cluster,
        data_reader_path=data_reader_path,
        data_filedir_default='/p/lscratchh/brainusr/datasets/MNIST',
        exit_after_setup=True,
        model_path=model_path,
        num_processes=1,
        output_file_name=output_file_name,
        error_file_name=error_file_name)
    return_code = os.system(command)
    tools.assert_failure(
        return_code,
        'you specified 1 model filenames, and 0 optimizer filenames; you must specify 1 optimizer filenames',
        error_file_name)
Пример #9
0
def test_unit_bad_params(cluster, dirname):
    exe = shutil.which('lbann')
    print(
        'TESTING: run lbann with ill-formed param (exit_after_setup should have `--` not `-`) lbann should throw exception\n'
    )
    (data_reader_path, model_path,
     optimizer_path) = get_default_parameters(dirname, two_models=False)
    (command_allocate, command_run, _,
     _) = tools.get_command(cluster=cluster,
                            num_processes=1,
                            return_tuple=True)
    (output_file_name, error_file_name) = get_file_names(dirname, 'bad_params')
    command_string = '{ca}{cr} {e} -exit_after_setup --reader={d} --model={m} --optimizer={o} > {ofn} 2> {efn}'.format(
        ca=command_allocate,
        cr=command_run,
        e=exe,
        d=data_reader_path,
        m=model_path,
        o=optimizer_path,
        ofn=output_file_name,
        efn=error_file_name)
    return_code = os.system(command_string)
    tools.assert_failure(return_code, "Arguments could not be parsed.",
                         error_file_name)