Skip to content

Commit

Permalink
add bench and lib
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryang00 committed Dec 9, 2024
1 parent c67fe3e commit 9d8e2e0
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 38 deletions.
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@
[submodule "bench/ORB_SLAM2"]
path = bench/ORB_SLAM2
url = https://github.com/Multi-V-VM/ORB_SLAM2
[submodule "bench/crewai"]
path = bench/crewai
url = https://github.com/Multi-V-VM/crewAI-examples/
[submodule "bench/llama-wamr"]
path = bench/llama-wamr
url = https://github.com/Multi-V-VM/llama-wamr
[submodule "lib/s2n-tls"]
path = lib/s2n-tls
url = https://github.com/Multi-V-VM/s2n-tls
2 changes: 1 addition & 1 deletion artifact/compare_local_remote_gpt_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def plot_graph(results, labels):
bar.set_color(colors.get(label, 'gray')) # Default to gray if color not found

# Customize the plot
ax.set_ylabel('Performance Score')
ax.set_ylabel('Tokens/s')
ax.set_xticks(x)
ax.set_xticklabels(labels, rotation=45, fontsize=30)

Expand Down
14 changes: 6 additions & 8 deletions artifact/graph2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ def plot_graph(results, labels):
plt.rc('font', **font)
# Define colors for each platform
colors = {
'MVVM-CPU': 'cyan',
'MVVM-Vanilla': 'cyan',
'MVVM-GPU': 'red',
'SGLang-GPU': 'blue',
'WASI-NN-CPU': 'red',
'WASI-NN-GPU': 'brown',
'OpenAI': 'purple',
}

# Create figure and axis
Expand All @@ -28,15 +26,15 @@ def plot_graph(results, labels):
bar.set_color(colors.get(label, 'gray')) # Default to gray if color not found

# Customize the plot
ax.set_ylabel('Performance Score')
ax.set_ylabel('Latency (s)')
ax.set_xticks(x)
ax.set_xticklabels(labels, rotation=45, fontsize=30)

# Add value labels on top of each bar
for bar in bars:
height = bar.get_height()
ax.text(bar.get_x() + bar.get_width()/2., height,
f'{height:.2f}',
f'{height:.4f}',
ha='center', va='bottom')

# Add grid for better readability
Expand All @@ -48,8 +46,8 @@ def plot_graph(results, labels):
return plt

# Example usage:
results = [2.78, 13.71, 0.75, 0.84, 79.13263037306803] # Example values
platforms = ['MVVM-CPU', 'SGLang-GPU', 'WASI-NN-CPU', 'WASI-NN-GPU', 'OpenAI']
results = [0.31, 0.000164, 0.01103125] # Example values
platforms = ['MVVM-Vanilla', 'MVVM-GPU', 'SGLang-GPU']

# Create and save the plot
plot = plot_graph(results, platforms)
Expand Down
55 changes: 55 additions & 0 deletions artifact/graph3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import matplotlib.pyplot as plt
import numpy as np


def plot_graph(results, labels):
font = {'size': 40}
plt.rc('font', **font)
# Define colors for each platform
colors = {
'FIFO': 'cyan',
'Latency Sensitive': 'red',
'MVVM': 'blue',
}

# Create figure and axis
fig, ax = plt.subplots(figsize=(10, 10))

# Create bar positions
x = np.arange(len(results))

# Create bars with specified colors
bars = ax.bar(x, results, width=0.3)

# Color each bar according to the platform
for bar, label in zip(bars, labels):
bar.set_color(colors.get(label, 'gray')) # Default to gray if color not found

# Customize the plot
ax.set_ylabel('Latency (s)')
ax.set_xticks(x)
ax.set_xticklabels(labels, rotation=45, fontsize=30)

# Add value labels on top of each bar
for bar in bars:
height = bar.get_height()
ax.text(bar.get_x() + bar.get_width()/2., height,
f'{height:.4f}',
ha='center', va='bottom')

# Add grid for better readability
ax.grid(True, axis='y', linestyle='--', alpha=0.7)

# Adjust layout to prevent label cutoff
plt.tight_layout()

return plt

# Example usage:
results = [898.078, 745.393, 482.713] # Example values
platforms = ['FIFO', 'Latency Sensitive', 'MVVM']

# Create and save the plot
plot = plot_graph(results, platforms)
plot.savefig('fifo_latency_vs_mvvm.pdf')
plot.close()
67 changes: 67 additions & 0 deletions artifact/graph4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import matplotlib.pyplot as plt
import numpy as np


def plot_graph(results1, results2, labels):
font = {'size': 40}
plt.rc('font', **font)
# Define colors for each platform
colors = {
'langgraph': 'cyan',
'azure_model': 'cyan',
'email_auto_responder_flow': 'cyan',
'game-builder-crew': 'cyan',
'instagram_post': 'cyan',
'job-posting': 'cyan',
}

# Create figure and axis
fig, ax = plt.subplots(figsize=(10, 10))

# Create bar positions
x = np.arange(len(results1))

# Create bars with specified colors
bars1 = ax.bar(x, results1, width=0.1)
bars2 = ax.bar(x+0.1, results2, width=0.1)

# Color each bar according to the platform
for bar, label in zip(bars1, labels):
bar.set_color( 'cyan') # Default to gray if color not found
for bar, label in zip(bars2, labels):
bar.set_color( 'purple') # Default to gray if color not found
# Customize the plot
ax.set_ylabel('Latency (s)')
ax.set_xticks(x)
ax.set_xticklabels(labels, rotation=45, fontsize=20)

# Add value labels on top of each bar
for bar in bars1:
height = bar.get_height()
ax.text(bar.get_x() + bar.get_width()/2., height,
f'{height:.2f}',
ha='center', va='bottom')

for bar in bars2:
height = bar.get_height()
ax.text(bar.get_x() + bar.get_width()/2., height,
f'{height:.2f}',
ha='center', va='bottom')

# Add grid for better readability
ax.grid(True, axis='y', linestyle='--', alpha=0.7)

# Adjust layout to prevent label cutoff
plt.tight_layout()

return plt

# Example usage:
results1 = [1.0, 1.0, 1.0] # Example values
results2 = [8.823, 1.0, 1.0] # Example values
platforms = ["job-post","long_file_translate","write_seo_blog_humanize"]

# Create and save the plot
plot = plot_graph(results1, results2, platforms)
plot.savefig('crewai_vs_openai.pdf')
plot.close()
Loading

0 comments on commit 9d8e2e0

Please sign in to comment.