Skip to content
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

Enable Multi-Core Processing Across All Operating Systems #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

er-or-er
Copy link

I noticed that when running the dGen model on a Windows 10 device, specifying multiple cores in config.py did not result in multi-core utilization; only one CPU core was being used. Upon investigating, I found several checks for if 'ix' not in os.name: in dgen_model.py and agents.py. These checks set the number of cores to None and used cf.ThreadPoolExecutor for non-'ix' operating systems, while cf.ProcessPoolExecutor was used for 'ix' operating systems.

To address this, I made the following changes:

  • Removed the if clauses that checked for the OS name.
  • Ensured that the number of cores specified in config.py is respected.
  • Set cf.ProcessPoolExecutor as the default executor regardless of the operating system.

These changes have significantly improved performance in my tests. The model now spawns processes equal to the number of cores specified in config.py, resulting in computation times that are approximately divided by the number of cores used.

Please review these changes and consider merging them if they do not cause any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants