From d742733279c77fa28a13122b4fc0d2bed4f6e805 Mon Sep 17 00:00:00 2001 From: David Rowenhorst Date: Mon, 10 Jun 2024 17:51:14 -0400 Subject: [PATCH] Attempt to fix Apple M-series and NLPAR gpu Signed-off by: David Rowenhorst --- pyebsdindex/_ebsd_index_parallel.py | 2 +- pyebsdindex/opencl/nlpar_cl.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyebsdindex/_ebsd_index_parallel.py b/pyebsdindex/_ebsd_index_parallel.py index dcdce45..cf4a64f 100644 --- a/pyebsdindex/_ebsd_index_parallel.py +++ b/pyebsdindex/_ebsd_index_parallel.py @@ -312,7 +312,7 @@ def index_pats_distributed( ngpupro = min(max(6, ngpu*6), 12) # number of processes that will serve data to the gpu #ngpupro = 8 if n_cpu_nodes < 8: - ngpupro = min(ngpupro,8) + ngpupro = min(ngpupro, n_cpu_nodes) if n_cpu_nodes < 2: ngpupro = 2 #if OSPLATFORM == 'Linux': diff --git a/pyebsdindex/opencl/nlpar_cl.py b/pyebsdindex/opencl/nlpar_cl.py index a3307a2..a367788 100644 --- a/pyebsdindex/opencl/nlpar_cl.py +++ b/pyebsdindex/opencl/nlpar_cl.py @@ -163,7 +163,7 @@ def calcsigma_cl(self,nn=1,saturation_protect=True,automask=True, normalize_d=Fa #print(gpu_id) clparams.get_context(gpu_id=gpu_id, kfile = 'clnlpar.cl') clparams.get_queue() - target_mem = clparams.queue.device.max_mem_alloc_size//2 + target_mem = min(clparams.queue.device.max_mem_alloc_size//2, int(4e9)) ctx = clparams.ctx prg = clparams.prg queue = clparams.queue @@ -400,7 +400,7 @@ def calcnlpar_cl(self, searchradius=None, lam = None, dthresh = None, saturation #print(gpu_id) clparams.get_context(gpu_id=gpu_id, kfile ='clnlpar.cl') clparams.get_queue() - target_mem = clparams.queue.device.max_mem_alloc_size//2 + target_mem = min(clparams.queue.device.max_mem_alloc_size//4, int(2e9)) ctx = clparams.ctx prg = clparams.prg queue = clparams.queue