You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the docs here, by default CARLsim configures all neuron groups with a CPU affinity mask, such that they always execute on CPU 0 (at least on Linux).
In many applications, we wish to run multiple CARLsim instances on the same machine (ex. to achieve statistically significant runs, or to evaluate different subpopulations in an evolutionary algorithm). The affinity mask interferes with this by placing all CARLsim instances on CPU 0.
Manually specifying the CPU affinity for simulations is tedious, so it would be preferable to have the option to remove the mask (or even to leave it disabled by default).
I have confirmed that simply commenting out the call to pthread_attr_setaffinity_np()here in the SNN::doCurrentUpdate() method (which does most of the work in a CARLsim simulation) is sufficient---without that line, separate CARLsim instances are automatically spread across all the cores on my machine.
Before and after photos, running 12 CARLsim instances concurrently (the red line is CPU 0):
CPU 0 still does more than its share of work (probably because I only removed the affinity mask from one function---many others are still using it in this example).
I'd propose adding a runtime flag to disable this and all other calls to pthread_attr_setaffinity_np().
Note: This problems does not affect macOS, because macOS traditionally ignores pthreads affinity masks.
The text was updated successfully, but these errors were encountered:
Does this also affect mutlithreaded parallelism within a single CARLsim instance? If so, that's a good argument for disabling the affinity mask entirely by default.
Commenting out all 15 affinity masks in snn_manager.cpp gives me full utilization on all threads.
For my use case (multiple CARLsim instances being run on CPU by ECJ) it makes sense to remove all of these from the codebase. I'd like someone else's input, though, to ensure that this doesn't break multi-CPU simulations or something.
As per the docs here, by default CARLsim configures all neuron groups with a CPU affinity mask, such that they always execute on CPU 0 (at least on Linux).
In many applications, we wish to run multiple CARLsim instances on the same machine (ex. to achieve statistically significant runs, or to evaluate different subpopulations in an evolutionary algorithm). The affinity mask interferes with this by placing all CARLsim instances on CPU 0.
Manually specifying the CPU affinity for simulations is tedious, so it would be preferable to have the option to remove the mask (or even to leave it disabled by default).
I have confirmed that simply commenting out the call to
pthread_attr_setaffinity_np()
here in theSNN::doCurrentUpdate()
method (which does most of the work in a CARLsim simulation) is sufficient---without that line, separate CARLsim instances are automatically spread across all the cores on my machine.Before and after photos, running 12 CARLsim instances concurrently (the red line is CPU 0):
CPU 0 still does more than its share of work (probably because I only removed the affinity mask from one function---many others are still using it in this example).
I'd propose adding a runtime flag to disable this and all other calls to
pthread_attr_setaffinity_np()
.Note: This problems does not affect macOS, because macOS traditionally ignores
pthreads
affinity masks.The text was updated successfully, but these errors were encountered: