syncysync

This commit is contained in:
Ziad Arafat committed 2023-12-05 23:47:11 -07:00
1 parent f7a850dda4
commit 6f3a1def83
1 file changed
+608 -32
+608 -32
View File
@@ -9,20 +9,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pandas in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (2.1.3)\n",
"Requirement already satisfied: matplotlib in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (3.8.2)\n",
"Requirement already satisfied: numpy<2,>=1.23.2 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from pandas) (1.26.2)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from pandas) (2.8.2)\n",
"Requirement already satisfied: pytz>=2020.1 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from pandas) (2023.3.post1)\n",
"Requirement already satisfied: tzdata>=2022.1 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from pandas) (2023.3)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (1.2.0)\n",
"Requirement already satisfied: cycler>=0.10 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (0.12.1)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (4.46.0)\n",
"Requirement already satisfied: kiwisolver>=1.3.1 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (1.4.5)\n",
"Requirement already satisfied: packaging>=20.0 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (23.2)\n",
"Requirement already satisfied: pillow>=8 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (10.1.0)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from matplotlib) (3.1.1)\n",
"Requirement already satisfied: six>=1.5 in /home/ugrad10/zarafat/src/parallel-programming/.venv/lib64/python3.11/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n"
"Requirement already satisfied: pandas in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (2.1.3)\n",
"Requirement already satisfied: matplotlib in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (3.8.2)\n",
"Requirement already satisfied: numpy<2,>=1.23.2 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from pandas) (1.26.2)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from pandas) (2.8.2)\n",
"Requirement already satisfied: pytz>=2020.1 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from pandas) (2023.3.post1)\n",
"Requirement already satisfied: tzdata>=2022.1 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from pandas) (2023.3)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (1.2.0)\n",
"Requirement already satisfied: cycler>=0.10 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (0.12.1)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (4.46.0)\n",
"Requirement already satisfied: kiwisolver>=1.3.1 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (1.4.5)\n",
"Requirement already satisfied: packaging>=20.0 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (23.2)\n",
"Requirement already satisfied: pillow>=8 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (10.1.0)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from matplotlib) (3.1.1)\n",
"Requirement already satisfied: six>=1.5 in /home/doge/parallel-programming/.venv/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n"
]
}
],
@@ -53,7 +53,9 @@
"2. CUDA\n",
"3. MPI\n",
"4. Linux Pthreads\n",
"5. "
"5. Java Threads\n",
"\n",
"For each of these we will run with 4, 8, 16, 32 threads and on a varying scale of array sizes.\n"
]
},
{
@@ -148,6 +150,13 @@
"df.head()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### All thread counts for all programs"
]
},
{
"cell_type": "code",
"execution_count": 4,
@@ -176,6 +185,19 @@
"plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Execution times for non-CUDA on each thread counts. \n",
"\n",
"- Observations. \n",
" - As thread count increases Java and MPI switch places. \n",
" - MPI unsurprisingly works better when it has more threads to work with on the machine. \n",
" - OpenMP performed the best closely behind the padded Linux Pthreads implementation. \n",
" - "
]
},
{
"cell_type": "code",
"execution_count": 5,
@@ -184,7 +206,7 @@
{
"data": {
"text/plain": [
"<matplotlib.legend.Legend at 0x7fefb215b790>"
"<matplotlib.legend.Legend at 0x7f9730ae2050>"
]
},
"execution_count": 5,
@@ -322,22 +344,576 @@
"metadata": {},
"outputs": [],
"source": [
"# compare cuda to OpenMP\n",
"df_cuda = df[df['Program'] == 'cuda']\n",
"df_openmp = df[df['Program'] == 'openmp']\n",
"\n",
"for thread_count in df_cuda['Thread Count'].unique():\n",
" cuda_df = df_cuda[df_cuda['Thread Count'] == thread_count]\n",
" openmp_df = df_openmp[df_openmp['Thread Count'] == thread_count]\n",
" plt.plot(cuda_df['Array Size'], cuda_df['Execution Time'], label='cuda')\n",
" plt.plot(openmp_df['Array Size'], openmp_df['Execution Time'], label='openmp')\n",
" \n",
" plt.xlabel('Array Size')\n",
" plt.ylabel('Execution Time')\n",
" plt.title('Execution Time vs. Array Size for Different Programs ({} threads)'.format(thread_count))\n",
" plt.legend()\n",
" plt.show()"
"# Graph cuda and openMP only\n",
"df_cuda_openmp = df[(df['Program'] == 'CUDA') | (df['Program'] == 'OpenMP')]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Comparing OpenMP with Cuda\n",
"- Since openmp and cuda both performed really well we can look closely to see how they compared. \n",
"- Observations\n",
" - Even at much higher array sizes cuda maintains a low execution time while openMP seems to struggle. "
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAHHCAYAAABDUnkqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB0b0lEQVR4nO3dd1hTZxsG8DussEFkigiCA1FA69YqburWuuretlatlarFveqebdXaumu1Kq5aV1XUuuunVXALiqIICCp7J+/3RyQ1AkoUCIT7d125NGfkPDkJyZ3nLIkQQoCIiIhIS+hougAiIiKigsRwQ0RERFqF4YaIiIi0CsMNERERaRWGGyIiItIqDDdERESkVRhuiIiISKsw3BAREZFWYbghIiIircJwQwXm1KlTkEgkOHXqlKZLyZNEIsHMmTM1XQYVMRcXFwwaNKhIl5mUlIRhw4bB3t4eEokEX3/9dZEun/Jv06ZNkEgkePjwoaZLoQLCcFOEsv+A8rpdvHhR0yXmy+rVq7Fp0yZNlwHg3es0++bi4qLpUouliRMnQiKRoFevXpou5b1cv34d3bt3h7OzMwwNDeHo6IjWrVvjxx9/1HRpmDdvHjZt2oSRI0diy5Yt6N+/f6EvUyaTYePGjWjWrBmsrKwglUrh4uKCwYMH4/Lly8rpZs6cCYlEgtjY2Fwfp0aNGmjWrJny/sOHD1X+nvT19WFtbY1GjRph8uTJCA8Pf2tdJf199qZz586ha9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c/vLlS2FkZJTjS1JHR0ecOXNGZTlr1qwRAMS5c+fyrFMulwtHR0fRrVs3leE7d+4UAMTp06eFEIpAiQLenLlr1y4BQISEhAghFEHD0NAwxyaN7NfU1dVVpKSkqIzLfs38/f1zPP6b0wohxPz584VEIlH5gu7du7coV66cymauf//9VwAQGzdufOtzOHr0qNDV1RW6urqiYcOGYuLEieKvv/5S+RLI9ma4edOiRYtyhIOWLVsKT09PkZaWphwml8tFo0aNROXKld9aW/Yy3/xyWLFihQAgfvvtN+WwjIwM0bBhQ2Fqaqr8MZMdJszNzcWzZ8/euaxx48YJAOLq1avvnFaIwgk3nTt3FgBEfHy8clh+32d5ye195OvrK1xdXVWGOTs7q/zNCCHEs2fPhFQqVQnPX3/9tQCg8uPv2bNnwsLC4p3hJjsMjB079q01e3l5CSsrK+X97L+TMWPGKIfJ5XLRvn17YWBgoHwNzpw5IwCIrVu3qjxe9g/b14fn9/m+Hm4OHDggJBKJCA8PF0IIMWHCBOV6zCvctGnTRvkDPCgoSHz22Wc5nktxxc1SGrBq1SocO3ZM5Xb48GGVaWrUqIFZs2Zh3bp18PX1RWxsLDZv3qzcGfbatWsICQlBnz598Pz5c8TGxiI2NhbJyclo2bIlTp8+DblcDrlcjn379qFjx46oU6dOjlpy2xRVUC5fvoxnz57hyy+/VNlhrX379nB3d8fBgwdzzPPmTmpNmjTBgwcPCq3GbMOGDVP+X1dXF3Xq1IEQAkOHDlUOt7S0RNWqVVXqCQgIQLVq1eDu7q58DWJjY9GiRQsAwMmTJ/NcpkQiQY8ePXDo0CEkJSUph+/YsQOOjo74+OOPlcsFgAMHDiAzM7NAnu/WrVtRp04d5U7sZmZmaN++fZ6bDAYOHAgjI6Ncx40cOTLLine truncated
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for program in df_cuda_openmp['Program'].unique():\n",
" program_df = df_cuda_openmp[df_cuda_openmp['Program'] == program]\n",
" plt.plot(program_df['Array Size'], program_df['Execution Time'], label=program)\n",
"\n",
"plt.xlabel('Array Size')\n",
"plt.ylabel('Execution Time')\n",
"plt.title('Execution Time vs. Array Size for CUDA and OpenMP')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Comprehensive table of data"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th>Execution Time</th>\n",
" </tr>\n",
" <tr>\n",
" <th>Program</th>\n",
" <th>Thread Count</th>\n",
" <th>Array Size</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"16\" valign=\"top\">Java</th>\n",
" <th rowspan=\"4\" valign=\"top\">4.0</th>\n",
" <th>10000</th>\n",
" <td>9.530628e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>3.292380e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>2.860490e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>2.484076e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">8.0</th>\n",
" <th>10000</th>\n",
" <td>1.444699e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>3.783955e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>4.141488e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>5.114960e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">16.0</th>\n",
" <th>10000</th>\n",
" <td>2.312823e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>3.764023e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>4.908494e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>1.604579e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">32.0</th>\n",
" <th>10000</th>\n",
" <td>3.589156e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>4.497204e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>2.445472e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>2.335915e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"16\" valign=\"top\">MPI</th>\n",
" <th rowspan=\"4\" valign=\"top\">4.0</th>\n",
" <th>10000</th>\n",
" <td>3.334606e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>1.614696e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.247393e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>1.137531e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">8.0</th>\n",
" <th>10000</th>\n",
" <td>3.131384e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>1.550956e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.183061e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>1.113281e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">16.0</th>\n",
" <th>10000</th>\n",
" <td>3.420866e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>2.056698e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.127848e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>1.020751e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">32.0</th>\n",
" <th>10000</th>\n",
" <td>6.231248e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>2.073539e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.436290e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>1.077001e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"16\" valign=\"top\">OpenMP</th>\n",
" <th rowspan=\"4\" valign=\"top\">4.0</th>\n",
" <th>10000</th>\n",
" <td>1.704972e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>3.588238e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.547572e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>9.187440e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">8.0</th>\n",
" <th>10000</th>\n",
" <td>2.573178e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>3.618154e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.103501e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>6.306812e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">16.0</th>\n",
" <th>10000</th>\n",
" <td>4.675294e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>5.380256e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.337741e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>4.289085e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">32.0</th>\n",
" <th>10000</th>\n",
" <td>8.865682e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>9.245034e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.737905e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>4.199411e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"16\" valign=\"top\">Padded</th>\n",
" <th rowspan=\"4\" valign=\"top\">4.0</th>\n",
" <th>10000</th>\n",
" <td>3.991356e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>4.614564e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.586557e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>1.049616e+07</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">8.0</th>\n",
" <th>10000</th>\n",
" <td>4.829786e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>6.848344e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.416199e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>6.447894e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">16.0</th>\n",
" <th>10000</th>\n",
" <td>9.357786e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>9.999386e+05</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>1.639122e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>5.542047e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"4\" valign=\"top\">32.0</th>\n",
" <th>10000</th>\n",
" <td>1.434314e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100000</th>\n",
" <td>1.614646e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1000000</th>\n",
" <td>2.259404e+06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10000000</th>\n",
" <td>5.403496e+06</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Execution Time\n",
"Program Thread Count Array Size \n",
"Java 4.0 10000 9.530628e+05\n",
" 100000 3.292380e+06\n",
" 1000000 2.860490e+07\n",
" 10000000 2.484076e+07\n",
" 8.0 10000 1.444699e+06\n",
" 100000 3.783955e+06\n",
" 1000000 4.141488e+07\n",
" 10000000 5.114960e+07\n",
" 16.0 10000 2.312823e+06\n",
" 100000 3.764023e+06\n",
" 1000000 4.908494e+07\n",
" 10000000 1.604579e+08\n",
" 32.0 10000 3.589156e+06\n",
" 100000 4.497204e+06\n",
" 1000000 2.445472e+07\n",
" 10000000 2.335915e+08\n",
"MPI 4.0 10000 3.334606e+05\n",
" 100000 1.614696e+06\n",
" 1000000 1.247393e+07\n",
" 10000000 1.137531e+08\n",
" 8.0 10000 3.131384e+05\n",
" 100000 1.550956e+06\n",
" 1000000 1.183061e+07\n",
" 10000000 1.113281e+08\n",
" 16.0 10000 3.420866e+05\n",
" 100000 2.056698e+06\n",
" 1000000 1.127848e+07\n",
" 10000000 1.020751e+08\n",
" 32.0 10000 6.231248e+05\n",
" 100000 2.073539e+06\n",
" 1000000 1.436290e+07\n",
" 10000000 1.077001e+08\n",
"OpenMP 4.0 10000 1.704972e+05\n",
" 100000 3.588238e+05\n",
" 1000000 1.547572e+06\n",
" 10000000 9.187440e+06\n",
" 8.0 10000 2.573178e+05\n",
" 100000 3.618154e+05\n",
" 1000000 1.103501e+06\n",
" 10000000 6.306812e+06\n",
" 16.0 10000 4.675294e+05\n",
" 100000 5.380256e+05\n",
" 1000000 1.337741e+06\n",
" 10000000 4.289085e+06\n",
" 32.0 10000 8.865682e+05\n",
" 100000 9.245034e+05\n",
" 1000000 1.737905e+06\n",
" 10000000 4.199411e+06\n",
"Padded 4.0 10000 3.991356e+05\n",
" 100000 4.614564e+05\n",
" 1000000 1.586557e+06\n",
" 10000000 1.049616e+07\n",
" 8.0 10000 4.829786e+05\n",
" 100000 6.848344e+05\n",
" 1000000 1.416199e+06\n",
" 10000000 6.447894e+06\n",
" 16.0 10000 9.357786e+05\n",
" 100000 9.999386e+05\n",
" 1000000 1.639122e+06\n",
" 10000000 5.542047e+06\n",
" 32.0 10000 1.434314e+06\n",
" 100000 1.614646e+06\n",
" 1000000 2.259404e+06\n",
" 10000000 5.403496e+06"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Display a full table\n",
"# turn off table truncation\n",
"pd.set_option('display.max_rows', None)\n",
"display(df.pivot_table(index=['Program', 'Thread Count', 'Array Size'], values='Execution Time'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Statistics of execution time. "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"count 8.000000e+01\n",
"mean 2.104659e+06\n",
"std 2.619990e+06\n",
"min 1.383090e+05\n",
"25% 4.410583e+05\n",
"50% 9.372750e+05\n",
"75% 1.991447e+06\n",
"max 9.671603e+06\n",
"Name: Execution Time, dtype: float64"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"count 8.000000e+01\n",
"mean 3.982728e+07\n",
"std 6.452756e+07\n",
"min 8.296540e+05\n",
"25% 3.380378e+06\n",
"50% 1.304605e+07\n",
"75% 4.257870e+07\n",
"max 2.793991e+08\n",
"Name: Execution Time, dtype: float64"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"count 8.000000e+01\n",
"mean 3.085687e+07\n",
"std 4.556039e+07\n",
"min 2.913650e+05\n",
"25% 1.232458e+06\n",
"50% 6.770169e+06\n",
"75% 3.751019e+07\n",
"max 1.148011e+08\n",
"Name: Execution Time, dtype: float64"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"count 8.000000e+01\n",
"mean 2.612748e+06\n",
"std 2.902114e+06\n",
"min 2.377350e+05\n",
"25% 8.365418e+05\n",
"50% 1.439095e+06\n",
"75% 2.531328e+06\n",
"max 1.071417e+07\n",
"Name: Execution Time, dtype: float64"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"count 20.000000\n",
"mean 3.560461\n",
"std 2.719199\n",
"min 1.390750\n",
"25% 1.530738\n",
"50% 2.385825\n",
"75% 4.447820\n",
"max 8.784860\n",
"Name: Execution Time, dtype: float64"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for program in df['Program'].unique():\n",
" program_df = df[df['Program'] == program]\n",
" print(f\"\\n{program}:\\n\")\n",
" display(program_df[\"Execution Time\"].describe())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Conclusion\n",
"- From our tests it seems that for a simple application cuda and OpenMP are really performant while MPI struggles\n",
"- The reason MPI is struggling is likely because there is a lot of latency between the machines. \n",
" - This is likely not a good application for MPI. MPI would work better on much larger datasets that can be split more evenly. \n",
"- OpenMP is very practical to parallelize simple applications and performs extremely well. \n",
"- GPUs are really fast. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@@ -356,7 +932,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.6"
}
},
"nbformat": 4,