text:
OSError: exception: access violation reading ... in nvvm.py

I am using cudatoolkit 10.1.168, llvmlite 0.30.0 and numba 0.46.0 in Windows 10, python 3.7.  I wrote some code for using the cuda & GPU. It drives me crazy that the kernel call line in the code doesn't compile (and run) on a random basis from time to time.
The memory access violation occurs every time in the numba\cuda\cudadrv\nvvm.py in compile(self, **options), line 232, err = self.driver.nvvmCompileProgram(self._handle, len(opts), c_opts)
8     r = cuda_dp.play_A_Game_With_GPU(env, env_out, doCheckDiceSel_2rollsLeft, doCheckDiceSel_1rollsLeft, doCheckSlotSel, countWins_out_gpu, countDraws_out_gpu, countLosts_out_gpu, avgRes_out_gpu, s_countWins_out_gpu, s_countDraws_out_gpu, s_countLosts_out_gpu, s_avgRes_out_gpu, cuda_dp.gpu_const_arrays, blocks, threads_per_block, random_states, Verbose = 0)
      9     clear_output(wait=True)
     10     if r==0:draws+=1

~\sajat\DicePokerAI\cuda_dp.py in play_A_Game_With_GPU(env_local, env_YP, doCheckDiceSel_2rollsLeft, doCheckDiceSel_1rollsLeft, doCheckSlotSel, countWins_out_gpu, countDraws_out_gpu, countLosts_out_gpu, avgRes_out_gpu, s_countWins_out_gpu, s_countDraws_out_gpu, s_countLosts_out_gpu, s_avgRes_out_gpu, gpu_const_arrays, blocks, threads_per_block, random_states, Verbose)
   1895             env_YP_gpu = cuda.to_device(env_YP)
   1896
