Skip to content

Commit

Permalink
easy set-up for dummy agent's cpu core
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Oct 25, 2024
1 parent 66203e9 commit 5439ccb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ai/backend/agent/dummy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DEFAULT_CONFIG_PATH = Path.cwd() / "agent.dummy.toml"

RandomRange = t.Tuple(t.ToFloat, t.ToFloat)
core_idx = {0, 1, 2, 3, 4}
num_core = 4


dummy_local_config = t.Dict({
Expand All @@ -29,7 +29,7 @@
}),
t.Key("resource"): t.Dict({
t.Key("cpu"): t.Dict({
t.Key("core-indexes", default=core_idx): tx.ToSet,
t.Key("num-core", default=num_core): t.ToInt,
}),
t.Key("memory"): t.Dict({
t.Key("size", default=34359738368): t.Int,
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/agent/dummy/intrinsic.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_metadata(self) -> AcceleratorMetadata:
}

async def list_devices(self) -> Collection[AbstractComputeDevice]:
cores = self.resource_config["cpu"]["core-indexes"]
num_core: int = self.resource_config["cpu"]["num_core"]
return [
CPUDevice(
device_id=DeviceId(str(core_idx)),
Expand All @@ -88,7 +88,7 @@ async def list_devices(self) -> Collection[AbstractComputeDevice]:
memory_size=0,
processing_units=1,
)
for core_idx in sorted(cores)
for core_idx in range(num_core)
]

async def available_slots(self) -> Mapping[SlotName, Decimal]:
Expand Down

0 comments on commit 5439ccb

Please sign in to comment.