Skip to content
Snippets Groups Projects

Replace PyCuda with CuPy

Merged Markus Holzer requested to merge holzer/pystencils:cupy into master
Viewing commit b23889f6
Show latest version
2 files
+ 14
8
Preferences
Compare changes
Files
2
@@ -419,13 +419,19 @@ class SerialDataHandling(DataHandling):
def world_rank(self):
return 0
def save_all(self, file):
np.savez_compressed(file, **self.cpu_arrays)
def save_all(self, filename, compressed=True, synchronise_data=True):
if synchronise_data:
for name in (self.cpu_arrays.keys() & self.gpu_arrays.keys()):
self.to_cpu(name)
if compressed:
np.savez_compressed(filename, **self.cpu_arrays)
else:
np.savez(filename, **self.cpu_arrays)
def load_all(self, file):
if '.npz' not in file:
file += '.npz'
file_contents = np.load(file)
def load_all(self, filename):
if '.npz' not in filename:
filename += '.npz'
file_contents = np.load(filename)
for arr_name, arr_contents in self.cpu_arrays.items():
if arr_name not in file_contents:
print(f"Skipping read data {arr_name} because there is no data with this name in data handling")