-> 1897             kernel_call_cuda_findBestDiceSelToWin[blocks, threads_per_block](env_local_gpu,env_YP_gpu, countWins_out_gpu, countDraws_out_gpu, countLosts_out_gpu, avgRes_out_gpu, gpu_const_arrays, random_states)
   1898
   1899             countWins_out_res = countWins_out_gpu.copy_to_host()

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\compiler.py in __call__(self, *args)
    797         Specialize and invoke this kernel with *args*.
    798         '''
--> 799         kernel = self.specialize(*args)
    800         cfg = kernel[self.griddim, self.blockdim, self.stream, self.sharedmem]
    801         cfg(*args)

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\compiler.py in specialize(self, *args)
    808         argtypes = tuple(
    809             [self.typingctx.resolve_argument_type(a) for a in args])
--> 810         kernel = self.compile(argtypes)
    811         return kernel
    812

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\compiler.py in compile(self, sig)
    827             self.definitions[(cc, argtypes)] = kernel
    828             if self.bind:
--> 829                 kernel.bind()
    830         return kernel
    831

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\compiler.py in bind(self)
    541         Force binding to current CUDA context
    542         """
--> 543         self._func.get()
    544
    545     @property

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\compiler.py in get(self)
    419         cufunc = self.cache.get(device.id)
    420         if cufunc is None:
--> 421             ptx = self.ptx.get()
    422
    423             # Link

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\compiler.py in get(self)
    390             arch = nvvm.get_arch_option(*cc)
    391             ptx = nvvm.llvm_to_ptx(self.llvmir, opt=3, arch=arch,
--> 392                                    **self._extra_options)
    393             self.cache[cc] = ptx
    394             if config.DUMP_ASSEMBLY:

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\cudadrv\nvvm.py in llvm_to_ptx(llvmir, **opts)
    494     cu.add_module(libdevice.get())
    495
--> 496     ptx = cu.compile(**opts)
    497     # XXX remove debug_pubnames seems to be necessary sometimes
    498     return patch_ptx_debug_pubnames(ptx)

~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\cudadrv\nvvm.py in compile(self, **options)
    230         c_opts = (c_char_p * len(opts))(*[c_char_p(x.encode('utf8'))
    231                                           for x in opts])
--> 232         err = self.driver.nvvmCompileProgram(self._handle, len(opts), c_opts)
    233         self._try_error(err, 'Failed to compile\n')
    234

OSError: exception: access violation reading 0x000002868DC6FFF8

If I try to re-run this part of the code from jupyter without restarting the kernel, I got a slightly different error:
....
~\.conda\envs\tensorflow-gpu\lib\site-packages\numba\cuda\cudadrv\nvvm.py in check_error(self, error, msg, exit)
    139                 sys.exit(1)
    140             else:
--> 141                 raise exc
    142
    143

NvvmError: Failed to compile

NVVM_ERROR_COMPILATION

Any hint?

@pittnerf thanks for reporting this. I have updated the comment with some syntax highlighting. In order to further diagnose this it would be beneficial if you could submit a minimal reproducer of this issue. This would allow us to potentially reproduce the issue your are encountering and examine it locally. Thanks!

Is this the same program that is randomly failing?  If so, is it possible to downgrade your CUDA toolkit to 10.0?

Yes, it is the same. I will try to downgrade and let you know the result.
Thanks,
Ferenc
Stan Seibert notifications@github.com ezt írta (időpont: 2019. nov. 11.,
Hét 17:36):

Is this the same program that is randomly failing? If so, is it possible
to downgrade your CUDA toolkit to 10.0?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/numba/numba/issues/4783?email_source=notifications&email_token=AJVN22J7OM4RGFRWEZ2V6Z3QTGCYZA5CNFSM4JIZ72N2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDXMAQY#issuecomment-552517699,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJVN22KL7OECYFO6RGMLEQDQTGCYZANCNFSM4JIZ72NQ
.

Hi, I downgraded to cudatoolkit 10.0. The result is the same. After that I tried to downgrade numba to 0.40.0 which didn't work, but with 0.43.1 I got the following error:
Incorrect number of arguments passed to called function!
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %635, i64 24, i1 true) #2
isvolatile argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %635, i64 24, i1 true) #2
Incorrect number of arguments passed to called function!
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %727, i64 24, i1 true) #2
isvolatile argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %727, i64 24, i1 true) #2
Incorrect number of arguments passed to called function!
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %635, i64 24, i1 true) #2
isvolatile argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %635, i64 24, i1 true) #2
Incorrect number of arguments passed to called function!
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %727, i64 24, i1 true) #2
isvolatile argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast1799, i8* align 4 %727, i64 24, i1 true) #2
Broken module found, compilation terminated!
Traceback (most recent call last):
File "C:/Users/user/sajat/DicePokerAI/generateConsecutiveGamesAndSave_16_GPU.py", line 105, in
cuda_dp.play_A_Game_With_GPU_and_save(env_local, env_YP, doCheckDiceSel_2rollsLeft, doCheckDiceSel_1rollsLeft, doCheckSlotSel, countWins_out, countDraws_out, countLosts_out, avgRes_out, s_countWins_out, s_countDraws_out, s_countLosts_out, s_avgRes_out, gpu_const_arrays, blocks, threads_per_block, random_states, diceSelInfo_rl2_array, diceSelInfo_rl2_array_index,diceSelInfo_rl1_array, diceSelInfo_rl1_array_index,slotSelInfo_array, slotSelInfo_array_index, Verbose = 0)
File "C:\Users\user\sajat\DicePokerAI\cuda_dp.py", line 2067, in play_A_Game_With_GPU_and_save
kernel_call_cuda_findBestDiceSelToWin[blocks, threads_per_block](env_local_gpu, env_YP_gpu,countWins_out_gpu, countDraws_out_gpu,countLosts_out_gpu, avgRes_out_gpu,gpu_const_arrays, random_states)
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\compiler.py", line 765, in call
kernel = self.specialize(*args)
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\compiler.py", line 776, in specialize
kernel = self.compile(argtypes)
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\compiler.py", line 795, in compile
kernel.bind()
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\compiler.py", line 503, in bind
self._func.get()
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\compiler.py", line 381, in get
ptx = self.ptx.get()
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\compiler.py", line 352, in get
**self._extra_options)
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\cudadrv\nvvm.py", line 502, in llvm_to_ptx
ptx = cu.compile(**opts)
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\cudadrv\nvvm.py", line 233, in compile
self._try_error(err, 'Failed to compile\n')
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\cudadrv\nvvm.py", line 251, in _try_error
self.driver.check_error(err, "%s\n%s" % (msg, self.get_log()))
File "C:\Users\user.conda\envs\tensorflow_new\lib\site-packages\numba\cuda\cudadrv\nvvm.py", line 141, in check_error
raise exc
numba.cuda.cudadrv.error.NvvmError: Failed to compile
NVVM_ERROR_COMPILATION

Hi Stan,
I have some further information: the python console displays the following error message when the memory access violation occurs:
Incorrect number of arguments passed to called function!
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast3, i8* align 4 %scevgep.i10.i, i64 24, i1 false) #2
isvolatile argument of memory intrinsics must be a constant int
call void @llvm.memcpy.p5i8.p0i8.i64(i8 addrspace(5)* align 4 %bitCast3, i8* align 4 %scevgep.i10.i, i64 24, i1 false) #2
Broken module found, compilation terminated!
I hope this sounds familiar to you.  It seems to me that this is really compilation time errors, since not a line is executed from the code (not even the first print command).
I managed somehow to track down which part of the code is the problematic one: my kernel function calls a device function and there I try to retrieve a value from a big constant array (with a total size of 161 021 952 bytes):
shape = (252, 64, 3, 2 * 2* 2* 2* 2* 2, 13), dtype=numpy.float32
This array is initialized and uploaded to the GPU with the help of the cuda.to_device() function prior to the kernel invocation, and its content doesn't change during the kernel run, so it is constant.
This is the line which causes the problem in the device function:
envTotal = myArray [index, upperTotalValue, slotVal, ind, action]
My guesses are:

either the array is too big
or the number of 5 indices are too much

What do you think?
Thanks imn advance,
Ferenc

that is an excellent bit of debugging.  @sklam: Is there an index limit on the GPU?  Is it possible we're hitting some argument count limit when the array arguments are unpacked?

I can't replicate the problem.  Compilation shouldn't be affected by big array.
I think this might be a LLVM compatibility problem; i.e. our LLVM8 vs NVVM.  This is likely an issue with llvm.memcpy having a different API. But, we shouldn't be generating memcpy calls. No GPU features should be emitting that.
Is it possible to provide a minimal reproducer?

I am trying to reproduce this separately.Until that do you see any problem in my environment? Conda lists packages as follows:
Name                    Version                   Build  Channel
_tflow_select             2.3.0                       mkl
absl-py                   0.8.1                    py37_0
astor                     0.8.0                    py37_0
attrs                     19.3.0                     py_0
backcall                  0.1.0                    py37_0
blas                      1.0                         mkl
bleach                    3.1.0                    py37_0
ca-certificates           2019.10.16                    0
certifi                   2019.9.11                py37_0
colorama                  0.4.1                    py37_0
cudatoolkit               10.1.168                      0
cycler                    0.10.0                   py37_0
decorator                 4.4.1                      py_0
defusedxml                0.6.0                      py_0
entrypoints               0.3                      py37_0
freetype                  2.9.1                ha9979f8_1
gast                      0.2.2                    py37_0
google-pasta              0.1.7                      py_0
graphviz                  2.38                 hfd603c8_2
grpcio                    1.16.1           py37h351948d_1
h5py                      2.9.0            py37h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha66f8fd_1
importlib_metadata        0.23                     py37_0
intel-openmp              2019.4                      245
ipykernel                 5.1.3            py37h39e3cac_0
ipython                   7.9.0            py37h39e3cac_0
ipython_genutils          0.2.0                    py37_0
jedi                      0.15.1                   py37_0
jinja2                    2.10.3                     py_0
jpeg                      9b                   hb83a4c4_2
jsonschema                3.1.1                    py37_0
jupyter_client            5.3.4                    py37_0
jupyter_core              4.6.1                    py37_0
keras                     2.2.4                         0
keras-applications        1.0.8                      py_0
keras-base                2.2.4                    py37_0
keras-preprocessing       1.1.0                      py_1
kiwisolver                1.1.0            py37ha925a31_0
libmklml                  2019.0.5                      0
libpng                    1.6.37               h2a8f88b_0
libprotobuf               3.9.2                h7bd577a_0
libsodium                 1.0.16               h9d3ae62_0
llvmlite                  0.30.0           py37ha925a31_0
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markdown                  3.1.1                    py37_0
markupsafe                1.1.1            py37he774522_0
matplotlib                3.1.1            py37hc8f65d3_0
mistune                   0.8.4            py37he774522_0
mkl                       2019.4                      245
mkl-service               2.3.0            py37hb782905_0
mkl_fft                   1.0.15           py37h14836fe_0
mkl_random                1.1.0            py37h675688f_0
more-itertools            7.2.0                    py37_0
msys2-conda-epoch         20160418                      1
nb_conda                  2.2.1                    py37_0
nb_conda_kernels          2.2.2                    py37_0
nbconvert                 5.6.1                    py37_0
nbformat                  4.4.0                    py37_0
notebook                  6.0.1                    py37_0
numba                     0.46.0           py37hf9181ef_0
numpy                     1.17.3           py37h4ceb530_0
numpy-base                1.17.3           py37hc3f5095_0
openssl                   1.1.1d               he774522_3
opt_einsum                3.1.0                      py_0
pandoc                    2.2.3.2                       0
pandocfilters             1.4.2                    py37_1
parso                     0.5.1                      py_0
pickleshare               0.7.5                    py37_0
pip                       19.3.1                   py37_0
prometheus_client         0.7.1                      py_0
prompt_toolkit            2.0.10                     py_0
protobuf                  3.9.2            py37h33f27b4_0
pydot                     1.4.1                    py37_0
pygments                  2.4.2                      py_0
pyparsing                 2.4.2                      py_0
pyqt                      5.9.2            py37h6538335_2
pyreadline                2.1                      py37_1
pyrsistent                0.15.4           py37he774522_0
python                    3.7.5                h8c8aaf0_0
python-dateutil           2.8.1                      py_0
pytz                      2019.3                     py_0
pywin32                   223              py37hfa6e2cd_1
pywinpty                  0.5.5                 py37_1000
pyyaml                    5.1.2            py37he774522_0
pyzmq                     18.1.0           py37ha925a31_0
qt                        5.9.7            vc14h73c81de_0
scipy                     1.3.1            py37h29ff71c_0
send2trash                1.5.0                    py37_0
setuptools                41.6.0                   py37_0
sip                       4.19.8           py37h6538335_0
six                       1.12.0                   py37_0
sqlite                    3.30.1               he774522_0
tbb                       2019.4               h74a9793_0
tensorboard               1.14.0           py37he3c9ec2_0
tensorflow                1.14.0          mkl_py37h7908ca0_0
tensorflow-base           1.14.0          mkl_py37ha978198_0
tensorflow-estimator      1.14.0                     py_0
termcolor                 1.1.0                    py37_1
terminado                 0.8.2                    py37_0
testpath                  0.4.2                    py37_0
tornado                   6.0.3            py37he774522_0
traitlets                 4.3.3                    py37_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_0
wcwidth                   0.1.7                    py37_0
webencodings              0.5.1                    py37_1
werkzeug                  0.16.0                     py_0
wheel                     0.33.6                   py37_0
wincertstore              0.2                      py37_0
winpty                    0.4.3                         4
wrapt                     1.11.2           py37he774522_0
yaml                      0.1.7                hc54c509_2
zeromq                    4.3.1                h33f27b4_3
zipp                      0.6.0                      py_0
zlib                      1.2.11               h62dcd97_3

NVIDIA CUDA Toolkit Version 10.1.243 is installed

Interestingly when I run my code the first time from Jupyter notebook I receive the memory access violation error in Jupyter and no further error message is shown. When I then try to run the same part of the code again (with no changes), I receive the "isvolatile .... llvm.memcpy"

I don't see an issue in the environment.  This is very likely caused by a certain code pattern or feature in a numba jitted cuda kernel.

Hi,
It took me about two weeks to amend my code in order to get rid of the Memory Access Violation errors of the llvm lite compiler. I have to emphasize again that all these error appear in compile time, so no code is executed. My code is complex, consists of more than thousand lines with many device side functions and preloaded constant arrays into the GPU memory. Now, having managed to get rid of the errors I have some availability so I will try my best to create short code which reproduces the errors. What I figured out were as follows:
0.) I didn't use function signatures, because I could not figure out how to exactly define them when using custom types (see below).
1.) Cuda & llvm combo doesn't like if I pack multiple arrays of constant values into a custom type array and try to copy from these content into local arrays within a device function.
What I did: in order to speed up computation I have calculated in advance some constant values in form of 10 different numpy arrays. In order to load them into the GPU memory I declared a custom type which packs all 10 arrays into a structure, so I can pass as parameter to the various device functions only the this variable  of custom type (and I don't need to pass reference to all ten of them).
cuda_const_arrays_type = numpy.dtype([
('a1', (numpy.int32,(7776, 13))),
('a2', (numpy.int32,(7776, 2, 5))),
('a3', (numpy.int32,(16494592))),
('a4', (numpy.int32,13)),
('a5', (numpy.float32,(22528, 64))),
('a6', (numpy.int32,(522523, 64))),
('a7', (numpy.int32,(32,5))),
('a8', (numpy.int32,(66667))),
('a9', (numpy.int32,(252, 64, 3, 2, 2, 2, 2, 2, 2, 13))),
('a10', (numpy.int32,(7776)))
])
Then I defined the variable on host side:
cuda_const_arrays = numpy.zeros(1, dtype=cuda_const_arrays_type)
.. load each array separately from disc and store them into the cuda_const_arrays[0]['a1'], cuda_const_arrays[0]['a2'], .... cuda_const_arrays[0]['a10'] respectively
load the packed array to the device
gpu_const_arrays = cuda.to_device(cuda_const_arrays[0])
As a result within a device function I could access any member of this arrays:
@cuda.jit(device=True)
def cuda_doSomething(gpu_const_arrays,...):
...
arrayOfSize13 = gpu_const_arrays.a1[index]
...
Now when I copied data from this constant arrays into some local array of a device function:
actions = cuda.local.array(13, numba.int32)
...
for i in range(13):
actions [i] = arrayOfSize13 [i]
and tried to use it later in the same device function, like
v = actions [i] *2
This led to Memory access violation in the compiler on a random basis. Finally I got rid of the packed constant array and defined & loaded each of them separately to the device.
2.) Device function code length
I observed that for some reason if the device function contains relatively many lines (e.g. 100), it also causes problem to the compiler. Thus I had to reorganize code and create more device function-type subroutines.
3.) The llvm compiler identifies some of the non-python elements extremely slow. For example I wanted to print out stack trace (which turned out finally that it is unsupported )
import traceback
...
traceback.print_stack()
On my computer it takes about one hour till the compiler returns that this is unsupported feature. Similar case with import sys and sys.exit().
As mentioned above, I will try to reproduce these and let you know.

Hi,
I am back to Numba and CUDA. I started a new project and believe me or not, I stumbled across the same problem on a new computer and I can't get rid of it. I created a small project available here: https://gitlab.com/pittnerf1/test-project-for-numba-and-cuda-functions/-/tree/master
When I try to run this jupyter notebook program, in case of the two cells including kernel invocations 1 and 2 the compilation of the kernel and device functions fails with the error randomly (sometimes it is compiled and run but many times the compile  just fails as showed below):

OSError                                   Traceback (most recent call last)
 in
6 data_isgomoku = np.load("data/isgomoku_moreThan5Good.npy")
7
----> 8 kernel_test_02[blocks, threads_per_block](envs_in_gpu, envs_out_gpu, random_states, data_isgomoku, proximities)
9 print ("Run OKAY")
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\compiler.py in call(self, *args)
757         '''
758         #print ("_call *args=",*args)
--> 759         kernel = self.specialize(*args)
760         cfg = kernel[self.griddim, self.blockdim, self.stream, self.sharedmem]
761         cfg(*args)
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\compiler.py in specialize(self, *args)
768         argtypes = tuple(
769             [self.typingctx.resolve_argument_type(a) for a in args])
--> 770         kernel = self.compile(argtypes)
771         return kernel
772
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\compiler.py in compile(self, sig)
787             self.definitions[(cc, argtypes)] = kernel
788             if self.bind:
--> 789                 kernel.bind()
790         return kernel
791
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\compiler.py in bind(self)
528         Force binding to current CUDA context
529         """
--> 530         self._func.get()
531
532     @property
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\compiler.py in get(self)
405         cufunc = self.cache.get(device.id)
406         if cufunc is None:
--> 407             ptx = self.ptx.get()
408
409             # Link
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\compiler.py in get(self)
376             arch = nvvm.get_arch_option(*cc)
377             ptx = nvvm.llvm_to_ptx(self.llvmir, opt=3, arch=arch,
--> 378                                    **self._extra_options)
379             self.cache[cc] = ptx
380             if config.DUMP_ASSEMBLY:
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\cudadrv\nvvm.py in llvm_to_ptx(llvmir, **opts)
498     cu.add_module(libdevice.get())
499
--> 500     ptx = cu.compile(**opts)
501     # XXX remove debug_pubnames seems to be necessary sometimes
502     return patch_ptx_debug_pubnames(ptx)
~.conda\envs\tensorflow\lib\site-packages\numba\cuda\cudadrv\nvvm.py in compile(self, **options)
234         c_opts = (c_char_p * len(opts))(*[c_char_p(x.encode('utf8'))
235                                           for x in opts])
--> 236         err = self.driver.nvvmCompileProgram(self._handle, len(opts), c_opts)
237         self._try_error(err, 'Failed to compile\n')
238
OSError: exception: access violation reading 0x000001C3B042FFF8
So it is clearly a problem with the code sent to the NVVM compiler, because it crashes it. I tried it out with CUDA Toolkit 9.2, 10.0,10.1,10.2, but the problem persists in all cases.
Could you please check out https://gitlab.com/pittnerf1/test-project-for-numba-and-cuda-functions/-/tree/master to see what I am doing wrong?
Cheers,
Ferenc

Hi everyone,
I just want to add that this problem occurs on Windows.  I have just tested the code on Google Colab and everything works fine. No error at all...  Very annoying...

After a few trials and restarts I see that Google Colab crashes, too.

I figured out that that the problem was that I used custom ndtype  (numpy.dtype). So I got rid of the custom ndtype and the access violation problem disappeared on numba 0.46. Unfortunately later versions seem to be unstable and still produce randomly "access violation" errors.

Came to this thread because I'm (sometimes consistently and sometimes randomly) getting the same error. Some of the similarities I notice are passing cuda.local.arrays into device functions. Hmm..

@sgbaird have you got a reproducer? I suspect I can track down the issue in NVVM if you have one, even if it doesn't reproduce consistently.

Hi @gmarkall , thanks for the reply! Here's a reproducer (for me at least)
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 19 16:30:07 2021.

@author: sterg

Compute the 1-Wasserstein distance (Earth Mover's distance) via Numba/CUDA kernel.
"""

