The Element and ParticleBeam classes have default device to "auto" which basically sets device = "cuda" if torch.cuda.is_available() else "cpu". c.f. this line and this line
The ParameterBeam, however, does not have this setting.
It will lead to RuntimeError complaining that the lattice and beam are on different devices if one runs cheetah using ParameterBeam on a PC equipped with cuda.
This is quite confusing for new users.
Suggestion: either we add to the ParameterBeam also the auto device setting (don't know if it makes sense as probably there won't be any speed gain); or perform some device checking when the simulation is called and throw a warning.
The
Element
andParticleBeam
classes have default device to "auto" which basically setsdevice = "cuda" if torch.cuda.is_available() else "cpu"
. c.f. this line and this lineThe
ParameterBeam
, however, does not have this setting.It will lead to RuntimeError complaining that the lattice and beam are on different devices if one runs cheetah using
ParameterBeam
on a PC equipped with cuda. This is quite confusing for new users.Suggestion: either we add to the ParameterBeam also the auto device setting (don't know if it makes sense as probably there won't be any speed gain); or perform some device checking when the simulation is called and throw a warning.