mirror of
https://github.com/smyalygames/FiniteVolumeGPU.git
synced 2025-09-15 03:32:17 +02:00
25 lines
805 B
Python
25 lines
805 B
Python
import pycuda.driver as cuda
|
|
|
|
from GPUSimulators.gpu import KernelContext
|
|
from . import simulator, boundary
|
|
|
|
|
|
class CudaSimulator(simulator.BaseSimulator):
|
|
def __init__(self,
|
|
context: KernelContext,
|
|
nx: int, ny: int,
|
|
dx: int, dy: int,
|
|
boundary_conditions: boundary.BoundaryCondition,
|
|
cfl_scale: float,
|
|
num_substeps: int,
|
|
block_width: int, block_height: int):
|
|
super().__init__(context, nx, ny, dx, dy, boundary_conditions, cfl_scale, num_substeps, block_width,
|
|
block_height)
|
|
|
|
# Create a CUDA stream
|
|
self.stream = cuda.Stream()
|
|
self.internal_stream = cuda.Stream()
|
|
|
|
def synchronize(self):
|
|
self.stream.synchronize()
|