domenica 13 gennaio 2013

un pattern per semplificare la parallelizzazione di codice scientifico

questo articolo è abbastanza carino... almeno per la didattica.

Simplifying the parallelization of scientific codes by a function-centric approach in Python

The purpose of this paper is to show how existing scientific software can be parallelized using a separate thin layer of Python code where all parallelization-specific tasks are implemented....The overall programming effort needed by this parallelization approach is limited, and the resulting parallel Python scripts have a compact and clean structure.

in sintesi


A generic Python function that implements the three-step parameter analysis can be as follows:

def solve_problems(initialize, func, finalize):
    input_args = initialize()
    output = [func(*args, **args) for args, kwargs in input_args]
    finalize(output)

The initialize, func and finalize functions, which are independent of solve_problem, are passed as input arguments.

nulla di così innovativo, l'uso della struttura a tre passi: inizio-faccio-finisco è un vero e proprio deja vu: l'ho già visto in concettualizzazioni tipo il design by contract, il setup/teardown dello unit testing ed anche nel mapReduce. 

Nessun commento:

Posta un commento