Skip to content

Commit

Permalink
improve model initalization variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jensdebruijn committed Oct 10, 2024
1 parent f73fb26 commit a8b63db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
27 changes: 27 additions & 0 deletions geb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
"""GEB simulates the environment, the individual behaviour of people, households and organizations - including their interactions - at small and large scale."""

__version__ = "1.0.0b2"

import os
import platform
import sys
from pathlib import Path
from numba import config
import importlib
import faulthandler


if platform.system() != "Windows":
# Modify LD_LIBRARY_PATH on Unix-like systems (Linux, macOS)
import tbb # noqa: F401

tbb_path = Path(sys.prefix) / "lib" / "libtbb.so"
assert tbb_path.exists(), f"tbb shared library not found at {tbb_path}"
os.environ["LD_LIBRARY_PATH"] = str(tbb_path)

# set threading layer to tbb, this is much faster than other threading layers
config.THREADING_LAYER = "tbb"

# set environment variable for GEB package directory
os.environ["GEB_PACKAGE_DIR"] = str(
Path(importlib.util.find_spec("geb").origin).parent.parent
)

faulthandler.enable()
21 changes: 0 additions & 21 deletions geb/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
import yaml
import logging
import functools
import faulthandler
from pathlib import Path
import importlib
import warnings
import tbb
from numba import config

from honeybees.visualization.ModularVisualization import ModularServer
from honeybees.visualization.modules.ChartVisualization import ChartModule
Expand All @@ -27,23 +23,6 @@
from geb.sensitivity import sensitivity_analysis as geb_sensitivity_analysis
from geb.multirun import multi_run as geb_multi_run

faulthandler.enable()

# set threading layer to tbb, this is much faster than other threading layers
config.THREADING_LAYER = "tbb"

# unset system environment variable for LD_LIBRARY_PATH, so that numba loads the
# correct shared libraries

os.environ["LD_LIBRARY_PATH"] = str(
Path(tbb.__path__[0]).parent.parent.parent / "libtbb.so"
)

# set environment variable for GEB package directory
os.environ["GEB_PACKAGE_DIR"] = str(
Path(importlib.util.find_spec("geb").origin).parent.parent
)


def multi_level_merge(dict1, dict2):
for key, value in dict2.items():
Expand Down

0 comments on commit a8b63db

Please sign in to comment.