-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from dcslab-snu/refactor/swapper
swapper, online profiling, core isolator
- Loading branch information
Showing
55 changed files
with
1,956 additions
and
814 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
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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# coding: UTF-8 | ||
|
||
|
||
from .base_isolator import Isolator | ||
from .affinity import AffinityIsolator | ||
from .base import Isolator | ||
from .cache import CacheIsolator | ||
from .core import CoreIsolator | ||
from .idle import IdleIsolator | ||
from .memory import MemoryIsolator | ||
from .schedule import SchedIsolator |
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,57 @@ | ||
# coding: UTF-8 | ||
|
||
import logging | ||
from typing import Optional | ||
|
||
from .base import Isolator | ||
from ...metric_container.basic_metric import MetricDiff | ||
from ...workload import Workload | ||
|
||
|
||
class AffinityIsolator(Isolator): | ||
def __init__(self, foreground_wl: Workload, background_wl: Workload) -> None: | ||
super().__init__(foreground_wl, background_wl) | ||
|
||
self._cur_step: int = self._foreground_wl.orig_bound_cores[-1] | ||
|
||
self._stored_config: Optional[int] = None | ||
|
||
@classmethod | ||
def _get_metric_type_from(cls, metric_diff: MetricDiff) -> float: | ||
return metric_diff.instruction_ps | ||
|
||
def strengthen(self) -> 'AffinityIsolator': | ||
self._cur_step += 1 | ||
return self | ||
|
||
@property | ||
def is_max_level(self) -> bool: | ||
# FIXME: hard coded | ||
return self._cur_step + 1 == self._background_wl.bound_cores[0] | ||
|
||
@property | ||
def is_min_level(self) -> bool: | ||
return self._foreground_wl.orig_bound_cores == self._foreground_wl.bound_cores | ||
|
||
def weaken(self) -> 'AffinityIsolator': | ||
self._cur_step -= 1 | ||
return self | ||
|
||
def enforce(self) -> None: | ||
logger = logging.getLogger(__name__) | ||
logger.info(f'affinity of foreground is {self._foreground_wl.orig_bound_cores[0]}-{self._cur_step}') | ||
|
||
self._foreground_wl.bound_cores = range(self._foreground_wl.orig_bound_cores[0], self._cur_step + 1) | ||
|
||
def reset(self) -> None: | ||
if self._foreground_wl.is_running: | ||
self._foreground_wl.bound_cores = self._foreground_wl.orig_bound_cores | ||
|
||
def store_cur_config(self) -> None: | ||
self._stored_config = self._cur_step | ||
|
||
def load_cur_config(self) -> None: | ||
super().load_cur_config() | ||
|
||
self._cur_step = self._stored_config | ||
self._stored_config = None |
Oops, something went wrong.