I'm using Keras with Tensorflow to replicate a DQN. Actually I'm using 2 GPUs, but I want to make my code executable in every machine, regardless the number of GPUs it has. So my question is: how can I get the number of GPUs present in my PC? I checked this but it gets me a lot of info I don't need. Is there any other way to get the number of GPUs?
Asked
Active
Viewed 5,274 times
2
-
4The answer you linked literally has the answer, they enumerate the GPUs, you just have to get the length of that list. – Dr. Snoopy Apr 12 '19 at 06:40
-
That's what I thought, but I wanted to know if there are another method. With that, you had the number of gpus + cpus present in your system – Joaquin Apr 12 '19 at 11:36
-
No, they specifically filter to only get the GPUs. – Dr. Snoopy Apr 12 '19 at 11:36
1 Answers
0
If you want to know how many GPUs are there running tf.contrib.eager.num_gpus()
will give you the answer.

D_negn
- 378
- 4
- 13
-
When I try to use that, it gives me the following error: File "
", line 28 def single_image_random_dot_stereograms(depth_values, hidden_surface_removal=True, convergence_dots_size=8, dots_per_inch=72, eye_separation=2,5, mu=0,333299994, normalize=True, normalize_max=-100, normalize_min=100, border_level=0, number_colors=256, output_image_shape=[1024, 768, 1], output_data_window=[1022, 757], name=None): ^ SyntaxError: invalid syntax – Joaquin Apr 13 '19 at 04:20