Add threads.py, add multi-GPU support