Skip to content

Commit

Permalink
Add nodes option to interface config
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Mar 22, 2024
1 parent 2af677a commit 8cae831
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Config(BaseModel):
cache_size: int = 1
write_size: int = 1
ranks: int = 8
nodes: str = "1"

def config_from_file(self, filename: str) -> Dict:
return from_yaml(filename)
Expand Down Expand Up @@ -73,5 +74,6 @@ def compute_context(self):
del context["config"]["cache_size"]
del context["config"]["write_size"]
del context["config"]["ranks"]
del context["config"]["nodes"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Config(BaseModel):
value_chunk_size: int = 1000
cache_size: int = 50
ranks: int = 8
nodes: str = "1"

def __call__(self):
logging.basicConfig(level=logging.INFO)
Expand Down Expand Up @@ -61,5 +62,6 @@ def compute_context(self):
del context["config"]["value_chunk_size"]
del context["config"]["cache_size"]
del context["config"]["ranks"]
del context["config"]["nodes"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/h5_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Config(BaseModel):
cell_distributions: config.CellDistributions = Field("???")
projections: config.SynapticProjections = Field("???")
mpi: Optional[str] = None
nodes: str = "1"

def config_from_file(self, filename: str) -> Dict:
return from_yaml(filename)
Expand All @@ -36,4 +37,5 @@ def __call__(self) -> None:
def compute_context(self):
context = super().compute_context()
del context["config"]["mpi"]
del context["config"]["nodes"]
return context
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/network_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Config(BaseModel):
chunk_size: int = 1000
value_chunk_size: int = 1000
ranks: int = 8
nodes: str = "1"

def config_from_file(self, filename: str) -> Dict:
return from_yaml(filename)
Expand Down Expand Up @@ -136,5 +137,6 @@ def compute_context(self):
del context["config"]["chunk_size"]
del context["config"]["value_chunk_size"]
del context["config"]["ranks"]
del context["config"]["nodes"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/neuroh5_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class NeuroH5Graph(Component):
class Config:
mpi: Optional[str] = None
nodes: str = "1"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -102,5 +103,6 @@ def files(self) -> Dict[str, str]:
def compute_context(self):
context = super().compute_context()
del context["config"]["mpi"]
del context["config"]["nodes"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/synapse_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Config(BaseModel):
population: config.PopulationName = Field("???")
morphology: config.SWCFilePath = Field("???")
mpi: Optional[str] = None
nodes: str = "1"

@property
def tree_output_filepath(self) -> str:
Expand All @@ -36,6 +37,7 @@ def compute_context(self):
# remove filepath in favor of uses
context = super().compute_context()
del context["config"]["mpi"]
del context["config"]["nodes"]
del context["config"]["filepath"]
context["config"]["morphology"] = file_hash(
context["config"]["morphology"]
Expand Down
2 changes: 2 additions & 0 deletions src/miv_simulator/interface/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Config(BaseModel):
chunk_size: int = 1000
value_chunk_size: int = 1000
ranks: int = 8
nodes: str = "1"

@field_validator("cell_types")
@classmethod
Expand Down Expand Up @@ -75,5 +76,6 @@ def compute_context(self):
del context["config"]["chunk_size"]
del context["config"]["value_chunk_size"]
del context["config"]["ranks"]
del context["config"]["nodes"]
context["predicate"]["uses"] = sorted([u.hash for u in self.uses])
return context

0 comments on commit 8cae831

Please sign in to comment.