Skip to content

Commit

Permalink
Merge pull request #8392 from apmasell/release0.56.1
Browse files Browse the repository at this point in the history
Release0.56.1
  • Loading branch information
sklam committed Sep 1, 2022
2 parents fd3e40f + 467acf6 commit 98272cb
Show file tree
Hide file tree
Showing 28 changed files with 628 additions and 270 deletions.
22 changes: 22 additions & 0 deletions CHANGE_LOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Version 0.56.1 (1 September, 2022)
----------------------------------

This is a bugfix release that supports NumPy 1.23 and fixes CUDA function
caching.

Pull-Requests:

* PR `#8239 <https://github.com/numba/numba/pull/8239>`_: Add decorator to run a test in a subprocess (`stuartarchibald <https://github.com/stuartarchibald>`_)
* PR `#8276 <https://github.com/numba/numba/pull/8276>`_: Move Azure to use macos-11 (`stuartarchibald <https://github.com/stuartarchibald>`_)
* PR `#8310 <https://github.com/numba/numba/pull/8310>`_: CUDA: Fix Issue #8309 - atomics don't work on complex components (`Graham Markall <https://github.com/gmarkall>`_)
* PR `#8342 <https://github.com/numba/numba/pull/8342>`_: Upgrade to ubuntu-20.04 for azure pipeline CI (`jamesobutler <https://github.com/jamesobutler>`_)
* PR `#8356 <https://github.com/numba/numba/pull/8356>`_: Update setup.py, buildscripts, CI and docs to require setuptools<60 (`stuartarchibald <https://github.com/stuartarchibald>`_)
* PR `#8374 <https://github.com/numba/numba/pull/8374>`_: Don't pickle LLVM IR for CUDA code libraries (`Graham Markall <https://github.com/gmarkall>`_)
* PR `#8377 <https://github.com/numba/numba/pull/8377>`_: Add support for NumPy 1.23 (`stuartarchibald <https://github.com/stuartarchibald>`_)
* PR `#8384 <https://github.com/numba/numba/pull/8384>`_: Move strace() check into tests that actually need it (`stuartarchibald <https://github.com/stuartarchibald>`_)
* PR `#8386 <https://github.com/numba/numba/pull/8386>`_: Fix the docs for numba.get_thread_id (`stuartarchibald <https://github.com/stuartarchibald>`_)
* PR `#8407 <https://github.com/numba/numba/pull/8407>`_: Pin NumPy version to 1.18-1.24 (`Andre Masella <https://github.com/apmasell>`_)
* PR `#8411 <https://github.com/numba/numba/pull/8411>`_: update version support table for 0.56.1 (`esc <https://github.com/esc>`_)
* PR `#8412 <https://github.com/numba/numba/pull/8412>`_: Create changelog for 0.56.1 (`Andre Masella <https://github.com/apmasell>`_)
* PR `#8413 <https://github.com/numba/numba/pull/8413>`_: Fix Azure CI for NumPy 1.23 and use conda-forge scipy (`Siu Kwan Lam <https://github.com/sklam>`_)

Version 0.56.0 (25 July, 2022)
------------------------------

Expand Down
16 changes: 8 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ jobs:
- template: buildscripts/azure/azure-linux-macos.yml
parameters:
name: macOS
vmImage: macOS-10.15
vmImage: macos-11
matrix:
py37_np118:
PYTHON: '3.7'
NUMPY: '1.18'
CONDA_ENV: 'azure_ci'
TEST_START_INDEX: 0
py310_np122:
py310_np123:
PYTHON: '3.10'
NUMPY: '1.22'
NUMPY: '1.23'
CONDA_ENV: 'azure_ci'
TEST_THREADING: 'tbb'
TEST_START_INDEX: 1

- template: buildscripts/azure/azure-linux-macos.yml
parameters:
name: Linux
vmImage: ubuntu-18.04
vmImage: ubuntu-20.04
matrix:
py37_np118_32bit:
# 32 bit linux only has np 1.15
Expand Down Expand Up @@ -107,19 +107,19 @@ jobs:
NUMPY: '1.21'
CONDA_ENV: azure_ci
TEST_START_INDEX: 14
py39_np122:
py39_np123:
PYTHON: '3.9'
NUMPY: '1.22'
NUMPY: '1.23'
CONDA_ENV: azure_ci
TEST_START_INDEX: 15
py310_np121:
PYTHON: '3.10'
NUMPY: '1.21'
CONDA_ENV: azure_ci
TEST_START_INDEX: 16
py310_np122:
py310_np123:
PYTHON: '3.10'
NUMPY: '1.22'
NUMPY: '1.23'
CONDA_ENV: azure_ci
TEST_START_INDEX: 17

