你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 23:14:03 +08:00
PEP8 code cleanups.
这个提交包含在:
@@ -28,9 +28,11 @@ np.seterr(invalid='raise')
|
|||||||
from gprMax.constants import c
|
from gprMax.constants import c
|
||||||
from gprMax.constants import floattype
|
from gprMax.constants import floattype
|
||||||
from gprMax.constants import complextype
|
from gprMax.constants import complextype
|
||||||
|
from gprMax.exceptions import GeneralError
|
||||||
from gprMax.materials import Material
|
from gprMax.materials import Material
|
||||||
from gprMax.pml import PML
|
from gprMax.pml import PML
|
||||||
from gprMax.utilities import fft_power
|
from gprMax.utilities import fft_power
|
||||||
|
from gprMax.utilities import human_size
|
||||||
from gprMax.utilities import round_value
|
from gprMax.utilities import round_value
|
||||||
|
|
||||||
|
|
||||||
@@ -234,8 +236,8 @@ class FDTDGrid(Grid):
|
|||||||
# Check if model can be run on specified GPU if required
|
# Check if model can be run on specified GPU if required
|
||||||
if self.gpu is not None:
|
if self.gpu is not None:
|
||||||
if self.memoryusage > self.gpu.totalmem:
|
if self.memoryusage > self.gpu.totalmem:
|
||||||
if snapmemsize != 0:
|
if snapsmemsize != 0:
|
||||||
G.snapsgpu2cpu = True
|
self.snapsgpu2cpu = True
|
||||||
else:
|
else:
|
||||||
raise GeneralError('Memory (RAM) required ~{} exceeds {} detected on specified {} - {} GPU!\n'.format(human_size(self.memoryusage), human_size(self.gpu.totalmem, a_kilobyte_is_1024_bytes=True), self.gpu.deviceID, self.gpu.name))
|
raise GeneralError('Memory (RAM) required ~{} exceeds {} detected on specified {} - {} GPU!\n'.format(human_size(self.memoryusage), human_size(self.gpu.totalmem, a_kilobyte_is_1024_bytes=True), self.gpu.deviceID, self.gpu.name))
|
||||||
|
|
||||||
|
@@ -174,7 +174,7 @@ def gpu_initialise_snapshot_array(G):
|
|||||||
G (class): Grid class instance - holds essential parameters describing the model.
|
G (class): Grid class instance - holds essential parameters describing the model.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
snapE*_gpu, snapH*_gpu (float): numpy arrays of snapshot data on GPU.
|
snapE_gpu, snapH_gpu (float): numpy arrays of snapshot data on GPU.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pycuda.gpuarray as gpuarray
|
import pycuda.gpuarray as gpuarray
|
||||||
|
@@ -392,4 +392,3 @@ def detect_gpus():
|
|||||||
print('GPU(s) detected: {}'.format(' | '.join(gputext)))
|
print('GPU(s) detected: {}'.format(' | '.join(gputext)))
|
||||||
|
|
||||||
return gpus
|
return gpus
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户