htm-community / htm.core

Actively developed Hierarchical Temporal Memory (HTM) community fork (continuation) of NuPIC. Implementation for C++ and Python
http://numenta.org
GNU Affero General Public License v3.0
150 stars 74 forks source link

Enable use of Parallel TS of c++17 #214

Open breznak opened 5 years ago

breznak commented 5 years ago

After #55 https://www.phoronix.com/scan.php?page=news_item&px=Intel-Parallel-STL-libstdc-libc

Paralel TS, as defined in c++17, should soon be available in GCC, Clang (supported in MSVC already :+1: ) I'm very interested to test its performance.


EDIT:

PROs:

CONs:


I will experiment with this, some progress outline, @breznak TODO:

ctrl-z-9000-times commented 5 years ago

I looked into this and it look pretty neat! It's always nice to see more ways to use the extra CPU cores that come with most computers now a days.

Some things to consider:

Naively, I think we could get the most bang/buck by parallelizing the methods:

breznak commented 5 years ago

Parallel code is difficult to get right. Although this approach does look really simple...

right, that should be the advantage of this approach, c++ would parallelize select (for-loops) for you implicitly.

I see 3 different levels of parallelisation that could be implemented:

Connections::computeActivity and NOT using mutex locks. This method is fault tolerant and does not need to be exact.

these are valuable hints, thank you!

Another thing I'd be interested is making ALL the code run in parallel (each column, ideally), this would be interesting from biological POV as the algos would be async, from implementation/future POV that 64+ threaded CPUs are becoming more and more common,

breznak commented 5 years ago

FYI, c++17 TS:Parallel in gcc-9 is now reaching availability, I've installed for Ubuntu from a PPA, our codebase compiles with g++9 #523 When I get some time I'd like to experiment with this approach more.