Comments (6)
Not to hijack the conversation, but the flame-graph also points at opencog::SourceSet
which looses huge amounts of time in boost which calls operator==
which calls pthread stuff. Over the last decade, I've repeatedly discovered that boost is a performance nightmare -- rip it out of your code, everything will run 2x or 3x faster. I mean, it seems odd to me that pthread-anything should be more than 1% of the total performance; that indicates thundering herds in operator==
Also: what's __GI__exp
and __ieee7
? These seem to be eating lots of time...
Also: as a general rule, you want to run any/all atomspace things with HUGETLB_MORECORE=yes LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libhugetlbfs.so.0
as this will in general give you a 50% performance boost.
from ure.
If you haven't configed hugepages, see below; its cut-n-paste from atomspace-postgres; you have to adjust these instructions for your app:
Tuning HugePages
Using 2MB-sized HugePages can also offer a large performance boost,
both for Postgres, and for the atomspace, especially when working with a
large atomspace. The procedure to set these up is a bit complicated.
First, add a hugepages user-group, and add postgres to it:
sudo groupadd hugepages
sudo gpasswd -a postgres hugepages
Then you need to find out what the group id (gid) was:
id postgres
Suppose that this shows group id 1234 for hugepages
. This needs to
be added to /etc/sysctl.conf
as well. So edit, and add:
vm.nr_hugepages = 16384 # 32GB of hugepages, 25% of RAM.
vm.hugetlb_shm_group=1234
Don't forget to sudo sysctl -p /etc/sysctl.conf
again.
Finally, the ability to use those pages. Add to /etc/security/limits.conf
:
@hugepages soft memlock unlimited
@hugepages hard memlock unlimited
from ure.
actually, you may as well set hugepages to 80% of RAM, or whatever the typical working-set size for the atomspace is.
from ure.
the flame-graph also points at opencog::SourceSet which looses huge amounts of time in boost which calls operator== which calls pthread stuff
Linas thank you for spotting this. I believe pthread stuff is a mutex lock at:
ure/opencog/ure/forwardchainer/SourceSet.cc
Lines 37 to 41 in 0a353dd
so root cause is not boost but intensive locking.
Also: what's __GI__exp and __ieee7? These seem to be eating lots of time...
I believe it is exponent calculation here:
ure/opencog/ure/forwardchainer/SourceSet.cc
Lines 175 to 188 in 0a353dd
from ure.
Hmm. Given that exp
is fast (should be less than 50-100 clock cycles) the fact that its showing up a lot means it's being called a lot. Probably too much. Similar remarks for the mutex -- it should be no more than dozens of clocks, unless there's a huge amount of lock contention...
from ure.
Thanks. Great findings!
Regarding the locks, these are just crude half-way steps towards parallel URE. Once we move to C++17 I'll use more refined (unique/shared) mutexes. Maybe some thread pool, etc, not sure yet.
Regarding exp
, it is used to calculate the probability distribution over sources, obviously this should be cached.
from ure.
Related Issues (20)
- cmake fails due to unify already existing HOT 6
- BackwardChainerUTest fails to build referencing Atomtable HOT 3
- Unbalanced quotations
- Forward chainer is not stable against library changes. HOT 3
- The hyperlink to the term unifier in the README leads nowhere. HOT 1
- Have the URE fully support formula premises wrapped in SetLink
- Add GlobNode support to the unifier HOT 1
- Why not DualLink ? HOT 2
- Using GlobNode in Backward Chainer HOT 2
- forward chainer finds that Tweety is a green frog in examples/ure/frog HOT 2
- add api to extract inference trace HOT 4
- URE compilation fails: warning: control reaches end of non-void function HOT 1
- Add BackwardChainerGetLink
- Backward chainer takes super long in this case HOT 3
- Fix replacement example inference tree expansion
- Add python ure_logger bindings HOT 6
- test_conditional_instantiation_1 triggers warnings in pattern engine HOT 6
- Bogus always-false clauses HOT 1
- Possible bug in AndBIT::expand() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ure.