Git Product home page Git Product logo

pycompss-autoparallel's Introduction

Codacy grade

Codacy coverage

codecov

Language

License

PyCOMPSs AutoParallel

The PyCOMPSs AutoParallel module.

The implementation includes:

  • The @parallel() decorator for Python to run applications with PyCOMPSs
  • Different Translator modules to automatically generate parallel Python code
    • Py2Scop Translator: Translation of Python code into OpenScop format
    • Scop2PScop2Py Translator: Integration with the PLUTO tool to generate possible parallelizations of the given code. The output is written in Python (by means of a CLooG extension) with parallel annotations following an OMP fashion.
    • Py2PyCOMPSs Translator: Translation of parallel annotated Python code into PyCOMPSs task definitions.
  • A Code Replacer module to replace the user code by autogenerated code.
  • Several example applications (examples/ folder).

Table of Contents


Dependencies

Software Dependencies

COMPSs: The COMP Superscalar (COMPSs) framework is mainly compose of a programming model which aims to ease the development of applications for distributed infrastructures, such as Clusters, Grids and Clouds and a runtime system that exploits the inherent parallelism of applications at execution time. The framework is complemented by a set of tools for facilitating the development, execution monitoring and post-mortem performance analysis. It natively supports Java but has bindings for Python, C and C++.

PLUTO: PLUTO is an automatic parallelization tool based on the polyhedral model. The polyhedral model for compiler optimization provides an abstraction to perform high-level transformations such as loop-nest optimization and parallelization on affine loop nests. Pluto transforms C programs from source to source for coarse-grained parallelism and data locality simultaneously. The core transformation framework mainly works by finding affine transformations for efficient tiling. OpenMP parallel code for multicores can be automatically generated from sequential C program sections. The outer (communication-free), inner, or pipelined parallelization is achieved purely with OpenMP parallel for pragmas.

Included Dependencies inside PyCOMPSs

DILL: It is recommended to install the DILL Python package for better serialization

Included Dependencies inside PLUTO

OpenSCOP: OpenScop is an open specification defining a file format and a set of data structures to represent a static control part (SCoP for short), i.e., a program part that can be represented in the polyhedral model. The goal of OpenScop is to provide a common interface to various polyhedral compilation tools in order to simplify their interaction. The OpenScop aim is to provide a stable, unified format that offers a durable guarantee that a tool can use an output or provide an input to another tool without breaking a toolchain because of some internal changes in one element of the chain. The other promise of OpenScop is the ability to assemble or replace the basic blocks of a polyhedral compilation framework at no, or at least low engineering cost.

CLooG: CLooG is a free software and library to generate code for scanning Z-polyhedra. That is, it finds a code (e.g. in C, FORTRAN...) that reaches each integral point of one or more parameterized polyhedra. CLooG has been originally written to solve the code generation problem for optimizing compilers based on the polytope model. Nevertheless, it is used now in different areas e.g. to build control automata for high-level synthesis or to find the best polynomial approximation of a function. CLooG may help in any situation where scanning polyhedra matters. While the user has full control of generated code quality, CLooG is designed to avoid control overhead and to produce a very effective code.

Python Module Dependencies

Extra Dependencies

Commands

Examples

The examples/ folder contains a folder per example application.

Each example application contains:

  • README.md: Description of the application and the generated task graphs.
  • run.sh: Script to launch all the versions of the application (internally calls the run.sh script of each version of the application).
  • A folder per version of the application (for instance, userparallel or autoparallel).

Each version of an example application contains:

  • results: Folder containing the execution results
  • run.sh: Script to launch the application locally using 4 cores
  • *.py: Python source files of the application

Some important notes:

  • All the run.sh scripts work without parameters. However, advanced users can call the scripts with extra parameters that are appended directly to the runcompss command.
  • The autoparallel versions contain a special *_autogen.py file containing the automatically generated code by the COMPSs AutoParallel module. This file is only saved for clarity purposes but is re-generated every time the application is launched.
  • The examples/ folder contains a run.sh script to run all the available applications locally using 4 cores. It displays a result table at the end of the execution.

Test

With debug mode enabled:

export PYTHONPATH=${git_base_dir}
cd pycompss
python nose_tests.py -s

