Skip to content

Commit

Permalink
frac ppo
Browse files Browse the repository at this point in the history
  • Loading branch information
ericl committed Nov 25, 2018
1 parent b85e7b4 commit 96599c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/ray/rllib/optimizers/multi_gpu_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import print_function

import logging
import math
import numpy as np
from collections import defaultdict
import tensorflow as tf
Expand Down Expand Up @@ -44,7 +45,9 @@ def _init(self,
if not num_gpus:
self.devices = ["/cpu:0"]
else:
self.devices = ["/gpu:{}".format(i) for i in range(num_gpus)]
self.devices = [
"/gpu:{}".format(i) for i in range(int(math.ceil(num_gpus)))
]
self.batch_size = int(sgd_batch_size / len(self.devices)) * len(
self.devices)
assert self.batch_size % len(self.devices) == 0
Expand Down

0 comments on commit 96599c7

Please sign in to comment.