ZMCintegral
ZMCintegral copied to clipboard
change of the function definition in example fails
Hi. I using the example with the integration math.sin(x[0]+x[1]+x[2]+x[3]) I inserted an intermediate function: ( I checked that it can be evaluated outside of my_func(x))
def my_func(x): yu = math.sin(x[0]+x[1]+x[2]+x[3]) integrand = P3_integrand_Eq2_c(x[0], x[1], x[2], x[3], wo, omegas, phase_type) return yu
I get the following errors:
Process Process-2: Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/home/ubuntu/anaconda3/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py", line 111, in multi_processing result.append(self.MCkernel(domain, i_batch)) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py", line 373, in MCkernel integration_kernel[blockspergrid, threadsperblock](num_loops, MCresult, chunk_size, n_chunk_x, domain, domain_range, batch_size, i_batch, rng_states, n_chunk) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/cuda/compiler.py", line 765, in call kernel = self.specialize(*args) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/cuda/compiler.py", line 776, in specialize kernel = self.compile(argtypes) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/cuda/compiler.py", line 792, in compile **self.targetoptions) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/cuda/compiler.py", line 62, in compile_kernel cres = compile_cuda(pyfunc, types.void, args, debug=debug, inline=inline) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/cuda/compiler.py", line 51, in compile_cuda locals={}) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 941, in compile_extra return pipeline.compile_extra(func) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 372, in compile_extra return self._compile_bytecode() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 872, in _compile_bytecode return self._compile_core() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 859, in _compile_core res = pm.run(self.status) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock return func(*args, **kwargs) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 253, in run raise patched_exception File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 244, in run stage() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 500, in stage_nopython_frontend self.locals) File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/compiler.py", line 1044, in type_inference_stage infer.propagate() File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/typeinfer.py", line 861, in propagate raise errors[0] numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(<numba.cuda.compiler.DeviceFunctionTemplate object at 0x7fd0ffc81a90>) with argument(s) of type(s): (array(float64, 1d, C))
- parameterized In definition 0: TypingError: Failed in nopython mode pipeline (step: nopython frontend) Untyped global name 'P3_integrand_Eq2_c': cannot determine Numba type of <class 'builtin_function_or_method'>
File "script.py", line 130: def my_func(x):
raised from /home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/typeinfer.py:1180
In definition 1: TypingError: Failed in nopython mode pipeline (step: nopython frontend) Untyped global name 'P3_integrand_Eq2_c': cannot determine Numba type of <class 'builtin_function_or_method'>
File "script.py", line 130: def my_func(x):
raised from /home/ubuntu/anaconda3/lib/python3.6/site-packages/numba/typeinfer.py:1180
This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: Function(<numba.cuda.compiler.DeviceFunctionTemplate object at 0x7fd0ffc81a90>) [2] During: typing of call at /home/ubuntu/anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py (365)
File "../../anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py", line 365: def integration_kernel(num_loops, MCresult, chunk_size, n_chunk_x, domain, domain_range, batch_size, i_batch, rng_states, n_chunk):
Traceback (most recent call last):
File "script.py", line 139, in