From afe017e0ab4210606cce809dda78a22459f8a3f6 Mon Sep 17 00:00:00 2001 From: Xuan Gu <xuan.gu@liu.se> Date: Tue, 9 May 2023 20:15:53 +0000 Subject: [PATCH] Update 2 files - /scripts/copy_data_for_benchmark.sh - /README.md --- README.md | 55 ++++++++++++++++++++---------- scripts/copy_data_for_benchmark.sh | 2 ++ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c10caba..142dad8 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,10 @@ -# 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 -- Clone the repository +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. + +### 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 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 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 . ``` @@ -28,19 +25,41 @@ docker push xuagu37/nvidia_nnu-net_for_pytorch:21.11.0 ### 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 -cd /proj/nsc/xuan/ngc/DeepLearningExamples/PyTorch/Segmentation/nnUNet +cd DeepLearningExamples/PyTorch/Segmentation/nnUNet 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 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 ``` @@ -53,11 +72,11 @@ enroot start --rw --mount ${PWD}/data:/data --mount ${PWD}/results:/results nnun python download.py --task 01 python preprocess.py --task 01 --dim 2 ``` -Exit the image. +Exit the 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 ``` - Run the script. diff --git a/scripts/copy_data_for_benchmark.sh b/scripts/copy_data_for_benchmark.sh index 798a31b..0b8279a 100644 --- a/scripts/copy_data_for_benchmark.sh +++ b/scripts/copy_data_for_benchmark.sh @@ -1,3 +1,5 @@ +mkdir data_orig +cp -a data/* data_orig/ cd data/01_2d for i in {0..9}; do -- GitLab