Skip to content

Commit

Permalink
Added custom name for steps to run same step multiple times and also …
Browse files Browse the repository at this point in the history
…added the index configuration for multiple hyper parameter values

Signed-off-by: AWS ParallelCluster user <[email protected]>
  • Loading branch information
AWS ParallelCluster user committed Nov 15, 2023
1 parent 6d7caaa commit 04b08eb
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 5 deletions.
11 changes: 10 additions & 1 deletion benchmarks/perf-tool/okpt/test/steps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from typing import Any, Dict, List

from okpt.test import profile
from okpt.io.config.parsers.util import parse_string_param


@dataclass
Expand All @@ -23,6 +24,7 @@ class Step:
Attributes:
label: Name of the step.
custom_name: Name of the step you want to give to differentiate the same step label from others
Methods:
execute: Run the step and return a step response with the label and
Expand All @@ -33,6 +35,9 @@ class Step:

def __init__(self, step_config: StepConfig):
self.step_config = step_config
self.custom_name = parse_string_param('custom_name', step_config.config,
step_config.implicit_config,
self.label)

def _action(self):
"""Step logic/behavior to be executed and profiled."""
Expand All @@ -48,13 +53,17 @@ def execute(self) -> List[Dict[str, Any]]:
Returns:
Dict containing step label and various step measures.
"""
print(f"************** Starting the step with name: {self.custom_name} **************")
action = self._action

# profile the action with measure decorators - add if necessary
action = getattr(profile, 'took')(action)

result = action()
if isinstance(result, dict):
return [{'label': self.label, **result}]
res = [{'label': self.label, **result}]
print(f"************** Completed the step with name: {self.custom_name} **************")
return res
print(f"************** Completed the step name: {self.custom_name} **************")

raise ValueError('Invalid return by a step')
3 changes: 2 additions & 1 deletion benchmarks/perf-tool/okpt/test/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def _action(self):
Returns:
An OpenSearch index creation response body.
"""
print("Creating index")
self.opensearch.indices.create(index=self.index_name, body=self.body)
return {}

Expand Down Expand Up @@ -726,7 +727,7 @@ def warmup_operation(endpoint, port, index):
Returns:
number of shards the plugin succeeded and failed to warm up.
"""
response = requests.get('http://' + endpoint + ':' + str(port) +
response = requests.get('https://' + endpoint + ':' + str(port) +
'/_plugins/_knn/warmup/' + index,
headers={'content-type': 'application/json'})
return response.json()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"settings": {
"index": {
"knn": true,
"number_of_shards": 1,
"number_of_replicas": 0,
"knn.algo_param.ef_search": 256
}
},
"mappings": {
"properties": {
"target_field": {
"type": "knn_vector",
"dimension": 960,
"method": {
"name": "hnsw",
"space_type": "l2",
"engine": "nmslib",
"parameters": {
"ef_construction": 512,
"m": 16
}
}
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"settings": {
"index": {
"knn": true,
"number_of_shards": 1,
"number_of_replicas": 0,
"knn.algo_param.ef_search": 256
}
},
"mappings": {
"properties": {
"target_field": {
"type": "knn_vector",
"dimension": 960,
"method": {
"name": "hnsw",
"space_type": "l2",
"engine": "nmslib",
"parameters": {
"ef_construction": 512,
"m": 16
}
}
}
}
}
}

6 changes: 3 additions & 3 deletions benchmarks/perf-tool/release-configs/nmslib-hnsw/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"settings": {
"index": {
"knn": true,
"number_of_shards": 24,
"number_of_replicas": 1,
"number_of_shards": 1,
"number_of_replicas": 0,
"knn.algo_param.ef_search": 100
}
},
"mappings": {
"properties": {
"target_field": {
"type": "knn_vector",
"dimension": 128,
"dimension": 960,
"method": {
"name": "hnsw",
"space_type": "l2",
Expand Down

0 comments on commit 04b08eb

Please sign in to comment.