Expand Down
4 changes: 2 additions & 2 deletions buildscripts/azure/azure-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
py310_np122:
py310_np123:
PYTHON: '3.10'
NUMPY: '1.22'
NUMPY: '1.23'
CONDA_ENV: 'testenv'
TEST_START_INDEX: 18
py37_np118:
Expand Down
8 changes: 4 additions & 4 deletions buildscripts/condarecipe.local/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ requirements:
host:
- python
- numpy
- setuptools
- setuptools <60
- importlib_metadata # [py<39]
# On channel https://anaconda.org/numba/
- llvmlite 0.39.*
Expand All @@ -45,8 +45,8 @@ requirements:
run:
- python >=3.7
# NumPy 1.22.0, 1.22.1, 1.22.2 are all broken for ufuncs, see #7756
- numpy >=1.18, !=1.22.0, !=1.22.1, !=1.22.2, <1.24
- setuptools
- numpy >=1.18, !=1.22.0, !=1.22.1, !=1.22.2, <1.23
- setuptools <60
- importlib_metadata # [py<39]
# On channel https://anaconda.org/numba/
- llvmlite 0.39.*
Expand Down Expand Up @@ -76,7 +76,7 @@ test:
# temporarily disable scipy testing on ARM, need to build out more packages
- scipy # [not (armv6l or armv7l)]
- ipython # [not (armv6l or armv7l or aarch64)]
- setuptools
- setuptools <60
- tbb >=2021 # [not (armv6l or armv7l or aarch64 or linux32 or ppc64le)]
- llvm-openmp # [osx]
# This is for driving gdb tests
Expand Down
5 changes: 3 additions & 2 deletions buildscripts/gpuci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ gpuci_mamba_retry create -n numba_ci -y \
"cffi" \
"psutil" \
"gcc_linux-64=7" \
"gxx_linux-64=7"
"gxx_linux-64=7" \
"setuptools<60"

conda activate numba_ci

if [ $NUMBA_CUDA_USE_NVIDIA_BINDING == "1" ]
then
gpuci_logger "Install NVIDIA CUDA Python bindings";
gpuci_mamba_retry install nvidia::cuda-python;
gpuci_mamba_retry install nvidia::cuda-python=11.7.0;
fi;

gpuci_logger "Install numba"
Expand Down
4 changes: 3 additions & 1 deletion buildscripts/incremental/setup_conda_environment.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ call deactivate
@rem Display root environment (for debugging)
conda list
@rem Scipy, CFFI, jinja2 and IPython are optional dependencies, but exercised in the test suite
conda create -n %CONDA_ENV% -q -y python=%PYTHON% numpy=%NUMPY% cffi pip scipy jinja2 ipython gitpython pyyaml
conda create -n %CONDA_ENV% -q -y python=%PYTHON% numpy=%NUMPY% cffi pip jinja2 ipython gitpython pyyaml "setuptools<60"

call activate %CONDA_ENV%
@rem Scipy comes from conda-forge for NumPy 1.23
if %NUMPY% == "1.23" (%CONDA_INSTALL% conda-forge::scipy) else (%CONDA_INSTALL% scipy)
@rem Install latest llvmlite build
%CONDA_INSTALL% -c numba/label/dev llvmlite=0.39
@rem Install required backports for older Pythons
Expand Down
8 changes: 6 additions & 2 deletions buildscripts/incremental/setup_conda_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ conda list
if [[ "$CONDA_SUBDIR" == "linux-32" || "$BITS32" == "yes" ]]; then
conda create -n $CONDA_ENV -q -y ${EXTRA_CHANNELS} python=$PYTHON pip gitpython pyyaml
else
conda create -n $CONDA_ENV -q -y ${EXTRA_CHANNELS} python=$PYTHON numpy=$NUMPY pip gitpython pyyaml
conda create -n $CONDA_ENV -q -y ${EXTRA_CHANNELS} python=$PYTHON numpy=$NUMPY pip gitpython pyyaml "setuptools<60"
fi

