Skip to content

Commit

Permalink
Merge pull request #3 from programmah/main
Browse files Browse the repository at this point in the history
fixed python typos
  • Loading branch information
programmah committed May 16, 2023
2 parents df3d3ce + 7a79bea commit 2fc1fa7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion _basic/python/jupyter_notebook/cupy/cupy_RDF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down
41 changes: 25 additions & 16 deletions _basic/python/jupyter_notebook/cupy/cupy_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"import cupy as cp\n",
"#copy data from Host to Device using cp.asarray()\n",
"h_X = np.arange(100, dtype=np.float32)#generating array of 100 values on the Host with NumPy\n",
"d_X = cp.asarray(x)# copy data to Device \n",
"d_X = cp.asarray(h_X)# copy data to Device \n",
"#copy data from Device to Host using cp.asnumpy()\n",
"h_X = cp.asnumpy(d_X)\n",
"```\n",
Expand Down Expand Up @@ -110,7 +110,7 @@
"\n",
"N = 10000\n",
"#select Device with index 1. \n",
"with cp.cuda.Device(1):\n",
"with cp.cuda.Device(0):\n",
" #input data initialzed\n",
" d_A = cp.arange(N, dtype=cp.int32)\n",
" d_B = cp.arange(N, dtype=cp.int32)\n",
Expand Down Expand Up @@ -148,6 +148,8 @@
"\n",
"\n",
"\n",
"\n",
"\n",
"#expected output: [ 0 2 4 ... 999994 999996 999998]"
]
},
Expand Down Expand Up @@ -248,14 +250,8 @@
"\n",
"\n",
"\n",
"#expected output:\n",
"#[[ 848610000 848635200 848660400 ... 854204400 854229600 854254800]\n",
"# [ 2124360000 2124435825 2124511650 ... 2141193150 2141268975 2141344800]\n",
"# [ -894857296 -894730846 -894604396 ... -866785396 -866658946 -866532496]\n",
"# ...\n",
"# [ 597268464 608532414 619796364 ... -1197101932 -1185837982 -1174574032]\n",
"# [ 1873018464 1884333039 1895647614 ... 89886818 101201393 112515968]\n",
"# [-1146198832 -1134833632 -1123468432 ... 1376875568 1388240768 1399605968]]"
"\n",
"#Note: Because of the random number, the output may slightly vary each time the cell is executed"
]
},
{
Expand Down Expand Up @@ -302,7 +298,7 @@
"#calling fuse function\n",
"z = compute(x,w)\n",
"print(z)\n",
"#expected output: 57.776024. output may varies because of random values of x & w"
"#expected output: 57.776024. Output may vary because of random values of x & w"
]
},
{
Expand Down Expand Up @@ -350,7 +346,7 @@
"r = cp.empty(N, dtype=cp.float32)\n",
"```\n",
"\n",
"**step 5**: Make the kernel call\n",
"**Step 5**: Make the kernel call\n",
"```python\n",
"compute_call(d_x,d_y, d_z, r)\n",
"print(r)\n",
Expand Down Expand Up @@ -419,7 +415,7 @@
"```python\n",
"mapping_expr = 'x * w'\n",
"```\n",
"**Step 3**: set reduction expression `a & b`\n",
"**Step 3**: set reduction expression `a + b`\n",
"```python\n",
"reduction_expr= 'a + b'\n",
"```\n",
Expand Down Expand Up @@ -665,7 +661,16 @@
"\n",
"\n",
"\n",
"#expected output[ 0 1 4 ... 888896841 889896836 890896833]"
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"#expected output: [ 0 2 4 ... 999994 999996 999998]"
]
},
{
Expand Down Expand Up @@ -866,7 +871,11 @@
"\n",
"\n",
"\n",
"#expected output: [ 0 1 4 ... 2147483647 2147483647 2147483647]"
"\n",
"\n",
"\n",
"\n",
"#expected output: [ 0 2 4 ... 999994 999996 999998]"
]
},
{
Expand Down Expand Up @@ -976,7 +985,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion _basic/python/jupyter_notebook/cupy/serial_RDF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions _basic/python/jupyter_notebook/numba/numba_guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
" for k in range(N):\n",
" d_C[row][col]+= d_A[row][k] * d_B[k][col]\n",
"```\n",
"#### step 2\n",
"#### Step 2\n",
"```python\n",
"#input data initialzed on the Host \n",
"h_A = np.array([[0,0,0,0],[1,1,1,1],[2,2,2,2],[3,3,3,3]], dtype=np.int32)\n",
Expand All @@ -317,7 +317,7 @@
"d_C = cuda.to_device(h_C)\n",
"\n",
"```\n",
"#### step 3\n",
"#### Step 3\n",
"```python\n",
"#set block and grid size and call kernel\n",
"num_of_threads_per_block = (2,2)\n",
Expand Down Expand Up @@ -356,8 +356,8 @@
"\n",
"#kernel function\n",
"def MatrixMul2D(d_A, d_B, d_C):\n",
" x, y = cuda.grid(2)\n",
" #complete kernel code\n",
" x, y = cuda.grid(2)\n",
" #complete kernel code\n",
"\n",
"\n",
"#input data initialized on the Host\n",
Expand Down Expand Up @@ -711,7 +711,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 2fc1fa7

Please sign in to comment.