def run_tests(args):
    failure = False
    this_machine = find_machine(verbose=False)
    machine_names = list(machine_list.keys())
    matrix_test_machines = ['eagle', 'summit']
    if '_matrix.yaml' in args.yaml:
        machine_names = matrix_test_machines
    else:
        machine_names = list(
            set(machine_names) - set(matrix_test_machines))
    # only test darwin on matching ci platform
    # and return early on darwin for matrix test

    if this_machine == 'darwin':
        if 'darwin' in machine_names:
            machine_names = ['darwin']
        else:
            return
    else:
        if 'darwin' in machine_names:
            machine_names.remove('darwin')

    for name in machine_names:
        try:
            check_config_concretizations(name, args.yaml)
        except(Exception) as e:
            print(e)
            failure = True
            continue
    exit(failure)
예제 #2
0
    def ctest_args(self):
        spec = self.spec
        define = CMakePackage.define
        machine = find_machine(verbose=False, full_machine_name=True)
        if spec.variants['host_name'].value == 'default':
            if machine == 'NOT-FOUND':
                spec.variants['host_name'].value = spec.format(
                    '{architecture}')
            else:
                spec.variants['host_name'].value = machine
        if spec.variants['extra_name'].value == 'default':
            spec.variants['extra_name'].value = spec.format('-{compiler}')
            if '+cuda' in spec:
                spec.variants['extra_name'].value = spec.variants[
                    'extra_name'].value + '-cuda@' + str(spec['cuda'].version)
            if spec.variants['latest_amrex'].value == True:
                spec.variants['extra_name'].value = spec.variants[
                    'extra_name'].value + '-latest-amrex'

        # Cmake options for ctest
        cmake_options = self.std_cmake_args
        cmake_options += self.cmake_args()
        cmake_options.remove('-G')
        cmake_options.remove(
            'Unix Makefiles')  # The space causes problems for ctest

        # Ctest options
        ctest_options = []
        ctest_options.extend([
            define('TESTING_ROOT_DIR', self.stage.path),
            define('SOURCE_DIR', self.stage.source_path),
            define('BUILD_DIR', self.build_directory)
        ])
        if machine == 'eagle.hpc.nrel.gov':
            ctest_options.append(
                define('CTEST_DISABLE_OVERLAPPING_TESTS', True))
            ctest_options.append(define('UNSET_TMPDIR_VAR', True))
            if '+cuda' in spec:
                cmake_options.append(define('GPUS_PER_NODE', '2'))
        ctest_options.append(
            define('CMAKE_CONFIGURE_ARGS', ' '.join(v for v in cmake_options)))
        ctest_options.append(
            define('HOST_NAME', spec.variants['host_name'].value))
        ctest_options.append(
            define('EXTRA_BUILD_NAME', spec.variants['extra_name'].value))
        ctest_options.append(
            define('USE_LATEST_AMREX', spec.variants['latest_amrex'].value))
        ctest_options.append(
            define('NP', spack.config.get('config:build_jobs')))
        ctest_options.append('-VV')
        ctest_options.append('-S')
        ctest_options.append(
            os.path.join(self.stage.source_path, 'test',
                         'CTestNightlyScript.cmake'))

        return ctest_options
예제 #3
0
    def ctest_args(self):
        spec = self.spec
        define = CMakePackage.define
        machine = find_machine(verbose=False)
        full_machine = find_machine(verbose=False, full_machine_name=True)

        if spec.variants['host_name'].value == 'default':
            if full_machine == 'NOT-FOUND':
                spec.variants['host_name'].value = spec.format('{architecture}')
            else:
                spec.variants['host_name'].value = full_machine

        if spec.variants['extra_name'].value == 'default':
            spec.variants['extra_name'].value = self.dashboard_build_name()

        # Cmake options for ctest
        cmake_options = self.std_cmake_args
        cmake_options += self.cmake_args()
        cmake_options.remove('-G')
        cmake_options.remove('Unix Makefiles') # The space causes problems for ctest
        if '%intel' in spec and '-DBoost_NO_BOOST_CMAKE=ON' in cmake_options:
            cmake_options.remove('-DBoost_NO_BOOST_CMAKE=ON') # Avoid dashboard warning
        if full_machine == 'eagle.hpc.nrel.gov':
            cmake_options.append(define('TEST_ABS_TOL', '1e-10'))
            cmake_options.append(define('TEST_REL_TOL', '1e-8'))

        # Ctest options
        ctest_options = []
        ctest_options.extend([define('TESTING_ROOT_DIR', self.stage.path),
            define('NALU_DIR', self.stage.source_path),
            define('BUILD_DIR', self.build_directory)])
        if full_machine == 'eagle.hpc.nrel.gov' or machine == 'ascicgpu':
            ctest_options.append(define('CTEST_DISABLE_OVERLAPPING_TESTS', True))
            ctest_options.append(define('UNSET_TMPDIR_VAR', True))
        ctest_options.append(define('CMAKE_CONFIGURE_ARGS',' '.join(v for v in cmake_options)))
        ctest_options.append(define('HOST_NAME', spec.variants['host_name'].value))
        ctest_options.append(define('EXTRA_BUILD_NAME', spec.variants['extra_name'].value))
        ctest_options.append(define('NP', spack.config.get('config:build_jobs')))
        ctest_options.append('-VV')
        ctest_options.append('-S')
        ctest_options.append(os.path.join(self.stage.source_path,'reg_tests','CTestNightlyScript.cmake'))

        return ctest_options
