Dual GPU error

105 views
Skip to first unread message

Zhengchen Cai

unread,
Jul 19, 2017, 12:18:22 PM7/19/17
to mcx-users
Hi Dr.Fang,

We got two 1080ti for MCX, we tried to launch the benchmark as gpuid = '11' and matlab was killed with error attached in the end of this email. We tried to run with each single GPU, and both of them worked well even with the one that is using for display. We also tried to decrease the number of photons to 10^6 and set tstep = 5*10^-10ns, and got the same error only with dual GPU. Could you please help? Thank you very much. 

Best regards,
Zhengchen

ERROR MESSAGE
------------------------------------------------------------------------
              abort() detected at Wed Jul 19 12:01:25 2017
------------------------------------------------------------------------

Configuration:
  Crash Decoding      : Disabled - No sandbox or build area path
  Crash Mode          : continue (default)
  Current Graphics Driver: NVIDIA Corporation GeForce GTX 1080 Ti/PCIe/SSE2 Version 4.5.0 NVIDIA 381.22
  Current Visual      : 0x21 (class 4, depth 24)
  Default Encoding    : UTF-8
  Deployed            : false
  GNU C Library       : 2.23 stable
  Host Name           : perf-imglab04
  MATLAB Architecture : glnxa64
  MATLAB Entitlement ID: 2136166
  MATLAB Root         : /util/packages/matlab/R2017a
  MATLAB Version      : 9.2.0.538062 (R2017a)
  OpenGL              : hardware
  Operating System    : Linux 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64
  Processor ID        : x86 Family 6 Model 62 Stepping 4, GenuineIntel
  Virtual Machine     : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  Window System       : The X.Org Foundation (11804000), display :0

Fault Count: 1


Abnormal termination:
abort()

Register State (from fault):
  RAX = 0000000000000000  RBX = 00007fb9b4df6120
  RCX = 00007fbac425c2b8  RDX = 0000000000000006
  RSP = 00007fb9b4df5c48  RBP = 00007fba0a673080
  RSI = 00000000000075f8  RDI = 0000000000006d64

   R8 = 00007fb9b4df6120   R9 = 0000000000000002
  R10 = 0000000000000008  R11 = 0000000000000202
  R12 = 0000000000000002  R13 = 0000000000000000
  R14 = 0000000000000000  R15 = 00007fb8cc0bd6a8

  RIP = 00007fbac425c2b8  EFL = 0000000000000202

   CS = 0033   FS = 0000   GS = 0000

Stack Trace (from fault):
[  0] 0x00007fbac425c2b8                           /usr/local/lib/libc.so.6+00209592 gsignal+00000056
[  1] 0x00007fbac425d73a                           /usr/local/lib/libc.so.6+00214842 abort+00000362
[  2] 0x00007fb8cc117b3e /NAS/home/zhe_cai/zhengchen/Softwares/mcxlab_2017/mcxlab.mexa64+00510782
[  3] 0x00007fb8cc10b600 /NAS/home/zhe_cai/zhengchen/Softwares/mcxlab_2017/mcxlab.mexa64+00460288
[  4] 0x00007fbac47f6f93 /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libgcc_s.so.1+00065427
[  5] 0x00007fbac47f731b /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libgcc_s.so.1+00066331 _Unwind_RaiseException+00000251
[  6] 0x00007fbac4d6489b /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6+00387227 __cxa_throw+00000091
[  7] 0x00007fbab38ed5a1                  bin/glnxa64/libmwm_interpreter.so+02413985
[  8] 0x00007fbab39ab9a1                  bin/glnxa64/libmwm_interpreter.so+03193249
[  9] 0x00007fbab39ac715                  bin/glnxa64/libmwm_interpreter.so+03196693 inMexEvalString+00000037
[ 10] 0x00007fb8cc0c0949 /NAS/home/zhe_cai/zhengchen/Softwares/mcxlab_2017/mcxlab.mexa64+00153929
[ 11] 0x00007fb8cc0af800 /NAS/home/zhe_cai/zhengchen/Softwares/mcxlab_2017/mcxlab.mexa64+00083968
[ 12] 0x00007fb8cc0a8133 /NAS/home/zhe_cai/zhengchen/Softwares/mcxlab_2017/mcxlab.mexa64+00053555
[ 13] 0x00007fb8cc0bd6a3 /NAS/home/zhe_cai/zhengchen/Softwares/mcxlab_2017/mcxlab.mexa64+00140963
[ 14] 0x00007fbaa8a016a3 /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00669347 __kmp_invoke_microtask+00000147
[ 15] 0x00007fbaa89d0007 /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00466951
[ 16] 0x00007fbaa89cf6f5 /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00464629
[ 17] 0x00007fbaa8a019c3 /util/packages/matlab/R2017a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00670147
[ 18] 0x00007fbac45d16ba              /lib/x86_64-linux-gnu/libpthread.so.0+00030394
[ 19] 0x00007fbac43106ad                           /usr/local/lib/libc.so.6+00947885 clone+00000109
[ 20] 0x0000000000000000                                   <unknown-module>+00000000


If this problem is reproducible, please submit a Service Request via:

A technical support engineer might contact you with further information.

Thank you for your help.** This crash report has been saved to disk as /NAS/home/zhe_cai/matlab_crash_dump.28004-1 **



MATLAB is exiting because of fatal error
Killed

Qianqian Fang

unread,
Jul 19, 2017, 1:15:18 PM7/19/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/19/2017 12:18 PM, Zhengchen Cai wrote:
Hi Dr.Fang,

We got two 1080ti for MCX, we tried to launch the benchmark as gpuid = '11' and matlab was killed with error attached in the end of this email. We tried to run with each single GPU, and both of them worked well even with the one that is using for display. We also tried to decrease the number of photons to 10^6 and set tstep = 5*10^-10ns, and got the same error only with dual GPU. Could you please help? Thank you very much.

hi Zhengchen

is it possible you are using an older version of mcx? can you type which mcxlab and see if it comes from the folder of the latest code?

this crash was supposed to be fixed back in May by this commit

https://github.com/fangq/mcx/commit/cfe280b2b6d4e8169c80938b43d24c8a89a44e6c

this should have been included in the 2017.7 release (and definitely nightly build).

please let me know

Qianqian

--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To post to this group, send email to mcx-...@googlegroups.com.
Visit this group at https://groups.google.com/group/mcx-users.
For more options, visit https://groups.google.com/d/optout.


Zhengchen Cai

unread,
Jul 19, 2017, 1:40:10 PM7/19/17
to mcx-users, zhengc...@gmail.com
Hi Dr.Fang,

I am using the latest version. 2017.3. I tried with 1000 photons and still got error, this only happens when I use dual GPU. 



在 2017年7月19日星期三 UTC-4下午1:15:18,q.fang写道:

Qianqian Fang

unread,
Jul 19, 2017, 1:40:59 PM7/19/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/19/2017 01:40 PM, Zhengchen Cai wrote:
Hi Dr.Fang,

I am using the latest version. 2017.3. I tried with 1000 photons and still got error, this only happens when I use dual GPU.

that's what I thought, please use 2017.7 or nightly build. this has already been fixed.

Zhengchen Cai

unread,
Jul 19, 2017, 3:13:21 PM7/19/17
to mcx-users, zhengc...@gmail.com
Nightly build gave the same error and I downloaded 2017.7 from github it showed error as "Output argument "fluence" (and maybe others) not assigned during call to "mcxlab". "  Do I need to make the mex file ? Thanks

在 2017年7月19日星期三 UTC-4下午1:40:59,q.fang写道:

Zhengchen Cai

unread,
Jul 19, 2017, 4:49:07 PM7/19/17
to mcx-users, zhengc...@gmail.com
Hi Dr.Fang,

I tried to make mex for 2017.7, but I got this error.  I tired with g++5 it gave me warning like make MEX doesn't comparable with g++5. 

make mex AR=g++-4.9
g++-4.9 mcx_core.o mcx_utils.o mcx_shapes.o tictoc.o mcextreme.o cjson/cJSON.o -output ../mcxlab/mcxlab -L/usr/local/cuda/lib -lm -lcudart CXXFLAGS='$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp  ' LDFLAGS='-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp ' -liomp5 mcxlab.cpp -outdir ../mcxlab -I/usr/local/cuda/include -DUSE_XORSHIFT128P_RAND 
g++-4.9: error: CXXFLAGS=$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp  : No such file or directory
g++-4.9: error: LDFLAGS=-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp : No such file or directory
Makefile:174: recipe for target '../bin/mcx' failed
make: *** [../bin/mcx] Error 1


在 2017年7月19日星期三 UTC-4下午3:13:21,Zhengchen Cai写道:

Qianqian Fang

unread,
Jul 19, 2017, 7:19:11 PM7/19/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/19/2017 03:13 PM, Zhengchen Cai wrote:
Nightly build gave the same error and I downloaded 2017.7 from github it showed error as "Output argument "fluence" (and maybe others) not assigned during call to "mcxlab". "  Do I need to make the mex file ? Thanks

I am surprised. can you send me your script so I can debug it on my side?
nightly build should have this fixed, must be a new issue.

Qianqian

Zhengchen Cai

unread,
Jul 19, 2017, 7:36:36 PM7/19/17
to Qianqian Fang, mcx-...@googlegroups.com
Hi Dr.Fang,

I am not in the lab now. I will send you my mcxlab toolbox and the code by tomorrow morning. But this is just the benchmark code. I was wandering this is because the mex file doesn't comparable with my system (ubuntu 16.04). I didn't manage to make a new mex and I guess the reason is the make file code was not taking these CXXFLAGS and LDFLAGS correctly.  With mcx running in terminal dual gpu worked. 

make mex AR=g++-4.9
g++-4.9 mcx_core.o mcx_utils.o mcx_shapes.o tictoc.o mcextreme.o cjson/cJSON.o -output ../mcxlab/mcxlab -L/usr/local/cuda/lib -lm -lcudart CXXFLAGS='$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp  ' LDFLAGS='-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp ' -liomp5 mcxlab.cpp -outdir ../mcxlab -I/usr/local/cuda/include -DUSE_XORSHIFT128P_RAND 
g++-4.9: error: CXXFLAGS=$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp  : No such file or directory
g++-4.9: error: LDFLAGS=-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp : No such file or directory
Makefile:174: recipe for target '../bin/mcx' failed
make: *** [../bin/mcx] Error 1

Thanks a lot. 
Zhengchen
Qianqian Fang <q.f...@neu.edu>于2017年7月19日 周三19:19写道:
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+unsubscribe@googlegroups.com.

To post to this group, send email to mcx-...@googlegroups.com.

Qianqian Fang

unread,
Jul 19, 2017, 7:39:08 PM7/19/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/19/2017 07:36 PM, Zhengchen Cai wrote:
Hi Dr.Fang,

I am not in the lab now. I will send you my mcxlab toolbox and the code by tomorrow morning. But this is just the benchmark code. I was wandering this is because the mex file doesn't comparable with my system (ubuntu 16.04). I didn't manage to make a new mex and I guess the reason is the make file code was not taking these CXXFLAGS and LDFLAGS correctly.  With mcx running in terminal dual gpu worked. 

make mex AR=g++-4.9

sorry, why you want to use AR=g++_4.9 with "make mex"?

when you run make mex, the linking program "AR" must be "mex" from matlab.

what happen if you drop that term?

Zhengchen Cai

unread,
Jul 19, 2017, 7:49:29 PM7/19/17
to Qianqian Fang, mcx-...@googlegroups.com
Because the default gcc version is 5.0 on my machine. If I don't specify AR I will get warning saying for making MEX it should be 4.9 and I got more errors. I can send you the screenshot tomorrow morning since I can't access to our cluster now. Sorry for this. 

Qianqian Fang <q.f...@neu.edu>于2017年7月19日 周三19:39写道:

Qianqian Fang

unread,
Jul 19, 2017, 7:55:56 PM7/19/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/19/2017 07:49 PM, Zhengchen Cai wrote:
Because the default gcc version is 5.0 on my machine. If I don't specify AR I will get warning saying for making MEX it should be 4.9 and I got more errors. I can send you the screenshot tomorrow morning since I can't access to our cluster now. Sorry for this.

I see. so, what yo want to do is to tell mex to use AR=g++_4.9, but not to tell make.
the way you used does the latter.

the makefile wasn't tested for this, but to achieve your purpose, you can edit
line#142, and insert AR=... at the end of the line

https://github.com/fangq/mcx/blob/master/src/Makefile#L142

this will let mex to use the desired AR settings.

Qianqian

Zhengchen Cai

unread,
Jul 19, 2017, 7:57:48 PM7/19/17
to Qianqian Fang, mcx-...@googlegroups.com
Sounds nice. I will try it asap and let you know. Thanks a lot. Have a nice evening. 

Qianqian Fang <q.f...@neu.edu>于2017年7月19日 周三19:55写道:

Zhengchen Cai

unread,
Jul 20, 2017, 8:49:30 AM7/20/17
to mcx-users, zhengc...@gmail.com
Hi Dr.Fang,


I downloaded the very latest nightly build version (20th July ) of mcxlab and src code this morning. Please see what I tried and got as following. 

1. mcxlab worked well except when using gpuid = '11' in the benchmark code
2. I added AR = g++-4.9 as you suggested in the end of line 142 of makefile, seem it was still using 5.4.0 instead of 4.9. Here is line 142: mexbox fermimex: LINKOPT+= CXXFLAGS='$$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER $(OMP) $(MEXCCOPT) $(USERCCOPT)' LDFLAGS='-L$$TMW_ROOT$$MATLABROOT/sys/os/$$ARCH $$LDFLAGS $(OMP) $(USERLINKOPT)' -liomp5 AR=g++-4.9
3. 2017.7 from github gave me "Output argument "fluence" (and maybe others) not assigned during call to "mcxlab" because there is no mex file. Same error happened when make mex from src 

ERROR MESSAGE:
mex mcx_core.o mcx_utils.o mcx_shapes.o tictoc.o mcextreme.o cjson/cJSON.o -output ../mcxlab/mcxlab -L/usr/local/cuda/lib -lm -lcudart CXXFLAGS='$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp ' LDFLAGS='-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp ' -liomp5 AR=g++-4.9 mcxlab.cpp -outdir ../mcxlab -I/usr/local/cuda/include -DUSE_XORSHIFT128P_RAND
Building with 'g++'.
Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release.
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:205:104: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
mxSetFieldByNumber(plhs[4],jstruct,0, mxCreateNumericArray(2,fielddim,mxSINGLE_CLASS,mxREAL));
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:215:96: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
mxSetFieldByNumber(plhs[3],jstruct,0, mxCreateNumericArray(2,fielddim,mxUINT8_CLASS,mxREAL));
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:224:112: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
mxSetFieldByNumber(plhs[2],jstruct,0, mxCreateNumericArray(3,fielddim,mxUINT32_CLASS,mxREAL));
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:233:112: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
mxSetFieldByNumber(plhs[1],jstruct,0, mxCreateNumericArray(2,fielddim,mxSINGLE_CLASS,mxREAL));
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:255:101: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
mxSetFieldByNumber(plhs[0],jstruct,2, mxCreateNumericArray(4,fielddim,mxSINGLE_CLASS,mxREAL));
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:259:97: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’
mxSetFieldByNumber(plhs[0],jstruct,0, mxCreateNumericArray(4,fielddim,mxSINGLE_CLASS,mxREAL));
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp: In function ‘void mcx_set_field(const mxArray*, const mxArray*, int, Config*)’:
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:372:17: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:402:17: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:414:17: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:487:17: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:503:17: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:510:17: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:556:10: error: cannot convert ‘const size_t* {aka const long unsigned int*}’ to ‘const int*’ in assignment
arraydim=mxGetDimensions(item);
^



