Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
habrok:additional_information:course_material:advanced_exercises_solutions [2023/09/27 07:50] – [Exercise 1.6: Loop over number of images] pedro | habrok:additional_information:course_material:advanced_exercises_solutions [2024/10/28 14:40] (current) – [Exercise 0] Changed to GitLab link aurel | ||
---|---|---|---|
Line 20: | Line 20: | ||
===== Exercise 0 ===== | ===== Exercise 0 ===== | ||
- | The files needed to complete these exercises are on [[https://github.com/rug-cit-hpc/ | + | The files needed to complete these exercises are on [[https://gitrepo.service.rug.nl/cit-hpc/habrok/ |
< | < | ||
- | git clone https://github.com/rug-cit-hpc/ | + | git clone https://gitrepo.service.rug.nl/cit-hpc/habrok/ |
</ | </ | ||
Line 331: | Line 331: | ||
**Run these commands on the imagefile to see what they do.** | **Run these commands on the imagefile to see what they do.** | ||
- | As you have seen these commands result in numbers that we could use in our script. In order to store a number | + | As you have seen these commands result in numbers that we could use in our script. In order to store the output |
< | < | ||
myvar=$( command ) | myvar=$( command ) | ||
Line 649: | Line 649: | ||
** Since we are going to submit all work from a single job script, we need to make sure that the executable is in place, before we can run the script. ** This can be achieved by running the following commands: | ** Since we are going to submit all work from a single job script, we need to make sure that the executable is in place, before we can run the script. ** This can be achieved by running the following commands: | ||
< | < | ||
- | module load foss/2020a | + | module load foss/2022b |
make | make | ||
</ | </ | ||
Line 655: | Line 655: | ||
First we need a list of all images to be processed, and this time we are going to store this list in a text file instead of in a variable. | First we need a list of all images to be processed, and this time we are going to store this list in a text file instead of in a variable. | ||
- | **Run a command (you can use '' | + | **Run a command (you can use '' |
Now open the script '' | Now open the script '' | ||
Line 668: | Line 668: | ||
echo " | echo " | ||
</ | </ | ||
- | **Insert the right command between the parentheses: | + | **Insert the right command between the parentheses: |
Finally, to make this a job array, we have to set a range that defines how many times this job is going to be run. Since we use '' | Finally, to make this a job array, we have to set a range that defines how many times this job is going to be run. Since we use '' | ||
Line 692: | Line 692: | ||
#SBATCH --mem=4GB | #SBATCH --mem=4GB | ||
#SBATCH --time=00: | #SBATCH --time=00: | ||
- | #SBATCH --partition=short | + | #SBATCH --partition=regular |
#SBATCH --job-name=Edge_Detection | #SBATCH --job-name=Edge_Detection | ||
#SBATCH --array=1-31 | #SBATCH --array=1-31 | ||
Line 709: | Line 709: | ||
image=$(cat " | image=$(cat " | ||
echo " | echo " | ||
+ | |||
+ | # Clean up the module environment | ||
+ | module purge | ||
+ | # Load the conversion and identification tools | ||
+ | module load ImageMagick/ | ||
# Get the directory in which the file is stored | # Get the directory in which the file is stored | ||
Line 720: | Line 725: | ||
echo " | echo " | ||
| | ||
- | # Clean up the module environment | ||
- | module purge | ||
- | # Load the compilers | ||
- | module load foss/2020a | ||
- | |||
# Convert the jpg file to the rgb format for easy processing | # Convert the jpg file to the rgb format for easy processing | ||
convert " | convert " | ||
Line 758: | Line 758: | ||
You can study the resulting image using the command: | You can study the resulting image using the command: | ||
< | < | ||
+ | module load ImageMagick/ | ||
display -resize 30% conv_Microcrystals.jpg | display -resize 30% conv_Microcrystals.jpg | ||
</ | </ | ||
Line 770: | Line 771: | ||
#SBATCH --mem=4GB | #SBATCH --mem=4GB | ||
#SBATCH --time=00: | #SBATCH --time=00: | ||
- | #SBATCH --partition=short | + | #SBATCH --partition=regular |
#SBATCH --job-name=Blurring | #SBATCH --job-name=Blurring | ||
#SBATCH --output=singlecpu.out | #SBATCH --output=singlecpu.out | ||
Line 777: | Line 778: | ||
module purge | module purge | ||
# Load the compilers | # Load the compilers | ||
- | module load foss/2020a | + | module load foss/2022b |
+ | # Load the conversion tool | ||
+ | module load ImageMagick/ | ||
# Compile the program | # Compile the program | ||
make | make | ||
Line 804: | Line 807: | ||
After performing this exercise, you should obtain something like the following: | After performing this exercise, you should obtain something like the following: | ||
- | {{:peregrine: | + | {{:habrok: |
The '' | The '' | ||
Line 839: | Line 842: | ||
**Run the blurring app with 2, 4, 8, and 16 MPI tasks, each using one core and running on a separate node.** Make note of the runtimes, as well as the overall wallclock time. How does this differ from the previous exercise? | **Run the blurring app with 2, 4, 8, and 16 MPI tasks, each using one core and running on a separate node.** Make note of the runtimes, as well as the overall wallclock time. How does this differ from the previous exercise? | ||
+ | |||
+ | You can try to resubmit the job with 4 nodes to a '' | ||
+ | |||
+ | The " | ||
+ | |||
<hidden Solution> | <hidden Solution> | ||
Line 847: | Line 855: | ||
After performing this exercise, you should get something like this: | After performing this exercise, you should get something like this: | ||
- | {{:peregrine: | + | {{:habrok: |
It is interesting to compare this graph with the one from exercise 2.2. The main difference is in '' | It is interesting to compare this graph with the one from exercise 2.2. The main difference is in '' | ||
Line 869: | Line 877: | ||
So far, you've been using either multiple CPUs on a single machine (OpenMP), or on multiple machines (MPI), to parallelize and speed up the image processing. In this exercise, you will have a look at how to use GPUs to achieve parallelization. In the folder named '' | So far, you've been using either multiple CPUs on a single machine (OpenMP), or on multiple machines (MPI), to parallelize and speed up the image processing. In this exercise, you will have a look at how to use GPUs to achieve parallelization. In the folder named '' | ||
- | We've reserved one GPU node with 2 k40 GPUs for this course. The reservation is called '' | + | We've reserved one GPU node with 2 V100 GPUs for this course. The reservation is called '' |
< | < | ||
#SBATCH --reservation=advanced_course | #SBATCH --reservation=advanced_course | ||
</ | </ | ||
- | **Request 1 (one) GPU of type k40 on the '' | + | **Request 1 (one) GPU of type V100 on the '' |
**Compare the times from exercise 2.2 with what you obtain now**. You might want to make the problem a bit harder by processing all the files from the '' | **Compare the times from exercise 2.2 with what you obtain now**. You might want to make the problem a bit harder by processing all the files from the '' | ||
Line 879: | Line 887: | ||
Programming the GPU is not for the faint of heart, though OpenACC makes it relatively easy. If you read C code, **study the code and try to figure out where is the GPU used**. If you plan to use an existing application with the GPU, you needn' | Programming the GPU is not for the faint of heart, though OpenACC makes it relatively easy. If you read C code, **study the code and try to figure out where is the GPU used**. If you plan to use an existing application with the GPU, you needn' | ||
- | <hidden Solution> | + | <hidden Solution> |
- | + | < | |
- | ''# | + | #SBATCH --gpus-per-node=v100:1 |
- | + | #SBATCH --reservation=advanced_course | |
- | '' | + | </ |
</ | </ | ||