From c4bab93c24fb50bb13a7c4529a6b75dcd1df1622 Mon Sep 17 00:00:00 2001 From: craig-warren Date: Tue, 12 May 2020 12:28:20 +0100 Subject: [PATCH] Correct bug with warning on CUDA/subgrids. --- gprMax/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gprMax/config.py b/gprMax/config.py index e32c3ac7..407cd63a 100644 --- a/gprMax/config.py +++ b/gprMax/config.py @@ -58,7 +58,7 @@ class ModelConfig: self.mode = '3D' self.grids = [] - self.ompthreads = None # Number of OpenMP threads + self.ompthreads = None # Store information for CUDA solver # gpu: GPU object @@ -72,7 +72,10 @@ class ModelConfig: # If no deviceID is given default to using deviceID 0. Else if either # a single deviceID or list of deviceIDs is given use first one. - deviceID = 0 if not deviceID else deviceID[0] + try: + deviceID = deviceID[0] + except: + deviceID = 0 self.cuda = {'gpu': sim_config.set_model_gpu(deviceID), 'snapsgpu2cpu': False} @@ -239,7 +242,7 @@ class SimulationConfig: self.general['subgrid'] = self.args.subgrid # Double precision should be used with subgrid for best accuracy self.general['precision'] = 'double' - if self.general['cuda']: + if self.general['subgrid'] and self.general['cuda']: logger.exception('The CUDA-based solver cannot currently be used with models that contain sub-grids.') raise ValueError except AttributeError: