@@ -0,0 +1,2831 @@
+# *****************************************************************************%0A# Copyright (c) 2020, Intel Corporation All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions are met:%0A#%0A#     Redistributions of source code must retain the above copyright notice,%0A#     this list of conditions and the following disclaimer.%0A#%0A#     Redistributions in binary form must reproduce the above copyright notice,%0A#     this list of conditions and the following disclaimer in the documentation%0A#     and/or other materials provided with the distribution.%0A#%0A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,%0A# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR%0A# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR%0A# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,%0A# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,%0A# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;%0A# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,%0A# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR%0A# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,%0A# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A# *****************************************************************************%0A%0A%0Aimport numba%0Aimport sdc%0A%0Afrom typing import NamedTuple%0Afrom sdc.utilities.utils import sdc_overload%0A%0A%0Aclass Chunk(NamedTuple):%0A    start: int%0A    stop: int%0A%0A%0Adef get_pool_size():%0A    if sdc.config.config_use_parallel_overloads:%0A        return numba.config.NUMBA_NUM_THREADS%0A%0A    return 1%0A%0A%0A@sdc_overload(get_pool_size)%0Adef get_pool_size_overload():%0A    pool_size = get_pool_size()%0A%0A    def get_pool_size_impl():%0A        return pool_size%0A%0A    return get_pool_size_impl%0A%0A%0Adef get_chunks(size, pool_size=0):%0A    if pool_size == 0:%0A        pool_size = get_pool_size()%0A%0A    chunk_size = (size - 1) // pool_size + 1%0A%0A    chunks = %5B%5D%0A    for i in range(pool_size):%0A        start = min(i * chunk_size, size)%0A        stop = min((i + 1) * chunk_size, size)%0A        chunks.append(Chunk(start, stop))%0A%0A    return chunks%0A%0A%0A@sdc_overload(get_chunks)%0Adef get_chunks_overload(size, pool_size=0):%0A    def get_chunks_impl(size, pool_size=0):%0A        if pool_size == 0:%0A            pool_size = get_pool_size()%0A%0A        chunk_size = (size - 1) // pool_size + 1%0A%0A        chunks = %5B%5D%0A        for i in range(pool_size):%0A            start = min(i * chunk_size, size)%0A            stop = min((i + 1) * chunk_size, size)%0A            chunk = Chunk(start, stop)%0A            chunks.append(chunk)%0A%0A        return chunks%0A%0A    return get_chunks_impl%0A

Move prange utils in separate PR (#612)