Skip to content

Commit 9c404b0

Browse files
committed
Ruff fixes
1 parent ef35fb3 commit 9c404b0

File tree

9 files changed

+24
-46
lines changed

9 files changed

+24
-46
lines changed

tutorials/nvmath-python/01_kernel_fusion.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@
443443
"import nvmath # Facilitates shared objects loading required by CuPy (Workaround for CuPy being unable to find nvrtc installed in wheels)\n",
444444
"import cupy as cp\n",
445445
"import numpy as np\n",
446-
"import cupyx as cpx\n",
446+
"import cupyx as cpx # noqa: F811\n",
447447
"\n",
448448
"# Define GEMM parameters\n",
449449
"m, n, k = 10_000_000, 40, 10\n",

tutorials/nvmath-python/01_kernel_fusion_SOLUTION.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"source": [
5151
"## Exercise: Evaluate performance of CuPy `@`-based vs. `matmul`-based implementations of GEMM\n",
5252
"\n",
53-
"import nvmath # Facilitates shared objects loading required by CuPy (Workaround for CuPy being unable to find nvrtc installed in wheels)\n",
53+
"import nvmath # noqa: F401 Facilitates shared objects loading required by CuPy (Workaround for CuPy being unable to find nvrtc installed in wheels)\n",
5454
"import cupy as cp\n",
5555
"import numpy as np\n",
5656
"import cupyx as cpx\n",

tutorials/nvmath-python/03_stateful_api.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@
343343
"import nvmath\n",
344344
"from nvmath.linalg.advanced import MatmulEpilog\n",
345345
"import cupy as cp\n",
346-
"import numpy as np\n",
347-
"import cupyx as cpx\n",
346+
"import numpy as np # noqa: F811\n",
347+
"import cupyx as cpx # noqa: F811\n",
348348
"\n",
349349
"\n",
350350
"# Helper function to benchmark two implementations F and (optionally) F_alternative\n",

tutorials/nvmath-python/04_callbacks.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
"metadata": {},
206206
"outputs": [],
207207
"source": [
208-
"import nvmath # Preload CTK libraries installed from wheels for CuPy\n",
208+
"import nvmath # noqa: F811 Preload CTK libraries installed from wheels for CuPy\n",
209209
"import cupy as cp\n",
210210
"\n",
211211
"\n",
@@ -837,7 +837,7 @@
837837
"metadata": {},
838838
"outputs": [],
839839
"source": [
840-
"import nvmath # Workaround for CuPy: CTK shared objects preload from wheels\n",
840+
"import nvmath # noqa: F811 Workaround for CuPy: CTK shared objects preload from wheels\n",
841841
"import cupy as cp\n",
842842
"\n",
843843
"image_gpu = cp.asarray(original_image, dtype=cp.float32)\n",

tutorials/nvmath-python/05_device_api.ipynb

Lines changed: 11 additions & 31 deletions
Large diffs are not rendered by default.

tutorials/nvmath-python/05_device_api_SOLUTION.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
"metadata": {},
8383
"outputs": [],
8484
"source": [
85+
"import numpy as np\n",
86+
"import matplotlib.pyplot as plt\n",
87+
"\n",
8588
"LIGHT_GREY = \"#AAA\"\n",
8689
"GREY = \"#777\"\n",
8790
"BLACK = \"#000\"\n",
@@ -92,9 +95,6 @@
9295
"PRIMARY_RED = '#eb7734'\n",
9396
"DARK_RED = '#ba5012'\n",
9497
"\n",
95-
"import numpy as np\n",
96-
"import matplotlib.pyplot as plt\n",
97-
"\n",
9898
"def call_payoff(x, strike, premium):\n",
9999
" return np.maximum(x - strike, 0.0) - premium\n",
100100
"\n",
@@ -144,7 +144,7 @@
144144
"metadata": {},
145145
"outputs": [],
146146
"source": [
147-
"import nvmath\n",
147+
"import nvmath # noqa: F401\n",
148148
"import cupy as cp\n",
149149
"\n",
150150
"RNG_SEED = 777777 # Random seed\n",

tutorials/nvmath-python/06_sparse_solver.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
"# Validate the solution by computing the residual norm ||A * x - b||\n",
198198
"# A small residual indicates an accurate solution\n",
199199
"residual = cp.linalg.norm(a @ x - b)\n",
200-
"print(f\"Solution computed successfully!\")\n",
200+
"print(\"Solution computed successfully!\")\n",
201201
"print(f\"Residual L2 norm ||A*x - b|| = {residual:.2e}\")\n",
202202
"print(f\"Matrix size: {a.shape[0]} × {a.shape[1]}\")\n",
203203
"print(f\"Number of non-zero elements: {a.nnz}\")"
@@ -263,7 +263,7 @@
263263
"\n",
264264
"# Validate the solution\n",
265265
"residual = cp.linalg.norm(a @ x - b)\n",
266-
"print(f\"Hybrid execution completed successfully!\")\n",
266+
"print(\"Hybrid execution completed successfully!\")\n",
267267
"print(f\"Residual L2 norm ||A*x - b|| = {residual:.2e}\")\n",
268268
"\n",
269269
"# Clean up: destroy the cuDSS handle\n",

tutorials/nvmath-python/06_sparse_solver_SOLUTION.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"\n",
130130
"# Validate the solution\n",
131131
"residual = cp.linalg.norm(a @ x - b)\n",
132-
"print(f\"Completed successfully!\")\n",
132+
"print(\"Completed successfully!\")\n",
133133
"print(f\"Residual L2 norm ||A*x - b|| = {residual:.2e}\")\n",
134134
"\n",
135135
"# Clean up: destroy the cuDSS handle\n",

tutorials/nvmath-python/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,3 @@ For detailed profiling, notebooks demonstrate using NVIDIA Nsight Systems and th
145145
- [nvmath-python Documentation](https://docs.nvidia.com/cuda/nvmath-python/)
146146
- [NVIDIA CUDA-X Libraries](https://developer.nvidia.com/gpu-accelerated-libraries)
147147
- [NVIDIA Nsight Tools](https://developer.nvidia.com/nsight-systems)
148-
149-

0 commit comments

Comments
 (0)