{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from matplotlib import gridspec\n",
    "import matplotlib\n",
    "import numpy as np\n",
    "import itertools\n",
    "cycol = next(itertools.cycle('brgcmk'))\n",
    "\n",
    "#set the global plot settings\n",
    "#plt.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})\n",
    "#plt.rc('text', usetex=True)\n",
    "plt.rcParams['figure.figsize'] = (8, 6)\n",
    "plt.rcParams['font.size'] = 18\n",
    "plt.rcParams['axes.labelsize'] = plt.rcParams['font.size']\n",
    "plt.rcParams['axes.titlesize'] = 1.75*plt.rcParams['font.size']\n",
    "plt.rcParams['legend.fontsize'] = plt.rcParams['font.size']\n",
    "plt.rcParams['xtick.labelsize'] = 1.25*plt.rcParams['font.size']\n",
    "plt.rcParams['ytick.labelsize'] = 1.25*plt.rcParams['font.size']\n",
    "#plt.rcParams['savefig.dpi'] = 4*plt.rcParams['savefig.dpi']\n",
    "plt.rcParams['xtick.major.size'] = 5 \n",
    "plt.rcParams['xtick.minor.size'] = 3 \n",
    "plt.rcParams['xtick.major.width'] = 1.0 \n",
    "plt.rcParams['xtick.minor.width'] = 1 \n",
    "plt.rcParams['ytick.major.size'] = 5 \n",
    "plt.rcParams['ytick.minor.size'] = 3 \n",
    "plt.rcParams['ytick.major.width'] = 1.0 \n",
    "plt.rcParams['ytick.minor.width'] = 1 \n",
    "plt.rcParams['legend.frameon'] = False\n",
    "plt.rcParams['legend.loc'] = 'upper right'\n",
    "plt.rcParams['axes.linewidth'] = 2\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/opt/homebrew/lib/python3.11/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#matplotlib.font_manager.get_cachedir()\n",
    "matplotlib.font_manager.findfont('Humor Sans')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.core.display import HTML\n",
    "\n",
    "def make_html(fontname):\n",
    "    return \"<p>{font}: <span style='font-family:{font}; font-size: 24px;'>{font}</p>\".format(font=fontname)\n",
    "\n",
    "code = \"\\n\".join([make_html(font) for font in sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist]))])\n",
    "\n",
    "HTML(\"<div style='column-count: 2;'>{}</div>\".format(code))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n",
      "findfont: Font family 'xkcd' not found.\n",
      "findfont: Font family 'xkcd Script' not found.\n",
      "findfont: Font family 'Humor Sans' not found.\n",
      "findfont: Font family 'Comic Neue' not found.\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 66336 characters]",
      "text/plain": [
       "<Figure size 800x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "nvidia_gflops=np.array([3614, 5580, 8611, 11517], dtype=int).astype(int)\n",
    "amd_gflops=np.array([2968, 5740, 8645, 11494], dtype=int).astype(int)\n",
    "n_gpus=np.array([1, 2, 3, 4], dtype=int).astype(int)\n",
    "#plt.plot(n_gpus, nvidia_gflops, '-o', label='NVIDIA A100')\n",
    "#plt.plot(n_gpus, amd_gflops, '-o', label='AMD MI250X')\n",
    "#new_list = range((min(n_gpus)), (max(n_gpus)+1))\n",
    "#plt.xticks(new_list)\n",
    "#plt.xticks()\n",
    "#plt.legend(loc='best')\n",
    "#plt.xlabel('Number of GPUs')\n",
    "#plt.ylabel('Performance in GFLOPs')\n",
    "#plt.savefig(\"PerformanceNVIDIA-AMD.pdf\")\n",
    "#plt.xkcd()\n",
    "with plt.xkcd():\n",
    "    # Based on \"The Data So Far\" from XKCD by Randall Munroe\n",
    "    # https://xkcd.com/373/\n",
    "\n",
    "    fig = plt.figure()\n",
    "    ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))\n",
    "    ax.spines[['top', 'right']].set_visible(False)\n",
    "    ax.plot(n_gpus, nvidia_gflops, '-o', label='NVIDIA A100')\n",
    "    ax.plot(n_gpus, amd_gflops, '-o', label='AMD MI250X')\n",
    "    ax.legend(loc='best')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "amd_comm=np.array([ 257, 302, 524])\n",
    "nvidia_comm=np.array([ 339, 507, 670])\n",
    "comm_gpus=np.array([2, 3, 4], dtype=int).astype(int)\n",
    "plt.plot(comm_gpus, nvidia_comm, '-o', label='NVIDIA A100')\n",
    "plt.plot(comm_gpus, amd_comm, '-o', label='AMD MI250X')\n",
    "new_list = range((min(comm_gpus)), (max(comm_gpus)+1))\n",
    "plt.xticks(new_list)\n",
    "plt.xticks()\n",
    "plt.xlabel('Number of GPUs')\n",
    "plt.legend(loc='best')\n",
    "plt.ylabel('Bandwidth GB/s')\n",
    "plt.savefig(\"BandwidthNVIDIA-AMD.pdf\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.2"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
