letianwu / zmcintegral Goto Github PK
View Code? Open in Web Editor NEWAn easy way to use multi-GPUs to calculate multi-dimensional integration
Home Page: https://arxiv.org/pdf/1902.07916v2.pdf
License: Apache License 2.0
An easy way to use multi-GPUs to calculate multi-dimensional integration
Home Page: https://arxiv.org/pdf/1902.07916v2.pdf
License: Apache License 2.0
Hi, I've read your paper with great interest, but I could not find the TensorFlow version of ZMCintegral. Could you may point me to the right repository?
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))
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
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'
Is there a way to perform linear algebra routines with ZMCintegral?
It seems that it is not supported to use kernels in the device function, and CuPy/PyCulib does not seem to be usable in a device function either.
Any suggestions on performing matrix algebra within a device function?
I have a very long expression that I want to integrate and i am getting the following error :
LLVM ERROR: out of memory
Traceback (most recent call last):
File "./Program.py", line 4382, in
result = MC.evaluate()
File "/home/.../ZMCintegral.py", line 82, in evaluate
MCresult = self.importance_sampling_iteration(self.initial_domain, 0)
File "/home/.../ZMCintegral.py", line 88, in importance_sampling_iteration
MCresult_chunks, large_std_chunk_id, MCresult_std_chunks = self.MCevaluate(domain)
File "/home/.../ZMCIntegral.py", line 140, in MCevaluate
MCresult.append(np.load(os.getcwd()+'/multi_temp/result'+str(i_batch)+'.npy'))
File "/home/.../miniconda3/envs/myenv/lib/python3.7/site-packages/numpy/lib/npyio.py", line 422, in load
fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/.../multi_temp/result0.npy'
Any suggestion on how to circumvent this problem ?
The code throws an error if the function takes more arguments than given in the domain, but setting the end and beginning of an interval in the domain causes the calculations to loop infinitely.
I suggest adding the ability to pass function arguments that are not integrated over.
In the meantime (or permanently), an error should be thrown if the two ends of a domain are equal.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.