fixed a bug in calculating the number of gpus