import os

# needs to appear before cuda import
os.environ["NUMBA_ENABLE_CUDASIM"] = "0"
# set to "1" for more debugging, but slower performance
os.environ["NUMBA_CUDA_DEBUGINFO"] = "1"
from numba import cuda, njit
from numba.types import int32, float32, int64, float64

from pdb import set_trace

import numpy as np

from math import sqrt

USE_64 = False

if USE_64:
    bits = 64
    nb_float = float64
    nb_int = int64
    np_float = np.float64
    np_int = np.int64
else:
    bits = 32
    nb_float = float32
    nb_int = int32
    np_float = np.float32
    np_int = np.int32

# local array shapes needs to be defined globally due to lack of dynamic array allocation support. Don't wrap with np.int32, etc. see https://github.com/numba/numba/issues/7314
rows = 10
cols = 3
cols_plus_1 = cols + 1
tot_cols = cols * 2
tot_cols_minus_1 = tot_cols - 1

np.random.seed(42)
[U, V, U_weights, V_weights] = [np.random.rand(rows, cols) for i in range(4)]

device = True
inline = True

@cuda.jit(device=device, inline=inline)
def copy(a, out):
    """
    copy a into out.

    Parameters
    ----------
    a : vector
        values to copy.
    out : vector
        values to copy into.

    Returns
    -------
    None.

    """
    for i in range(len(a)):
        i = int(i)
        out[i] = a[i]

@cuda.jit(device=device, inline=inline)
def partition(arr, ids, l, h):
    """
    Partition using pivot.

    Function takes last element as pivot, places the pivot element at its correct
    position in sorted array, and places all smaller (smaller than pivot) to left of
    pivot and all greater elements to right of pivot

    Source: Modified from https://www.geeksforgeeks.org/iterative-quick-sort/
    which was contributed by Mohit Kumra.

    Parameters
    ----------
    arr : vector of floats
        The array to be sorted.
    ids : vector of ints
        The unsorted IDs corresponding to arr, in other words range(len(arr)).
    l : int
        Starting index for sorting.
    h : int
        Ending index for sorting.

    Returns
    -------
    int
        the new pivot?

    """
    # index of smaller element
    i = l - 1

    pivot = arr[h]

    for j in range(l, h):

        # If current element is smaller than or equal to pivot
        if arr[j] <= pivot:

            # increment index of smaller element
            i += 1
            arr[i], arr[j] = arr[j], arr[i]
            ids[i], ids[j] = ids[j], ids[i]

    arr[i + 1], arr[h] = arr[h], arr[i + 1]
    ids[i + 1], ids[h] = ids[h], ids[i + 1]

    return i + 1

@cuda.jit(device=device, inline=inline)
def quickSortIterative(arr, stack, ids):
    """
    Perform iterative quicksort on array and an unsorted ID list of the array.

    Source: Modified from https://www.geeksforgeeks.org/iterative-quick-sort/
    which was contributed by Mohit Kumra.

    Parameters
    ----------
    arr : vector of floats
        The array to be sorted.
    stack : vector of ints
        Array initialized with 0's
    ids : vector of ints
        The unsorted IDs corresponding to arr, in other words range(len(arr)).

    Returns
    -------
    None.

    """
    # low and high indices.
    l, h = (0, len(arr) - 1)
    # stack = [0] * size
    # ids = list(range(len(arr)))

    # initialize top of stack
    top = -1

    # fill ids with range(len(arr))
    for i in range(len(arr)):
        ids[i] = i
        stack[i] = 0

    # push initial values of l and h to stack
    top = top + 1
    stack[top] = l
    top = top + 1
    stack[top] = h

    # Keep popping from stack while is not empty
    while top >= 0:

        # Pop h and l
        h = stack[top]
        top = top - 1
        l = stack[top]
        top = top - 1

        # Set pivot element at its correct position in
        # sorted array
        p = partition(arr, ids, l, h)

        # If there are elements on left side of pivot,
        # then push left side to stack
        if p - 1 > l:
            top = top + 1
            stack[top] = l
            top = top + 1
            stack[top] = p - 1

        # If there are elements on right side of pivot,
        # then push right side to stack
        if p + 1 < h:
            top = top + 1
            stack[top] = p + 1
            top = top + 1
            stack[top] = h

@cuda.jit(device=device, inline=inline)
def concatenate(vec, vec2, out):
    """
    Concatenate two vectors.

    Parameters
    ----------
    vec : vector
        First vector to concatenate.
    vec2 : vector
        Second vector to concatenate.
    out : vector
        Initialization of concatenated vector.

    Returns
    -------
    None.

    """
    # number of elements
    n = len(vec)
    n2 = len(vec2)
    # initialize
    # out =cuda.local.array(n+n2, nb_float) # doesn't work because of dynamic allocation
    # populate out
    for i in range(n):
        out[i] = vec[i]
    for i in range(n2):
        out[i + n2] = vec2[i]

@cuda.jit(device=device, inline=inline)
def diff(vec, out):
    """
    Compute gradient.

    Parameters
    ----------
    vec : vector of floats
        The vector for which to calculate the gradient.
    out : vector of floats
        Initialization of output vector (one less element than vec) which contains the gradient.

    Returns
    -------
    None.

    """
    # number of elements
    n = len(vec) - 1
    # progressively add next elements
    for i in range(n):
        out[i] = vec[i + 1] - vec[i]

@cuda.jit(device=device, inline=inline)
def bisect_right(a, v, ids):
    """
    Return the indices where to insert items in v in list a, assuming a is sorted.

    Parameters
    ----------
    arr : 1D array
        Array for which to perform a binary search.
    v : 1D array
        Values to perform the binary search for.
    ids : 1D array
        Initialized list of indices, same size as v.

    Returns
    -------
    None.

    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there. Optional args lo (default 0)
    and hi (default len(a)) bound the slice of a to be searched.

    Source: modified from https://github.com/python/cpython/blob/43bab0537ceb6e2ca3597f8f3a3c79733b897434/Lib/bisect.py#L15-L35
    """
    n = len(a)
    n2 = len(v)
    for i in range(n2):
        lo = 0
        mid = 0
        hi = n
        x = v[i]
        while lo < hi:
            mid = (lo + hi) // 2
            # Use __lt__ to match the logic in list.sort() and in heapq
            if x < a[mid]:
                hi = mid
            else:
                lo = mid + 1
        ids[i] = lo

@cuda.jit(device=device, inline=inline)
def sort_by_indices(v, ids, out):
    """
    Sort v by ids and assign to out, as in out = v[ids].

    Parameters
    ----------
    v : vector
        values to sort.
    ids : vector
        indices to use for sorting.
    out : vector
        preallocated vector to put sorted values into.

    Returns
    -------
    None.

    """
    for i in range(len(v)):
        idx = ids[i]
        out[i] = v[idx]

@cuda.jit(device=device, inline=inline)
def cumsum(vec, out):
    """
    Return the cumulative sum of the elements in a vector.

    Referenced https://stackoverflow.com/a/15889203/13697228

    Parameters
    ----------
    vec : 1D array
        Vector for which to compute the cumulative sum.

    out: 1D array
        Initialized vector which stores the cumulative sum.

    prepend_zero : bool
        Whether to prepend a zero (fairly specific to Wasserstein distance).

    Returns
    -------
    out : 1D array
        The cumulative sum of elements in vec (same shape as vec).

    """
    # number of elements
    n = len(vec)
    # initialize
    total = 0.0
    # progressively add next elements
    for i in range(n):
        total += vec[i]
        out[i] = total

@cuda.jit(device=device, inline=inline)
def divide(v, b, out):
    """
    Divide a vector by a scalar.

    Parameters
    ----------
    v : vector
        vector numerator.
    b : float
        scalar denominator.
    out : vector
        initialized vector to populate with divided values.

    Returns
    -------
    None.

    """
    for i in range(len(v)):
        out[i] = v[i] / b

@cuda.jit(device=device, inline=inline)
def ecdf(u, sorted_weights, cdf_indices, out):
    """
    Compute the weighted empirical cumulative density function (ECDF) for a vector.

    Parameters
    ----------
    u : vector
        Monotonically increasing vector for which to compute the ECDF.
    weights : vector
        Vector of weights, the same size as u, used to weight the ECDF.
    out : vector
        Initialized vector, same size as u, in which to place the ECDF.

    Returns
    -------
    None.

    """
    # allocate local arrays
    sorted_cumweights = cuda.local.array(cols_plus_1, nb_float)
    cdf_sorted_cumweights = cuda.local.array(tot_cols_minus_1, nb_float)

    # cumulative sum, and normalization
    sorted_cumweights[0] = 0.0
    cumsum(sorted_weights, sorted_cumweights[1:])

    sort_by_indices(sorted_cumweights, cdf_indices, cdf_sorted_cumweights)
    # sort_by_indices(sorted_cumweights, cdf_indices, cdf_sorted_cumweights)
    divide(cdf_sorted_cumweights, sorted_cumweights[-1], out)

