-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
shg8
committed
Apr 11, 2024
1 parent
fe59044
commit 8441702
Showing
14 changed files
with
25,086 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
|
||
# Ask for the path to the CSV file | ||
path = input('Enter the path to the CSV file: ') | ||
df = pd.read_csv(path) | ||
|
||
# Convert nanoseconds to milliseconds | ||
for col in ['preprocess', 'prefix_sum', 'preprocess_sort', 'sort', 'tile_boundary', 'render']: | ||
df[col] = df[col] / 1e6 # Convert from ns to ms | ||
|
||
# Sort DataFrame by num_instances | ||
df = df.sort_values(by='num_instances') | ||
|
||
# Order the kernels according to the execution sequence | ||
kernel_sequence = ['preprocess', 'prefix_sum', 'preprocess_sort', 'sort', 'tile_boundary', 'render'] | ||
|
||
# Calculate cumulative sums for the specified order | ||
df_cumulative = df.copy() | ||
for i, kernel in enumerate(kernel_sequence): | ||
if i == 0: | ||
df_cumulative[kernel + '_cumulative'] = df_cumulative[kernel] | ||
else: | ||
df_cumulative[kernel + '_cumulative'] = df_cumulative[kernel_sequence[i-1] + '_cumulative'] + df_cumulative[kernel] | ||
|
||
# Plotting | ||
plt.figure(figsize=(10, 6)) | ||
|
||
# Collect line plots to access their colors for the fill | ||
line_plots = [] | ||
|
||
# Plot lines for all kernels to store their colors | ||
for kernel in kernel_sequence: | ||
cumulative_column = kernel + '_cumulative' | ||
line_plot, = plt.plot(df_cumulative['num_instances'], df_cumulative[cumulative_column], label=kernel) | ||
line_plots.append(line_plot) | ||
|
||
plt.fill_between(df_cumulative['num_instances'], 0, df_cumulative[kernel_sequence[0] + '_cumulative'], color=line_plots[0].get_color(), alpha=0.3) | ||
|
||
# Fill the area with the color of the line above | ||
for i in range(len(line_plots)-1): | ||
plt.fill_between(df_cumulative['num_instances'], df_cumulative[kernel_sequence[i] + '_cumulative'], df_cumulative[kernel_sequence[i+1] + '_cumulative'], color=line_plots[i+1].get_color(), alpha=0.3) | ||
|
||
plt.xlabel('Number of Instances') | ||
plt.ylabel('Milliseconds') | ||
plt.title('Cumulative Duration of Compute Kernels') | ||
plt.legend() | ||
plt.grid(True) | ||
plt.show() | ||
|
||
# Save the plot | ||
plt.savefig('cumulative_duration.png') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
import subprocess | ||
|
||
# Ask for the folder and executable if not in environment variables | ||
folder_path = os.getenv("MODEL_FOLDER_PATH") | ||
executable_path = os.getenv("3DGS_VIEWER_PATH") | ||
|
||
resolutions = input("Please enter the resolutions (separated by comma): ") | ||
resolutions = resolutions.split(',') | ||
|
||
if not folder_path: | ||
folder_path = input("Please enter the folder containing model folders: ") | ||
if not executable_path: | ||
executable_path = input("Please enter the 3dgs_viewer path: ") | ||
|
||
# List the files in the folder | ||
files_in_folder = os.listdir(folder_path) | ||
|
||
# Run the command for each file | ||
for file in files_in_folder: | ||
# skip non-folders | ||
if not os.path.isdir(os.path.join(folder_path, file)): | ||
continue | ||
|
||
for resolution in resolutions: | ||
width, height = resolution.split('x') | ||
|
||
file_path = os.path.join(folder_path, file) | ||
basename = os.path.basename(file_path) + "_" + resolution | ||
print(f"Running benchmark for {basename}") | ||
command = [executable_path, "--no-gui", "--width", width, "--height", height, "-i", "-v", "--validation", "-b", | ||
"../benchmark_output/" + basename + ".csv", "--", file_path] | ||
subprocess.run(command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.