Skip to content

Commit

Permalink
updated colab notebook with scopy results
Browse files Browse the repository at this point in the history
  • Loading branch information
tvercaut committed Dec 23, 2022
1 parent c9ec966 commit b176518
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions tests/spd_forward_solve_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPlHXxhQkC8kGTNfxN/oKe/",
"authorship_tag": "ABX9TyN0JFpiKDeXK9tTd/a7xn9o",
"include_colab_link": true
},
"kernelspec": {
Expand Down Expand Up @@ -47,7 +47,7 @@
"base_uri": "https://localhost:8080/"
},
"id": "3hHTa-xCjIQv",
"outputId": "482cc3c9-43e2-451b-af42-a745f88b528e"
"outputId": "cf255d05-b0ab-4a79-9765-1ed23fbff784"
},
"outputs": [
{
Expand All @@ -59,8 +59,8 @@
"Running on cuda\n",
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Collecting git+https://github.com/cai4cai/torchsparsegradutils\n",
" Cloning https://github.com/cai4cai/torchsparsegradutils to /tmp/pip-req-build-6zkqcw6n\n",
" Running command git clone -q https://github.com/cai4cai/torchsparsegradutils /tmp/pip-req-build-6zkqcw6n\n",
" Cloning https://github.com/cai4cai/torchsparsegradutils to /tmp/pip-req-build-plwawj9f\n",
" Running command git clone -q https://github.com/cai4cai/torchsparsegradutils /tmp/pip-req-build-plwawj9f\n",
" Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
" Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
" Preparing wheel metadata ... \u001b[?25l\u001b[?25hdone\n",
Expand Down Expand Up @@ -144,16 +144,14 @@
"base_uri": "https://localhost:8080/"
},
"id": "0CzeubR_kUVA",
"outputId": "199b16e4-526f-4b44-c99e-be1c933e4458"
"outputId": "dc3ff1db-1425-4a82-cf54-0ad60f81963c"
},
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Downloading https://suitesparse-collection-website.herokuapp.com/MM/Rothberg/cfd2.tar.gz\n",
"untarring cfd2.tar.gz\n",
"Loaded suitesparse matrix Rothberg/cfd2: type=<class 'scipy.sparse.coo.coo_matrix'>, shape=(123440, 123440)\n",
"Created random RHS with shape=(123440,)\n"
]
Expand Down Expand Up @@ -198,7 +196,7 @@
{
"cell_type": "code",
"source": [
"run_scipy = False\n",
"run_scipy = True\n",
"if run_scipy:\n",
" t, n = scipy_test(A_np_coo, b_np, scipy.sparse.linalg.spsolve, 'scipy.spsolve COO')\n",
" t, n = scipy_test(A_np_csr, b_np, scipy.sparse.linalg.spsolve, 'scipy.spsolve CSR')\n",
Expand All @@ -216,15 +214,30 @@
"base_uri": "https://localhost:8080/"
},
"id": "4KaNyZpDogS4",
"outputId": "ab5a18a5-4f73-4b27-d4a5-b71350c68842"
"outputId": "34e0dc0b-392b-4485-ac55-1233dde26aaf"
},
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"/usr/local/lib/python3.8/dist-packages/scipy/sparse/linalg/dsolve/linsolve.py:144: SparseEfficiencyWarning: spsolve requires A be CSC or CSR matrix format\n",
" warn('spsolve requires A be CSC or CSR matrix format',\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Skipping scipy tests\n"
"scipy.spsolve COO took 108.62 seconds - resnorm=2.15e-10\n",
"scipy.spsolve CSR took 98.29 seconds - resnorm=2.49e-10\n",
"scipy.cg COO took 72.09 seconds - resnorm=3.50e-03\n",
"scipy.cg CSR took 55.59 seconds - resnorm=3.50e-03\n",
"scipy.bicgstab COO took 112.65 seconds - resnorm=2.31e-03\n",
"scipy.bicgstab CSR took 88.79 seconds - resnorm=2.31e-03\n",
"scipy.minres COO took 0.54 seconds - resnorm=3.05e+01\n",
"scipy.minres CSR took 0.38 seconds - resnorm=3.05e+01\n"
]
}
]
Expand All @@ -250,10 +263,10 @@
],
"metadata": {
"id": "DHqwjtVOrRyH",
"outputId": "20aa9e46-1e9d-4b55-b70c-88ff6eb1ccc5",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputId": "307faf94-ee4a-4943-d483-ad084246ee0d"
},
"execution_count": 5,
"outputs": [
Expand Down Expand Up @@ -346,10 +359,10 @@
],
"metadata": {
"id": "3HH-nGDSsIXy",
"outputId": "793408b1-955b-4f8b-b184-bf8f24ea188b",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputId": "7a8dacff-efaa-416a-f6d5-9a87a2b84157"
},
"execution_count": 7,
"outputs": [
Expand All @@ -358,15 +371,15 @@
"name": "stdout",
"text": [
"GPU memory allocated: 0.04Gb - max allocated: 0.04Gb\n",
"tsgu.sparse_generic_solve GPU CSR took 0.65 seconds - resnorm=1.33e+00\n",
"tsgu.sparse_generic_solve GPU CSR took 0.62 seconds - resnorm=1.93e+00\n",
"GPU memory allocated: 0.04Gb - max allocated: 0.05Gb\n",
"tsgu.sparse_generic_solve minres GPU CSR took 0.48 seconds - resnorm=1.33e+00\n",
"tsgu.sparse_generic_solve minres GPU CSR took 0.46 seconds - resnorm=1.93e+00\n",
"GPU memory allocated: 0.04Gb - max allocated: 0.05Gb\n",
"tsgu.sparse_generic_solve cg GPU CSR took 0.06 seconds - resnorm=2.39e+02\n",
"tsgu.sparse_generic_solve cg GPU CSR took 0.06 seconds - resnorm=2.43e+02\n",
"GPU memory allocated: 0.04Gb - max allocated: 0.05Gb\n",
"tsgu.sparse_generic_solve bicgstab GPU CSR took 10.42 seconds - resnorm=2.15e-04\n",
"tsgu.sparse_generic_solve bicgstab GPU CSR took 9.35 seconds - resnorm=2.60e-04\n",
"GPU memory allocated: 0.04Gb - max allocated: 0.05Gb\n",
"tsgu.sparse_solve_j4t cg GPU CSR took 8.32 seconds - resnorm=3.51e-03\n",
"tsgu.sparse_solve_j4t cg GPU CSR took 6.39 seconds - resnorm=2.74e-03\n",
"GPU memory allocated: 0.04Gb - max allocated: 0.05Gb\n"
]
}
Expand Down

0 comments on commit b176518

Please sign in to comment.