mzemplenyi / OED-graphical-models

Optimal experimental design algorithm for inferring causal graphical models.
2 stars 0 forks source link

Help Debugging Segmentation Violation with mkContab #1

Open jirehhuang opened 3 years ago

jirehhuang commented 3 years ago

Hi,

I'm not very familiar with MATLAB, and am having issues debugging a segmentation violation error when running the default example in setupOED (with network 'ten'). I added some print statements to pinpoint the error, and it appears to be with the execution of mkContab in logMargLikMultiFamily. I'm on Ubuntu 18.04.5 with MATLAB R2017a freshly installed, and I used update-alternatives to use gcc/g++ 4.9.3 instead of 7.5. The command line output is attached below.

Thanks in advance!

Jireh

`MATLAB is selecting SOFTWARE OPENGL rendering.

                                                                                         < M A T L A B (R) >
                                                                               Copyright 1984-2017 The MathWorks, Inc.
                                                                               R2017a (9.2.0.556344) 64-bit (glnxa64)
                                                                                           March 27, 2017

To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com.

mkPath Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In path (line 109) In addpath (line 88) In mkPath (line 15) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 24) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Building with 'gcc'. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) MEX completed successfully. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 25) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 30) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 33) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 36) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 39) setupOED Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.

ans =

'
  setupOED: stg.dataOrigin = simFromCPD
 '

ans =

'/home/jireh/Documents/ucla/research/projects/current/code/OED/BayesianOED'

Directory name already exists for that scenario number. Created a new directory named "MEC_Scen2" Warning: Directory already exists.

In setupOED (line 62) Warning: MATLAB has disabled some advanced graphics rendering features by switching to software OpenGL. For more information, click here.

ans =

'
  Starting simulation 1 of 3.
 '

Warning: Directory already exists.

In startSim (line 8) In setupOED (line 106)

ans =

'
  expNum = 1
 '

ans =

'
  Before runExperiment()
 '

ans =

'
  runExperiment: stg.dataOrigin = simFromCPD
 '

ans =

'
  runExperiment: Debug 1
 '

ans =

'
  runExperiment: Debug 2
 '

ans =

'
  runExperiment: Debug 3
 '

ans =

'
  mkAllFamilyLogMargLik: Starting
 '

ans =

'
  mkAllFamilyLogMargLik: Debug 1
 '

ans =

'
  mkAllFamilyLogMargLik: Debug 2
 '

ans =

'
  mkAllFamilyLogMargLik: Debug 3
 '

ans =

'
  mkAllFamilyLogMargLik: Debug 4; cpdType = "multinomial"
 '

ans =

'
  logMargLikMultiFamilyAll: Starting
 '

ans =

'
  logMargLikMultiFamilyAll: Debug 1
 '

ans =

'
  logMargLikMultiFamilyAll: i = 1
 '

ans =

'
  logMargLikMultiFamilyAll: isClamped = 0, uncertainPerfectFlag = 0
 '

ans =

'
  logMargLikMultiFamilyAll: k = 1
 '

ans =

'
  logMargLikMultiFamilyAll: uncertainPerfectFlag = 0
 '

ans =

'
  logMargLikMultiFamilyAll: Debug 2
 '

ans =

'
  logMargLikMultiFamily: Starting
 '

ans =

'
  logMargLikMultiFamily: unclampedADTreePtr =
 '

3193269488

ans =

'
  logMargLikMultiFamily: sfam = 1
 '

ans =

'
  logMargLikMultiFamily: sfamsz = 2
 '

ans =

'
  logMargLikMultiFamily: Right before mkContab
 '

   Segmentation violation detected at Mon May  3 09:53:00 2021

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.27 stable Host Name : jireh-pc-ubuntu MATLAB Architecture : glnxa64 MATLAB Entitlement ID: 6614012 MATLAB Root : /usr/local/MATLAB/R2017a MATLAB Version : 9.2.0.556344 (R2017a) OpenGL : software Operating System : Linux 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 Processor ID : x86 Family 6 Model 158 Stepping 12, 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 = 00000000be556cf0 RBX = 00007fe62f4bc2c8 RCX = 00007fe62f4bc1e8 RDX = 00007fe56888d088 RSP = 00007fe62f4bba90 RBP = 00007fe62f4bbae0 RSI = 00007fe62f4bbb20 RDI = 00007fe6357ff040

R8 = 00007fe5be572750 R9 = 00007fe63001efc0 R10 = 0000000000000008 R11 = 0000000000000246 R12 = 00007fe62f4bc1e8 R13 = 00007fe62f4bc1e8 R14 = 00007fe5be572750 R15 = 00007fe62f4bc200

RIP = 00007fe56868bae0 EFL = 0000000000010202

CS = 0033 FS = 0000 GS = 0000

Stack Trace (from fault): [ 0] 0x00007fe56868bae0 /home/jireh/Documents/ucla/research/projects/current/code/OED/BayesianOED/ADTree/mkContab.mexa64+00002784 mexFunction+00000054 [ 1] 0x00007fe641fcc6a7 bin/glnxa64/libmex.so+00186023 mexRunMexFile+00000439 [ 2] 0x00007fe641fc44a3 bin/glnxa64/libmex.so+00152739 [ 3] 0x00007fe641fc5295 bin/glnxa64/libmex.so+00156309 [ 4] 0x00007fe6412b71f3 bin/glnxa64/libmwm_dispatcher.so+00782835 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2iS2+00000947 [ 5] 0x00007fe6412b7abe bin/glnxa64/libmwm_dispatcher.so+00785086 _ZN8Mfh_file11dispatch_fhEiPP11mxArraytagiS2+00000030 [ 6] 0x00007fe63d5dc4a0 bin/glnxa64/libmwm_lxe.so+11719840 [ 7] 0x00007fe63d5dca2b bin/glnxa64/libmwm_lxe.so+11721259 [ 8] 0x00007fe63d646961 bin/glnxa64/libmwm_lxe.so+12155233 [ 9] 0x00007fe63cf5ca00 bin/glnxa64/libmwm_lxe.so+04905472 [ 10] 0x00007fe63cf5ec84 bin/glnxa64/libmwm_lxe.so+04914308 [ 11] 0x00007fe63cf5b224 bin/glnxa64/libmwm_lxe.so+04899364 [ 12] 0x00007fe63cf56b21 bin/glnxa64/libmwm_lxe.so+04881185 [ 13] 0x00007fe63cf56fb9 bin/glnxa64/libmwm_lxe.so+04882361 [ 14] 0x00007fe63cf5aa10 bin/glnxa64/libmwm_lxe.so+04897296 [ 15] 0x00007fe63cf5aadf bin/glnxa64/libmwm_lxe.so+04897503 [ 16] 0x00007fe63d054a1c bin/glnxa64/libmwm_lxe.so+05921308 [ 17] 0x00007fe63d059083 bin/glnxa64/libmwm_lxe.so+05939331 [ 18] 0x00007fe63d4dbb0e bin/glnxa64/libmwm_lxe.so+10668814 [ 19] 0x00007fe63d5ce0ce bin/glnxa64/libmwm_lxe.so+11661518 [ 20] 0x00007fe6412b71f3 bin/glnxa64/libmwm_dispatcher.so+00782835 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2iS2+00000947 [ 21] 0x00007fe6412b7abe bin/glnxa64/libmwm_dispatcher.so+00785086 _ZN8Mfh_file11dispatch_fhEiPP11mxArraytagiS2+00000030 [ 22] 0x00007fe63d5dc4a0 bin/glnxa64/libmwm_lxe.so+11719840 [ 23] 0x00007fe63d5dca2b bin/glnxa64/libmwm_lxe.so+11721259 [ 24] 0x00007fe63d6469b1 bin/glnxa64/libmwm_lxe.so+12155313 [ 25] 0x00007fe63cf5ca00 bin/glnxa64/libmwm_lxe.so+04905472 [ 26] 0x00007fe63cf5ec84 bin/glnxa64/libmwm_lxe.so+04914308 [ 27] 0x00007fe63cf5b224 bin/glnxa64/libmwm_lxe.so+04899364 [ 28] 0x00007fe63cf56b21 bin/glnxa64/libmwm_lxe.so+04881185 [ 29] 0x00007fe63cf56fb9 bin/glnxa64/libmwm_lxe.so+04882361 [ 30] 0x00007fe63cf5aa10 bin/glnxa64/libmwm_lxe.so+04897296 [ 31] 0x00007fe63cf5aadf bin/glnxa64/libmwm_lxe.so+04897503 [ 32] 0x00007fe63d054a1c bin/glnxa64/libmwm_lxe.so+05921308 [ 33] 0x00007fe63d059083 bin/glnxa64/libmwm_lxe.so+05939331 [ 34] 0x00007fe63d4dbb0e bin/glnxa64/libmwm_lxe.so+10668814 [ 35] 0x00007fe63d4a7dd4 bin/glnxa64/libmwm_lxe.so+10456532 [ 36] 0x00007fe63d4a814a bin/glnxa64/libmwm_lxe.so+10457418 [ 37] 0x00007fe63d4a9919 bin/glnxa64/libmwm_lxe.so+10463513 [ 38] 0x00007fe63d51e2be bin/glnxa64/libmwm_lxe.so+10941118 [ 39] 0x00007fe63d51e64a bin/glnxa64/libmwm_lxe.so+10942026 [ 40] 0x00007fe63f67f41b bin/glnxa64/libmwbridge.so+00189467 [ 41] 0x00007fe63f6800cd bin/glnxa64/libmwbridge.so+00192717 _Z8mnParserv+00000829 [ 42] 0x00007fe64157ddf3 bin/glnxa64/libmwmcr.so+00552435 [ 43] 0x00007fe64157ff9e bin/glnxa64/libmwmcr.so+00561054 [ 44] 0x00007fe641580619 bin/glnxa64/libmwmcr.so+00562713 _ZN5boost6detail17task_shared_stateINS_3_bi6bind_tIvPFvRKNS_8functionIFvvEEEENS2_5list1INS2_5valueIS6_EEEEEEvE6do_runEv+00000025 [ 45] 0x00007fe64157ef06 bin/glnxa64/libmwmcr.so+00556806 [ 46] 0x00007fe641d4c739 bin/glnxa64/libmwiqm.so+00857913 [ 47] 0x00007fe641d3906c bin/glnxa64/libmwiqm.so+00778348 _ZN5boost6detail8function21function_obj_invoker0ISt8functionIFNS_3anyEvEES4_E6invokeERNS1_15function_bufferE+00000028 [ 48] 0x00007fe641d38d4c bin/glnxa64/libmwiqm.so+00777548 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tagRN5boost10shared_ptrIN14cmddistributor17IIPCompletedEventEEE+00000428 [ 49] 0x00007fe641d16fba bin/glnxa64/libmwiqm.so+00638906 [ 50] 0x00007fe641d0515f bin/glnxa64/libmwiqm.so+00565599 [ 51] 0x00007fe641d07609 bin/glnxa64/libmwiqm.so+00574985 [ 52] 0x00007fe652b9501a bin/glnxa64/libmwservices.so+02469914 [ 53] 0x00007fe652b965cf bin/glnxa64/libmwservices.so+02475471 [ 54] 0x00007fe652b96d7a bin/glnxa64/libmwservices.so+02477434 _Z25svWS_ProcessPendingEventsiib+00000186 [ 55] 0x00007fe64157e56e bin/glnxa64/libmwmcr.so+00554350 [ 56] 0x00007fe64157e901 bin/glnxa64/libmwmcr.so+00555265 [ 57] 0x00007fe64156c206 bin/glnxa64/libmwmcr.so+00479750 [ 58] 0x00007fe65142d6db /lib/x86_64-linux-gnu/libpthread.so.0+00030427 [ 59] 0x00007fe65115671f /lib/x86_64-linux-gnu/libc.so.6+01185567 clone+00000063 [ 60] 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.

If this problem is reproducible, please submit a Service Request via: http://www.mathworks.com/support/contact_us/

A technical support engineer might contact you with further information.

Thank you for your help. This crash report has been saved to disk as /home/jireh/matlab_crash_dump.12402-1

MATLAB is exiting because of fatal error Killed`

debug_oed.txt

jirehhuang commented 3 years ago

I installed MATLAB 2021a on my Windows device, and MATLAB crashes when executing mkContab in logMargLikMultiFamily as well.

I also tried downloading and running the code for BDAGL, and I get the same issue when running mkAllFamilyLogMargLik (which is the problematic function that subsequently executes logMargLikMultiFamily which runs mkContab).

I'm unable to replicate this, but there was a situation where MATLAB did not crash but instead gave the following crash report.

`Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Building with 'MinGW64 Compiler (C)'. C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.c: In function 'mxCreateNumericArrayE': C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.c:15:33: warning: passing argument 2 of 'mxCreateNumericArray_730' from incompatible pointer type [-Wincompatible-pointer-types] a = mxCreateNumericArray(ndim,dims1,class,ComplexFlag); ^~~~~ In file included from C:\Program Files\MATLAB\R2021a/extern/include/mex.h:43:0, from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.h:1, from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.c:1: C:\Program Files\MATLAB\R2021a/extern/include/matrix.h:284:30: note: expected 'const mwSize {aka const long long unsigned int }' but argument is of type 'int *'

define mxCreateNumericArray mxCreateNumericArray_730

                          ^

C:\Program Files\MATLAB\R2021a/extern/include/matrix.h:954:1: note: in expansion of macro 'mxCreateNumericArray' mxCreateNumericArray(mwSize ndim, const mwSize dims, mxClassID classid, mxComplexity flag); ^~~~~~~~ C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.c:17:22: warning: passing argument 2 of 'mxSetDimensions_730' from incompatible pointer type [-Wincompatible-pointer-types] mxSetDimensions(a, dims, ndim); ^~~~ In file included from C:\Program Files\MATLAB\R2021a/extern/include/mex.h:43:0, from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.h:1, from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_mexutil.c:1: C:\Program Files\MATLAB\R2021a/extern/include/matrix.h:277:25: note: expected 'const mwSize {aka const long long unsigned int }' but argument is of type 'const int '

define mxSetDimensions mxSetDimensions_730

                     ^

C:\Program Files\MATLAB\R2021a/extern/include/matrix.h:940:1: note: in expansion of macro 'mxSetDimensions' mxSetDimensions(mxArray pa, const mwSize pdims, mwSize ndims); ^~~~~~~

C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:28:0: warning: "INFINITY" redefined

define INFINITY my_infinity()

In file included from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:6:0: C:/ProgramData/MATLAB/SupportPackages/R2021a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/math.h:356:0: note: this is the location of the previous definition

define INFINITY __builtin_inff()

C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:29:0: warning: "NAN" redefined

define NAN my_nan()

In file included from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:6:0: C:/ProgramData/MATLAB/SupportPackages/R2021a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/math.h:357:0: note: this is the location of the previous definition

define NAN __builtin_nanf("")

MEX completed successfully. Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Error using mkContab Requested 244813135874x1 (1824.0GB) array exceeds maximum array size preference (15.9GB). This might cause MATLAB to become unresponsive.

Error in logMargLikMultiFamily (line 18) counts = mkContab( unclampedADTreePtr, sfam, sfamsz );

Error in logMargLikMultiFamilyAll (line 109) LM(i,k) = logMargLikMultiFamily(pa, i, nodeArity, alpha, intervention, unclampedADTreePtr, clampedADTreePtr);

Error in mkAllFamilyLogMargLik (line 100) allFamilyLogMargLik = logMargLikMultiFamilyAll(data, nodeArity, impossibleFamilyMask, priorESS, intervention, verbose );

Error in bdagl (line 11) aflml = mkAllFamilyLogMargLik( data, 'nodeArity', repmat(2,1,nNodes), 'impossibleFamilyMask', aflp~=-Inf, 'priorESS', 1);

Related documentation

Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.`

bdagl_crash.txt

mzemplenyi commented 3 years ago

Hi Jireh, Thanks for logging this issue. I also ran into errors getting Eaton and Murphy's BDAGL code running on my Windows computer several years ago. As a first step, we should try to get the BDAGL code base and tutorial working on your device. I'm guessing we'll have more luck on your Windows device, so let's try that first.

I found the following resources helpful for troubleshooting "incompatible pointer type" warnings that appeared when I ran "mkPath":

Could you try the following and let me know if these steps reduce errors associated with calling mkAllFamilyLogMargLik() ?

  1. Open the file "minka_mexutil.c" within the "BDAGL/Foreign" directory. Add

    #include "matrix.h"

    as a new line to the header of the file and then edit the inputs to the function mxCreateNumericArrayE (line 5 or 6) to read:

    mxArray *mxCreateNumericArrayE(int ndim, const mwSize *dims,

    instead of:

    mxArray *mxCreateNumericArrayE(int ndim, const int *dims,
  2. In "mkPath.m", edit the compiling flag for the "minka_mexutil.c" to be "-compatibleArrayDims" instead of "-O". That is, it should read:

    if exist('gammaln')~=3
    cd('Foreign');
    mex -compatibleArrayDims gammaln.c minka_mexutil.c minka_util.c
    cd('..');
    end 

    instead of:

    if exist('gammaln')~=3
    cd('Foreign');
    mex -O gammaln.c minka_mexutil.c minka_util.c
    cd('..');
    end 

There may still be additional compiling warnings or errors that we'll need to address in a similar fashion, but let me know if this helps. Thanks, Michele

jirehhuang commented 3 years ago

Hi Michele,

Thank you for taking the time to respond to my issue! I appreciate your help.

I made the edits that you suggested, but unfortunately, it still crashes. Sometimes, it just shuts down MATLAB, and other times without rhyme or reason I was able to get the error log attached below. It appears to be the same issue of trying to create an array that is too large. I have also attached the BDAGL code that I have edited according to your instructions, including the file that I am executing (test_bdagl.m).

`Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Building with 'MinGW64 Compiler (C)'. C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:28:0: warning: "INFINITY" redefined

define INFINITY my_infinity()

In file included from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:6:0: C:/ProgramData/MATLAB/SupportPackages/R2021a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/math.h:356:0: note: this is the location of the previous definition

define INFINITY __builtin_inff()

C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:29:0: warning: "NAN" redefined

define NAN my_nan()

In file included from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:6:0: C:/ProgramData/MATLAB/SupportPackages/R2021a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/math.h:357:0: note: this is the location of the previous definition

define NAN __builtin_nanf("")

MEX completed successfully. Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Error using mkContab Requested 2765958938626x1 (20608.0GB) array exceeds maximum array size preference (15.9GB). This might cause MATLAB to become unresponsive.

Error in logMargLikMultiFamily (line 18) counts = mkContab( unclampedADTreePtr, sfam, sfamsz );

Error in logMargLikMultiFamilyAll (line 109) LM(i,k) = logMargLikMultiFamily(pa, i, nodeArity, alpha, intervention, unclampedADTreePtr, clampedADTreePtr);

Error in mkAllFamilyLogMargLik (line 100) allFamilyLogMargLik = logMargLikMultiFamilyAll(data, nodeArity, impossibleFamilyMask, priorESS, intervention, verbose );

Error in test_bdagl (line 8) aflml = mkAllFamilyLogMargLik( data, 'nodeArity', repmat(2,1,nNodes), 'impossibleFamilyMask', aflp~=-Inf, 'priorESS', 1);

Related documentation`

Best, Jireh

bdagl_crash2.txt

BDAGL_modified.zip

mzemplenyi commented 3 years ago

Hi Jireh, Could you try adding

#include "matrix.h" 

to the "mkContab.c" file header and also change the "-O" flag to "-compatibleArrayDims" for mkContab.c in the "mkPath.m" file?

Thanks, Michele

jirehhuang commented 3 years ago

Hi Michele,

Done. Unfortunately, still crashes, with the same error it appears. Does BDAGL work straight out of the .zip on your device?

Best, Jireh

mzemplenyi commented 3 years ago

Hi Jireh, No, BDAGL did not work straight out of the .zip on my Windows computer. I had to make the edits that I described above to fix incompatible pointer type warnings that surfaced when I ran "mkPath.m." I was unable to get the BDAGL code to work on the Linux machines that my university's computer cluster uses. I would have needed a deeper understanding of C or C++ to troubleshoot those errors.

Could you show me the messages that your device gives when you just enter the command "mkPath" in your console? Thanks, Michele

jirehhuang commented 3 years ago

Pretty much included in the previous messages I shared:

mkPath Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In path (line 109) In addpath (line 86) In mkPath (line 19) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In path (line 109) In addpath (line 86) In mkPath (line 19) Building with 'MinGW64 Compiler (C)'. C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:28:0: warning: "INFINITY" redefined

define INFINITY my_infinity()

In file included from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:6:0: C:/ProgramData/MATLAB/SupportPackages/R2021a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/math.h:356:0: note: this is the location of the previous definition

define INFINITY __builtin_inff()

C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:29:0: warning: "NAN" redefined

define NAN my_nan()

In file included from C:\Users\ijire\Documents\Research\projects\current\code\BDAGL\Foreign\minka_util.c:6:0: C:/ProgramData/MATLAB/SupportPackages/R2021a/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/math.h:357:0: note: this is the location of the previous definition

define NAN __builtin_nanf("")

MEX completed successfully. Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.

In mkPath (line 29) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 29) Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 30) Warning: Function gammaln has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. In mkPath (line 30)

mzemplenyi commented 3 years ago

Got it, thanks. It looks like someone else logged a similar out of memory issue with the mkContab function. 32 bit vs 64 bit compatibility issues with the C code are likely the problem.

I'm not sure what the best way to proceed is, but some options would be to:

  1. Try using Matlab R2017a on your Windows system, rather than the R2021a version, if possible.
  2. Make edits to mkContab as suggested in the help article I linked to above, ideally with the help of a someone more familiar with C than I am.
  3. Track down the updated version of BDAGL used in https://jmlr.org/papers/volume17/14-497/14-497.pdf to see if that version is compatible with your devices. The link to their software in the footnote on page 25 appears to be out-of-date, but Professor Jin Tian could provide an updated link.

I'm sorry for all the troubleshooting pains!

jirehhuang commented 3 years ago

Thank you so much for your help! I'll post an update if I can figure out a fix to get it working hahaa.