With debug mode disabled:

export PYTHONPATH=${git_base_dir}
cd pycompss
python -O nose_tests.py

Coverage

Run coverage:

./coverage_run.sh

Upload coverage:

echo "YOUR_TOKEN" > .CODACY_PROJECT_TOKEN
echo "YOUR_TOKEN" > .CODECOV_PROJECT_TOKEN

./coverage_upload.sh

Style

This project follows the PyCodeStyle guide (formerly called pep8).

This project tolerates the following relaxations:

  • E501 line too long : Code lines can be up to 120 characters

You can verify the code style by running:

pycodestyle . --max-line-length=120 --statistics --count

Clean

find . -name "*.pyc" -delete
find . -name "*.pyo" -delete

Contributing

All kinds of contributions are welcome. Please do not hesitate to open a new issue, submit a pull request or contact the author if necessary.

Author

Cristián Ramón-Cortés Vilarrodona <cristian.ramoncortes(at)bsc.es> (Personal Website)

This work is supervised by:

  • Rosa M. Badia (BSC)
  • Philippe Clauss (INRIA)
  • Jorge Ejarque (BSC)

Disclaimer

This is part of a collaboration between the CAMUS Team at INRIA and the Workflows and Distributed Computing Team at BSC and is still under development.

License

Licensed under the Apache 2.0 License

pycompss-autoparallel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycompss-autoparallel's Issues

Add center-of-mass application

Level

MINOR

Environment

  • Master

Description

Add new center-of-mass application.

Minimal example to reproduce

Exception

Expected behaviour

Description of the expected behaviour.

list indices must be integers or slices, not float

I have a simple for loop to parallelize, but it doesn't work;

@parallel()
def foo():
    a = list(range(10))
    for i in range(10):
        a[i] = 5 
    return a

raise error :

pycompss.util.translators.py2scop.translator_py2scop.Py2ScopException: Exception on Py2Scop.translate method.
Message: ERROR: Cannot generate SCOPs from ForBlocks
Nested Exception: list indices must be integers or slices, not float

Pycodestyle misc issues

Level

MINOR

Environment

  • Master

Description

Fix pycodestyle issues when running the command provided in the README.md file.

Minimal example to reproduce

Exception

Expected behaviour

Python decorator executes twice

The decorator is defined in file decorator.py.
The user code is defined in file example.py.
The generated parallel code is defined in file example_pycompss.py

Since the generated parallel code may use methods declared in the user code, it is necessary to import all the methods declared in the user file. When importing it, the decorator is executed another time.

Pythonpath

We are manually setting the PYTHONPATH to load modules between them.

GEMM MN results

Level

MINOR

Environment

  • Master

Description

Update the GEMM experimentation results at MN.

Minimal example to reproduce

Exception

Expected behaviour

Description of the expected behaviour.

Loop taskification as collections

Level

MAJOR

Environment

  • AutoParallel master

Description

The overhead when creating tasks from loop tiles is big enough to try another approach. Maybe using the new PyCOMPSs COLLECTION types.

Minimal example to reproduce

Exception

Expected behaviour

Py2PyCOMPSs

Replace dummy code on Py2PyCOMPSs Translator by a real implementation.

Update GEMM analysis

Level

MINOR

Environment

  • Trunk

Description

Update the GEMM analysis comparing the sequential version and a manually turned version of the code obtained by the autoparallel.

Minimal example to reproduce

Exception

Expected behaviour

Py2Scop

Replace dummy code on Py2Scop Translator by a real implementation.

Support function calls as statements

Extend the Py2Scop and the Py2PyCOMPSs translators to support function calls as statements.

Example:

# Function callee                                                                                                                                                                                                                                                        
def function_callee(a, b, c):                                                                                                                                                                                                                                                  
    for i in range(0, 10, 1):                                                                                                                                                                                                                                                  
        c[i] = multiply(c[i], a[i], b[i])                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                               
def multiply(c, a, b):                                                                                                                                                                                                                                                         
    return c + a * b

pycodestyle 2.6.0 issues

Level

MINOR

Environment

  • Master

Description

Fix new issues appeared when upgrading to pycodestyle 2.6.0.

Minimal example to reproduce

Exception

Expected behaviour

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.