def distribute_job(dict_input: dict, split_function: Callable) -> dict:
    """
    Using the jobs and parameters defined in `dict_input` create
    a set of independent jobs.
    """
    dict_jobs = split_function(lift(dict_input))
    return run_parallel_jobs(dict_jobs, lift(dict_input))
Exemple #2
0
def test_storable():
    a = A()
    b = A()

    a.x = 1
    b.x = f(3, 4)

    c = g(a, lift(b))
    b.x = c
    d = h(lift(b), a)

    result = run_process(d, n_processes=1, registry=serial.base)
    assert result.x == 7
Exemple #3
0
def test_storable():
    a = A()
    b = A()

    a.x = 1
    b.x = f(3, 4)

    c = g(a, lift(b))
    b.x = c
    d = h(lift(b), a)

    result = run_process(d, n_processes=1, registry=serial.base)
    assert result.x == 7
Exemple #4
0
def test_lift_01():
    a = A()
    a.x = add(1, 2)
    a.y = sub(9, 11)
    b = f(lift(a))

    result = run_single(b)
    assert result == 1
    def _parameter_sweep(self, parameter_space, kernel_options, device_options, tuning_options):
        """Build a Noodles workflow by sweeping the parameter space"""
        results = []

        #randomize parameter space to do pseudo load balancing
        parameter_space = list(parameter_space)
        random.shuffle(parameter_space)

        #split parameter space into chunks
        work_per_thread = int(numpy.ceil(len(parameter_space) / float(self.max_threads)))
        chunks = _chunk_list(parameter_space, work_per_thread)

        for chunk in chunks:

            chunked_result = self._run_chunk(chunk, kernel_options, device_options, tuning_options)

            results.append(lift(chunked_result))

        return gather(*results)
def run_partialcharges(results: Results,
                       options: Options,
                       promise: PromisedObject = None) -> dict:
    """
    Compute partial charges
    """
    opts = edit_calculator_options(options,
                                   ['esp2multipole', 'partialcharges'])

    if promise is not None:
        path_partialcharges = options.path_optionfiles / "partialcharges.xml"
        sections_to_edit = {"partialcharges": {"input": promise}}
        opts['partialcharges'] = schedule(edit_xml_file)(
            path_partialcharges, 'options', lift(sections_to_edit))

    logger.info("Running CHELPG fit")
    args = create_promise_command("xtp_tools -e partialcharges -o {}",
                                  opts['partialcharges'])

    return call_xtp_cmd(args,
                        options.scratch_dir / 'partialcharges',
                        expected_output={})
Exemple #7
0
    def _parameter_sweep(self, parameter_space, kernel_options, device_options,
                         tuning_options):
        """Build a Noodles workflow by sweeping the parameter space"""
        results = []

        #randomize parameter space to do pseudo load balancing
        parameter_space = list(parameter_space)
        random.shuffle(parameter_space)

        #split parameter space into chunks
        work_per_thread = int(
            numpy.ceil(len(parameter_space) / float(self.max_threads)))
        chunks = _chunk_list(parameter_space, work_per_thread)

        for chunk in chunks:

            chunked_result = self._run_chunk(chunk, kernel_options,
                                             device_options, tuning_options)

            results.append(lift(chunked_result))

        return gather(*results)
Exemple #8
0
def lift_object():
    a = A()
    a.x = add(1, 2)
    a.y = sub(9, 11)
    return f(noodles.lift(a))
Exemple #9
0
def lift_ordered_dict():
    x = OrderedDict()
    x['a'] = 1
    x['b'] = add(1, 2)
    return g(noodles.lift(x))