Makefile:174: recipe for target '../bin/mcx' failed
make: *** [../bin/mcx] Error 255


Thanks a lot
Zhengchen

在 2017年7月19日星期三 UTC-4下午7:55:56,q.fang写道:

Qianqian Fang

unread,
Jul 20, 2017, 1:32:57 PM7/20/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/20/2017 08:49 AM, Zhengchen Cai wrote:
Hi Dr.Fang,


I downloaded the very latest nightly build version (20th July ) of mcxlab and src code this morning. Please see what I tried and got as following.

are you using matlab 2017?



1. mcxlab worked well except when using gpuid = '11' in the benchmark code

this is what I found out.

the nightly build version runs fine on matlab 2016a or older. But it did give me
similar crashes when I ran it on 2017a. the crash, however, seems to be random
and some time it could run without an error on 2017a.

using debug tools, I managed to trace the crash to this function:

https://github.com/fangq/mcx/blob/b4a37d226b15d94ad9f2e9e315f9c935631e9ba1/src/mcxlab.cpp#L709-L725

particularly line#718. this is a commonly used trick to force matlab to
flush command line console from a mex. but it appears that it cause
matlab trouble if multiple threads flush, even sequentially (I added the
omp critical back in May to address, but seems not enough for 2017a).

I just submitted a new commit, only allowing the master thread to flush
the command window, this seems to work with 2017a, as well as older
versions.

https://github.com/fangq/mcx/commit/eed619f3da08297d8ff2847f5674c9a182ed81fe

by the way, I also fixed the progress bar no update issue because after
matlab 2014b, waitbar function returns object instead of a handle.

https://github.com/fangq/mcx/commit/6e839efcf9596391cbcd6b971889140fb9fa8a84

please update your copy or download the nightly build again for Linux.



2. I added AR = g++-4.9 as you suggested in the end of line 142 of makefile, seem it was still using 5.4.0 instead of 4.9. Here is line 142: mexbox fermimex: LINKOPT+= CXXFLAGS='$$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER $(OMP) $(MEXCCOPT) $(USERCCOPT)' LDFLAGS='-L$$TMW_ROOT$$MATLABROOT/sys/os/$$ARCH $$LDFLAGS $(OMP) $(USERLINKOPT)' -liomp5 AR=g++-4.9

ok, the correct flag to add is LD=g++-4.9.

you can use the verbose mode (adding "-v" after the mex command) to see
all mex supported env variables. the linking program is specified by LD in
mex 2010a (this is what I used to compile nightly build for compatibility).
These variables may subject to change if you use a newer mex.


3. 2017.7 from github gave me "Output argument "fluence" (and maybe others) not assigned during call to "mcxlab" because there is no mex file. Same error happened when make mex from src 

ERROR MESSAGE:
mex mcx_core.o mcx_utils.o mcx_shapes.o tictoc.o mcextreme.o cjson/cJSON.o -output ../mcxlab/mcxlab -L/usr/local/cuda/lib -lm -lcudart CXXFLAGS='$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp ' LDFLAGS='-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp ' -liomp5 AR=g++-4.9 mcxlab.cpp -outdir ../mcxlab -I/usr/local/cuda/include -DUSE_XORSHIFT128P_RAND
Building with 'g++'.
Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release.
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
/NAS/home/zhe_cai/zhengchen/Softwares/mcx_master/mcx/mcx/src/mcxlab.cpp:205:104: error: cannot convert ‘int*’ to ‘const size_t* {aka const long unsigned int*}’ for argument ‘2’ to ‘mxArray* mxCreateNumericArray(size_t, const size_t*, mxClassID, mxComplexity)’

