Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Remove mentions to asyncreserved keyword for usage with Python 3.7 #135

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
apparently, async was never needed
removed a runaway '=True'
douglasrizzo committed Nov 7, 2019
commit fe06f562ecf7914f439503693955e76afcd33382
6 changes: 3 additions & 3 deletions elf/utils_elf.py
Original file line number Diff line number Diff line change
@@ -188,13 +188,13 @@ def hist(self, s, key=None):
else:
return self[key][s]

def transfer_cpu2gpu(self, batch_gpu, asynch=True):
def transfer_cpu2gpu(self, batch_gpu):
''' transfer batch data to gpu '''
# For each time step
for k, v in self.batch.items():
batch_gpu[k].copy_(v, asynch=asynch)
batch_gpu[k].copy_(v)

def transfer_cpu2cpu(self, batch_dst, asynch=True):
def transfer_cpu2cpu(self, batch_dst):
''' transfer batch data to cpu '''

# For each time step
8 changes: 4 additions & 4 deletions elf_python/memory_receiver.py
Original file line number Diff line number Diff line change
@@ -75,19 +75,19 @@ def _cpu2gpu(batch_cpu, batch_gpu, allow_incomplete_batch=False):
if isinstance(batch_cpu_t[k], (torch.FloatTensor, torch.LongTensor)):
if allow_incomplete_batch:
if len(batch_cpu_t[k].size()) == 1:
batch_gpu_t[k] = batch_cpu_t[k][:batchsize].cuda(asynch=True)
batch_gpu_t[k] = batch_cpu_t[k][:batchsize].cuda()
else:
batch_gpu_t[k] = batch_cpu_t[k][:batchsize, :].cuda(asynch=True)
batch_gpu_t[k] = batch_cpu_t[k][:batchsize, :].cuda()
else:
if isinstance(batch_cpu_t[k], torch.FloatTensor):
if k not in batch_gpu_t:
batch_gpu_t[k] = torch.cuda.FloatTensor(batch_cpu_t[k].size())
batch_gpu_t[k].copy_(batch_cpu_t[k], asynch=True)
batch_gpu_t[k].copy_(batch_cpu_t[k])

elif isinstance(batch_cpu_t[k], torch.LongTensor):
if k not in batch_gpu_t:
batch_gpu_t[k] = torch.cuda.LongTensor(batch_cpu_t[k].size())
batch_gpu_t[k].copy_(batch_cpu_t[k], asynch=True)
batch_gpu_t[k].copy_(batch_cpu_t[k])
else:
batch_gpu_t[k] = batch_cpu_t[k]

2 changes: 1 addition & 1 deletion rlpytorch/runner/parameter_server.py
Original file line number Diff line number Diff line change
@@ -215,7 +215,7 @@ def process_main(self, i, gpu_id):

while True:
self.cvs_recv[i].wait()
utils_elf.transfer_cpu2gpu(batch, batch_gpu, asynch=True)
utils_elf.transfer_cpu2gpu(batch, batch_gpu)
self.cvs_send[i].notify()
self.cb_remote_batch_process(context, batch_gpu)