Does NuPIC use threads or processes?



I’ve been reviewing the code in a few of the code in the hotgym and NYC taxi example code. It looks to me like HTM uses sub-processes for processing multiple models simultaneously. Is my understanding correct? Or does HTM use threads?

And I’m curious to know what are the reasons why were sub-processes used instead of threads? Or vice-versa if threads are in fact being used.


@mellertson I changed the title of this from “Does HTM use threads or processes?” to “Does NuPIC use threads or processes?” and moved it from #htm-hackers into #nupic.


In most of NuPIC, models run in a single process/thread. You may run multiple models in separate threads or processes if you would like.

Swarming is one case where we run multiple models and I believe that we use subprocess.Popen to run models in a separate processes.


Our models need to be run in different processes, at least if you’re running the default “TP10X2” implementation of Temporal Memory. The underlying C++ code uses static variables inside of methods, for example here:

This means if you have two models running on two threads, the models will quietly clobber each other’s data.

(These variables ,e.g. newSynapses, should probably be members on the object, not static variables.)


4 posts were split to a new topic: Predicting stock directionality with NuPIC an Aqua

Predicting stock directionality with NuPIC and Aqua

Thanks for the info. Sounds like separate processes is the way to go.

Predicting stock directionality with NuPIC and Aqua