Skip to content

Commit

Permalink
Add nice colors to gsheet + minor fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharras committed Oct 16, 2023
1 parent 7404525 commit b0d4c80
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sync_benchmark_files_to_gsheet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: main

jobs:
sync_kmeans_benchmark_result_file_with_gsheet:
sync_benchmark_result_file_with_gsheet:
name: Run synchronization script
runs-on: ubuntu-latest
environment: Publish
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_cpu_benchmarks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- name: Check oneapi default device
run: python -c "import dpctl; dpctl.select_default_device().print_device_info()"

- name: Run k-means benchmarks
- name: Run benchmarks
run: |
cd benchmarks/kmeans
PYTHONPATH=$PYTHONPATH:$(realpath ../../kmeans_dpcpp/) benchopt run --no-plot -l -d Simulated_correlated_data[n_samples=1000,n_features=14]
Expand Down
46 changes: 40 additions & 6 deletions benchmarks/pca/consolidate_result_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ def _gspread_sync(source, gspread_url, gspread_auth_key):
# freeze filter rows and benchmark-defining cols
worksheet.freeze(rows=1, cols=walltime_worksheet_col)

format_queries = []

# Text is centerd and wrapped in all cells
global_format = dict(
horizontalAlignment="CENTER",
Expand All @@ -393,7 +395,7 @@ def _gspread_sync(source, gspread_url, gspread_auth_key):
f"{gspread.utils.rowcol_to_a1(1, 1)}:"
f"{gspread.utils.rowcol_to_a1(n_rows + 1, n_cols)}"
)
worksheet.format(global_range, global_format)
format_queries.append(dict(range=global_range, format=global_format))

# benchmark_id and walltime columns are bold
bold_format = dict(textFormat=dict(bold=True))
Expand All @@ -405,12 +407,44 @@ def _gspread_sync(source, gspread_url, gspread_auth_key):
f"{gspread.utils.rowcol_to_a1(2, walltime_worksheet_col)}:"
f"{gspread.utils.rowcol_to_a1(n_rows + 1, walltime_worksheet_col)}"
)
worksheet.batch_format(
[
dict(range=benchmark_id_col_range, format=bold_format),
dict(range=walltime_col_range, format=bold_format),
]
format_queries.append(dict(range=benchmark_id_col_range, format=bold_format))
format_queries.append(dict(range=walltime_col_range, format=bold_format))

# Header is light-ish yellow
yellow_lighter_header = dict(
backgroundColorStyle=dict(
rgbColor=dict(red=1, green=1, blue=102 / 255, alpha=1)
)
)
header_row_range = (
f"{gspread.utils.rowcol_to_a1(1, 1)}:"
f"{gspread.utils.rowcol_to_a1(1, n_cols)}"
)
format_queries.append(dict(range=header_row_range, format=yellow_lighter_header))

# Every other benchmark_id has greyed background
gainsboro_background = dict(
backgroundColorStyle=dict(
rgbColor=dict(red=220 / 255, green=220 / 255, blue=220 / 255, alpha=1)
)
)
benchmark_ids = df[BENCHMARK_ID_NAME]
benchmark_ids_ending_idx = np.where(
(benchmark_ids.shift() != benchmark_ids).values[1:] + 1
)
for benchmark_id_range_start, benchmark_id_range_end in zip(
*(iter(benchmark_ids_ending_idx),) * 2
):
benchmark_row_range = (
f"{gspread.utils.rowcol_to_a1(benchmark_id_range_start + 1, 1)}:"
f"{gspread.utils.rowcol_to_a1(benchmark_id_range_end, n_cols)}"
)
format_queries.append(
dict(range=benchmark_row_range, format=gainsboro_background)
)

# Apply formats
worksheet.batch_format(format_queries)

# auto-resize rows and cols
worksheet.columns_auto_resize(0, n_cols - 1)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/pca/solvers/sklearn_torch_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def get_result(self):
pass

return dict(
float(explained_variance_ratio_sum=self.explained_variance_ratio_.sum()),
explained_variance_ratio_sum=float(self.explained_variance_ratio_.sum()),
version_info=version_info,
__name=self.name,
**self._parameters,
Expand Down

0 comments on commit b0d4c80

Please sign in to comment.