-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""This module implements the DistributedPredicate class.""" | ||
from __future__ import annotations | ||
|
||
import logging | ||
from typing import TYPE_CHECKING | ||
|
||
from bqskit.passes.control.predicate import PassPredicate | ||
|
||
if TYPE_CHECKING: | ||
from bqskit.compiler.passdata import PassData | ||
from bqskit.ir.circuit import Circuit | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class DistributedPredicate(PassPredicate): | ||
""" | ||
The DistributedPredicate class. | ||
The DistributedPredicate returns true if the targeted machine is distributed | ||
across multiple chips. | ||
""" | ||
|
||
def get_truth_value(self, circuit: Circuit, data: PassData) -> bool: | ||
"""Call this predicate, see :class:`PassPredicate` for more info.""" | ||
return data.model.coupling_graph.is_distributed() |