feat(kernel): make handling path and file extension for kernel by respective Context

This commit is contained in:
Anthony Berg 2025-06-24 20:18:24 +02:00
parent d4607183aa
commit 4da604737a
10 changed files with 10 additions and 10 deletions

View File

@ -221,7 +221,7 @@ class CudaContext(object):
if error_str:
self.logger.debug(f"Error: {error_str}")
kernel_filename = os.path.normpath(kernel_filename)
kernel_filename = os.path.normpath("cuda/" + kernel_filename + ".cu")
kernel_path = os.path.abspath(os.path.join(self.module_path, kernel_filename))
# self.logger.debug("Getting %s", kernel_filename)

View File

@ -91,7 +91,7 @@ class HIPContext(Context):
if error_str:
self.logger.debug(f"Compilation error: {error_str}")
kernel_filename = os.path.normpath(kernel_filename)
kernel_filename = os.path.normpath("hip/" + kernel_filename + ".hip")
kernel_path = os.path.abspath(os.path.join(self.module_path, kernel_filename))
# Create a hash of the kernel options

View File

@ -74,7 +74,7 @@ class EE2DKP07Dimsplit(BaseSimulator):
self.theta = np.float32(theta)
# Get kernels
module = context.get_module("cuda/EE2D_KP07_dimsplit.cu",
module = context.get_module("EE2D_KP07_dimsplit",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -72,7 +72,7 @@ class Force(Simulator.BaseSimulator):
self.g = np.float32(g)
# Get kernels
module = context.get_module("cuda/SWE2D_FORCE.cu",
module = context.get_module("SWE2D_FORCE",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -71,7 +71,7 @@ class HLL(Simulator.BaseSimulator):
self.g = np.float32(g)
# Get kernels
module = context.get_module("cuda/SWE2D_HLL.cu",
module = context.get_module("SWE2D_HLL",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -73,7 +73,7 @@ class HLL2(Simulator.BaseSimulator):
self.theta = np.float32(theta)
# Get kernels
module = context.get_module("cuda/SWE2D_HLL2.cu",
module = context.get_module("SWE2D_HLL2",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -80,7 +80,7 @@ class KP07(Simulator.BaseSimulator):
self.order = np.int32(order)
# Get kernels
module = context.get_module("cuda/SWE2D_KP07.cu",
module = context.get_module("SWE2D_KP07",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -80,7 +80,7 @@ class KP07Dimsplit(Simulator.BaseSimulator):
self.theta = np.float32(theta)
# Get kernels
module = context.get_module("cuda/SWE2D_KP07_dimsplit.cu",
module = context.get_module("SWE2D_KP07_dimsplit",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -73,7 +73,7 @@ class LxF(Simulator.BaseSimulator):
self.g = np.float32(g)
# Get kernels
module = context.get_module("cuda/SWE2D_LxF.cu",
module = context.get_module("SWE2D_LxF",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]

View File

@ -72,7 +72,7 @@ class WAF(Simulator.BaseSimulator):
self.g = np.float32(g)
# Get kernels
module = context.get_module("cuda/SWE2D_WAF.cu",
module = context.get_module("SWE2D_WAF",
defines={
'BLOCK_WIDTH': self.block_size[0],
'BLOCK_HEIGHT': self.block_size[1]