@cuda.jit(device=device, inline=inline)
def integrate(u_cdf, v_cdf, deltas, p):
    """
    Integrate between two vectors using a p-norm.

    Parameters
    ----------
    u_cdf : numeric vector
        First CDF.
    v_cdf : numeric vector
        Second CDF of same length as a.
    deltas : numeric vector
        The differences between the original vectors a and b.
    p : int, optional
        The finite power for which to compute the p-norm. The default is 2.

    If p == 1 or p == 2, use of power is avoided, which introduces an overhead
    # of about 15% (according to https://github.com/scipy/scipy/blob/47bb6febaa10658c72962b9615d5d5aa2513fa3a/scipy/stats/stats.py#L8404-L8488)
    However, without support for math.square or np.square (2021-08-19), math.pow
    is required for p == 2.

    Returns
    -------
    out : numeric scalar
        The p-norm of a and b.

    """
    n = len(u_cdf)
    out = 0.0
    if p == 1:
        for i in range(n):
            out += abs(u_cdf[i] - v_cdf[i]) * deltas[i]
    elif p == 2:
        for i in range(n):
            out += ((u_cdf[i] - v_cdf[i]) ** p) * deltas[i]
            out = sqrt(out)
    elif p > 2:
        for i in range(n):
            out += (u_cdf[i] - v_cdf[i]) ** p * deltas[i]
            out = out ** (1 / p)
    return out

@cuda.jit(device=device, inline=inline)
def cdf_distance(u, v, u_weights, v_weights, p, out):
    r"""
    Compute distance between two one-dimensional distributions :math:`u` and :math:`v`.

    The respective CDFs are :math:`U` and :math:`V`, and the
    statistical distance is defined as:
    .. math::
        l_p(u, v) = \left( \int_{-\infty}^{+\infty} |U-V|^p \right)^{1/p}
    p is a positive parameter; p = 1 gives the Wasserstein distance, p = 2
    gives the energy distance.

    Parameters
    ----------
    u_values, v_values : array_like
        Values observed in the (empirical) distribution.
    u_weights, v_weights : array_like
        Weight for each value.
        `u_weights` (resp. `v_weights`) must have the same length as
        `u_values` (resp. `v_values`). If the weight sum differs from 1, it
        must still be positive and finite so that the weights can be normalized
        to sum to 1.

    Returns
    -------
    distance : float
        The computed distance between the distributions.

    Notes
    -----
    The input distributions can be empirical, therefore coming from samples
    whose values are effectively inputs of the function, or they can be seen as
    generalized functions, in which case they are weighted sums of Dirac delta
    functions located at the specified values.

    References
    ----------
    .. [1] Bellemare, Danihelka, Dabney, Mohamed, Lakshminarayanan, Hoyer,
           Munos "The Cramer Distance as a Solution to Biased Wasserstein
           Gradients" (2017). :arXiv:`1705.10743`.
    """
    # allocate local float arrays
    ## combined vector
    uv = cuda.local.array(tot_cols, nb_float)
    uv_deltas = cuda.local.array(tot_cols_minus_1, nb_float)

    ## CDFs and sorted weights
    u_cdf = cuda.local.array(tot_cols_minus_1, nb_float)
    v_cdf = cuda.local.array(tot_cols_minus_1, nb_float)

    u_sorted_weights = cuda.local.array(cols, nb_float)
    v_sorted_weights = cuda.local.array(cols, nb_float)
    # u_cdf_sorted = cuda.local.array(tot_cols_minus_1, nb_float)
    # v_cdf_sorted = cuda.local.array(tot_cols_minus_1, nb_float)

    # allocate local int arrays
    ## sorters and stacks
    u_sorter = cuda.local.array(cols, nb_int)
    u_stack = cuda.local.array(cols, nb_int)

    v_sorter = cuda.local.array(cols, nb_int)
    v_stack = cuda.local.array(cols, nb_int)

    uv_sorter = cuda.local.array(tot_cols, nb_int)
    uv_stack = cuda.local.array(tot_cols, nb_int)

    ## CDF indices via binary search
    u_cdf_indices = cuda.local.array(tot_cols_minus_1, nb_int)
    v_cdf_indices = cuda.local.array(tot_cols_minus_1, nb_int)

    # concatenate u and v into uv
    concatenate(u, v, uv)

    # sorting
    quickSortIterative(u, u_stack, u_sorter)
    sort_by_indices(u_weights, u_sorter, u_sorted_weights)
    quickSortIterative(v, v_stack, v_sorter)
    sort_by_indices(v_weights, v_sorter, v_sorted_weights)
    quickSortIterative(uv, uv_stack, uv_sorter)

    # Get the respective positions of the values of u and v among the values of
    # both distributions. See also np.searchsorted
    bisect_right(u, uv[:-1], u_cdf_indices)
    bisect_right(v, uv[:-1], v_cdf_indices)

    # empirical CDFs
    ecdf(u, u_sorted_weights, u_cdf_indices, u_cdf)
    ecdf(v, v_sorted_weights, v_cdf_indices, v_cdf)

    # # # set_trace()

    # sorting
    # u_cdf_sorted[0] = 0.0
    # v_cdf_sorted[0] = 0.0
    # sort_by_indices(u_cdf, u_cdf_indices, u_cdf_sorted)
    # sort_by_indices(v_cdf, v_cdf_indices, v_cdf_sorted)

    # # # copy(v_cdf_sorted, out)

    # Integration
    diff(uv, uv_deltas)  # See also np.diff
    out = integrate(u_cdf, v_cdf, uv_deltas, p)

#

# out_cols = cols_plus_1
# out_cols = tot_cols_minus_1
# out_cols = cols
# shape = (rows, out_cols)
# shape = rows

@cuda.jit(device=device, inline=inline)
def wasserstein_distance(u, v, u_weights, v_weights, out):
    r"""
    Compute the first Wasserstein distance between two 1D distributions.

    This distance is also known as the earth mover's distance, since it can be
    seen as the minimum amount of "work" required to transform :math:`u` into
    :math:`v`, where "work" is measured as the amount of distribution weight
    that must be moved, multiplied by the distance it has to be moved.

    Source: https://github.com/scipy/scipy/blob/47bb6febaa10658c72962b9615d5d5aa2513fa3a/scipy/stats/stats.py#L8245-L8319

    Parameters
    ----------
    u_values, v_values : array_like
        Values observed in the (empirical) distribution.
    u_weights, v_weights : array_like, optional
        Weight for each value. If unspecified, each value is assigned the same
        weight.
        `u_weights` (resp. `v_weights`) must have the same length as
        `u_values` (resp. `v_values`). If the weight sum differs from 1, it
        must still be positive and finite so that the weights can be normalized
        to sum to 1.

    Returns
    -------
    distance : float
        The computed distance between the distributions.

    Notes
    -----
    The input distributions can be empirical, therefore coming from samples
    whose values are effectively inputs of the function, or they can be seen as
    generalized functions, in which case they are weighted sums of Dirac delta
    functions located at the specified values.

    References
    ----------
    .. [1] Bellemare, Danihelka, Dabney, Mohamed, Lakshminarayanan, Hoyer,
           Munos "The Cramer Distance as a Solution to Biased Wasserstein
           Gradients" (2017). :arXiv:`1705.10743`.
    """
    cdf_distance(u, v, u_weights, v_weights, np_int(1), out)

@cuda.jit(
    "void(float{0}[:,:], float{0}[:,:], float{0}[:,:], float{0}[:,:], float{0}[:,:])".format(
        bits
    )
)
def distance(U, V, U_weights, V_weights, out):
    # get CUDA iterator
    idx = cuda.grid(1)

    # for debugging
    x = cuda.threadIdx.x
    bx = cuda.blockIdx.x
    bdx = cuda.blockDim.x
    # if x == 1 and bx == 3:
    #     set_trace()

    if idx < rows:
        # unpack
        u = U[idx]
        v = V[idx]
        u_weights = U_weights[idx]
        v_weights = V_weights[idx]

        # calculation
        wasserstein_distance(u, v, u_weights, v_weights, out[idx])

