- Clone this repo (optionally: fork it to your github first)
git clone <>
- Enter the directory and make your virtual environment (any Python3 version should be fine. Here I use 3.9)
cd ghc2024-vectorization-workshop
python3.9 -m venv venv
- Activate your new virtual environment
source venv/bin/activate
- Install required packages from the requirements.txt
python -m pip install -r requirements.txt
-
Open a new Google Colab Notebook (https://colab.research.google.com). You will need to be signed into your own Google account
-
copy-paste the code from
utils.py
into the first cell and run
-
Open the
q#.py
in your text editor, according to the question (q1 through q7). For the given question, put your optimized code in thevec_*
function where it sayspass # insert your code here
. -
To test that your function works and compare the speed (for relevent questions) by running the
test_run.py
script:
python test_run.py
Note: if you're having trouble with one function and want to skip to the next one, just use #
to comment out that line in the test_run.py
If your function matches the desired output, then you should see either a "Success" message, or a printout of the timing differences.
-
Copy the code from the
q#.py
for your corresponding question (q1 through q7). Be sure to include the imports too, EXCEPT **do not include the linefrom util import print_time_results, time_funcs
. You have already pasted these functions into your notebook during the Setup. -
Update the
vec_*
function where it sayspass # insert your code here
. -
Run the
test_*
function to determine if your output is satisfactory, and what the speedup is (for relevent questions). You won't use thetest_run.py
script if you're working in a Notebook; just copy-paste thetest_
functions directly and run them.
- Go to the Google Form https://forms.gle/9xrjTUSEDozPm4kJ6 and report the speed-up factor you acheived for each function! We'll shout-out the biggest speed-ups live in the workshop.