Help with Multiprocessing in HTM.core

Hey Everybody,

Does anyone here have experience using multiprocessing in HTM.core?

I currently have a Cortical Column class which contains a number of TM layers and methods to encode, spatially pool, and temporally extend input.

One layer processes sensory input, and the other processes motor input.

I want the two layers to simultaneously process their inputs in parallel in order to speed up computation time, but I don’t have a great frame of reference on how to do it.



HTM.core is not multi-threaded unfortunately. There are still a few places where global variables are used to pass arguments…I know, bad programming practice, but I could not get them all out.

If you have C++ experience, go ahead and try to clean up the remaining parts.

1 Like

I should qualify this a little. By “global variables” in this context I mean objects that contain state.
The Network object contains a set of objects (particularly SP’s an TM’s) that contain state. Within a Network, the inputs are applied to the algorithms in a prescribed sequence to modify that state (learning). So, having more than one thread executing a Network object at the same time would not work.

However, there is no problem using multiple threads where each thread is handling a different Network object. Of course, if the outputs from one Network are connected to the input of another Network object, those inputs would need to be queued and synchronized so a thread does not step on another thread’s data. That is the missing part.

1 Like

I believe that it is possible to parallelize within SP and TM using openMP

1 Like

Yes, it is possible parallelize the objects in such a way that only one of the threads is modifying the state at a time but each feeding it input. But, TM is expecting a time sequence of inputs. If there is more than one thread feeding it inputs, at random times, then it will be seeing a mixture of the inputs being fed by all of the threads. I don’t think that is what you want is it?

1 Like

fully agree with you!

1 Like