{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Parallel performance of a simple Python code\n", "Here is a summary of the results from running the `mpi.py´ program." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import math\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "plt.rcParams['figure.figsize'] = [12,6]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Dave\n", "nprocDW = [64, 64, 320]\n", "tsecDW = [2.2847, 1.5821, 1.0517]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Leevi\n", "nprocLT = [2, 8, 16, 64, 256]\n", "tsecLT = [19.96, 6.23, 3.52, 2.26, 1.15]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Letizia\n", "nprocLC = [2, 8, 16, 32, 64, 256]\n", "tsecLC = [22.8416, 6.2493, 3.3238, 4.0696, 2.3058, 1.1402]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Tommi\n", "nprocTV = [ 1, 2, 4, 16, 32, 64, 256 ]\n", "tsecTV = [ 43.4103989601, 23.3102600574, 11.0595788956, 3.5252571106, 4.08421611786, 2.28794884682, 1.16591596603 ]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Tuija\n", "nprocTL = [2, 8, 16, 32, 128] \n", "tsecTL = [19.8880, 6.5444, 3.4134, 4.2096, 1.3018]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Yijun\n", "nprocYW = [16,32,64,128,256]\n", "tsecYW = [3.3989,4.2119,1.5718,1.3543,1.1443]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "raises-exception" ] }, "outputs": [], "source": [ "# Convert to NumPy arrays\n", "nprocDW = np.array(nprocDW)\n", "tsecDW = np.array(tsecDW)\n", "nprocLT = np.array(nprocLT)\n", "tsecLT = np.array(tsecLT)\n", "nprocLC = np.array(nprocLC)\n", "tsecLC = np.array(tsecLC)\n", "nprocTV = np.array(nprocTV)\n", "tsecTV = np.array(tsecTV)\n", "nprocTL = np.array(nprocTL)\n", "tsecTL = np.array(tsecTL)\n", "nprocYW = np.array(nprocYW)\n", "tsecYW = np.array(tsecYW)\n", "\n", "# Plot data\n", "f, (ax1, ax2) = plt.subplots(1, 2)\n", "ax1.plot(nprocDW, tsecDW, 'o', label='User 1')\n", "ax1.plot(nprocLT, tsecLT, 'o', label='User 2')\n", "ax1.plot(nprocLC, tsecLC, 'o', label='User 3')\n", "ax1.plot(nprocTV, tsecTV, 'o', label='User 4')\n", "ax1.plot(nprocTL, tsecTL, 'o', label='User 5')\n", "ax1.plot(nprocYW, tsecYW, 'o', label='User 6')\n", "ax1.set_xlabel('Number of cores')\n", "ax1.set_ylabel('Calculation time [s]')\n", "ax1.set_title('Raw parallel performance')\n", "ax1.legend()\n", "\n", "# Find bounds for reference parallel performance line\n", "minx = min(nprocDW.min(), nprocLT.min(), nprocLC.min(), nprocTV.min(), nprocTL.min(), nprocYW.min())\n", "miny = min(tsecDW.min(), tsecLT.min(), tsecLC.min(), tsecTV.min(), tsecTL.min(), tsecYW.min())\n", "maxy = max(tsecDW.max(), tsecLT.max(), tsecLC.max(), tsecTV.max(), tsecTL.max(), tsecYW.max())\n", "maxx = minx + (maxy - miny)\n", "ax2.plot([np.log2(minx), np.log2(maxx)], [np.log2(maxy), np.log2(miny)], 'k--', label='Perfect parallelization')\n", "\n", "ax2.plot(np.log2(nprocDW), np.log2(tsecDW), 'o', label='User 1')\n", "ax2.plot(np.log2(nprocLT), np.log2(tsecLT), 'o', label='User 2')\n", "ax2.plot(np.log2(nprocLC), np.log2(tsecLC), 'o', label='User 3')\n", "ax2.plot(np.log2(nprocTV), np.log2(tsecTV), 'o', label='User 4')\n", "ax2.plot(np.log2(nprocTL), np.log2(tsecTL), 'o', label='User 5')\n", "ax2.plot(np.log2(nprocYW), np.log2(tsecYW), 'o', label='User 6')\n", "\n", "ax2.axis('equal')\n", "ax2.set_xlabel('log$_{2}$(Number of cores)')\n", "ax2.set_ylabel('log$_{2}$(Calculation time) [s]')\n", "ax2.set_title('Log$_{2}$ parallel performance')\n", "ax2.legend()" ] } ], "metadata": { "celltoolbar": "Tags", "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.8.2" } }, "nbformat": 4, "nbformat_minor": 2 }