# NumbaRuntimeError: Failed in cuda mode pipeline NRT required but not enabled

**URL:** <https://numba.discourse.group/t/numbaruntimeerror-failed-in-cuda-mode-pipeline-nrt-required-but-not-enabled/2369>\
**Category:** Support: What is this error message?\
**Created:** [January 23, 2024, 6:38am UTC](https://numba.discourse.group/t/numbaruntimeerror-failed-in-cuda-mode-pipeline-nrt-required-but-not-enabled/2369 "2024-01-23T06:38:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newlearner\_CUDA](https://avatars.discourse-cdn.com/v4/letter/n/eada6e/32.png) [@newlearner\_CUDA](https://numba.discourse.group/u/newlearner_CUDA)\
**Post date:** [January 23, 2024, 6:38am UTC](https://numba.discourse.group/t/numbaruntimeerror-failed-in-cuda-mode-pipeline-nrt-required-but-not-enabled/2369/1 "2024-01-23T06:38:30Z")

</div>

I am a new learner of Numba. I want to speed up my code. But there is always some errors like this:

> NotImplementedError Traceback (most recent call last)  
> /usr/local/lib/python3.10/dist-packages/numba/core/lowering.py in lower\_expr(self, resty, expr)  
> 1323 # raise NotImplementedError if the types aren’t supported  
> → 1324 impl = self.context.get\_function(“static\_getitem”, signature)  
> 1325 return impl(self.builder,
> 
> 38 frames  
> NotImplementedError: No definition for lowering static\_getitem(List(int64, True), Literalint) → int64
> 
> During handling of the above exception, another exception occurred:
> 
> NumbaRuntimeError Traceback (most recent call last)  
> /usr/local/lib/python3.10/dist-packages/numba/core/runtime/context.py in \_require\_nrt(self)  
> 40 def \_require\_nrt(self):  
> 41 if not self.\_enabled:  
> —\> 42 raise errors.NumbaRuntimeError(“NRT required but not enabled”)  
> 43  
> 44 def \_check\_null\_result(func):
> 
> NumbaRuntimeError: Failed in cuda mode pipeline (step: native lowering)  
> NRT required but not enabled  
> During: lowering “$60binary\_subscr.2 = static\_getitem(value=point1, index=0, index\_var=$const58.1, fn=)” at (11)

And this is my code:

> @cuda.jit  
> def opti\_field\_line(point1, point2, z, u\_final):  
> a,b = cuda.grid(2)  
> h = 540  
> w = 960  
> wavelength = 0.000532  
> PS = 0.0108  
> PI = 3.14159265358979323846
> 
> ```
> if a < h and b < w:
> if point1[0]-(b-w/2)*PS < 0 and point2[0]-(b-w/2)*PS > 0:
> t1 = math.sqrt(PI/wavelength/z) * (point1[0]-(b-w/2)*PS)
> t2 = math.sqrt(PI/wavelength/z) * (point2[0]-(b-w/2)*PS)
> c1 = 1/(1j-1) * math.sqrt(2/PI) * ((2*t1-1/5*t1 **5+1/108*t1** 9) + 1j*(-2/3*t1 **3+1/21*t1** 7+1/660*t1**11))
> c2 = 1/(1j-1) * math.sqrt(2/PI) * ((2*t2-1/5*t2 **5+1/108*t2** 9) + 1j*(-2/3*t2 **3+1/21*t2** 7+1/660*t2**11))
> c3 = -1*math.copysign(1, t1)+ (1-1j)/2 * math.sqrt(2/PI) * cmath.exp(-1j*t1**2)/t1
> c4 = -1*math.copysign(1, t2)+ (1-1j)/2 * math.sqrt(2/PI) * cmath.exp(-1j*t2**2)/t2
> c5 = 1/4 * (1+1j) * math.sqrt(2*wavelength*z) * 1/z * cmath.exp(1j*2*PI/wavelength*z) * cmath.exp(1j*PI/wavelength/z*(point1[1]-(a-h/2)*PS)**2)
> if abs(t1) < 1.609 and abs(t2) < 1.609:
> c = c1 + c2
> u_final[a][b] += c5 * c
> elif abs(t1) < 1.609 and abs(t2) > 1.609:
> c = c1 + c4
> u_final[a][b] += c5 * c
> elif abs(t1) > 1.609 and abs(t2) < 1.609:
> c = c3 + c2
> u_final[a][b] += c5 * c
> elif abs(t1) > 1.609 and abs(t2) > 1.609:
> c = c3 + c4
> u_final[a][b] += c5 * c
> 
> ```
> 
> h = 540  
> w = 960  
> u\_final = np.zeros((h, w), dtype=np.complex128)
> 
> TPB = 16  
> threadsperblock = (TPB, TPB)  
> blockspergrid\_x = math.ceil(u\_final.shape[0]/threadsperblock[0])  
> blockspergrid\_y = math.ceil(u\_final.shape[1]/threadsperblock[1])  
> blockspergrid = (blockspergrid\_x, blockspergrid\_y)
> 
> u\_final\_gpu = cuda.to\_device(u\_final)  
> opti\_field\_line[blockspergrid, threadsperblock]([-1, 0], [1, 0], 100, u\_final\_gpu)

I’d be very grateful if you could help me.
