Comments (4)
This could have something to do with the communication overhead on your specific system or the load on your CPU from other process. Another option is that this has something to do with how Jupyter handles parallelization. One experiment to try would be running this from a script instead of from Jupyter and monitoring the CPU usage during the run. Hope this helps!
from emcee.
This could have something to do with the communication overhead on your specific system or the load on your CPU from other process. Another option is that this has something to do with how Jupyter handles parallelization. One experiment to try would be running this from a script instead of from Jupyter and monitoring the CPU usage during the run. Hope this helps!
Thanks so much for the reply! I wrapped the code into a .py
script file and ran it on my Windows laptop. The output makes me confused:
(Note that the final run was much faster, at 26 iterations/s)
So instead of seeing just the output from one serial run and one parallel run, I got ten different MCMC run outputs. And yes my CPU cores were at full speed during the parallel run:
from emcee.
Good discovery! I think that if you now wrap your script as follows:
if __name__ == "__main__":
# The rest of the script goes here...
Then it'll only run everything once! This is probably because multiprocessing
is forking the process and running all the setup on each worker.
from emcee.
Good discovery! I think that if you now wrap your script as follows:
if __name__ == "__main__": # The rest of the script goes here...Then it'll only run everything once! This is probably because
multiprocessing
is forking the process and running all the setup on each worker.
Thanks! The result I got in my previous reply was actually exactly the effect of adding if __name__ == "__main__":
. (I found this solution on StackOverflow just some moments earlier...) I added this line before the part on multiprocessing.
If I don't add anything, I got an error pop out:
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
from emcee.
Related Issues (20)
- HDF backend file size
- Multiprocessing Pool scaling not as expected HOT 4
- [3.1.3] test failure with scipy 1.10 HOT 3
- Progress bar HOT 1
- Investigate the use of optree for structured parameter sets
- Issue on page /index.html HOT 1
- Add set_description to `pbar._NoOpPBar` HOT 1
- In emcee.EnsembleSampler threads command is not working
- Problem using 4-byte floats with EnsembleSampler HOT 4
- JAX implementation of emcee HOT 3
- issue with emcee installation HOT 3
- (solved) issue with sampler stalling with multiprocessing
- Saving non-arrayifiable data at each likelihood evaluation (either to disk or in memory) HOT 4
- Incompatible with numpy 2.0.0rc1 HOT 3
- New release to prepare for numpy 2 HOT 5
- Trying to use Blobs with the vectorize=True keyword returns a ValueError("incompatible input dimensions")
- emcee 3.1.5 incompatible with numpy < 1.25.0
- Using multithreading from tutorial doesnt seem to work
- Modified Walk Moves
- Issues with Parameter Extraction from Emcee
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emcee.