Refactor string handling for GPU usage report

This prepares for future addition of reporting the list of available
compatible GPUs in the auto-selection case, which is needed for gmx
tune-pme to function well. Current outputs are only of IDs of
available GPUs, or IDs of those that will be used. The latter depends
on the number of PP ranks, so it doesn't help gmx tune-pme find out
how to run the optimization. At some point, delegating this kind of
task to hwinfo called from gmx tune-pme might be preferable.

The only functionality changes here are of reporting GPU ids by
referring to them as IDs, and the string of the ones used is of style
"0,1,4" rather than "#0, #1, #4". The use of the template function and
constructing the temporary vector prepares for the next commit.

Change-Id: Ic37989ce2f8e6396f450e1b5457ea7ea70b3849b