Skip to content

Commit

Permalink
Update "pathology/tumor_detection/ignite/profiling_camelyon_pipeline.…
Browse files Browse the repository at this point in the history
…ipynb" (Project-MONAI#1673)

Fixes # .

### Description
Update the usage of nvtx in "tumor_detection_camelyon"

### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [ ] Avoid including large-size files in the PR.
- [ ] Clean up long text outputs from code cells in the notebook.
- [ ] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [ ] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`

---------

Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
KumoLiu and pre-commit-ci[bot] authored Mar 21, 2024
1 parent 6ca52e4 commit 89ca2f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-modified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build:
if: github.repository == 'Project-MONAI/tutorials'
container:
image: nvcr.io/nvidia/pytorch:22.04-py3
image: nvcr.io/nvidia/pytorch:24.02-py3
options: --gpus all --ipc host
runs-on: [self-hosted, linux, x64]
steps:
Expand Down
67 changes: 14 additions & 53 deletions pathology/tumor_detection/ignite/profiling_camelyon_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -108,12 +108,13 @@
"text": [
"Downloading...\n",
"From: https://drive.google.com/uc?id=1uWS4CXKD-NP_6-SgiQbQfhFMzbs0UJIr\n",
"To: /Users/bhashemian/workspace/tutorials/pathology/tumor_detection/ignite/training.csv\n",
"100%|██████████| 153k/153k [00:00<00:00, 1.91MB/s]\n",
"To: /workspace/Code/tutorials/pathology/tumor_detection/ignite/training.csv\n",
"100%|██████████| 153k/153k [00:00<00:00, 1.75MB/s]\n",
"Downloading...\n",
"From: https://drive.google.com/uc?id=1OxAeCMVqH9FGpIWpAXSEJe6cLinEGQtF\n",
"To: /Users/bhashemian/workspace/tutorials/pathology/tumor_detection/ignite/training/images/tumor_091.tif\n",
"100%|██████████| 546M/546M [00:22<00:00, 24.1MB/s] \n"
"From (original): https://drive.google.com/uc?id=1OxAeCMVqH9FGpIWpAXSEJe6cLinEGQtF\n",
"From (redirected): https://drive.google.com/uc?id=1OxAeCMVqH9FGpIWpAXSEJe6cLinEGQtF&confirm=t&uuid=cbee2da2-249c-4d81-bc97-6e589a8452ce\n",
"To: /workspace/Code/tutorials/pathology/tumor_detection/ignite/training/images/tumor_091.tif\n",
"100%|██████████| 546M/546M [00:10<00:00, 50.4MB/s] \n"
]
},
{
Expand Down Expand Up @@ -157,8 +158,8 @@
"source": [
"!nsys profile \\\n",
" --trace nvtx,osrt,cudnn,cuda, \\\n",
" --delay 15 \\\n",
" --duration 60 \\\n",
" --delay 5 \\\n",
" --duration 10 \\\n",
" --show-output true \\\n",
" --force-overwrite true \\\n",
" --output profile_report.nsys-rep \\\n",
Expand All @@ -172,52 +173,12 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Generating SQLite file profile_report.sqlite from profile_report.nsys-rep\n",
"Exporting 265495 events: [=================================================100%]\n",
"Using profile_report.sqlite for SQL queries.\n",
"Running [/usr/local/cuda-11.6/NsightSystems-cli-2021.5.2/target-linux-x64/reports/nvtxppsum.py profile_report.sqlite]... \n",
"\n",
"+----------+-----------------+-----------+--------------+--------------+------------+-------------+--------------+--------------------------+\n",
"| Time (%) | Total Time (ns) | Instances | Avg (ns) | Med (ns) | Min (ns) | Max (ns) | StdDev (ns) | Range |\n",
"+----------+-----------------+-----------+--------------+--------------+------------+-------------+--------------+--------------------------+\n",
"| 28.7 | 33706579200 | 5 | 6741315840.0 | 6324451800.0 | 176995000 | 13682363400 | 4889241407.0 | Iteration |\n",
"| 21.3 | 25011936300 | 5 | 5002387260.0 | 4787481900.0 | 2873517700 | 8072929200 | 2035498721.7 | Batch |\n",
"| 20.3 | 23839370600 | 50 | 476787412.0 | 376589400.0 | 220633100 | 1154097400 | 276441893.0 | Preprocessing |\n",
"| 19.3 | 22742525900 | 450 | 50538946.4 | 36570950.0 | 18874200 | 202062000 | 36166736.1 | TorchVisiond_ColorJitter |\n",
"| 9.4 | 11044461700 | 5 | 2208892340.0 | 1996530400.0 | 148099300 | 4407900900 | 1534918799.1 | ResNet18 |\n",
"| 0.3 | 384269900 | 450 | 853933.1 | 65400.0 | 21000 | 22487800 | 2212634.3 | RandZoomd |\n",
"| 0.2 | 244892100 | 450 | 544204.7 | 441950.0 | 321800 | 8677700 | 541248.4 | ScaleIntensityRanged |\n",
"| 0.1 | 128083500 | 450 | 284630.0 | 243900.0 | 187400 | 4721600 | 230932.6 | Postprocessing |\n",
"| 0.1 | 91848800 | 450 | 204108.4 | 176450.0 | 128700 | 745700 | 87187.5 | ToNumpyd |\n",
"| 0.1 | 65417500 | 450 | 145372.2 | 117000.0 | 90200 | 4613300 | 219185.3 | AsDiscreted |\n",
"| 0.1 | 59017500 | 450 | 131150.0 | 82250.0 | 17400 | 1050600 | 123950.6 | RandRotate90d |\n",
"| 0.0 | 55917100 | 50 | 1118342.0 | 882450.0 | 685900 | 5798000 | 801880.3 | GridSplitd |\n",
"| 0.0 | 54120900 | 450 | 120268.7 | 100700.0 | 68500 | 721200 | 59828.4 | ToTensord |\n",
"| 0.0 | 51677300 | 450 | 114838.4 | 101350.0 | 67500 | 1154000 | 60160.7 | CastToTyped |\n",
"| 0.0 | 50674700 | 450 | 112610.4 | 95650.0 | 71300 | 613700 | 51643.2 | ToTensord_2 |\n",
"| 0.0 | 48966300 | 450 | 108814.0 | 95900.0 | 75200 | 428700 | 44791.2 | Activationsd |\n",
"| 0.0 | 39524100 | 450 | 87831.3 | 45950.0 | 7600 | 2748400 | 153536.8 | RandFlipd |\n",
"| 0.0 | 2460800 | 50 | 49216.0 | 39450.0 | 28700 | 146100 | 23219.6 | Lambdad |\n",
"| 0.0 | 1074200 | 4 | 268550.0 | 194150.0 | 142200 | 543700 | 186523.3 | Loss |\n",
"+----------+-----------------+-----------+--------------+--------------+------------+-------------+--------------+--------------------------+\n",
"\n",
"Running [/usr/local/cuda-11.6/NsightSystems-cli-2021.5.2/target-linux-x64/reports/nvtxppsum.py profile_report.sqlite] to [profile_report_nvtxppsum.csv]... PROCESSED\n",
"\n",
"Running [/usr/local/cuda-11.6/NsightSystems-cli-2021.5.2/target-linux-x64/reports/nvtxpptrace.py profile_report.sqlite] to [profile_report_nvtxpptrace.csv]... PROCESSED\n",
"\n"
]
}
],
"outputs": [],
"source": [
"!nsys stats \\\n",
" --report nvtxppsum,nvtxppsum,nvtxpptrace \\\n",
" --report nvtx_pushpop_sum,nvtx_pushpop_sum,nvtx_pushpop_trace \\\n",
" --format table,csv \\\n",
" --output -,. \\\n",
" --force-overwrite true \\\n",
Expand Down Expand Up @@ -576,7 +537,7 @@
],
"source": [
"# Load NVTX Push/Pop Range Summary\n",
"summary = pd.read_csv(\"profile_report_nvtxppsum.csv\")\n",
"summary = pd.read_csv(\"profile_report_nvtx_pushpop_sum.csv\")\n",
"# display(summary)\n",
"\n",
"# Set the Range (which is the name of each range) as the index\n",
Expand Down Expand Up @@ -704,7 +665,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ for file in "${files[@]}"; do
unset PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION
fi

cmd=$(echo "papermill ${papermill_opt} --progress-bar -k ${kernelspec}")
cmd=$(echo "papermill ${papermill_opt} --progress-bar --log-output -k ${kernelspec}")
echo "$cmd"
time out=$(echo "$notebook" | eval "$cmd")
success=$?
Expand Down

0 comments on commit 89ca2f1

Please sign in to comment.