def get_path_to_externals():
    machine = find_machine.find_machine(verbose=False)
    if machine in ['cee', 'snl-hpc', 'ascicgpu', 'ascic']:
        return '/projects/wind/spack-manager'
    elif machine in ['eagle']:
        return '/projects/exawind/exawind-snapshots/spack-manager'
    elif machine in ['rhodes']:
        return '/projects/ecp/exawind/exawind-snapshots/spack-manager'
    elif machine in ['summit']:
        # This is currently on a project scratch directory and is
        # unfortunately subject to purge
        return '/gpfs/alpine/proj-shared/cfd116/jrood/spack-manager-summit'
    else:
        return
예제 #5
0
def create_snapshots(args):
    machine = find_machine(verbose=False)
    extension = path_extension(args.name, args.use_machine_name)
    env_path = os.path.join(os.environ['SPACK_MANAGER'], 'environments',
                            extension)

    print('\nCreating snapshot environment')

    command(manager, 'create-env', '-d', env_path)

    e = ev.Environment(env_path)

    with e.write_transaction():
        e.yaml['spack']['concretizer'] = {'unify': 'when_possible'}
        e.write()

    spec_data = machine_specs[machine]
    add_view(e, extension, args.link_type)
    for s in spec_data:
        add_spec(e, extension, s, args.modules)

    top_specs = get_top_level_specs(e)

    if args.stop_after == 'create_env':
        return

    if args.use_develop:
        use_develop_specs(e, top_specs)
    else:
        use_latest_git_hashes(e, top_specs)

    if args.stop_after == 'mod_specs':
        return

    ev.activate(e)
    print('\nConcretize')
    command(concretize, '-f')
    if args.stop_after == 'concretize':
        return
    print('\nInstall')
    with multiprocessing.Pool(args.num_threads):
        spack_install_cmd(args.spack_install_args)

    if args.modules:
        print('\nGenerate module files')
        command(module, 'tcl', 'refresh', '-y')
    return env_path
예제 #6
0
def create_env(parser, args):
    if args.directory is not None:
        if os.path.exists(args.directory) is False:
            print("making", args.directory)
            os.makedirs(args.directory)

        theDir = args.directory
    elif args.name is not None:
        theDir = os.path.join(os.environ['SPACK_MANAGER'], 'environments',
                              args.name)
        if os.path.exists(theDir) is False:
            print("making", theDir)
            os.makedirs(theDir)
    else:
        theDir = os.getcwd()

    has_view = False
    if args.yaml:
        assert (os.path.isfile(args.yaml))
        with open(args.yaml, 'r') as fyaml:
            print(fyaml)
            user_yaml = syaml.load_config(fyaml)
            user_view = environment.config_dict(user_yaml).get('view')
            if user_view:
                has_view = True
    env = environment.Environment(theDir,
                                  init_file=args.yaml,
                                  with_view=has_view,
                                  keep_relative=True)
    yaml = env.yaml

    def _unify_already_set(yaml):
        return ('spack' in yaml and 'concretizer' in yaml['spack']
                and 'unify' in yaml['spack']['concretizer'])

    if not args.yaml or not _unify_already_set(yaml):
        yaml['spack']['concretizer'] = {'unify': True}
        with env.write_transaction():
            env.write()

    if args.machine is not None:
        machine = args.machine
        if machine not in fm.machine_list.keys():
            raise Exception('Specified machine %s is not defined' % machine)
    else:
        machine = find_machine(verbose=False)

    if args.spec:
        spec_list = spack.cmd.parse_specs(args.spec)
        for s in spec_list:
            env.add(s)

    inc_creator = IncludesCreator()
    genPath = os.path.join(os.environ['SPACK_MANAGER'], 'configs', 'base')
    inc_creator.add_scope('base', genPath)
    hostPath = os.path.join(os.environ['SPACK_MANAGER'], 'configs', machine)

    if os.path.exists(hostPath):
        inc_creator.add_scope('machine', hostPath)
    else:
        print('Host not setup in spack-manager: %s' % hostPath)

    include_file_name = 'include.yaml'
    include_file = os.path.join(theDir, include_file_name)
    inc_creator.write_includes(include_file)
    if 'include' in yaml['spack']:
        yaml['spack']['include'].append(include_file_name)
    else:
        yaml['spack']['include'] = [include_file_name]

    env.write()

    fpath = os.path.join(os.environ['SPACK_MANAGER'], '.tmp')

    os.makedirs(fpath, exist_ok=True)

    storage = os.path.join(fpath, 'created_env_path.txt')

    with open(storage, 'w') as f:
        f.write(theDir)

    return theDir