Prev: estimate states of state space moddel using system identification toolbox
Next: Coordinates arrays to plaid
From: theotheraussie Bellamy on 9 Aug 2010 20:50 I'm grasping at straws here. This situation is: The task has been to converted Matlab to CPP and validate before integrating into the system. I am runnning several (minimum of 5) Matlab session over a period of a weekend to produce validation data. Each session is calling a CPP routine from Matlab and when it returns to Matlab it writes to a .mat file. Each session is writing to a different file. On monday morning I compare the results produced over the weekend with results produced purely by Matlab, i find some differences that i start to track down. The problem is that i can not reproduce the differencs found from the weekend run when diaplsying the data to the screen. I try to run the data and write to file again. (take not no code changes). This time the results are identical to the validation. We have had clean builds on both runs. Made no code changes between runs. Tested individual data slices. tested all the usual human errors: - typos, code difference. I'm using Matlab 2007b on a virtual machine, VNC. This has happened once before and i would like to understand why. current theories: - Running several session of Matlab writing to different files at once screws up the memory management. - Somehow unix is screwing up the writing to files. - The virtual machine, VNC is doing breaking and the state of these specific points are not saved properly before VNC starts again to continue where it left off. - A solar Flare has intereacted with my PC to screw with my head. - Murphy is seriously pissed at me for some reason. I need to know why this is happening. If anyone has some insight, Matlab related or not, it would be appreciated.
From: Steven_Lord on 10 Aug 2010 09:46
"theotheraussie Bellamy" <beau.bellamy(a)baesystems.com> wrote in message news:i3q7ol$jap$1(a)fred.mathworks.com... > I'm grasping at straws here. > This situation is: > The task has been to converted Matlab to CPP and validate before > integrating into the system. > I am runnning several (minimum of 5) Matlab session over a period of a > weekend to produce validation data. Each session is calling a CPP routine > from Matlab and when it returns to Matlab it writes to a .mat file. Each > session is writing to a different file. On monday morning I compare the > results produced over the weekend with results produced purely by Matlab, > i find some differences that i start to track down. > The problem is that i can not reproduce the differencs found from the > weekend run when diaplsying the data to the screen. I try to run the data > and write to file again. (take not no code changes). This time the results > are identical to the validation. > > We have had clean builds on both runs. > Made no code changes between runs. > Tested individual data slices. > tested all the usual human errors: > - typos, code difference. > > I'm using Matlab 2007b on a virtual machine, VNC. > This has happened once before and i would like to understand why. > current theories: > - Running several session of Matlab writing to different files at once > screws up the memory management. > - Somehow unix is screwing up the writing to files. I would be surprised if either of these were the cause of the problem. > - The virtual machine, VNC is doing breaking and the state of these > specific points are not saved properly before VNC starts again to continue > where it left off. > - A solar Flare has intereacted with my PC to screw with my head. > - Murphy is seriously pissed at me for some reason. > > I need to know why this is happening. If anyone has some insight, Matlab > related or not, it would be appreciated. The crystal ball is fuzzy since you haven't told us even in general what your code is trying to do. A couple of thoughts: 1) What else is running on the VM during your weekend runs that is not running when you try to reproduce this behavior? 2) Do any of the function you're calling use any random number generator functions like RAND, RANDN, or RANDI? [Keep in mind that both direct calls to these functions as well as calls to functions one of whose descendant (children, grandchildren, etc.) call one of these functions could have an impact on the reproducibility of your code.] 3) When you say the results are identical to the validation when you display to the screen, do you mean "they look the same" or do you mean "they are bit-for-bit exactly the same as shown by ISEQUAL or FORMAT HEX"? Even a difference of a single bit at the start of a long computation could result in large changes at the end of that computation. 4) Have you run your CPP code through a memory checking tool like Valgrind? Perhaps you're accessing some uninitialized memory in such a way that you don't get a segmentation violation but you do get results that depend on the contents of that memory. 5) Is there a different code path used when you display to screen and when you write to file? If so, perhaps the code path that writes the results to the file is where the error occurs. 6) Are you writing the data to the file with full precision? -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com |