Skip to content
Snippets Groups Projects
Commit afe017e0 authored by Xuan Gu's avatar Xuan Gu
Browse files

Update 2 files

- /scripts/copy_data_for_benchmark.sh
- /README.md
parent 7c28d77b
No related branches found
No related tags found
No related merge requests found
# Benchmark_nnU-Net_for_PyTorch # Benchmark of nnU-Net for PyTorch on Berzelius
Benchmark of nnU-Net for PyTorch on Berzelius
It is based on the Nvidia NGC recipe of nnU-net for Pytorch.
Latest Version 21.11.0
Modified February 3, 2022
See [NVIDIA Deep Learning Examples](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/nnunet_for_pytorch).
### On local computer The benchmarking is based on [Nvidia NGC nnU-net for Pytorch](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/nnunet_for_pytorch) v21.11.0.
- Clone the repository
### On local computer (optional)
- Download the code
``` ```
wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/nnunet_for_pytorch/versions/21.11.0/zip -O /tmp/nnunet_for_pytorch_21.11.0.zip wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/nnunet_for_pytorch/versions/21.11.0/zip -O /tmp/nnunet_for_pytorch_21.11.0.zip
mkdir /samsung1t/ngc/nnunet_for_pytorch_21.11.0 mkdir /samsung1t/ngc/nnunet_for_pytorch_21.11.0
...@@ -15,7 +12,7 @@ unzip /tmp/nnunet_for_pytorch_21.11.0.zip -d /samsung1t/ngc/nnunet_for_pytorch_2 ...@@ -15,7 +12,7 @@ unzip /tmp/nnunet_for_pytorch_21.11.0.zip -d /samsung1t/ngc/nnunet_for_pytorch_2
cd /samsung1t/ngc/nnunet_for_pytorch_21.11.0/ cd /samsung1t/ngc/nnunet_for_pytorch_21.11.0/
``` ```
- Build the nnU-Net PyTorch NGC container - Build the nnU-Net PyTorch Docker container
``` ```
docker build -t nnunet . docker build -t nnunet .
``` ```
...@@ -28,19 +25,41 @@ docker push xuagu37/nvidia_nnu-net_for_pytorch:21.11.0 ...@@ -28,19 +25,41 @@ docker push xuagu37/nvidia_nnu-net_for_pytorch:21.11.0
### On Berzelius ### On Berzelius
- Clone the repository - Create directories
```
mkdir -p /proj/nsc_testing/xuan/nnUnet_benchmark
cd /proj/nsc_testing/xuan/nnUnet_benchmark
mkdir data results
```
<!-- - Clone the repository
``` ```
cd /proj/nsc/xuan/ngc cd /proj/nsc_testing/xuan/ngc
git clone https://github.com/NVIDIA/DeepLearningExamples git clone https://github.com/NVIDIA/DeepLearningExamples
cd /proj/nsc/xuan/ngc/DeepLearningExamples/PyTorch/Segmentation/nnUNet cd DeepLearningExamples/PyTorch/Segmentation/nnUNet
mkdir data results mkdir data results
``` -->
Docker is not available on Berzelius. We us Apptainer or Enroot.
- Prepare the dataset
With Apptainer
``` ```
- Pull from xuagu37 and run the image apptainer pull nvidia_nnu-net_for_pytorch.sif docker://xuagu37/nvidia_nnu-net_for_pytorch:21.11.0
apptainer exec --nv -B ${PWD}/data:/data -B ${PWD}/results:/results --nv nvidia_nnu-net_for_pytorch.sif bash -c "cd /workspace/nnunet_pyt && python download.py --task 01 && python preprocess.py --task 01 --dim 2"
```
Using singularity With Enroot
```
enroot import 'docker://xuagu37/nvidia_nnu-net_for_pytorch:21.11.0'
enroot create --name nnunet xuagu37+nvidia_nnu-net_for_pytorch+21.11.0.sqsh
enroot start --rw --mount ${PWD}/data:/data --mount ${PWD}/results:/results nnunet bash -c "cd /workspace/nnunet_pyt && python download.py --task 01 && python preprocess.py --task 01 --dim 2"
```
<!-- Using singularity
``` ```
singularity pull nvidia_nnu-net_for_pytorch.sif docker://xuagu37/nvidia_nnu-net_for_pytorch:21.11.0 singularity pull nvidia_nnu-net_for_pytorch.sif docker://xuagu37/nvidia_nnu-net_for_pytorch:21.11.0
singularity shell -B ${PWD}/data:/data -B ${PWD}/results:/results --nv nvidia_nnu-net_for_pytorch.sif singularity shell -B ${PWD}/data:/data -B ${PWD}/results:/results --nv nvidia_nnu-net_for_pytorch.sif
``` ```
Or using enroot Or using enroot
``` ```
...@@ -53,11 +72,11 @@ enroot start --rw --mount ${PWD}/data:/data --mount ${PWD}/results:/results nnun ...@@ -53,11 +72,11 @@ enroot start --rw --mount ${PWD}/data:/data --mount ${PWD}/results:/results nnun
python download.py --task 01 python download.py --task 01
python preprocess.py --task 01 --dim 2 python preprocess.py --task 01 --dim 2
``` ```
Exit the image. Exit the image.
-->
- For benchmarking purpose, we use 1000 copied of a single image - For benchmarking purpose, we use 1000 copied of a single image
``` ```
mkdir data_orig
cp -a data/* data_orig/
bash copy_data_for_benchmark.sh bash copy_data_for_benchmark.sh
``` ```
- Run the script. - Run the script.
......
mkdir data_orig
cp -a data/* data_orig/
cd data/01_2d cd data/01_2d
for i in {0..9}; do for i in {0..9}; do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment