Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation violation detected #53

Closed
Eidantz opened this issue Nov 14, 2018 · 8 comments
Closed

Segmentation violation detected #53

Eidantz opened this issue Nov 14, 2018 · 8 comments

Comments

@Eidantz
Copy link

Eidantz commented Nov 14, 2018

clear cfg;

cfg.unitinmm=0.1; %set the grid to 100um
cfg.nphoton=3e7;%3e7 Photons

prop=[ 0.019 7.8   0.89 1.37     % medium 1: skin & skull 7-8mm
   0.02  9.0   0.89 1.37     % medium 3: gray matter the rest
   ];

cfg.prop=[0 0 1 1];
%define layer structure
cfg.vol=ones(300,200,100);
j=1;
for h=1:70 % define 150 layers with random brain optical properties
cfg.vol(:,:,j:j+1)=h;
j=j+1;
cfg.prop=[cfg.prop;prop(1,:)];
end
for h=71:99 % define 150 layers with random brain optical properties
cfg.vol(:,:,j:j+1)=h;
j=j+1;
cfg.prop=[cfg.prop;prop(2,:)];
end
cfg.vol=uint8(cfg.vol);

% define the source position
cfg.srcpos=[150,100,0]+1;
cfg.srcdir=[0 0 1];

% time-domain simulation parameters
cfg.tstart=0;%time start
cfg.tend=10e-6;%time end
cfg.tstep=100e-9;%time step

% GPU thread configuration
cfg.autopilot=1;
cfg.gpuid='1111';

cfg.issavedet=1; % enable recording partial pathlength of detected photons
cfg.detpos=[51 101 1 2];%define the detector position(S-D= 100*0.1mm= 1cm)

fprintf('running simulation ... this takes about 20 seconds on a 4* TITAN X (Pascal) \n');

for i=1:15 %run the simulation 15 times
tic;
[f(i),det(i),vol(i),seeds(i)]=mcxlab(cfg);
toc;
clear f;
fprintf(sprintf('simulation number: %d is done..............................',i));
end

I ran this code on Ubuntu 16.04.2 LTS server with 4 TITAN X (Pascal)
and it worked.
a few days later I tried to run it again and the Matlab crashed with this error


   Segmentation violation detected at Wed Nov 14 10:33:05 2018

Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Current Graphics Driver: Unknown software
Current Visual : None
Default Encoding : UTF-8
Deployed : false
GNU C Library : 2.23 stable
Host Name : ZigZagDL
MATLAB Architecture : glnxa64
MATLAB Entitlement ID: 5144975
MATLAB Root : /usr/local/MATLAB/R2017a
MATLAB Version : 9.2.0.556344 (R2017a)
OpenGL : software
Operating System : Linux 4.4.0-77-generic #98-Ubuntu SMP Wed Apr 26 08:34:02 UTC 2017 x86_64
Processor ID : x86 Family 6 Model 79 Stepping 1, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : No active display

Fault Count: 1

Abnormal termination:
Segmentation violation

Register State (from fault):
RAX = 00007f07ef4d06c0 RBX = 00007f07ad2f4010
RCX = 00000000000009c0 RDX = 00000000000059b0
RSP = 00007f08651272c8 RBP = 00007f0865128570
RSI = 00007f07ad2f9000 RDI = 00007f07ef4d56b0

R8 = 00007f07fbb59720 R9 = 0000000000000002
R10 = 0000000000000822 R11 = 00007f087e414b50
R12 = 00007f0865128c78 R13 = 0000000000000000
R14 = 00000000000059b0 R15 = 000000000000000c

RIP = 00007f08827fe566 EFL = 0000000000010283

CS = 0033 FS = 0000 GS = 0000

Stack Trace (from fault):
[ 0] 0x00007f08827fe566 /lib/x86_64-linux-gnu/libc.so.6+01365350
[ 1] 0x00007f07b752f132 /home/student1/Eidan/mcxlab/mcx.mexa64+00168242 mexFunction+00002858
[ 2] 0x00007f0873a716a7 bin/glnxa64/libmex.so+00186023 mexRunMexFile+00000439
[ 3] 0x00007f0873a694a3 bin/glnxa64/libmex.so+00152739
[ 4] 0x00007f0873a6a295 bin/glnxa64/libmex.so+00156309
[ 5] 0x00007f0872d5c1f3 bin/glnxa64/libmwm_dispatcher.so+00782835 ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2+00000947
[ 6] 0x00007f0872d5cabe bin/glnxa64/libmwm_dispatcher.so+00785086 ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2+00000030
[ 7] 0x00007f086f0814a0 bin/glnxa64/libmwm_lxe.so+11719840
[ 8] 0x00007f086f081a2b bin/glnxa64/libmwm_lxe.so+11721259
[ 9] 0x00007f086f15ba7c bin/glnxa64/libmwm_lxe.so+12614268
[ 10] 0x00007f086f106fc1 bin/glnxa64/libmwm_lxe.so+12267457
[ 11] 0x00007f086ea01a00 bin/glnxa64/libmwm_lxe.so+04905472
[ 12] 0x00007f086ea03c84 bin/glnxa64/libmwm_lxe.so+04914308
[ 13] 0x00007f086ea00224 bin/glnxa64/libmwm_lxe.so+04899364
[ 14] 0x00007f086e9fbb21 bin/glnxa64/libmwm_lxe.so+04881185
[ 15] 0x00007f086e9fbfb9 bin/glnxa64/libmwm_lxe.so+04882361
[ 16] 0x00007f086e9ffa10 bin/glnxa64/libmwm_lxe.so+04897296
[ 17] 0x00007f086e9ffadf bin/glnxa64/libmwm_lxe.so+04897503
[ 18] 0x00007f086eaf9a1c bin/glnxa64/libmwm_lxe.so+05921308
[ 19] 0x00007f086eafe083 bin/glnxa64/libmwm_lxe.so+05939331
[ 20] 0x00007f086ef80b0e bin/glnxa64/libmwm_lxe.so+10668814
[ 21] 0x00007f086f0730ce bin/glnxa64/libmwm_lxe.so+11661518
[ 22] 0x00007f0872d5c1f3 bin/glnxa64/libmwm_dispatcher.so+00782835 ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2+00000947
[ 23] 0x00007f0872d5cabe bin/glnxa64/libmwm_dispatcher.so+00785086 ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2+00000030
[ 24] 0x00007f086f0814a0 bin/glnxa64/libmwm_lxe.so+11719840
[ 25] 0x00007f086f081a2b bin/glnxa64/libmwm_lxe.so+11721259
[ 26] 0x00007f086f0eb9b1 bin/glnxa64/libmwm_lxe.so+12155313
[ 27] 0x00007f086ea01a00 bin/glnxa64/libmwm_lxe.so+04905472
[ 28] 0x00007f086ea03c84 bin/glnxa64/libmwm_lxe.so+04914308
[ 29] 0x00007f086ea00224 bin/glnxa64/libmwm_lxe.so+04899364
[ 30] 0x00007f086e9fbb21 bin/glnxa64/libmwm_lxe.so+04881185
[ 31] 0x00007f086e9fbfb9 bin/glnxa64/libmwm_lxe.so+04882361
[ 32] 0x00007f086e9ffa10 bin/glnxa64/libmwm_lxe.so+04897296
[ 33] 0x00007f086e9ffadf bin/glnxa64/libmwm_lxe.so+04897503
[ 34] 0x00007f086eaf9a1c bin/glnxa64/libmwm_lxe.so+05921308
[ 35] 0x00007f086eafe083 bin/glnxa64/libmwm_lxe.so+05939331
[ 36] 0x00007f086ef80b0e bin/glnxa64/libmwm_lxe.so+10668814
[ 37] 0x00007f086ef4cdd4 bin/glnxa64/libmwm_lxe.so+10456532
[ 38] 0x00007f086ef4d14a bin/glnxa64/libmwm_lxe.so+10457418
[ 39] 0x00007f086ef4e919 bin/glnxa64/libmwm_lxe.so+10463513
[ 40] 0x00007f086efd0155 bin/glnxa64/libmwm_lxe.so+10994005
[ 41] 0x00007f086efd079d bin/glnxa64/libmwm_lxe.so+10995613
[ 42] 0x00007f0872d09ede bin/glnxa64/libmwm_dispatcher.so+00446174
[ 43] 0x00007f0872cf0628 bin/glnxa64/libmwm_dispatcher.so+00341544 ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2+00000616
[ 44] 0x00007f086f0814a0 bin/glnxa64/libmwm_lxe.so+11719840
[ 45] 0x00007f086f081a2b bin/glnxa64/libmwm_lxe.so+11721259
[ 46] 0x00007f086f0eb9b1 bin/glnxa64/libmwm_lxe.so+12155313
[ 47] 0x00007f086ea01a00 bin/glnxa64/libmwm_lxe.so+04905472
[ 48] 0x00007f086ea03c84 bin/glnxa64/libmwm_lxe.so+04914308
[ 49] 0x00007f086ea00224 bin/glnxa64/libmwm_lxe.so+04899364
[ 50] 0x00007f086e9fbb21 bin/glnxa64/libmwm_lxe.so+04881185
[ 51] 0x00007f086e9fbfb9 bin/glnxa64/libmwm_lxe.so+04882361
[ 52] 0x00007f086e9ffa10 bin/glnxa64/libmwm_lxe.so+04897296
[ 53] 0x00007f086e9ffadf bin/glnxa64/libmwm_lxe.so+04897503
[ 54] 0x00007f086eaf9a1c bin/glnxa64/libmwm_lxe.so+05921308
[ 55] 0x00007f086eafe083 bin/glnxa64/libmwm_lxe.so+05939331
[ 56] 0x00007f086ef80b0e bin/glnxa64/libmwm_lxe.so+10668814
[ 57] 0x00007f086ef4cdd4 bin/glnxa64/libmwm_lxe.so+10456532
[ 58] 0x00007f086ef4d14a bin/glnxa64/libmwm_lxe.so+10457418
[ 59] 0x00007f086ef4e919 bin/glnxa64/libmwm_lxe.so+10463513
[ 60] 0x00007f086efc32be bin/glnxa64/libmwm_lxe.so+10941118
[ 61] 0x00007f086efc364a bin/glnxa64/libmwm_lxe.so+10942026
[ 62] 0x00007f087112441b bin/glnxa64/libmwbridge.so+00189467
[ 63] 0x00007f08711250cd bin/glnxa64/libmwbridge.so+00192717 _Z8mnParserv+00000829
[ 64] 0x00007f0873022df3 bin/glnxa64/libmwmcr.so+00552435
[ 65] 0x00007f0873024f9e bin/glnxa64/libmwmcr.so+00561054
[ 66] 0x00007f0873025619 bin/glnxa64/libmwmcr.so+00562713 _ZN5boost6detail17task_shared_stateINS_3_bi6bind_tIvPFvRKNS_8functionIFvvEEEENS2_5list1INS2_5valueIS6_EEEEEEvE6do_runEv+00000025
[ 67] 0x00007f0873023f06 bin/glnxa64/libmwmcr.so+00556806
[ 68] 0x00007f08737f1739 bin/glnxa64/libmwiqm.so+00857913
[ 69] 0x00007f08737de06c bin/glnxa64/libmwiqm.so+00778348 _ZN5boost6detail8function21function_obj_invoker0ISt8functionIFNS_3anyEvEES4_E6invokeERNS1_15function_bufferE+00000028
[ 70] 0x00007f08737ddd4c bin/glnxa64/libmwiqm.so+00777548 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tagRN5boost10shared_ptrIN14cmddistributor17IIPCompletedEventEEE+00000428
[ 71] 0x00007f08737bbfba bin/glnxa64/libmwiqm.so+00638906
[ 72] 0x00007f08737aa15f bin/glnxa64/libmwiqm.so+00565599
[ 73] 0x00007f08737ac609 bin/glnxa64/libmwiqm.so+00574985
[ 74] 0x00007f088415201a bin/glnxa64/libmwservices.so+02469914
[ 75] 0x00007f08841535cf bin/glnxa64/libmwservices.so+02475471
[ 76] 0x00007f0884153d7a bin/glnxa64/libmwservices.so+02477434 _Z25svWS_ProcessPendingEventsiib+00000186
[ 77] 0x00007f087302356e bin/glnxa64/libmwmcr.so+00554350
[ 78] 0x00007f0873023901 bin/glnxa64/libmwmcr.so+00555265
[ 79] 0x00007f0873011206 bin/glnxa64/libmwmcr.so+00479750
[ 80] 0x00007f0882a816ba /lib/x86_64-linux-gnu/libpthread.so.0+00030394
[ 81] 0x00007f08827b782d /lib/x86_64-linux-gnu/libc.so.6+01075245 clone+00000109
[ 82] 0x0000000000000000 +00000000

This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

I tried to reduce the number of photons but even 1e6 won't work. any suggestions?

@fangq
Copy link
Owner

fangq commented Dec 2, 2018

@Eidantz, sorry for the delay, only saw it today.

I noticed the same when I upgraded my desktop from 14.04 to 16.04 yesterday. I am not yet sure what cause the crash, but it seems matlab 2016 does not seem to like the mex compiled on Ubuntu 16.04.

I, however, found that matlab 2017a and 2018a work fine with mcxlab. Do you have those versions? if yes, do you see the same?

@Eidantz
Copy link
Author

Eidantz commented Dec 4, 2018

I am using MATLAB R2017a (9.2.0.556344) 64-bit (glnxa64). I contact MATLAB company but they haven't responded yet.
If it helps the mcxlab stop at this point:

normalizing raw data ...        normalization factor alpha=33.333332
simulated 30000000 photons (30000000) with 57344 threads (repeat x1)
MCX simulation speed: 9511.73 photon/ms
total simulated energy: 30000000.00     absorbed: 28.61906%
(loss due to initial specular reflection is excluded in the total)

@fangq
Copy link
Owner

fangq commented Dec 4, 2018

the above log is the end of mcxlab's kernel command line messages - so it looks like the kernel was completed correctly.

can you checkout the current dev branch "etherdome" and recompile on your system (git clone first, and then git checkout etherdome inside mcx folder), and see if this issue remains.

If this does not help, to really figure out what happened, you should install valgrind on your system, and run the below command

matlab -nojvm -r "scriptname_caused_crash" -D"valgrind --error-limit=no --tool=memcheck -v --log-file=valgrind.log" ”

then, the valgrind.log will contain the debug info for the crashes, if you can post it, I would be able to find out which line of the code failed in your simulation.

@fangq
Copy link
Owner

fangq commented Dec 8, 2018

let me know if you have tested the above command with the valgrind debug log. happy to look into the log file and find any clue.

@Eidantz
Copy link
Author

Eidantz commented Dec 8, 2018

I tried the Etherdome version, but the mcx.mex I took from the old version and the problem is from the mcx.mex file, doesn't it?
Did you update the mcx.mex file?
I will try tomorrow the Valgrind and I will update you.

@fangq
Copy link
Owner

fangq commented Dec 8, 2018

I assume you meant the mcx.mexa64 file? it is a binary recompiled in the nightly build. you can download the latest binary from http://mcx.space/nightly/linux64/

@Eidantz
Copy link
Author

Eidantz commented Dec 8, 2018

I used this version

http://mcx.space/nightly/linux64/mcxlab-linux-x86_64-v2018.12.zip

and it works perfectly!

@fangq
Copy link
Owner

fangq commented Dec 14, 2018

thanks, I will close this issue for now.

@fangq fangq closed this as completed Dec 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants