Skip to content

Commit

Permalink
Rename size_history to history_size.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerilk committed Oct 7, 2024
1 parent 469acf6 commit 08fbbc3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bindings/python/cconfigspace/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ def serialize_wrapper(tun, state_size, p_state, p_state_size):
serialize_wrapper = 0

if deserialize is not None:
def deserialize_wrapper(o_space, size_history, p_history, num_optima, p_optima, state_size, p_state, p_tuner_data):
def deserialize_wrapper(o_space, history_size, p_history, num_optima, p_optima, state_size, p_state, p_tuner_data):
try:
if p_history:
history = [Evaluation.from_handle(p_history[i]) for i in range(size_history)]
history = [Evaluation.from_handle(p_history[i]) for i in range(history_size)]
else:
history = []
if p_optima:
Expand Down
2 changes: 1 addition & 1 deletion include/cconfigspace/tuner.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ struct ccs_user_defined_tuner_vector_s {
*/
ccs_result_t (*deserialize_state)(
ccs_objective_space_t objective_space,
size_t size_history,
size_t history_size,
ccs_evaluation_t *history,
size_t num_optima,
ccs_evaluation_t *optima,
Expand Down
22 changes: 11 additions & 11 deletions src/tuner_deserialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

struct _ccs_random_tuner_data_mock_s {
_ccs_tuner_common_data_t common_data;
size_t size_history;
size_t history_size;
size_t size_optima;
ccs_evaluation_t *history;
ccs_evaluation_t *optima;
Expand Down Expand Up @@ -43,22 +43,22 @@ _ccs_deserialize_bin_ccs_random_tuner_data(
CCS_VALIDATE(_ccs_deserialize_bin_ccs_tuner_common_data(
&data->common_data, version, buffer_size, buffer, opts));
CCS_VALIDATE(_ccs_deserialize_bin_size(
&data->size_history, buffer_size, buffer));
&data->history_size, buffer_size, buffer));
CCS_VALIDATE(_ccs_deserialize_bin_size(
&data->size_optima, buffer_size, buffer));

if (!(data->size_history + data->size_optima))
if (!(data->history_size + data->size_optima))
return CCS_RESULT_SUCCESS;
mem = (uintptr_t)calloc(
(data->size_history + data->size_optima),
(data->history_size + data->size_optima),
sizeof(ccs_evaluation_t));
CCS_REFUTE(!mem, CCS_RESULT_ERROR_OUT_OF_MEMORY);

data->history = (ccs_evaluation_t *)mem;
mem += data->size_history * sizeof(ccs_evaluation_t);
mem += data->history_size * sizeof(ccs_evaluation_t);
data->optima = (ccs_evaluation_t *)mem;

for (size_t i = 0; i < data->size_history; i++)
for (size_t i = 0; i < data->history_size; i++)
CCS_VALIDATE(_ccs_object_deserialize_with_opts_check(
(ccs_object_t *)data->history + i,
CCS_OBJECT_TYPE_EVALUATION, CCS_SERIALIZE_FORMAT_BINARY,
Expand Down Expand Up @@ -119,7 +119,7 @@ _ccs_deserialize_bin_random_tuner(
tuner_ret),
evaluations);
odata = (_ccs_random_tuner_data_clone_t *)((*tuner_ret)->data);
for (size_t i = 0; i < data.size_history; i++)
for (size_t i = 0; i < data.history_size; i++)
utarray_push_back(odata->history, data.history + i);
for (size_t i = 0; i < data.size_optima; i++)
utarray_push_back(odata->optima, data.optima + i);
Expand All @@ -129,7 +129,7 @@ _ccs_deserialize_bin_random_tuner(
*tuner_ret = NULL;
evaluations:
if (data.history)
for (size_t i = 0; i < data.size_history; i++)
for (size_t i = 0; i < data.history_size; i++)
if (data.history[i])
ccs_release_object(data.history[i]);
end:
Expand Down Expand Up @@ -202,7 +202,7 @@ _ccs_deserialize_bin_user_defined_tuner(
res,
vector->deserialize_state(
data.base_data.common_data.objective_space,
data.base_data.size_history,
data.base_data.history_size,
data.base_data.history,
data.base_data.size_optima,
data.base_data.optima, data.blob.sz,
Expand All @@ -220,7 +220,7 @@ _ccs_deserialize_bin_user_defined_tuner(
CCS_VALIDATE_ERR_GOTO(
res,
vector->tell(
*tuner_ret, data.base_data.size_history,
*tuner_ret, data.base_data.history_size,
data.base_data.history),
tuner);
goto end;
Expand All @@ -231,7 +231,7 @@ _ccs_deserialize_bin_user_defined_tuner(
if (data.base_data.common_data.objective_space)
ccs_release_object(data.base_data.common_data.objective_space);
if (data.base_data.history) {
for (size_t i = 0; i < data.base_data.size_history; i++)
for (size_t i = 0; i < data.base_data.history_size; i++)
if (data.base_data.history[i])
ccs_release_object(data.base_data.history[i]);
free(data.base_data.history);
Expand Down

0 comments on commit 08fbbc3

Please sign in to comment.