-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(PET): parallel computation of function metadata
- Loading branch information
1 parent
e63898a
commit 8f04e70
Showing
2 changed files
with
62 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de) | ||
# | ||
# Copyright (c) 2020, Technische Universitaet Darmstadt, Germany | ||
# | ||
# This software may be modified and distributed under the terms of | ||
# the 3-Clause BSD License. See the LICENSE file in the package base | ||
# directory for details. | ||
|
||
from .PETGraphX import Node, NodeID | ||
from typing import List, Set | ||
|
||
global_pet = None | ||
|
||
|
||
def pet_function_metadata_initialize_worker(pet): | ||
global global_pet | ||
global_pet = pet | ||
|
||
|
||
def pet_function_metadata_parse_func(param_tuple): | ||
func_node = param_tuple | ||
stack: List[Node] = global_pet.direct_children(func_node) | ||
func_node.children_cu_ids = [node.id for node in stack] | ||
local_children: Set[NodeID] = set() | ||
|
||
while stack: | ||
child = stack.pop() | ||
local_children.add(child.id) | ||
children = global_pet.direct_children(child) | ||
func_node.children_cu_ids.extend([node.id for node in children]) | ||
stack.extend(children) | ||
|
||
local_reachability_dict = func_node.calculate_reachability_pairs(global_pet) | ||
local_result = func_node.id, local_reachability_dict, local_children | ||
return local_result |