# Activate first
Expand All @@ -63,7 +63,11 @@ if [ "${VANILLA_INSTALL}" != "yes" ]; then
# Only install scipy on 64bit, else it'll pull in NumPy, 32bit linux needs
# to get scipy from pip
if [[ "$CONDA_SUBDIR" != "linux-32" && "$BITS32" != "yes" ]] ; then
$CONDA_INSTALL ${EXTRA_CHANNELS} scipy
if [[ "$NUMPY" == "1.23" ]] ; then
$CONDA_INSTALL ${EXTRA_CHANNELS} conda-forge::scipy
else
$CONDA_INSTALL ${EXTRA_CHANNELS} scipy
fi
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- llvmlite=0.39
- numpy
- numpydoc
- setuptools
- setuptools<60
# https://stackoverflow.com/questions/67542699/readthedocs-sphinx-not-rendering-bullet-list-from-rst-fileA
- docutils==0.16
# The following is needed to fix RTD.
Expand Down
8 changes: 5 additions & 3 deletions docs/source/user/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ vary with target operating system and hardware. The following lists them all

* Required build time:

* ``setuptools``
* ``setuptools<60``
* ``numpy``
* ``llvmlite``
* Compiler toolchain mentioned above

* Required run time:

* ``setuptools``
* ``setuptools<60``
* ``numpy``
* ``llvmlite``

Expand Down Expand Up @@ -278,7 +278,9 @@ information.
+===========+==============+===========================+============================+==============================+===================+=============================+
| 0.57.x | TBC | 3.8.x <= version < 3.12 | 1.19 <= version < 1.24 | 0.40.x | 11.x | 2021.x |
+-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
| 0.56.x | 2022-07-25 | 3.7.x <= version < 3.11 | 1.18 <= version < 1.23 | 0.39.x | 11.x | 2021.x |
| 0.56.1 | TBC | 3.7.x <= version < 3.11 | 1.18 <= version < 1.24 | 0.39.x | 11.x | 2021.x |
+-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
| 0.56.0 | 2022-07-25 | 3.7.x <= version < 3.11 | 1.18 <= version < 1.23 | 0.39.x | 11.x | 2021.x |
+-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
| 0.55.2 | 2022-05-25 | 3.7.x <= version < 3.11 | 1.18 <= version < 1.23 | 0.38.x | 11.x | 2021.x |
+-----------+--------------+---------------------------+----------------------------+------------------------------+-------------------+-----------------------------+
Expand Down
23 changes: 13 additions & 10 deletions docs/source/user/threading-layer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,18 @@ the parallel code will only execute on 2 threads. However, we can later call
size. And we do not have to worry about setting it before Numba gets imported.
It only needs to be called before the parallel function is run.

.. _numba-threading-layer-thread-id:

Getting a Thread ID
-------------------

In some cases it may be beneficial to have access to a unique identifier for the
current thread that is executing a parallel region in Numba. For that purpose,
Numba provides the :func:`numba.get_thread_id` function. This function is the
corollary of OpenMP's function ``omp_get_thread_num`` and returns an integer
between 0 (inclusive) and the number of configured threads as described above
(exclusive).

API Reference
~~~~~~~~~~~~~

Expand All @@ -298,13 +310,4 @@ API Reference

.. autofunction:: numba.get_num_threads

Getting a Thread ID
-------------------

In some cases it may be beneficial to have access to a unique identifier
for the current thread that is executing a parallel region in Numba.
For that purpose,
Numba provides the ``get_thread_id()`` function. This function is the corollary of
OpenMP's function ``omp_get_thread_num`` and returns an integer between 0 (inclusive)
and the number of configured threads as described above (exclusive).

.. autofunction:: numba.get_thread_id
18 changes: 17 additions & 1 deletion numba/core/typing/arraydecl.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,23 @@ def resolve_T(self, ary):
retty = ary.copy(layout=layout)
return retty

# NOTE: .imag and .real are implemented with @overload_attribute
def resolve_real(self, ary):
return self._resolve_real_imag(ary, attr='real')

def resolve_imag(self, ary):
return self._resolve_real_imag(ary, attr='imag')

def _resolve_real_imag(self, ary, attr):
if ary.dtype in types.complex_domain:
return ary.copy(dtype=ary.dtype.underlying_float, layout='A')
elif ary.dtype in types.number_domain:
res = ary.copy(dtype=ary.dtype)
if attr == 'imag':
res = res.copy(readonly=True)
return res
else:
msg = "cannot access .{} of array of {}"
raise TypingError(msg.format(attr, ary.dtype))

