你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-08 07:24:19 +08:00
Updates for version 3.1.0 - Big Smoke. These updates are predominately to enable gprMax to be run on GPUs using NVIDIA CUDA.
这个提交包含在:
@@ -87,8 +87,18 @@ class FDTDGrid(Grid):
|
||||
self.messages = True
|
||||
self.tqdmdisable = False
|
||||
|
||||
# Get information about host machine
|
||||
self.hostinfo = None
|
||||
|
||||
# CPU - OpenMP threads
|
||||
self.nthreads = 0
|
||||
|
||||
# GPU
|
||||
# Threads per block
|
||||
self.tpb = (256, 1, 1)
|
||||
|
||||
# GPU object
|
||||
self.gpu = None
|
||||
|
||||
# Threshold (dB) down from maximum power (0dB) of main frequency used
|
||||
# to calculate highest frequency for numerical dispersion analysis
|
||||
@@ -168,6 +178,33 @@ class FDTDGrid(Grid):
|
||||
self.Tz = np.zeros((Material.maxpoles, self.nx + 1, self.ny + 1, self.nz + 1), dtype=complextype)
|
||||
self.updatecoeffsdispersive = np.zeros((len(self.materials), 3 * Material.maxpoles), dtype=complextype)
|
||||
|
||||
def gpu_set_blocks_per_grid(self):
|
||||
"""Set the blocks per grid size used for updating the electric and magnetic field arrays on a GPU."""
|
||||
self.bpg = (int(np.ceil(((self.nx + 1) * (self.ny + 1) * (self.nz + 1)) / self.tpb[0])), 1, 1)
|
||||
|
||||
def gpu_initialise_arrays(self):
|
||||
"""Initialise standard field arrays on GPU."""
|
||||
|
||||
import pycuda.gpuarray as gpuarray
|
||||
|
||||
self.ID_gpu = gpuarray.to_gpu(self.ID)
|
||||
self.Ex_gpu = gpuarray.to_gpu(self.Ex)
|
||||
self.Ey_gpu = gpuarray.to_gpu(self.Ey)
|
||||
self.Ez_gpu = gpuarray.to_gpu(self.Ez)
|
||||
self.Hx_gpu = gpuarray.to_gpu(self.Hx)
|
||||
self.Hy_gpu = gpuarray.to_gpu(self.Hy)
|
||||
self.Hz_gpu = gpuarray.to_gpu(self.Hz)
|
||||
|
||||
def gpu_initialise_dispersive_arrays(self):
|
||||
"""Initialise dispersive material coefficient arrays on GPU."""
|
||||
|
||||
import pycuda.gpuarray as gpuarray
|
||||
|
||||
self.Tx_gpu = gpuarray.to_gpu(self.Tx)
|
||||
self.Ty_gpu = gpuarray.to_gpu(self.Ty)
|
||||
self.Tz_gpu = gpuarray.to_gpu(self.Tz)
|
||||
self.updatecoeffsdispersive_gpu = gpuarray.to_gpu(self.updatecoeffsdispersive)
|
||||
|
||||
|
||||
def dispersion_analysis(G):
|
||||
"""
|
||||
|
在新工单中引用
屏蔽一个用户