Skip to content

Commit

Permalink
feat: added number of available cores as an attribute and applied the…
Browse files Browse the repository at this point in the history
… attribute where relevant.
  • Loading branch information
gtdang committed Aug 23, 2024
1 parent fff9bd1 commit 0c6f4df
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions hnn_core/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import io
import logging
import mimetypes
import multiprocessing
import numpy as np
import platform
import psutil
import sys
import json
import urllib.parse
Expand Down Expand Up @@ -320,6 +321,9 @@ def __init__(self, theme_color="#802989",
# load default parameters
self.params = self.load_parameters(network_configuration)

# Number of available cores
self.n_cores = self._available_cores()

# In-memory storage of all simulation and visualization related data
self.simulation_data = defaultdict(lambda: dict(net=None, dpls=list()))

Expand All @@ -344,7 +348,7 @@ def __init__(self, theme_color="#802989",
placeholder='Fill if applies',
description='MPI cmd:', disabled=False)
self.widget_n_jobs = BoundedIntText(value=1, min=1,
max=multiprocessing.cpu_count(),
max=self.n_cores,
description='Cores:',
disabled=False)
self.load_data_button = FileUpload(
Expand Down Expand Up @@ -585,8 +589,9 @@ def _run_button_clicked(b):
self.widget_simulation_name, self._log_out, self.drive_widgets,
self.data, self.widget_dt, self.widget_tstop,
self.widget_ntrials, self.widget_backend_selection,
self.widget_mpi_cmd, self.widget_n_jobs, self.params,
self._simulation_status_bar, self._simulation_status_contents,
self.widget_mpi_cmd, self.n_cores, self.widget_n_jobs,
self.params, self._simulation_status_bar,
self._simulation_status_contents,
self.connectivity_widgets, self.viz_manager,
self.simulation_list_widget, self.cell_pameters_widgets)

Expand Down

0 comments on commit 0c6f4df

Please sign in to comment.