---
tags: teaching, swd6
---
# 2022-11 <br> SWD6: High Performance Python π
Welcome to the hack pad for SWD6 course from Research Computing at the University of Leeds!
You can edit this document using [Markdown syntax](https://guides.github.com/features/mastering-markdown/).
## Contents
1. [Links to resource](#Links-to-resources)
2. [Agenda](#Agenda)
3. [What's your name and where do you come from?](#Whatβs-your-name-and-where-do-you-come-from)
## Links to resources
- [Workshop Book](https://arctraining.github.io/swd6_hpp/)
- [Github repository](https://github.com/ARCTraining/swd6_hpp)
- [Research Computing website](https://arc.leeds.ac.uk/)
- [Contact Research Computing](https://bit.ly/arc-help)
- [Teams link](https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZGQwMjcyMzItOTdmNy00NjdlLWFjNDgtYWFhYjczODgxMmY0%40thread.v2/0?context=%7b%22Tid%22%3a%22bdeaeda8-c81d-45ce-863e-5232a535b7cb%22%2c%22Oid%22%3a%2280803cb5-e822-4cba-83ba-e3909f66677b%22%7d)
## Location & pre workshop prep
**Please ensure you have done the pre workshop prep**
This is an in person training course that is taking place in [West Teaching Lab Upper (G.29)](https://it.leeds.ac.uk/it?id=kb_article&sysparm_article=KB0011378) - School of Fine Art, History of Art and Cultural Studies. This is a computer cluster but we recommend you bring the device you do your computational work on.
- **_Essential_**: To prepare for this workshop please register for a [Google account](https://accounts.google.com/signup) to allow you access to Google Colab.
- **_Optional_**: You may also want to install the required environment on your own personal device. This setup can be time consuming so in advance of the workshop please do the following:
- installing the [conda package manager tool](https://docs.conda.io/en/latest/miniconda.html)
- Installing `mamba` into your `base` conda environment
```bash
# mamba is an improved version of conda
# install this for more performant environment generation
$ conda activate base
$ conda install -c conda-forge mamba
```
- downloading the workshop repository
- creating the workshop conda environment (specify the correct file for your operating system)
```bash
# If you have git and conda installed you can do this with the following steps
$ git clone https://github.com/ARCTraining/swd6_hpp
$ cd swd6_hpp
# if on Linux or using WSL2
$ mamba env create -f environment.yml
# if on MacOS
$ mamba env create -f environment_mac.yml
# if on Windows (but not using WSL2)
$ mamba env create -f environment_win_native.yml
```
If you have any issues performing the setup please get in touch.
## Agenda
| Time | Agenda |
| --------- | ----------------------------------------------------------------- |
| 10:00 | Welcome, optimising your code |
| 11:00 | Break |
| 11:10 | Optimising your code (cont.) |
| 12:00 | Lunch |
| 13:00 | Compilers and Parallelisation |
| 14:30 | Break |
| 14:40 | Parallelisation(cont.) and GPU |
| 16:00 | Close |
## What's your name and where do you come from?
- **Add your own entry below using the edit mode**
## Primes function
```python=
def primes(n):
if n==2:
return [2]
elif n<2:
return []
s=list(range(3,n+1,2))
mroot = n ** 0.5
half=(n+1)//2-1
i=0
m=3
while m <= mroot:
if s[i]:
j=(m*m-3)//2
s[j]=0
while j<half:
s[j]=0
j+=m
i=i+1
m=2*i+3
primes = [2]
for x in s:
if x:
primes.append(x)
return primes
```