Hi,

nested prange loops seem to be a common gotcha for users. I can't say if there is ever a reason to do this, but at least I can't think of any. For me, this sounds like we should turn it into a compile time error – unless someone can think of a use case? Even in that case, I'd still emit a warning since it seems so unlikely to be intended.

Please reply to the cython-users list to facilitate user feedback.

Stefan



-------- Forwarded Message --------
Subject: Re: [cython-users] Converting to Python objects with nogil (inside prange for loop)
Date: Fri, 15 Jul 2022 07:43:26 +0100


with nogil, parallel():
  for i in prange(N):
    for j in prange(km.BatchSize):

You usually only want one loop in a set of nested loops to be prange. Typically the outer loop, but in this case it might be easier to parallelize the inner loop.

_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to