Opinions : GPU enabled wheel to target CPU only no GPU device


First, I am no Pytorch user, I only build the wheels for others.

At the moment, I build a CPU and GPU wheel and suffixed them with _cpu and _gpu. The drawback is that some users have difficulties installing the torch wheels since many other wheels depends on torch and not torch_[cg]pu (e.g. allennlp, pytorch-pretrained-bert).

I wonder if I build torch with GPU+CPU support, then if users not using GPUs will encounters issues?
(errors such as : “no cuda capable device found” are ok and acceptable in the context of no GPU device and code not targeted to the CPU.)
I am aware that many GPU operations are encapsulated into torch.cuda and shielded with torch.cuda.is_available().

I did run the Pytorch tests with a torch_gpu wheel and no GPU device, and most of them succeeded.

What are your thoughts on this? Do you see any caveats/issues?



Until quite recently, the cpu wheel from the website was actually the cuda 8.0 wheel :wink: So a gpu wheel should be perfectly fine to use in a cpu-only environment (if you encounter any problem, do raise an issue as it should be the case).
The reason why we now have pure cpu binary is just because of size as the cuda ones are much larger and it’s nice to have a slim cpu binary.

One thing that has a big impact on wheel size in particular is the list of cuda architecture you provide it, so you might want to be careful with the exact cuda arch you build for to make sure it covers all your users (Some arch will work with code compiled for other ones but will be slower or won’t take advantage of new features).