From 2274fa1c9f14061d294ba01298f7addfe0fedd3d Mon Sep 17 00:00:00 2001 From: Matthew R Hermes Date: Wed, 13 Nov 2024 17:40:51 -0600 Subject: [PATCH] hotfix #127 proper handling of array size < nthreads --- my_pyscf/lassi/op_o1/utilities.py | 1 + 1 file changed, 1 insertion(+) diff --git a/my_pyscf/lassi/op_o1/utilities.py b/my_pyscf/lassi/op_o1/utilities.py index f85a1e3e..e7276866 100644 --- a/my_pyscf/lassi/op_o1/utilities.py +++ b/my_pyscf/lassi/op_o1/utilities.py @@ -133,6 +133,7 @@ def get_contig_blks (mask): def split_contig_array (arrlen, nthreads): '''Divide a contiguous array into chunks to be handled by each thread''' + nthreads = min (arrlen, nthreads) blklen, rem = divmod (arrlen, nthreads); blklen = np.array ([blklen,]*nthreads) blklen[:rem] += 1