{"action":"created","issue":{"url":"https://api.github.com/repos/numba/numba/issues/1533","labels_url":"https://api.github.com/repos/numba/numba/issues/1533/labels{/name}","comments_url":"https://api.github.com/repos/numba/numba/issues/1533/comments","events_url":"https://api.github.com/repos/numba/numba/issues/1533/events","html_url":"https://github.com/numba/numba/issues/1533","id":117490673,"number":1533,"title":"wraparound option not recognized as valid keyword option for jit on CPU target","user":{"login":"spearsem","id":744988,"avatar_url":"https://avatars.githubusercontent.com/u/744988?v=3","gravatar_id":"","url":"https://api.github.com/users/spearsem","html_url":"https://github.com/spearsem","followers_url":"https://api.github.com/users/spearsem/followers","following_url":"https://api.github.com/users/spearsem/following{/other_user}","gists_url":"https://api.github.com/users/spearsem/gists{/gist_id}","starred_url":"https://api.github.com/users/spearsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spearsem/subscriptions","organizations_url":"https://api.github.com/users/spearsem/orgs","repos_url":"https://api.github.com/users/spearsem/repos","events_url":"https://api.github.com/users/spearsem/events{/privacy}","received_events_url":"https://api.github.com/users/spearsem/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-18T01:29:03Z","updated_at":"2015-12-10T22:14:52Z","closed_at":"2015-11-20T19:07:25Z","body":"I'm trying to use the `wraparound` keyword argument for `jit` to disable negative index wrap-around, but this generates a `NameError` for me. I made a toy example below and show the code pasted into IPython, followed by the traceback. I'm using Anaconda 2.7.10, and Numba 0.22.1.\r\n\r\nI did some digging in the code and I can't find a reference to `no_wraparound` other than the piece of code that handles these keyword arguments.\r\n\r\nIn particular, you can see for the target I am working with (a CPU), that the `OPTIONS` `dict` is set to [include the keyword `wraparound`](https://github.com/numba/numba/blob/992a1c1f449075273f18f36dbe6964c9afdc7763/numba/targets/cpu.py#L170), whereas the piece of code that attempts to set the flag [seems to expect this to be `no_wraparound`](https://github.com/numba/numba/blob/a854ae8513baeeaa02b99b3208597841ecea2b68/numba/targets/options.py#L46). \r\n\r\nI think from what code I read that `flags.set` is referring to the [`ConfigOptions.set` method](https://github.com/numba/numba/blob/master/numba/utils.py#L131) defined in `utils.py`. But this is actually hard to reason about because it's not clear why some of the other options map to alternative names, such as `nopython` becoming `enable_pyobject` or `looplift` becoming `enable_looplift` when the flags are set ... these names (`enable_pyobject` and `enable_looplift`) don't appear to be part of the target `OPTIONS` `dict` either, so it's unclear why they do not also raise a `NameError`. I see where [these option names exist in `compiler.py`](https://github.com/numba/numba/blob/master/numba/compiler.py#L22), but it's not clear how one goes from the `OPTIONS` `dict` of the target to the one defined in the `Flags` class. Also, `wraparound` and/or `no_wraparound` seem to have been missing from that `OPTIONS` `dict` in `compiler.py` at least for several versions going back in the commit history. I didn't bisect to see if I could find precisely where it diverges from the documentation, but it might give you some idea of where to start looking. Some clarification about how exactly that bit of code works would be very helpful. Thanks!\r\n\r\n```python\r\nIn [77]: %cpaste\r\nPasting code; enter '--' alone on the line to stop or use Ctrl-D.\r\n:from numba import jit\r\n:\r\n:def py_sum(vals, N):\r\n:    s = 0\r\n:    i = 0\r\n:    while i < N:\r\n:        s += vals[i]\r\n:        i += 1\r\n:    return s\r\n:\r\n:py_sum_jit = jit('int32 (int32[:], int32)', \r\n:                 nopython=True, \r\n:                 looplift=True, \r\n:                 wraparound=False)(py_sum)\r\n:--\r\n---------------------------------------------------------------------------\r\nNameError                                 Traceback (most recent call last)\r\n<ipython-input-77-d8e95e59d50e> in <module>()\r\n     12                  nopython=True,\r\n     13                  looplift=True,\r\n---> 14                  wraparound=False)(py_sum)\r\n\r\n/home/ely/anaconda/lib/python2.7/site-packages/numba/decorators.pyc in wrapper(func)\r\n    170         if sigs is not None:\r\n    171             for sig in sigs:\r\n--> 172                 disp.compile(sig)\r\n    173             disp.disable_compile()\r\n    174         return disp\r\n\r\n/home/ely/anaconda/lib/python2.7/site-packages/numba/dispatcher.pyc in compile(self, sig)\r\n    343 \r\n    344             flags = compiler.Flags()\r\n--> 345             self.targetdescr.options.parse_as_flags(flags, self.targetoptions)\r\n    346 \r\n    347             cres = compiler.compile_extra(self.typingctx, self.targetctx,\r\n\r\n/home/ely/anaconda/lib/python2.7/site-packages/numba/targets/options.pyc in parse_as_flags(cls, flags, options)\r\n     25         opt = cls()\r\n     26         opt.from_dict(options)\r\n---> 27         opt.set_flags(flags)\r\n     28         return flags\r\n     29 \r\n\r\n/home/ely/anaconda/lib/python2.7/site-packages/numba/targets/options.pyc in set_flags(self, flags)\r\n     45 \r\n     46         if kws.pop('wraparound', True) == False:\r\n---> 47             flags.set(\"no_wraparound\")\r\n     48 \r\n     49         if kws.pop('boundcheck', False):\r\n\r\n/home/ely/anaconda/lib/python2.7/site-packages/numba/utils.pyc in set(self, name, value)\r\n    131     def set(self, name, value=True):\r\n    132         if name not in self.OPTIONS:\r\n--> 133             raise NameError(\"Invalid flag: %s\" % name)\r\n    134         self._values[name] = value\r\n    135 \r\n\r\nNameError: Invalid flag: no_wraparound\r\n```\r\n\r\nYou may also want to elaborate in the documentation if the issue is related to the name of the keyword arg, because in the docstring it makes it seem that `wraparound` should be OK:\r\n\r\n```python\r\ntargetoptions: \r\n    For a cpu target, valid options are:\r\n        nopython: bool\r\n            Set to True to disable the use of PyObjects and Python API\r\n            calls. The default behavior is to allow the use of PyObjects\r\n            and Python API. Default value is False.\r\n\r\n        forceobj: bool\r\n            Set to True to force the use of PyObjects for every value.\r\n            Default value is False.\r\n\r\n        looplift: bool\r\n            Set to True to enable jitting loops in nopython mode while\r\n            leaving surrounding code in object mode. This allows functions\r\n            to allocate NumPy arrays and use Python objects, while the\r\n            tight loops in the function can still be compiled in nopython\r\n            mode. Any arrays that the tight loop uses should be created\r\n            before the loop is entered. Default value is True.\r\n\r\n        wraparound: bool\r\n            Set to True to enable array indexing wraparound for negative\r\n            indices, for a small performance penalty. Default value\r\n            is True.\r\n```"},"comment":{"url":"https://api.github.com/repos/numba/numba/issues/comments/163765036","html_url":"https://github.com/numba/numba/issues/1533#issuecomment-163765036","issue_url":"https://api.github.com/repos/numba/numba/issues/1533","id":163765036,"user":{"login":"d1manson","id":4244876,"avatar_url":"https://avatars.githubusercontent.com/u/4244876?v=3","gravatar_id":"","url":"https://api.github.com/users/d1manson","html_url":"https://github.com/d1manson","followers_url":"https://api.github.com/users/d1manson/followers","following_url":"https://api.github.com/users/d1manson/following{/other_user}","gists_url":"https://api.github.com/users/d1manson/gists{/gist_id}","starred_url":"https://api.github.com/users/d1manson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d1manson/subscriptions","organizations_url":"https://api.github.com/users/d1manson/orgs","repos_url":"https://api.github.com/users/d1manson/repos","events_url":"https://api.github.com/users/d1manson/events{/privacy}","received_events_url":"https://api.github.com/users/d1manson/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T22:14:52Z","updated_at":"2015-12-10T22:14:52Z","body":"Am I right in thinking that bounds checking is now off (and cannot be turned on) but negative indexing is now on (and cannot be turned off)?  That's kind of strange...at the very least this should be made clear in the intro docs (if it isn't already).\r\n\r\nDo you have any sense of how performance varies across each of the 2^2=4 combinations of checks?\r\n\r\nIdeally it would be nice to be able to control the state of those checks on a per-variable basis, but that's just being greedy."}}