there are probably gcc version compatibility issues. hopefully they will be gone if
you do the above two steps.

let me know what you see.

Qianqian

Zhengchen Cai

unread,
Jul 20, 2017, 2:24:36 PM7/20/17
to mcx-users, zhengc...@gmail.com
Hi Dr.Fang,

Yes I was using matlab 2017a, but I also tired with 2016a before. Anyway, now it's fine both with 2017a and 2016a. Thanks a lot.  

Best regards,
Zhengchen

在 2017年7月20日星期四 UTC-4下午1:32:57,q.fang写道:

Qianqian Fang

unread,
Jul 20, 2017, 2:35:26 PM7/20/17
to mcx-...@googlegroups.com, Zhengchen Cai
On 07/20/2017 02:24 PM, Zhengchen Cai wrote:
Hi Dr.Fang,

Yes I was using matlab 2017a, but I also tired with 2016a before. Anyway, now it's fine both with 2017a and 2016a. Thanks a lot. 

great! glad to know it works now. were you able to compile the code using the flags
I mentioned?

Zhengchen Cai

unread,
Jul 20, 2017, 2:51:53 PM7/20/17
to mcx-users, zhengc...@gmail.com
It also woks with the nightly build version now. Thanks again. 

make mex
nvcc -c -lineinfo -Xcompiler -Wall -Xcompiler -fopenmp -m64 -DUSE_ATOMIC -use_fast_math -DSAVE_DETECTORS -DUSE_CACHEBOX -use_fast_math -arch=sm_20 -DMCX_TARGET_NAME='"Fermi MCX"' --compiler-options "-fPIC" -DMCX_CONTAINER -DUSE_XORSHIFT128P_RAND -o mcx_core.o  mcx_core.cu
cc -I/usr/local/cuda/include -g -Wall -std=c99  -fopenmp -m64 -fPIC -DMCX_CONTAINER -c -o mcx_utils.o  mcx_utils.c
cc -I/usr/local/cuda/include -g -Wall -std=c99  -fopenmp -m64 -fPIC -DMCX_CONTAINER -c -o mcx_shapes.o  mcx_shapes.c
cc -I/usr/local/cuda/include -g -Wall -std=c99  -fopenmp -m64 -fPIC -DMCX_CONTAINER -c -o tictoc.o  tictoc.c
cc -I/usr/local/cuda/include -g -Wall -std=c99  -fopenmp -m64 -fPIC -DMCX_CONTAINER -c -o mcextreme.o  mcextreme.c
cc -I/usr/local/cuda/include -g -Wall -std=c99  -fopenmp -m64 -fPIC -DMCX_CONTAINER -c -o cjson/cJSON.o  cjson/cJSON.c
mex mcx_core.o mcx_utils.o mcx_shapes.o tictoc.o mcextreme.o cjson/cJSON.o -output ../mcxlab/mcxlab -L/usr/local/cuda/lib -lm -lcudart CXXFLAGS='$CXXFLAGS -DSAVE_DETECTORS -DUSE_CACHEBOX -DMCX_CONTAINER -fopenmp  ' LDFLAGS='-L$TMW_ROOT$MATLABROOT/sys/os/$ARCH $LDFLAGS -fopenmp ' -liomp5 LD=g++-4.9 mcxlab.cpp -outdir ../mcxlab -I/usr/local/cuda/include -DUSE_XORSHIFT128P_RAND 
Building with 'g++'.
Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release.
MEX completed successfully.


在 2017年7月20日星期四 UTC-4下午2:35:26,q.fang写道:
Reply all
Reply to author
Forward
0 new messages