@bound_function("array.transpose")
def resolve_transpose(self, ary, args, kws):
Expand Down
37 changes: 20 additions & 17 deletions numba/cuda/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def __init__(self, codegen, name, entry_name=None, max_registers=None,
# Driver API at link time.
self._linking_files = set()

# Cache the LLVM IR string
self._llvm_strs = None
# Maps CC -> PTX string
self._ptx_cache = {}
# Maps CC -> cubin
Expand All @@ -95,8 +97,14 @@ def __init__(self, codegen, name, entry_name=None, max_registers=None,
self._nvvm_options = nvvm_options
self._entry_name = entry_name

@property
def llvm_strs(self):
if self._llvm_strs is None:
self._llvm_strs = [str(mod) for mod in self.modules]
return self._llvm_strs

def get_llvm_str(self):
return str(self._module)
return self.llvm_strs[0]

def get_asm_str(self, cc=None):
return self._join_ptxes(self._get_ptxes(cc=cc))
Expand Down Expand Up @@ -126,7 +134,7 @@ def _get_ptxes(self, cc=None):
warn(NumbaInvalidConfigWarning(msg))
options['debug'] = False

irs = [str(mod) for mod in self.modules]
irs = self.llvm_strs

if options.get('debug', False):
# If we're compiling with debug, we need to compile modules with
Expand Down Expand Up @@ -298,15 +306,15 @@ def _reduce_states(self):
after deserialization.
"""
if self._linking_files:
msg = ('cannot pickle CUDACodeLibrary function with additional '
'libraries to link against')
msg = 'Cannot pickle CUDACodeLibrary with linking files'
raise RuntimeError(msg)
if not self._finalized:
raise RuntimeError('Cannot pickle unfinalized CUDACodeLibrary')
return dict(
codegen=None,
name=self.name,
entry_name=self._entry_name,
module=self._module,
linking_libraries=self._linking_libraries,
llvm_strs=self.llvm_strs,
ptx_cache=self._ptx_cache,
cubin_cache=self._cubin_cache,
linkerinfo_cache=self._linkerinfo_cache,
Expand All @@ -315,28 +323,23 @@ def _reduce_states(self):
)

@classmethod
def _rebuild(cls, codegen, name, entry_name, module, linking_libraries,
ptx_cache, cubin_cache, linkerinfo_cache, max_registers,
nvvm_options):
def _rebuild(cls, codegen, name, entry_name, llvm_strs, ptx_cache,
cubin_cache, linkerinfo_cache, max_registers, nvvm_options):
"""
Rebuild an instance.
"""
instance = cls.__new__(cls)
super(cls, instance).__init__(codegen, name)
instance._entry_name = entry_name

instance._module = module
instance._linking_libraries = linking_libraries
instance._linking_files = set()
instance = cls(codegen, name, entry_name=entry_name)

instance._llvm_strs = llvm_strs
instance._ptx_cache = ptx_cache
instance._cubin_cache = cubin_cache
instance._linkerinfo_cache = linkerinfo_cache
instance._cufunc_cache = {}

instance._max_registers = max_registers
instance._nvvm_options = nvvm_options

instance._finalized = True

return instance


Expand Down
2 changes: 1 addition & 1 deletion numba/cuda/cudadrv/devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def array_core(ary):
a view without the repeated dimensions.
"""
if not ary.strides:
if not ary.strides or not ary.size:
return ary
core_index = []
for stride in ary.strides:
Expand Down
2 changes: 1 addition & 1 deletion numba/cuda/simulator/cudadrv/devicearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def array_core(ary):
a view without the repeated dimensions.
"""
if not ary.strides:
if not ary.strides or not ary.size:
return ary
core_index = []
for stride in ary.strides:
Expand Down
12 changes: 8 additions & 4 deletions numba/cuda/tests/cudadrv/test_cuda_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ def test_devicearray_view_bad_not_c_contig(self):
array = cuda.to_device(original)[:, ::2]
with self.assertRaises(ValueError) as e:
array.view("i4")
self.assertEqual(
"To change to a dtype of a different size,"
" the array must be C-contiguous",
str(e.exception))

msg = str(e.exception)
self.assertIn('To change to a dtype of a different size,', msg)

contiguous_pre_np123 = 'the array must be C-contiguous' in msg
contiguous_post_np123 = 'the last axis must be contiguous' in msg
self.assertTrue(contiguous_pre_np123 or contiguous_post_np123,
'Expected message to mention contiguity')

def test_devicearray_view_bad_itemsize(self):
original = np.array(np.arange(12), dtype="i2").reshape(4, 3)
Expand Down

0 comments on commit 98272cb

Please sign in to comment.