Refactoring

This commit is contained in:
André R. Brodtkorb
2018-10-31 13:02:21 +01:00
parent 71777dad4e
commit 4fa09d5d39
12 changed files with 1404 additions and 633 deletions

View File

@@ -187,16 +187,20 @@ class CudaContext(object):
kernel_path = os.path.abspath(os.path.join(self.module_path, kernel_filename))
#self.logger.debug("Getting %s", kernel_filename)
# Create a hash of the kernel (and its includes)
# Create a hash of the kernel options
options_hasher = hashlib.md5()
options_hasher.update(str(defines).encode('utf-8') + str(compile_args).encode('utf-8'));
options_hash = options_hasher.hexdigest()
options_hasher = None
# Create hash of kernel souce
source_hash = CudaContext.hash_kernel( \
kernel_path, \
include_dirs=[self.module_path] + include_dirs)
# Create final hash
root, ext = os.path.splitext(kernel_filename)
kernel_hash = root \
+ "_" + CudaContext.hash_kernel( \
kernel_path, \
include_dirs=[self.module_path] + include_dirs) \
+ "_" + source_hash \
+ "_" + options_hash \
+ ext
cached_kernel_filename = os.path.join(self.cache_path, kernel_hash)

View File

@@ -85,6 +85,7 @@ class BaseSimulator:
#Keep track of simulation time
self.t = 0.0;
def __str__(self):
return "{:s} [{:d}x{:d}]".format(self.__class__.__name__, self.nx, self.ny)