$25
High Performance for Engineering Applications
All commands or code must work on Euler with no modules loaded unless specified otherwise. They may behave differently on your computer, so be sure to test on Euler before you submit.
For this assignment before we have your git repos set up, submit all responses on Canvas.
Please submit clean code. Consider using a formatter like clang-format.
1. (a) Read the files timing.md and slurm usage.md from the general directory of the ME759 Resource Repo. These are very important documents of the expectations for your assignments throughout the semester.
(b) Read the hw repos.md file and follow the instructions to create an account. This is very important and must be done in order for you to have a way to turn in HW02.
(c) At least skim workflow.md. This contains a quick guide for effectively working between your local computer and Euler.
2. Write a single line of bash for each of the following (you can use pipes and/or redirects). Pretend that any files or directories mentioned exist (don’t turn them in).
a) Print the current working directory
b) Change directories into a directory called somedir
c) List the names of all files in the current directory
d) (Optional) Write a for loop which prints each integer 0 to 10.
e) (Optional) Print the names of all files ending in .txt in the current directory or any of its subtree
f) (Optional) Print the last 2 lines of a plain text file in the current directory called sometext.txt
g) (Optional) Print the entire contents of a file in the current directory called sometext.txt
3. Using Euler and the module command, answer the following questions.
a) Are there any modules loaded (module list) when you log in?
b) What version (version number) of gcc is available to you without loading any modules?
c) List all gcc modules available on Euler.
d) Which gcc module is loaded when you run module load gcc and what version number of gcc is loaded by that module?
e) List one other piece of software that you know that has a module on Euler and one sentence about what it does. (If you aren’t familiar with any of the other software, look one up and write a sentence about it.)
4. Write a bash script called task4.sh with a Slurm header which asks for
• 2 CPU cores
• A job name of FirstSlurm
• An output file called FirstSlurm.out
• An error file called FirstSlurm.err
and runs a single command to print the hostname of the machine (compute node) running the job. This job should be submittable by running sbatch task4.sh on the head node.
5. Research some useful Slurm tools (one sentence responses):
a) Explain what SLURM SUBMIT DIR is in the environment of a running Slurm job.
b) In what directory does a Slurm job on euler begin execution. You should run some jobs to check this?
c) Explain what SLURM JOB ID is in the environment of a running Slurm job.
d) Explain what the following script header line specifies: #SBATCH --array=0-9
e) Explain what SLURM ARRAY TASK ID is in the environment of a running Slurm job with
the header from part (d).
f) Explain what the following script header line specifies: #SBATCH --gres=gpu:1
6. Write a C++ program called task6.cpp which takes a command line argument N, and prints out each integer from 0 to N (including 0 and N) separated by spaces on a single line ending in a newline.
• Compile command: g++ task6.cpp -Wall -O3 -o task6
• Run command: ./task6 N
• Expected output (followed by newline): 0 1 2 3 ··· N
• Expected output for N = 6 (followed by newline): 0 1 2 3 4 5 6