nnaisense / evotorch

Advanced evolutionary computation library built directly on top of PyTorch, created at NNAISENSE.
https://evotorch.ai
Apache License 2.0
1.01k stars 63 forks source link

Add better help message when using device="cuda" with Ray actors #18

Closed flukeskywalker closed 1 year ago

flukeskywalker commented 2 years ago

When defining a Problem, if the user specifies device="cuda", num_actors=2 (as an example), but does not specify num_gpus_per_actor, the following error results from each actor which is not fully clear on what's wrong:

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

Such a misconfig should be detected and a more helpful message should be given instead.