Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oraqlle committed May 2, 2023
2 parents cf85259 + 980eef8 commit 409b470
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 99 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- [Software and Tooling](./chapter3/software-tooling.md)
- [Bash Scripts](./chapter3/bash.md)
- [Job batching & SLURM](./chapter3/slurm.md)
- [Strudel](./chapter3/strudel.md)
- [Challenges](./chapter3/challenges.md)

- [Parallel Computing](./chapter4/chapter4.md)
Expand Down
Binary file removed src/chapter3/.DS_Store
Binary file not shown.
42 changes: 6 additions & 36 deletions src/chapter3/challenges.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,15 @@
# M3 Challenges
# Challenges

## Challenge 1

Navigate to your scratch directory and, using vim (or your chosen in-terminal editor) create a file called `hello.txt` that contains the text "Hello World". Once you have created the file, use the `cat` command to print the contents of the file to the screen.
Something simple to start off. Create a bash script called `hello.sh` that prints "Hello World" to the screen. Submit this job to the queue using `sbatch`. Check the status of the job using `squeue`. Once the job has finished, check the output using `cat`. You can find the output file in the directory you submitted the job from.

## Challenge 2

Write a bash script that prints the contents of the above hello.txt file to the screen and run it locally (on your login node).
Something a bit more involved. Clone your [challenges repository](https://github.com/MonashDeepNeuron/HPC-Training-Challenges.git) into your personal folder in the scratch directory. Then, in this same directory, create a submission script that will install python 3.10 using miniconda, create a virtual environment, install the necessary dependencies, and clone and run the `alexnet_stl10.py` script in the M3 section. Remember, don't directly load python using module, follow the instructions in the [software tooling](./software-tooling.md#python) chapter.
Once completed, commit and push your changes as well as the output.

## Challenge 3

Submit the above script to the queue by writing another SLURM bash script. Check the status of the job using `squeue`. Once the job has finished, check the output using `cat`. You can find the output file in the directory you submitted the job from.

## Challenge 4

Request an interactive node and attach to it. Once you have done this, install python 3.7 using conda.

## Challenge 5

Clone and run [this](./dl_on_m3/alexnet_stl10.py) script. You will need to first install the dependencies for it. You don't need to wait for it to finish, just make sure it is working. You will know its working if it starts listing out the loss and accuracy for each epoch. You can stop it by pressing `ctrl + c`.

Once you have confirmed that it is working, deactivate and delete the conda environment, and then end the interactive session.

> Hint: I have included the dependencies and their versions (make sure you install the right version) in the `requirements.txt` file. You will need python 3.7 to run this script.
## Challenge 6

Go back to the login node. Now you are going to put it all together. Write a bash script that does the following:

- (1) requests a compute node
- (2) installs python using conda
- (3) clones and runs the above script

Let this run fully. Check the output of the script to make sure it ran correctly. Does it match the output of the script you ran in challenge 5?
> Hint: You can check the output of the script at any time by `cat`ing the output file. The script does not need to have finished running for you to do this.
## Challenge 7

Edit your submission script so that you get a gpu node, and run the script using the gpu.
> Hint: Use the m3h partition
## Challenge 8

Now you want to clean up your working directory. First, push your solutions to your challenges repo. Then, delete the challenges directory, as well as the conda environment you created in challenge 6.
A continuation of challenge 2. Edit your submission script so that you get a gpu node, and run the script using the gpu.
Commit and push your changes as well as the output.
Binary file removed src/chapter3/imgs/aaf_strudel.png
Binary file not shown.
Binary file removed src/chapter3/imgs/auth_strudel.png
Binary file not shown.
Binary file removed src/chapter3/imgs/strudel1.png
Binary file not shown.
Binary file removed src/chapter3/imgs/strudel2.png
Binary file not shown.
Binary file removed src/chapter3/imgs/strudel_home.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/chapter3/software-tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To create and activate Python environments within Miniconda, follow these steps:
```bash
# Create a new environment
# Change env-name to whatever you want to call your environment
conda create --name env-name python=<version>
conda create --name env-name python=3.10

# Activate the environment
conda activate env-name
Expand Down
31 changes: 1 addition & 30 deletions src/chapter3/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

## Request an account

In order to access M3, you will need to request an account. To do this, follow this link: [HPC ID](https://hpc.erc.monash.edu.au/karaage/aafbootstrap). This should take you to a page this this:

![HPC ID](./imgs/aaf.png)
In order to access M3, you will need to request an account. To do this, follow this link: [HPC ID](https://hpc.erc.monash.edu.au/karaage/aafbootstrap). This should take you to a page this this: ![HPC ID](./imgs/aaf.png)

Type in Monash, as you can see here. Select Monash University, and tick the Remember my organisation box down the bottom. Once you continue to your organisation, it will take you to the Monash Uni SSO login page. You will need to login with your Monash credentials.

Expand All @@ -21,30 +19,3 @@ To request to join the MDN project, again from the Home page click on Join Exiti
In the text box type `vf38` and click search. This is the project code for MDN. Then select the project and click submit. You will now have to wait for the project admins to approve your request. Once they have done this, you will be able to access the project. This should not take longer than a few days, and you will get an email telling you when you have access.

Once you have access to everything, you are ready to get started with M3. Good job!!

## Git SSH setup

In order to reliably clone git repos in M3, in particular private ones, it is best practice to use SSH cloning. This is a bit more complicated to set up, but once it is done, it is much more streamlined. There are few steps involved. First, you will need to generate an SSH key on M3. Login to M3, and run the following command:

```bash
ssh-keygen -t ed25519 -C "[email protected]"
```

This will then prompt you to enter a file location. Just press enter to use the default location. It will then ask you to enter a passphrase. This is optional, but recommended.

Once you have generated your key, you need to add it to the ssh agent. Do this by running:

```bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
```

You will then need to copy the public key to your clipboard. You can do this by running:

```bash
cat ~/.ssh/id_ed25519.pub
```

Then, go to your github account, go to settings, and click on the SSH and GPG keys tab. Click on New SSH key, and paste the key into the box. Give it a name, and click Add SSH key.

You should now be able to clone repos using SSH. To do this, go to the repo you want to clone, but instead of copying the HTTP link, copy the SSH link, and then its regular git cloning.
31 changes: 0 additions & 31 deletions src/chapter3/strudel.md

This file was deleted.

0 comments on commit 409b470

Please sign in to comment.