calculator / app.py
noumanjavaid's picture
Create app.py
9f21f70 verified
raw
history blame
2.1 kB
import streamlit as st
import pandas as pd
def calculate_cost(num_pairs, gpu_type):
if gpu_type == "Nvidia A100":
daily_rate = 28
time_per_pair = 1 # minute
elif gpu_type == "H100 80GB PCIe":
daily_rate = 78.96
time_per_pair = 0.5 # assuming it's twice as fast
else: # AWS p4d.24xlarge
daily_rate = 786.48
time_per_pair = 0.25 # assuming it's four times as fast due to 8 GPUs
total_time_minutes = num_pairs * time_per_pair
total_time_hours = total_time_minutes / 60
hourly_rate = daily_rate / 24
total_cost = total_time_hours * hourly_rate
return total_cost
st.set_page_config(page_title="GPU Cost Calculator", page_icon="🧮", layout="wide")
st.title("GPU Cost Calculator")
# Input for number of pairs
num_pairs = st.number_input("Enter the number of pairs to process:", min_value=1, value=5)
# Select GPU type
gpu_type = st.selectbox(
"Select GPU type:",
("Nvidia A100", "H100 80GB PCIe", "AWS p4d.24xlarge (8x A100)")
)
# Calculate button
if st.button("Calculate Cost"):
cost = calculate_cost(num_pairs, gpu_type)
st.write(f"Estimated cost for processing {num_pairs} pairs on {gpu_type}: ${cost:.4f}")
# Display GPU information
st.subheader("GPU Information")
gpu_data = {
"Provider": ["H100 80GB PCIe", "AWS (p4d.24xlarge)", "GPU Mart"],
"GPU": ["Nvidia H100", "Nvidia A100 (8 GPUs)", "Nvidia A100"],
"vCPUs": [16, 96, "Dual 18-Core E5-2697v4"],
"RAM": ["125 GB", "1152 GiB", "256 GB"],
"GPU Memory": ["80 GB", "320 GB (8 x 40 GB)", "40 GB HBM2e"],
"Instance Storage": ["Network Storage: 10Pb+", "8 x 1000 GB NVMe SSD", "240 GB SSD + 2TB NVMe + 8TB SATA"],
"Network Bandwidth": ["Not Specified", "400 Gbps", "100Mbps - 1Gbps"],
"On-Demand Price/hr": ["$3.29", "$32.77", "N/A"],
"Daily Price": ["$78.96", "$786.48", "$28.00"],
"Monthly Price": ["$2,368.80", "$23,594.40", "$799.00"],
"1-Year Reserved (Hourly)": ["N/A", "$19.22", "N/A"],
"3-Year Reserved (Hourly)": ["N/A", "$11.57", "N/A"]
}
df = pd.DataFrame(gpu_data)
st.table(df)