Wellcome to the Hidet tutorial!
This tutorial will show you
More documentation can be found at Hidet's website.
If you wish to play along with the tutorial notebook, we recommend that you launch a jupyter notebook.
# create a python virtual env
virtualenv hidet-tutorial && source hidet-tutorial/bin/activate
# install jupyter notebook
pip install notebook
# install dependency of this tutorial
pip install torch torchaudio torchvision wurlitzer Pygments
# install hidet
pip install hidet
# launch a jupyter notebook
jupyter notebook --port 8888 --ip 0.0.0.0
If you are using a VM provided by the workshop, simply visit <ip of the machine>:8888
You will be asked to provide a token, look for the token in the output of the jupyter
command above.
If you are using you own remote CUDA capable machine, perform a port-forwarding
ssh -NL 8888:localhost:8888 <user>@<remote>
and open http://127.0.0.1:8888
You should have already cloned the GitHub repository for this tutorial (https://github.com/CentML/asplos23-tutorial). You can find two subdirectories that contains the notebooks:
asplos23-tutorial/hidet_tutorials_ipynb/
asplos23-tutorial/hidet_script_tutorials_ipynb/
To check if Hidet is installed and functions correctly, you can run the following jupyter cell:
import hidet
print(hidet.randn([3, 4]) + 1)
Compiling cpu task adds(x=float32[3, 4])...
Tensor(shape=(3, 4), dtype='float32', device='cpu') [[2.4308946 1.0857943 0.94579965 0.20885205] [0.43885875 0.2745815 1.453223 2.7053485 ] [0.5086057 0.3385288 1.5116855 2.1649857 ]]