def driver(U, V, U_weights, V_weights):
    # block, grid
    block_dim = 1
    grid_dim = int(rows // block_dim + 1)

    # CUDA setup
    stream = cuda.stream()

    # copying/allocating to GPU
    cuda_U = cuda.to_device(np.asarray(U, dtype=np_float), stream=stream)
    cuda_V = cuda.to_device(np.asarray(V, dtype=np_float), stream=stream)
    cuda_U_weights = cuda.to_device(
        np.asarray(U_weights, dtype=np_float), stream=stream
    )
    cuda_V_weights = cuda.to_device(
        np.asarray(V_weights, dtype=np_float), stream=stream
    )
    cuda_out = cuda.device_array((rows, cols), np_float)

    # calculations
    distance[grid_dim, block_dim](
        cuda_U, cuda_V, cuda_U_weights, cuda_V_weights, cuda_out
    )

    # copy to CPU
    out = cuda_out.copy_to_host(stream=stream)

    return out

out = driver(U, V, U_weights, V_weights)
print(out[0])

"""CODE GRAVEYARD"""
"""
"""

@sgbaird Many thanks, new issue created for this as it's a distinct problem: #7326.

authors: esc gmarkall pittnerf seibert sgbaird sklam


text:
TypeError when calling jitclass method with optional type member

Reporting a bug

[x] I have tried using the latest released version of Numba (most recent is
visible in the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
numba version : 0.54.0
[x] I have included a self contained code sample to reproduce the problem.
i.e. it's possible to run as 'python bug.py'.

import numba
from numba.experimental import jitclass

spec=[("_a", numba.optional(numba.int32))]
@jitclass(spec=spec)
class A:
    def __init__(self, a):
        self._a = a

    def test(self, a):
        return self._a == a

a = A(None)
a.test(1)

This produces below errors.
Traceback (most recent call last):
  File "/opt/test/test.py", line 14, in <module>
    a.test(1)
  File "/opt/python/py3.9/lib/python3.9/site-packages/numba/experimental/jitclass/boxing.py", line 59, in wrapper
    return method(*args, **kwargs)
TypeError: expected int32, got None

@hn-sl thank you for reporting this. I can confirm I can reproduce this on current master.

Interestingly enough, the following is fine:
import numba
from numba.experimental import jitclass

spec = [("_a", numba.optional(numba.intp))]

@jitclass(spec=spec)
class A:
    def __init__(self, a):
        self._a = a

    def test(self, a):
        return self._a == a

a = A(1)
a.test(None)

The error comes from here:
https://github.com/numba/numba/blob/master/numba/core/optional.py#L118

The underlying error is that Numba does not directly support comparing an Optional type against non-Optional type. Instead, Numba tries to cast the Optional type to match the other argument but that fail because the Optional type contains a None.

source: gharchive/issue

authors: esc hn-sl sklam

repo: numba/numba

license_type: permissive

license_source: bigquery


text:
inconsistent array order  for bare and qualified jit decorator

Consider the following code:
import functools
import numpy as np
import numba as nb

N = 4
M = 2
a = np.arange(M*N, dtype=np.float64).reshape(M, N).T
b = np.ones(M, dtype=np.float64)

def calc0(x, y, out=None):
    op = np.multiply
    it = np.nditer((x, y, None), [], [['readonly'], ['readonly'], ['writeonly', 'allocate']])
    for (a, b, c) in it:
        op(a, b, out=c)
    return it.operands[2]

@nb.njit
def calc1(x, y, out):
    it = np.nditer((x, y))
    for i, (u, v) in enumerate(it):
        out[i] = u * v

@nb.njit(nb.void(nb.float64[:,:], nb.float64[:], nb.float64[:]))
def calc2(x, y, out):
    it = np.nditer((x, y))
    for i, (u, v) in enumerate(it):
        out[i] = u * v

def calc1_wrap(x, y):
    shape = np.broadcast_shapes(x.shape, y.shape)
    size = functools.reduce(lambda u, v: u*v, shape)
    out = np.empty(size, dtype=np.float64)
    calc1(x, y, out)
    return out.reshape(shape)

def calc2_wrap(x, y):
    shape = np.broadcast_shapes(x.shape, y.shape)
    size = functools.reduce(lambda u, v: u*v, shape)
    out = np.empty(size, dtype=np.float64)
    calc2(x, y, out)
    return out.reshape(shape)

a * b
calc0(a, b)
calc1_wrap(a, b)
calc2_wrap(a, b)

calc1.signatures
calc2.signatures

The output is:
array([[0., 4.],
       [1., 5.],
       [2., 6.],
       [3., 7.]])

array([[0., 4.],
       [1., 5.],
       [2., 6.],
       [3., 7.]])

array([[0., 1.],
       [2., 3.],
       [4., 5.],
       [6., 7.]])

array([[0., 4.],
       [1., 5.],
       [2., 6.],
       [3., 7.]])

[(array(float64, 2d, F), array(float64, 1d, C), array(float64, 1d, C))]
[(array(float64, 2d, A), array(float64, 1d, A), array(float64, 1d, A))]

The third array stands out. It seems that the bare @njit assumes that the a is in Fortran order. This is not consistent with numpy behaviour. Is there a reason for this, or a minor bug?
One could argue that numpy documentation is misleading: https://numpy.org/doc/stable/reference/generated/numpy.nditer.html?highlight=nditer#numpy.nditer

Thanks for the report. I think the issue is in the 4th array arising from the call to calc2_wrap. Running the same script with JIT compilation disabled (via setting the environment variable NUMBA_DISABLE_JIT=1) yields:
[[0. 4.]
 [1. 5.]
 [2. 6.]
 [3. 7.]]
[[0. 4.]
 [1. 5.]
 [2. 6.]
 [3. 7.]]
[[0. 1.]
 [2. 3.]
 [4. 5.]
 [6. 7.]]
[[0. 1.]
 [2. 3.]
 [4. 5.]
 [6. 7.]]

whereas with the JIT enabled it produces:
[[0. 4.]
 [1. 5.]
 [2. 6.]
 [3. 7.]]
[[0. 4.]
 [1. 5.]
 [2. 6.]
 [3. 7.]]
[[0. 1.]
 [2. 3.]
 [4. 5.]
 [6. 7.]]
[[0. 4.]
 [1. 5.]
 [2. 6.]
 [3. 7.]]

I suspect the nditer isn't matching NumPy in the case of an 'A' array order, it would require a runtime check to determine the order ahead of iteration.
MWR for the issue:
from numba import njit, float64
import numpy as np

N = 4
M = 2
a = np.arange(M * N, dtype=np.float64).reshape(M, N).T

@njit((float64[:,:],))
def foo(x):
    for i in np.nditer(x):
        print(i)

print('Python:')
foo.py_func(a)
print('\nJIT:')
foo(a)

This produces:
Python:
0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0

JIT:
0.0
4.0
1.0
5.0
2.0
6.0
3.0
7.0


text:
Inconsistent error state with numpy for zero division

Reporting a bug

[ ] I have tried using the latest released version of Numba (most recent is
visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
[ ] I have included a self contained code sample to reproduce the problem.
i.e. it's possible to run as 'python bug.py'.

In numpy, the default error state for zero division is warn which will raise a warning instead of an error when zero division:
>>> import numpy as np
>>> np.geterr()
{'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
>>> 1.0 / np.float64(0.0)

Warning (from warnings module):
  File "<pyshell#13>", line 1
RuntimeWarning: divide by zero encountered in double_scalars
inf

In numba, an error will be raised by default:
>>> import numba
>>> @numba.njit
... def test_numba_zero_division():
...     print(1.0/np.float64(0.0))

>>> test_numba_zero_division()
Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    test_numba_zero_division()
ZeroDivisionError: division by zero

Is it a bug?

xref for general reference: https://github.com/numba/numba/issues/8700

I don't think this is a bug in so much as it was never intended or expected to work. Perhaps it would be good to note this in the documentation associated with Numba's NumPy support.
I think there's a two separate things here:

In Numba division such as python float type / np.float64 type will still use the CPython semantics of raising if there's a divide by zero. Two options to work around this 1) set the error model e.g. @njit(error_model='numpy') which ignores divide by zero in such operations, 2) where divide by zero should not be considered use np.divide opposed to the / builtin, e.g. np.divide(1.0, np.float64(0.0)).
The state associated with np.geterr etc is not supported and whilst theoretically possible to support, it would be incredibly challenging to implement correctly/in a way that replicates what NumPy does.

set the error model e.g. @njit(error_model='numpy') which ignores divide by zero in such operations

This seems to be a solution for me, thanks!

authors: gmarkall haiiliin stuartarchibald


text:
Implement implicit output layout for 'A' layout

This fixes issue #1418.
This completes the ufunc layout handling for A layout.
The numpy logic appears to prefer 'C' if any input is it, then, 'F' layout if any input is it.  Otherwise, default to 'C' layout if all inputs are of 'A' layout.

The PR is fine with me. I will leave it open a bit in case others want to chime in.

source: gharchive/pull-request

authors: pitrou sklam


text:
Prompt is triggered when new files are created during Obsidian Sync

Thanks for the plugin, I was just thinking that something like this would be useful!
I found an issue with Obsidian Sync.

Create a file on 1st device
Open Obsidian on 2nd device
The file will be synched to the 2nd device, when it's created, a prompt for a template will pop up

If there are multiple new files being synched, multiple prompts will open one after another, and will need to be closed one by one.
I would expect that the prompt would appear only if a brand new file is created manually.

@cakechaser  I just published a new version, which intends to fix that. ( version 1.0.4 )
Would you kindly check if the problem fully solved by it or not?

Works great now, thank you for the quick fix!

authors: cakechaser numeroflip

license: MIT

license_source: github-api


text:
add requirement versions

pull request towards #27
add versions for all the requirements except 'windows-curses'.
I don't have a Windows system with me so I am not able to do anything on 'windows-curses'. It would be great if someone with a Windows system is able to help.

@adtyanair Sorry for late reply. It looks fine to me. windows-curses has a latest version of 1.1.

@nurdtechie98 can you just check about windows-curses?


text:
Failed Test Case 5: Getting wrong output

hello! I'm getting the wrong output for this level and I'm not sure how I should fix my code

Seems like your code sorts by distance before sorting by price sometimes when it's not supposed to. You should only sort by distance if the price is the same, so could you check if you implemented a price equality check correctly?

Seems like your code sorts by distance before sorting by price sometimes when it's not supposed to. You should only sort by distance if the price is the same, so could you check that before comparing by distance, you implemented a price equality check correctly?

Thank you! I changed my compareTo(Booking other) method to compare based on price first then waitingTime, it passed the test case :)

authors: haoyangw jeanyeeee


text:
[v1.2][T09-B1] EduBuddy

@chuakunhong @johnnychanjx @TeyXinHui

Enhancements
Kun Hong:  Morph Phone input into NRIC input to reflect EduBuddy requirements
Keng Seng: Add Sort Command to sort students by name in alphabetical order
Johnny:       Change case sensitivity for command word for standardized input
Xin Hui:       Add Delete Tag Command to delete specified tag from every student

@kengsengg @TeyXinHui @johnnychanjx @chuakunhong
There is one thing I forgot to mention:

Think about the major and minor features you want to implement, and update your user guide to show all the new features (commands), even though you haven't started yet!

v1.2 Enhancements
Kun Hong: Add TagReplace Command that allows a specified tag to be replaced by an intended tag
Keng Seng: Enable Sort Command to sort by tags as well
Johnny: Redesign the browser panel to fit our user target profile
Xin Hui: Add new Subject class which records subjects taken by students and their grades

@kengsengg @TeyXinHui @johnnychanjx @chuakunhong Good job 👍
Here are something you need to take note:

I have seen some coming in v2.0 labels inside user guide, remember to put in the enhancements you have done and label them as since v1.x. All the other original features can also be labeled as since v1.0 to make them consistent
Inside use guide, the detailed command and example of the new features can be included now. The key point is that you need to come up with the design before implementation
User guide can include screenshots about how to use the command and what is the expected outcome
Update FAQ and Command Summary in user guide accordingly
Add more label inside the issue tracker (i.e. priority, status)
For the issues labeled as story, the benefit part (after so that) should be put inside the description of this issue instead of title
Make sure all the PRs are linked to the corresponding issues using the issue number
Write your project portfolio

v1.4 Enhancements
Kun Hong: Implement AddRemark and DeleteRemark Command
Keng Seng: Enable the list of appointments to be viewed on the calendar UI
Johnny: Reflect updated student's name, IC, subjects on the student profile page
Xin Hui: Improve the input command for subjects

authors: dalessr kengsengg


text:
这个功能解决了什么问题？
因为几乎所有项目的样式都有略微的差别,而目前组件上提供的无法满足正常的项目需求,自定义样式很麻烦.所以能不能提供一个class的props套在组件的最外层,或者像antd的modal一样,提供一个className和一个wrapClassName.这样开发者自定义样式就非常方便了.
你期望的组件设计是怎样的？
props: {
className: 'xxx'
}
component: {
class="nutui-xxx" :class="className"
}

https://www.uniapp-nutui.tech/guide/theme.html#自定义组件的-style-或-class

repo: nutui-uniapp/nutui-uniapp


text:
add deploy-stage and test-lh

https://github.com/daliborgogic/lighthouse-ci

https://www.npmjs.com/package/jest-junit#configuration

https://jestjs.io/docs/en/expect#tobegreaterthanorequalnumber

repo: nuxdie/frontendweekend


text:
Docs for YAML in i18n blocks

I was trying to figure out how to use YAML in my  blocks, and noticed that there was no guide to do it.
If there's some better way, please do let me know, since I want to use this myself :)

Thank @ljoonal !

authors: ljoonal paulgv


text:
Odd behavior when working in npm run dev

First let me say, Nuxt is awesome!  I'm looking forward to the 1.0 release!
Ok so when working on m templates, eventually I get the below (screenshot) effect on my pages.  The only way to fix it it seems is to go into my layout and delete the contents of the  block, save and reload the page manually, then add it back in.  After that all goes back to normal, but not for long before it creeps up again.
Here's my page:
<template lang="jade">
  div
    ThickPageBanner
    CustomerLogin
</template>

Here's my layout:
<template>

            <meta charset="utf-8">
            <meta http-equiv="x-ua-compatible" content="ie=edge">
            <title>Title</title>
            <meta name="description" content="">
            <meta name="viewport" content="width=device-width, initial-scale=1">

            <link rel="icon" type="image/png" href="favicon.png">

            <link type="text/css" rel="stylesheet" href="http://fast.fonts.net/cssapi/e1ef451d-c61f-4ad3-b4e0-e3d8adb46d89.css"/>
            <link rel="stylesheet" href="/assets/css/main-min.css">

                <SiteHeader/>

                    <nuxt/>

                <SiteFooter/>

</template>

Hi, thanks for your support.
I think there is a misunderstanding about how you should use layouts.
You don't need to write again ,  and .
Nuxt.js write it by itself, if you want to customize there content you can use configuration properties: External resources
Your template should be:
<template>

   <SiteHeader/>

        <nuxt/>

    <SiteFooter/>

</template>

Looks like that did it, thanks!

authors: alexchopin jubairsaidi


text:
feat: add subFolders option for generate

Hi there,
First of all, thank you for this awesome project & all the effort you are putting together to make Nuxt.js awesome!
I faced a little issue using nuxt generate as it creates a directory for every route & write an index.html inside it.
index.html
/about/index.html
/contact/index.html

However, most CDN (& or static hosting) do URL normalization to enforce consistent URL patterns (e.g Netlify).
Quoted from Netlify documentation:
When “Pretty URLs” is enabled under processing settings for your site, Netlify will enforce consistent URL patterns.

A link to /about.html will be rewritten to /about in your HTML files and Netlify will enforce a redirect from /about/ to /about

A link to /about/index.html will be rewritten to /about/ and Netlify will redirect from /about to /about/

With that said, the current generate does not suit the following scenario:
Let's say I have the following routes:
- /
- /about
- /contact

My webapp loads on / (e.g: https://example.com)
I navigate to a route using CSR (e.g https://example.com/about)
I refresh & been redirected to https://example.com/about/

Which means, if Google crawls /about, it will face a 301 redirection to /about/ (using Netlify for example).
Adding the subFolders option to generate fixes this problem.
Any thoughts/restrictions?
Fixes

[x] #721

Todo

[x] Tests
[x] Add documentation under Configuration / Generate

Codecov Report

Merging #2032 into dev will decrease coverage by 0.09%.
The diff coverage is 75%.

@@            Coverage Diff            @@
##              dev    #2032     +/-   ##
=========================================
- Coverage   96.21%   96.12%   -0.1%
=========================================
  Files          14       14
  Lines         952      954      +2
=========================================
+ Hits          916      917      +1
- Misses         36       37      +1

Impacted Files
Coverage Δ

lib/common/options.js
89.47% <ø> (ø)
:arrow_up:

lib/builder/generator.js
98.79% <75%> (-1.21%)
:arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e97bb1d...59ad478. Read the comment docs.

Hi @Gomah
I talked with the team and we agree with this suggestion, could you add tests for it so we can merge it afterwards?

Hi @Atinux, cool!
Just wondering what's the best approach to test this, as basic.generate.test.js generates the files by default before running the tests suite.
Should I just add the tests after closing the server or is there a different method?
Also, what's the best way to test it?
a) Generate & check if the routes rendered in fixtures/basic/dist are a folder or a file by checking the type with fs.
b) Generate & check if the routes rendered path based on the subFolders option.
c) A better option? 😄

As you will need to generate the files twice, you either have to add another test or re-generate within the same basic test. The first speaks for it self, for the later you could take a look how I approached that here: https://github.com/pimlie/nuxt-generate-cluster/blob/next/test/single.regenerate.test.js
So after the normal tests are done I first remove the full dist/users/ folder and check if they really have been removed (eg the routes should give a 404). After that I run the generate command again but this time I dont build Nuxt but only initiate. After that you could check either check the fs but inline with the current test implementation I would test if you can retrieve eg /user/1.html from the server.
For your test you would also need to change the nuxt config of course before generating the second time.

Ok, just got time to look at it!
@pimlie, Yeah, I'm trying to re-generate within the same basic test specs with a different configuration ;)
However, adding subFolders: false throws an error while trying to render the component in lib/app/components/nuxt-child.js.
TypeError: Cannot read property 'components' of undefined

# nuxt-child.js
# parent.$route
{ name: null,
  meta: {},
  path: '/stateless.html',
  hash: '',
  query: {},
  params: {},
  fullPath: '/stateless.html',
  matched: [] }

The routerViewKey computed function in /lib/app/components/nuxt.js actually return an invalid route:
/routename.html

instead of
/routename

I'll try to get some time to deeply look at it this week-end.
@Atinux, @pimlie, any ideas where I should look at?

Hi @Gomah
For TypeError: Cannot read property 'components' of undefined, I made a fix to nuxt.js core (https://github.com/nuxt/nuxt.js/commit/4b79c38f41786566f86b993ef2ae3f5151c6a9c0).
Actually I remember why it's not possible. Most CDN cannot serve /routename to routename.html but instead has to be /routename -> /routename/index.html.
Also, if you go to /routename.html, Vue does not know this route (since it has an extension in its name) and cannot load the app.
Actually, the right solution is to use canonical urls in your header: https://support.google.com/webmasters/answer/139066?hl=en
Example of your nuxt.config.js:
module.exports = {
  head: function () {
    const path = this.$route.path.replace(/\/$/, '') // Remove trailing /
    return {
      link: [{ rel: 'canonical', href: `https://my-website.com${path}` }]
    }
  }
}

I also made a fix so you can use head() {...} in the next release.
I believe we could add it to the documentation.

Thanks for the fix!
Are we still considering this option? Even if the canonical url is set, I believe it's still crucial as Google is crawling 301s for those routes.
I just got the test working actually, I added the extensions option to the serveStatic function to set an extension fallback so the local server mounted during the tests behave like Netlify servers (or any other server using html fallbacks).
I've added test/basic.generate.nosubfolders.test.js, let me know if there's a better way to structure this test.

I believe this option can be used with Netlify or the extensions set for serve-static.
I can merge it, but could you make the changes for the documentation: https://github.com/nuxt/docs/blob/master/en/api/configuration-generate.md

Awesome :raised_hands:

I was looking at the tests but I dont think they are specific enough. E.g. there is currently no check if subfolders: true really generates users/1/index.html and subfolders: false generates users/1.html as serveStatic will always magically translate the users/1 url to the correct one. Currently if someone changes the following line https://github.com/nuxt/nuxt.js/blob/dev/lib/builder/generator.js#L185 to read if (true) { the nosubfolder tests will still pass because of this.
As I mentioned in my comment above, I think you should make sure that in basic.generate.js you test one of the users as users/1/index.html and in the nosubfolders test you test one of the users as users/1.html.
But due to the fact that serveStatic can be an issue in the test itself, I actually think it would be best to also add a fs check. For the nosubfolders test it would look like this:
import { existsSync } from 'fs'
...
test('/users/1.html', async t => {
  const html = await rp(url('/users/1.html'))
  t.true(html.includes('
User: 1
'))
  t.true(existsSync(resolve(__dirname, 'fixtures/basic/dist', 'users/1.html')))
  t.false(existsSync(resolve(__dirname, 'fixtures/basic/dist', 'users/1/index.html')))
})

You never cant have enough tests ;)

@pimlie True, I was focused on rendering the component properly with serveStatic that I forgot my initials thoughts!
Just added your suggestion #2132 👍

Hi @Gomah , I tried the your subfolders branch but when we try to generate, the mounted method is not called in my case but is being called correctly in rc11 version

@piyushchauhan2011 Weird, all my mounted hooks are working using nuxt@dev.
Do you have an example?

@piyushchauhan2011 @Gomah
Same problem occurred for me, but I founded the two cases.

When I use static routing like below, actually the generated hoge.html doesn't call mounted method.

.
├── pages
│     ├── index.vue
│     └── hoge.vue

but when I use dynamic routing, the generated hoge.html also call mounted method correctly.

.
├── pages
│     └── _id.vue

  generate: {
    routes: [
      'hoge'
    ]
  }

I'm on Nuxt 1.4, and experiencing the same issue as @gonshi with subFolders:false. App looks great in dev or when generated with subFolders:true.
Would be great to see this working as it'd resolve some SEO  and URL canonicalization issues for non-dynamic routes very nicely.

authors: Atinux Gomah codecov-io gonshi jscheller pimlie piyushchauhan2011


text:
pip install permission denied no fuck given

dionyziz@descartes ~/workspace/opensource_grr % pip install ipaddr
Downloading/unpacking ipaddr
  Downloading ipaddr-2.1.11.tar.gz
  Running setup.py (path:/tmp/pip_build_dionyziz/ipaddr/setup.py) egg_info for package ipaddr

Installing collected packages: ipaddr
  Running setup.py install for ipaddr
    error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ipaddr.py'
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_dionyziz/ipaddr/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-q9ixfd-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying ipaddr.py -> build/lib.linux-x86_64-2.7

running install_lib

copying build/lib.linux-x86_64-2.7/ipaddr.py -> /usr/local/lib/python2.7/dist-packages

error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ipaddr.py'

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_dionyziz/ipaddr/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-q9ixfd-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_dionyziz/ipaddr
Storing debug log for failure in /usr/local/google/home/dionyziz/.pip/pip.log
dionyziz@descartes ~/workspace/opensource_grr % fuck
No fuck given

Rule doesn't exist as of yet. Thanks for the info!

authors: SanketDG dionyziz

repo: nvbn/thefuck

license: mit


text:
🛑 Kubeflow ML Platform is down

In dfbdaa0, Kubeflow ML Platform (https://kubeflow.lab.novaglobal.com.sg) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Kubeflow ML Platform is back up in d22a55c.

repo: nvgsg/lab-upptime


text:
🛑 NVIDIA AI Enterprise Hub is down

In f4bdb51, NVIDIA AI Enterprise Hub (https://nvaie.lab.novaglobal.com.sg) was down:

HTTP code: 0
Response time: 0 ms

Resolved: NVIDIA AI Enterprise Hub is back up in b5eef66.


text:
🛑 Kubeflow ML Platform is down

In 8a0039e, Kubeflow ML Platform (https://kubeflow.lab.novaglobal.com.sg) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Kubeflow ML Platform is back up in c0d0fce.


text:
Sample application to chat with NIMs and ai.nvidia.com

A sample application that demonstrates the ability to use OpenAI APIs with NVIDIA Inference Microservices (NIMs) whether self-hosted or from build.nvidia.com.

I would recommend renaming that application to something more explicit: sample_nim?

@mocsharp are we ready to merge?

authors: jjomier mocsharp

repo: nvidia-holoscan/holohub


text:
No completion

My init.vim
lua << EOF

local nvim_lsp = require('lspconfig')
local on_attach = function(_, bufnr)
	require'completion'.on_attach()
end
local servers = {'pyright', 'clangd'}
for _, server in ipairs(servers) do
  nvim_lsp[server].setup {
    on_attach = on_attach,
  }
end
EOF
" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()

" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect

" Avoid showing message extra message when using completion
set shortmess+=c
imap <tab> <Plug>(completion_smart_tab)
imap <s-tab> <Plug>(completion_smart_s_tab)

How to reproduce
On pressing tab, don't get autocomplete.
Expected behavior
Autocomplete menu appears

@notprash
What version of neovim are you running? if you are unsure run nvim --version

Yes.  You are right. And the fix is already exists.
https://github.com/nvim-lua/completion-nvim/pull/400
But it is not merged yet...  I don't know why.

authors: PolarianDev Shougo notprash

repo: nvim-lua/completion-nvim


text:
Linux stuff

NOTE
Please verify that the base repository above has the intended destination!
Github by default opens Pull Requests against the parent of a forked repository.
If this is your personal fork and you didn't intend to open a PR for contribution
to the original project then adjust the base repository accordingly.

please read the body of your PR.

this is meant to be on your personal fork. Please actually read the text that comes up when you fork. Closing.

authors: boxoloxo fbernier feoh


text:
fix: remove global print function call

This commit removes a call to an unknown print global function.
Closes #78

Thank you! :sweat_smile:

authors: jarviliam rcarriga

repo: nvim-neotest/neotest-python


text:
Context window should inherit tabstop

Tabstops (I use \t for indents) are shown as 8 in the context window, while I configure the code window to use tabstop=4

Setting tabstop while the window is already open doesn't affect tabstops in the context window too

Fixes in #162

repo: nvim-treesitter/nvim-treesitter-context


text:
ft('lua'): fmt('lsp') How to choose which LSP is specific?

use
ft("lua"):fmt({
  fn = function(buf,range)
    vim.lsp.buf.format({
      buffer = buf,
      range = range,
      async = true,
      name = "some server"
      filter = function(client) return client.name == "this" or client.name == "that" end
})

:h vim.lsp.buf.format

Thank you


text:
Finder float window too small with vertical splits

Is your feature request related to a problem? Please describe.
When using :Lspsaga finder with 4 windows side by side, the window is too small to be useful:

Describe the solution you'd like
Finder should have an option to utilize the whole screen space rather than be limited by the window width where the command was run.
Like this (from :FzfLua lsp_finder)

Describe alternatives you've considered
:FzfLua lsp_finder :/
Additional context
opening from left most window:

that was quick 😮  thank you!

The right most one isn't affected by the fix though:

I'm assuming the left window ("REFERENCES") needs similar attention.

how about now

a little broken

thanks for report it how about now.

except pic one other works fine i think

increased.

seems better than before

hardcore min is 50 maybe not good in your screen ? for me it works like this


text:
don't require XDG_HOME to use it, it's not required

here's the actual session variables that might be set if you're using an xdg compatible system. the spec does not require this variable to be set, it has a default. To be honest I think you should just use this directory period if it's not set.
❯ env | grep XDG                                                                                # ~
XDG_CURRENT_DESKTOP=KDE
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=1

Which directory are you suggesting it use?
No XDG variable is required by nvm; the snippet in the readme falls back to $HOME/.nvm when $XDG_CONFIG_HOME does not exist.

Which directory are you suggesting it use?
No XDG variable is required by nvm; the snippet in the readme falls back to $HOME/.nvm when $XDG_CONFIG_HOME does not exist.

I'm suggesting it follow the spec

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

I'm suggesting it follow the spec

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

The specification uses the term "should be written" which means that it is entirely up to the whims of a maintainer whether to do so. As such, nvm is in full compliance with the XDG spec, as it is.
Regardless, to fully comply with the XDG spec would be a breaking change for 99.99999% of all nvm users, and would scatter nvm-related files in multiple locations on the user's system. That's not an improvement, and that's not software I'd wish to maintain. I reluctantly added support for $XDG_CONFIG_HOME at the urging of a tiny tiny minority of users that requested it, but I'm not going to pollute my user's systems with files in multiple locations; that would be quite hostile to them.

The specification uses the term "should be written" which means that it is entirely up to the whims of a maintainer whether to do so. As such, nvm is in full compliance with the XDG spec, as it is.
Regardless, to fully comply with the XDG spec would be a breaking change for 99.99999% of all nvm users, and would scatter nvm-related files in multiple locations on the user's system. That's not an improvement, and that's not software I'd wish to maintain. I reluctantly added support for $XDG_CONFIG_HOME at the urging of a tiny tiny minority of users that requested it, but I'm not going to pollute my user's systems with files in multiple locations; that would be quite hostile to them.

IMHO anything in config should be "commit"-able, so you can use software like yadm to easily re-set up your environment on a new install. also the reason the tiny amount of users want it is because we don't like ~/ being filled with a ton of .files, and having things split up means you can commit things, if necessary you can blow cache away, etc. anyways, do what though wilt. I mean, splitting it up, I'd just search for the existing directories/layouts and then configure those/or migrate them to the new location(s) on update.

IMHO anything in config should be "commit"-able, so you can use software like yadm to easily re-set up your environment on a new install. also the reason the tiny amount of users want it is because we don't like ~/ being filled with a ton of .files, and having things split up means you can commit things, if necessary you can blow cache away, etc. anyways, do what though wilt. I mean, splitting it up, I'd just search for the existing directories/layouts and then configure those/or migrate them to the new location(s) on update.

I just installed nvm and of course it created a dir in my home dir. Awful. Even windows stores it's stuff in a config dir (AppData), imagine having all apps store their config on your desktop or in C:\ directly.
@ljharb The default dir for XDG_CONFIG_HOME is not in $HOME, but in $HOME/.config , as per https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

Moreover, configs (${XDG_CONFIG_HOME:-$HOME/.config}) should be split from cache (${XDG_CACHE_HOME:-$HOME/.cache}) and other data (${XDG_DATA_HOME:-$HOME/.local/share}) and other info defined in the spec.

authors: ljharb ssipos90 xenoterracide

repo: nvm-sh/nvm


text:
Error on Windows 10

Operating system and version:
nvm debug output:

nvm ls output:

How did you install nvm?
Installing nvm using curl and kept getting
"The revocation function was unable to check revocation for the certificate."
What steps did you perform?
So I put --ssl-no-revoke at the end and it ran
What happened?

What did you expect to happen?
Is there anything in any of your profile files that modifies the PATH?

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

What shell are you using? nvm requires WSL on windows.


text:
Cannot Install nvm on ubuntu

Operating system and version:
Ubuntu 22.04.1
nvm debug output:

nvm ls output:

How did you install nvm?

What steps did you perform?
I just ran this line of code "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash"
What happened?
I got this error after the timer stopped and nothing was downloaded
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:--  0:02:10 --:--:--     0
curl: (28) Failed to connect to raw.githubusercontent.com port 443 after 130204 ms: Connection timed out
What did you expect to happen?
I expected that it would install nvm
Is there anything in any of your profile files that modifies the PATH?

I'm not sure...

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

 curl -I --compressed -v https://nodejs.org/dist/
*   Trying 104.20.23.46:443...
* Connected to nodejs.org (104.20.23.46) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=*.nodejs.org
*  start date: Jan 11 00:00:00 2022 GMT
*  expire date: Feb 11 23:59:59 2023 GMT
*  subjectAltName: host "nodejs.org" matched cert's "nodejs.org"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* Using Stream ID: 1 (easy handle 0x555ffbab7550)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> HEAD /dist/ HTTP/2
> Host: nodejs.org
> user-agent: curl/7.81.0
> accept: */*
> accept-encoding: deflate, gzip, br, zstd
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 200
HTTP/2 200
< date: Sun, 18 Dec 2022 18:47:26 GMT
date: Sun, 18 Dec 2022 18:47:26 GMT
< content-type: text/html
content-type: text/html
< last-modified: Sun, 18 Dec 2022 14:35:12 GMT
last-modified: Sun, 18 Dec 2022 14:35:12 GMT
< cache-control: max-age=14400
cache-control: max-age=14400
< cf-cache-status: HIT
cf-cache-status: HIT
< age: 1625
age: 1625
< vary: Accept-Encoding
vary: Accept-Encoding
< strict-transport-security: max-age=31536000; includeSubDomains; preload
strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
x-content-type-options: nosniff
< server: cloudflare
server: cloudflare
< cf-ray: 77ba11260bbb8b09-BOM
cf-ray: 77ba11260bbb8b09-BOM
< content-encoding: br
content-encoding: br
<

Connection #0 to host nodejs.org left intact

This looks like you're having difficulty connecting to github - if you can't download the install script then certainly nothing will install.
Can you try curl -I --compressed -v https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh as well?

I tried this "curl -I --compressed -v https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh" today but still I'm getting these errors,
curl -I --compressed -v https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh

Trying 49.44.79.236:443...
Trying 2405:200:1607:2820:41::36:443...
Immediate connect fail for 2405:200:1607:2820:41::36: Network is unreachable
connect to 49.44.79.236 port 443 failed: Connection timed out
Failed to connect to raw.githubusercontent.com port 443 after 133746 ms: Connection timed out
Closing connection 0
curl: (28) Failed to connect to raw.githubusercontent.com port 443 after 133746 ms: Connection timed out

Seems like your internet connection has some issues. It could be your workplace/school, your ISP, or your government, but this isn't really something I can help you debug, unfortunately.

Same issue basically.
root@husky:~# curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15916  100 15916    0     0   109k      0 --:--:-- --:--:-- --:--:--  109k
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
error: git-remote-https died of signal 4
Failed to clone nvm repo. Please report this!
root@husky:~#

It's 22.04 as-well.

@Itz-Hyperz same comment to you - can you clone the nvm repo by itself?

Hey there, I was too unable to clone and install nvm in my device. It seems like a government thing. The address is blocked all together. I used vpn and was able to install nvm properly. Let me know if it works for you too. 👍🏼

I agree that's likely what it is, so I'm going to close this. I believe India has recently blocked githubusercontent.com, so I'd suggest a vpn, or advocating to your government, if this affects you.

It's a ban from your country, or some proxy config
I'm from Nigeria, and i experienced the same issues a while ago.
Simply use a VPN to download it.
At least, It worked for me.

What worked for me was to copy this file from Github and save it locally in my machine.
Later run the same command but just replace the Github link with the local file path and you're ready to go!

Like @kedarMvyas  suggested, save this file to your local machine. Then run (using bash):
bash path/to/file/install.sh

authors: ANUJSP25 Anonav0 Itz-Hyperz devodii donjne kedarMvyas ljharb


text:
Added the changes as suggested under #11.

Hey!!
I have added the pre page loader and a navigation button for scrolling to the top of the page ..
Pls see to it , and if you like the changes then pls merge it .

Hey! So sorry about the late response I had a really busy weekend. I just merged and saw the loading screen. Looks cool! The button is also very useful. Thank you so much! In addition to the update, I'm gonna try to change the background color of the website and the container to match the loading screen
Highly appreciate your contribution. <3

repo: nvralone/site


text:
Incorrect linter info msg

When we have a method like:
public someType someMethod() {
  synchronized (someObject) {
    doSomething();
    return something;
  }
}

we get an output like:
nnn    info     The method someMethod in class SomeClass is missing an explicit return  ImplicitReturnStatement
I think that's actually incorrect :)

@lowrider59 this is a CodeNarc issue, not a npm-groovy-lint one ^^
You may disable the rule in this file or on this specific piece of code using inline-disable comments :)
https://nvuillam.github.io/npm-groovy-lint/#disabling-rules-in-source

I believe it is complaining that your "synchronized" call is being used as the return value of the function.  The return that is there is returning from the closure (the nested block), not the function.
Try:
public someType someMethod() {
  return synchronized (someObject) {
    doSomething();
    return something;
  }
}

authors: lowrider59 nvuillam vallon

repo: nvuillam/npm-groovy-lint


text:
🛑 Harmony Bot Website is down

In f74e0e8, Harmony Bot Website ($HARMONY_WEB) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Harmony Bot Website is back up in 9d025c5.

repo: nxvvvv/uptime


text:
🛑 Harmony Bot Website is down

In ed55c36, Harmony Bot Website ($HARMONY_WEB) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Harmony Bot Website is back up in 3cbfb42.


text:
I cant sync items at my window pc,while work as intended at ipad and my andriod phone

and the note list pop out in weird position which blocked my “file explorer”button，I have to restart the obsidian to fix it

Now that you’ve restarted Obsidian, is the problem still occurring?
On Thu, Sep 15, 2022 at 03:00 onylin @.***> wrote:

and the note list pop out in weird position which blocked my “file
explorer”button，I have to restart the obsidian to fix it
—
Reply to this email directly, view it on GitHub
https://github.com/nybbles/obsidian-pocket/issues/105, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AADG36LJWYUEL2DW3K35N7DV6LXUNANCNFSM6AAAAAAQNHGGRM
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

--
Nimalan

Now that you’ve restarted Obsidian, is the problem still occurring?
On Thu, Sep 15, 2022 at 03:00 onylin @.> wrote: and the note list pop out in weird position which blocked my “file explorer”button，I have to restart the obsidian to fix it — Reply to this email directly, view it on GitHub <#105>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADG36LJWYUEL2DW3K35N7DV6LXUNANCNFSM6AAAAAAQNHGGRM . You are receiving this because you are subscribed to this thread.Message ID: @.>
-- Nimalan

yeah,it works fine on my mobile devices，but sadly i still cant make this plugin working on my pc

authors: nybbles onylin

repo: nybbles/obsidian-pocket


text:
Why there will never be a _ref at the base of an object.

For whenever this is brought up again, these are the reasons why there will never be a _ref at the base of any object within this particular project.  This post contains logic that will hopefully be referred to from other issues to avoid repeating the same logic in other threads.
For example, we can return something like this:
{
  "a": {
    "_ref": "<someone else's resource id>"
  }
}

When that object is composed, we will recursively add the data from _ref to the object in a.  However, we shouldn't do this:
{
  "_ref": "<my own resource id>"
}

The meaning of the word reference is "something that refers" and I am very hesitant to give the word special meaning for our particular project.  That is, it shouldn't suddenly change from representing "that guy over there" to "who I am" because of its position in an object tree.

Reference:
a :  allusion, mention
b :  something (as a sign or indication) that refers a reader or consulter to another source of information (as a book or passage)
c :  consultation of sources of information

In a RESTful API, GET <--> PUT is supposed to be commutative in that putting something somewhere should mean that getting the exact same uri should give the exact thing you put there, and vice versa.  There are multiple places you could get the same information from, and assigning a ref into the data means you can't save to multiple places without modifying the data each time (i.e., versioning, publishing, etc.).

Having a _ref means that you are pointing somewhere else, and that anything in that ref object means that it is someone else's data.  Having a _ref at the base is implying that the entire object is someone else's data.  Unless you're trying to create an exception?

Having a _ref at the base of an object means that you can easily PUT an object with a base-level  _ref to a uri that doesn't match; we often PUT to multiple places because of publishing and versioning, and having the uri in the data means we have to edit the data each time we were to do that.  Performing a simple diff between objects becomes a multiple step process.  Having an object at a certain uri with a base _ref pointing to a different uri sounds like a debugging nightmare.

Having a ref at the base of an object means that all of the code that does recursion on our objects will have to be rewritten.  This includes how we do composition, how we create new pages, and how we publish data.  It would have to be rewriten to ignore the first level of data and then start the recursion, which considering that most of our objects are only a single level or two levels deep, would do terrible things to our performance.  For scale, that's about 60% of byline-core's codebase.

These arguments were originally posted here:  https://github.com/nymag/byline-editor/issues/89
This Issue is referenced in our routing documentation.

As an addendum, the _self exposed to composed pages will always be the URI of the thing being requested. This means a few things:

GET /pages/:id.html will expose the page's URI
GET /components/:name/instances/:id wil expose the component's URI

This is the reason why the data-uri in root elements of our layouts is the page URI when requesting a composed page and the layout component's URI when requesting the layout itself.

authors: TakenPilot nelsonpecora

repo: nymag/amphora


text:
simple key mapping for page areas

BREAKING CHANGE
This replaces the (complicated) insertion of page data into layouts with a simple 1:1 key mapping. The old way was extremely flexible, but complicated and slow (and it turns out was more than we actually needed). The new way allows us to bake some assumptions into our data and kiln, and lays the foundation for switching layouts.
Here's what the old data looked like:
# page
pageRef:
  layout: /layout/ref
  areaA: /a/string/ref
  areaB:
    - /another/ref
    - /a/third/ref

# layout
layoutRef:
  propA: ['areaA']
  propB:
    -
      _ref: /some/layout/component
    - areaB

Here's what the new data looks like:
# page
pageRef:
  layout: /layout/ref
  propA:
    - /a/string/ref # all page areas look the same
  propB:
    - /another/ref
    - /a/third/ref

# layout
layoutRef:
  propA: propA # layout prop and page prop have the same name, allowing for easy insertion and switching
  propB: propB
  propC:
    -
      _ref: /some/layout/component

👍

authors: byronhulcher yoshokatana


text:
Craft 3 module generator zip file is empty

Generated zip file has only .craftplugin file. This one is named site and has Service, Twig Extension, Variables, with comments turned on.
sitemodule.zip

Is this still happening for anyone @marionnewlevant @boscho87 ?

Seems fixed will check tomorrow

😅👍🏾

authors: boscho87 khalwat marionnewlevant


text:
🛑 ImageSlide Converter is down

In 32eb887, ImageSlide Converter (https://slide.ootr.jp/api/healthz) was down:

HTTP code: 0
Response time: 0 ms

Resolved: ImageSlide Converter is back up in 1df5fc5 after 47 minutes.

repo: o-tr/upptime


text:
readme images are stretched on mobile devices

The images are stretched on mobile devicss. There might be a "height" value which is problematic.

Which browser is it ? It has height. Yet appears good on chrome and android.

Any browser. Try to emulate a mobile device.

I will probably provide a PR to fix this.


text:
VM User Portal auto-logout(timeout) when UserSessionTimeOutInterval=-1

Description of problem: User informed me today they could not log into the VM Portal. After investigation it looks like the UI is requesting a logout when  TimeOutInterval is -1. The admin portal works as expected and never logs out.
[root@cloud ~]# engine-config --get UserSessionTimeOutInterval
UserSessionTimeOutInterval: -1 version: general

/var/log/ovirt-engine/engine.log
2019-08-30 09:46:03,512-04 INFO  [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-4) [] User creynolds@COMPANY-LDAP successfully logged in with scopes: ovirt-app-admin ovirt-app-api ovirt-app-portal ovirt-ext=auth:sequence-priority=~ ovirt-ext=revoke:revoke-all ovirt-ext=token-info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token-info:validate ovirt-ext=token:password-access
2019-08-30 09:46:03,726-04 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-4) [214c7367] EVENT_ID: USER_VDC_LOGIN(30), User creynolds@company-ldap-authz connecting from '1.2.3.4' using session 'biGolLongSessionIDkeY==' logged in.
2019-08-30 09:46:07,438-04 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-5) [6d8a13a3] EVENT_ID: USER_VDC_LOGOUT(31), User creynolds@company-ldap-authz connected from '1.2.3.4' using session 'biGolLongSessionIDkeY==' logged out.
2019-08-30 09:46:07,486-04 INFO  [org.ovirt.engine.core.sso.servlets.OAuthRevokeServlet] (default task-4) [] User creynolds@COMPANY-LDAP successfully logged out

As a workaround, I set UserSessionTimeOutInterval to 999 and the user can now log in.
VM Portal version number:
Red Hat Virtualization VM Portal Version 1.5.3-1
oVirt version number:
ovirt-engine-4.3.5.5-0.1.el7.noarch
Browser and version:
Same result on several browsers.
Steps to Reproduce:

engine-config --set UserSessionTimeOutInterval=-1
Try to log into User VM Portal.
Get logged out right away.

Actual results: User is logged out immediately.
Expected results: User is never automatically logged out.

Duplicate of https://github.com/oVirt/ovirt-web-ui/issues/1085 and will be fixed in https://github.com/oVirt/ovirt-web-ui/pull/1087

repo: oVirt/ovirt-web-ui


text:
Add design document in github

To help future developers understand the project

added the documentation


text:
Weird blue border around folder selection

I have 1 folder shared with me.
I went into a collaborative document and selected to "Add to Folder". When I select the folder to which I want to add it, it gets a weird asymmetric blue border. Notice that I have switched focus to the "My Library" tab, which indicates that the blue border is not the browser's focus border.

Chrome 40.0.2214.111 Mac OSX

Attached a fix. Assigning to @mrvisser for review

Note that the blue item is supposed to indicate the selected item, so it is expected to remain blue when you tab away from it. However, the asymmetry definitely was a visual issue.

Very minor feedback request, back to @nicolaasmatthijs

Followed up on review. Back to @mrvisser for merging.

authors: mrvisser nicolaasmatthijs