Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Python 3.7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jma127 committed Aug 9, 2018
1 parent 751eb1c commit 673dba1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -43,7 +43,7 @@ endif()
set(CMAKE_CXX_STANDARD 17)
set(PYBIND11_CPP_STANDARD -std=c++17)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wno-register -fPIC -march=native")
"${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wno-register -Wno-deprecated-declarations -fPIC -march=native")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
Expand Down
12 changes: 6 additions & 6 deletions src_py/elf/utils_elf.py
Expand Up @@ -245,28 +245,28 @@ def half(self):
for k, v in self.batch.items()}
return new_batch

def cpu2gpu(self, gpu, async=True):
def cpu2gpu(self, gpu, non_blocking=True):
''' transfer batch data to gpu '''
# For each time step
new_batch = self.empty_copy()
new_batch.batch = {k: v.cuda(gpu, async=async)
new_batch.batch = {k: v.cuda(gpu, non_blocking=non_blocking)
for k, v in self.batch.items()}
return new_batch

def cpu2cpu(self, gpu, async=True):
def cpu2cpu(self, gpu, non_blocking=True):
''' transfer batch data to gpu '''
# For each time step
new_batch = self.empty_copy()
new_batch.batch = {k: v.clone() for k, v in self.batch.items()}
return new_batch

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

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

# For each time step
Expand Down
2 changes: 1 addition & 1 deletion src_py/rlpytorch/runner/parameter_server.py
Expand Up @@ -245,7 +245,7 @@ def process_main(self, i, gpu_id):

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

Expand Down

0 comments on commit 673dba1

Please sign in to comment.