Skip to content

Commit

Permalink
Merge pull request #126 from GEB-model/initialization
Browse files Browse the repository at this point in the history
Initialization
  • Loading branch information
jensdebruijn authored Oct 10, 2024
2 parents f73fb26 + 33a359d commit 8396765
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
- name: Install the project
run: uv sync --extra dev
- name: Run tests
run: uv run pytest
run: uv run pytest -s
29 changes: 28 additions & 1 deletion 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"
__version__ = "1.0.0b3"

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()
22 changes: 1 addition & 21 deletions geb/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
import yaml
import logging
import functools
import faulthandler
from pathlib import Path
import importlib
import warnings
import tbb
from numba import config
import importlib

from honeybees.visualization.ModularVisualization import ModularServer
from honeybees.visualization.modules.ChartVisualization import ChartModule
Expand All @@ -27,23 +24,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 8396765

Please sign in to comment.