Skip to content

Commit 3fa5501

Browse files
No more global config
1 parent 2675fb9 commit 3fa5501

3 files changed

Lines changed: 6 additions & 25 deletions

File tree

accelforge/frontend/config.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,6 @@
88
import os
99
import sys
1010

11-
USER_CUSTOM_CONFIG_PATH_VAR = "ACCELFORGE_CONFIG_PATH"
12-
13-
14-
def get_config() -> "Config":
15-
if USER_CUSTOM_CONFIG_PATH_VAR in os.environ:
16-
f = os.environ[USER_CUSTOM_CONFIG_PATH_VAR]
17-
elif hasattr(sys, "real_prefix") or (
18-
hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix
19-
):
20-
f = os.path.join(sys.prefix, "accelforge", "config.yaml")
21-
else:
22-
f = os.path.join(user_config_dir("accelforge"), "config.yaml")
23-
24-
if not os.path.exists(f):
25-
logging.warning(f"No configuration file found. Creating config file at {f}.")
26-
os.makedirs(os.path.dirname(f), exist_ok=True)
27-
config = Config()
28-
config.to_yaml(f)
29-
30-
logging.warning(f"Loading configuration file from {f}")
31-
return Config.from_yaml(f)
32-
3311

3412
class Config(EvalableModel):
3513
expression_custom_functions: EvalableList[str | Callable] = EvalableList()

accelforge/frontend/spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from accelforge.frontend.workload import Workload
99
from accelforge.frontend.variables import Variables
10-
from accelforge.frontend.config import Config, get_config
10+
from accelforge.frontend.config import Config
1111
from accelforge.frontend.mapping import Mapping
1212
from accelforge.frontend.model import Model
1313
import hwcomponents
@@ -37,7 +37,7 @@ class Spec(EvalableModel):
3737
variables: Variables = Variables()
3838
""" Variables that can be referenced in other places in the spec. """
3939

40-
config: Config = Field(default_factory=get_config)
40+
config: Config = Config()
4141
""" Configuration settings. """
4242

4343
renames: Renames = Renames()

accelforge/mapper/FFM/_make_pmappings/make_pmappings_from_templates/run_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ def run_model(
155155

156156
per_memory_usage_df = {}
157157
for memory, occupancies in total_occupancy.items():
158-
if job.ignored_resources is not None and memory not in job.ignored_resources:
158+
ignored = (
159+
job.ignored_resources is not None and memory not in job.ignored_resources
160+
)
161+
if not ignored or metrics & Metrics.ACTIONS:
159162
key = f"usage<SEP>memory<SEP>{memory}"
160163
per_memory_usage_df[key] = (
161164
sum(occupancies.values()) / memory_to_size[memory]

0 commit comments

Comments
 (0)