eggplantbren / DNest4

Diffusive Nested Sampling
MIT License
60 stars 21 forks source link

std::system_error thread #12

Closed fredRos closed 8 years ago

fredRos commented 8 years ago

I downloaded release 0.1.1, compilation worked ok but when I execute the StraightLine example, I get this output

~/software/dnest4/DNest4/code/Examples/StraightLine$ ./main 
# Using 1 thread.
# Target compression factor between levels = 2.7182818284590451
# Seeding random number generators. First seed = 1469089269.
# Generating 5 particles from the prior...done.
terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)

a quick google search pointed me to this stackoverflow issue but looking at your makefiles, you do link in -lpthread.

May I suggest that you consider moving away from handwritten makefiles and migrate to a more powerful build system? It will take you some time to set it up but from my experience this will save you many user questions in case your code becomes popular.

eggplantbren commented 8 years ago

Hi,

As suggested in the stackoverflow thread, I've now added -pthread to the linking stage (commit 37a930abe243bf90f9146b224464a749412de594). This might matter on different versions of gcc or something. If this doesn't work, you can try compiling with -DNO_THREADS, which disables all that.

Regarding better build systems, I have had colleagues suggest and/or write CMake and Scons build systems before, but as I am not an expert in these I was unable to fix any issues that arose (and they did arise quite frequently). That's why I'm still using hand-written Makefiles, at least for now.

fredRos commented 8 years ago

Thanks for the quick reply, it now runs fine with multiple threads.

eggplantbren commented 8 years ago

Excellent. Thanks for confirming that it worked.