Skip to content

Commit

Permalink
Working OS info save function (#163)
Browse files Browse the repository at this point in the history
* Working version

* Put all header info on one line
  • Loading branch information
jordandsullivan authored Jan 9, 2025
1 parent 1c0a272 commit a897a19
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions benchmarks/scripts/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from time import time
import platform
import os
import pandas as pd
from datetime import datetime
from cirq import CZTargetGateset, optimize_for_target_gateset
Expand Down Expand Up @@ -143,6 +145,17 @@ def get_header(df):
f"{key}={value}" for key, value in compiler_versions.items()
)

# Get Operating System Info
os_info = platform.system() # OS name (e.g., 'Darwin' for macOS, 'Linux', 'Windows')
os_version = platform.version() # OS version
architecture = platform.architecture() # System architecture (e.g., '64bit')

# Get Parallelism Info (number of CPU cores)
cpu_count = os.cpu_count() # Number of available CPU cores

# Combine the information into a header
header_info = f"OS: {os_info} {os_version}, Architecture: {architecture[0]}, CPU Cores: {cpu_count}"
version_header += f" # {header_info}"
return version_header

def save_results(results_log, benchmark_name="gates", folder="../results", append=False):
Expand Down

0 comments on commit a897a19

Please sign in to comment.