Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Task #867

Draft
wants to merge 25 commits into
base: devel
Choose a base branch
from
Draft

[WIP] Task #867

wants to merge 25 commits into from

Conversation

MenoIy
Copy link
Contributor

@MenoIy MenoIy commented Apr 22, 2021

Approach
Create new decorator task that will allow pyccel to recognize that the current function will be used in task parallelism and automatically calculate its dependencies.
task decorator have two optional arguments :

  • type : type of the task if its 'master' that mean that this function is responsible for running other task functions, default 'child'
  • threads_num : number of threads reserved for this task region

A task function can only run in parallel if the parent function is a task of type 'master'.

@task
def A():
    # do something

@task('master')
def main():
    a = A()

Block of task is identifies by the first occurrence of a task (currently : in function call / Assign) until the first non task element or the end of the program.

# Function  A and B are tasks

@task('master')
def main():
    x, y = # do something

    # this will run in parallel
    # ------
    a = A(x) # first task A
    b = B(y) # second task B
    # ------

    c = a + b # first non task block

Dependencies between tasks is calculated by collecting all the information of task function into a namespace list
that help to update dependencies(In, out) shared elements ( for openmp) and precoders function (for other library)
as we go on semantic stage.

@MenoIy MenoIy linked an issue Apr 22, 2021 that may be closed by this pull request
@MenoIy MenoIy changed the title Task [WIP] Task Apr 22, 2021
Comment on lines +3825 to +3828
class TaskFunctionCall(FunctionCall):
pass

class Task(Basic):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be in ast/omp.py ?

|------C
B----

in this scenario A, B will run in parallel, C will wait for then to complets, and D will only wait for A to complete.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo complets->complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task-based parallelism
4 participants