Open samithaj opened 7 years ago
I have a similar problem. I am able to compile the code but every time I run it, it aborts with the error message
Segmentation fault: 11
Can somebody please help me? I really want to use this tool.
@samithaj pthread_mutex_t needs to be initialized at the time of declaration:pthread_mutex_t mut_mutex = PTHREAD_MUTEX_INITIALIZER But I also meet the question:Segmentation fault: 11
@zy158 Did you generate the vectorfile and give the correct path to it? This solved the problem for me.
But I also meet the question:Segmentation fault: 11
@vhenk Did you have finished this problem? I also meet the error Segmentation fault: 11
`➜ DKRL-master make g++ Train_cnn_multi.cpp -o Train_cnn_multi -O2 -lpthread Train_cnn_multi.cpp:296:14: error: expected expression mut_mutex = PTHREAD_MUTEX_INITIALIZER; ^ /usr/include/pthread.h:182:35: note: expanded from macro 'PTHREAD_MUTEX_INITIALIZER'
define PTHREAD_MUTEX_INITIALIZER {_PTHREAD_MUTEX_SIG_init, {0}}
Train_cnn_multi.cpp:491:49: warning: cast to 'void ' from smaller integer type 'int' [-Wint-to-void-pointer-cast] pthread_create(&threads[k], NULL, rand_sel, (void )k); //train ^ Train_cnn_multi.cpp:499:53: warning: cast to 'void ' from smaller integer type 'int' [-Wint-to-void-pointer-cast] pthread_create(&threads2[k], NULL, update_grad, (void )k); //update ^ Train_cnn_multi.cpp:953:4: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ Train_cnn_multi.cpp:963:4: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ 4 warnings and 1 error generated. make: *** [Train_cnn_multi] Error 1`
when i replace line 296
mut_mutex = PTHREAD_MUTEX_INITIALIZER;
withmut_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
it gives➜ DKRL-master sudo ./Train_cnn_multi size = 50 size of layer1 = 50 size of word = 50 learing rate = 0.001 margin = 1 method = bern [1] 1266 segmentation fault sudo ./Train_cnn_multi