mirror of
https://github.com/smyalygames/FiniteVolumeGPU.git
synced 2025-11-29 17:28:03 +01:00
Refactoring
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user