-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change of the function definition in example fails #14
Comments
Did you use the numba cuda decorator <@numba.cuda.jit> for your intermediate function? I have also been working with this package, ZMCintegral, and found that all functions called must be decorated with 'jit'. |
the function P3_integrand_Eq2_c should also be a device function. Here I provide you with an example similar to yours with our new version:
|
For constants, you have two choices:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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))
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):
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):
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
result = MC.evaluate()
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py", line 74, in evaluate
MCresult = self.importance_sampling_iteration(self.initial_domain, 0)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py", line 80, in importance_sampling_iteration
MCresult_chunks, large_std_chunk_id, MCresult_std_chunks = self.MCevaluate(domain)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/ZMCintegral/ZMCintegral.py", line 130, in MCevaluate
MCresult.append(np.load(os.getcwd()+'/multi_temp/result'+str(i_batch)+'.npy'))
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numpy/lib/npyio.py", line 372, in load
fid = open(file, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/workspace/phase_step/multi_temp/result0.npy'
The text was updated successfully, but these errors were encountered: