@@ -57,11 +57,10 @@ def memcpy_htod(self, dest, src):
57
57
"""This method must implement a host to device copy."""
58
58
pass
59
59
60
- def refresh_memory (self , arguments , should_sync ):
61
- """Copy the original content of the output memory to device memory."""
62
- for i , arg in enumerate (arguments ):
63
- if should_sync [i ]:
64
- self .memcpy_htod (self .allocations [i ], arg )
60
+ @abstractmethod
61
+ def refresh_memory (self , device_memory , host_arguments , should_sync ):
62
+ """This method must implement refreshing the device memory with a clean copy."""
63
+ pass
65
64
66
65
67
66
class GPUBackend (Backend ):
@@ -86,6 +85,12 @@ def copy_texture_memory_args(self, texmem_args):
86
85
"""This method must implement the allocation and copy of texture memory to the GPU."""
87
86
pass
88
87
88
+ def refresh_memory (self , gpu_memory , host_arguments , should_sync ):
89
+ """Refresh the GPU memory with the untouched host arguments."""
90
+ for i , arg in enumerate (host_arguments ):
91
+ if should_sync [i ]:
92
+ self .memcpy_htod (gpu_memory [i ], arg )
93
+
89
94
90
95
class CompilerBackend (Backend ):
91
96
"""Base class for compiler backends"""
@@ -94,6 +99,12 @@ class CompilerBackend(Backend):
94
99
def __init__ (self , iterations , compiler_options , compiler ):
95
100
pass
96
101
102
+ def refresh_memory (self , gpu_memory , host_arguments , should_sync ):
103
+ """Refresh the GPU memory with the untouched host arguments."""
104
+ for i , arg in enumerate (host_arguments ):
105
+ if should_sync [i ]:
106
+ self .memcpy_htod (self .allocations [i ], arg )
107
+
97
108
@abstractmethod
98
109
def cleanup_lib (self ):
99
110
"""Unload the previously loaded shared library"""
0 commit comments