From b7fabeb1f1646901d83b35850b94d5ed10f310a7 Mon Sep 17 00:00:00 2001 From: WuK Date: Sat, 27 Jan 2024 14:35:30 +0800 Subject: [PATCH] =?UTF-8?q?Update=202023-11-22-=E5=B8=B8=E7=94=A8=E4=BD=9C?= =?UTF-8?q?=E5=9B=BE=E8=84=9A=E6=9C=AC.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...34\345\233\276\350\204\232\346\234\254.md" | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git "a/_posts/2023-11-22-\345\270\270\347\224\250\344\275\234\345\233\276\350\204\232\346\234\254.md" "b/_posts/2023-11-22-\345\270\270\347\224\250\344\275\234\345\233\276\350\204\232\346\234\254.md" index 30bc4d505..20be72cdc 100644 --- "a/_posts/2023-11-22-\345\270\270\347\224\250\344\275\234\345\233\276\350\204\232\346\234\254.md" +++ "b/_posts/2023-11-22-\345\270\270\347\224\250\344\275\234\345\233\276\350\204\232\346\234\254.md" @@ -139,33 +139,34 @@ title: "常用作图脚本" ```python3 import sys -import pandas as pd import altair as alt import vl_convert as vlc from cairosvg import svg2pdf def main(*argv): - df = alt.Chart(pd.DataFrame({ - 'GPU': ['K40', 'P100', 'V100', 'A100', 'H100'], - 'L1': [64, 64, 128, 192, 256], - 'L2': [1536, 4096, 6144, 40960, 51200] - })).encode( - x=alt.X('L1').title('L1D+SMEM/KB per SM').scale(domain=(50, 250)), - y=alt.Y('L2').title('L2/KB').scale(domain=(0, 50000)), - text='GPU' + data = [{"GPU": "K40", "L1": 64, "L2": 1536}, + {"GPU": "P100", "L1": 64, "L2": 4096}, + {"GPU": "V100", "L1": 128, "L2": 6144}, + {"GPU": "A100", "L1": 192, "L2": 40960}, + {"GPU": "H100", "L1": 256, "L2": 51200}] + + data = alt.Chart(alt.InlineData(data)).encode( + x=alt.X('L1:Q').title('L1D+SMEM/KB per SM').scale(domain=(50, 250)), + y=alt.Y('L2:Q').title('L2/KB').scale(domain=(0, 50000)), + text='GPU:N' ) - df = df.mark_line( + data = data.mark_line( color="grey" - ) + df.mark_text( + ) + data.mark_text( align='left', baseline='middle', dx=5, dy=5 ) - df = df.configure_axisY( + data = data.configure_axisY( tickMinStep=10000 ).configure_axisX( tickMinStep=50 @@ -175,11 +176,11 @@ def main(*argv): ) svg2pdf(write_to="gpu-evole.pdf", - bytestring=vlc.vegalite_to_svg(vl_spec=df.to_json())) + bytestring=vlc.vegalite_to_svg(vl_spec=data.to_json())) return 0 if __name__ == '__main__': sys.exit(main(*sys.argv)) -``` \ No newline at end of file +```