Again, thank you for your help, and if you're interested I could describe
you in details the goals of this code (i guess it's not the purpose of tis
list)
I'll let you know!
Pierre
Jonathan Olmsted <jpolmsted at gmail.com> a ?crit :
Pierre,
Have you used a tool like Valgrind? There is a bit of a learning curve,
but
it is exceedingly useful.
A few comments:
1) For cases likes this gctortute(TRUE) in your R script helps those ?for
enough iterations in a loop?? bugs to present quickly. With
gctorture(TRUE)
I?m producing the crash with fewer than 50 iters.
?2) What you are implementing has everything to do with RNGs, so setting
the seed is useful for reproducibility?
?.?
2) I got useful messages from Valgrind after changing your prefix
increments to postfix increments, but I didn?t before making that switch
? (if I remember correctly)?
.
3) These msgs points me to these lines
for(int i = 1; i < kappa+2; i++){
phi_omega[i-1] = phi_C(arma::trans(omegas.row(i)),
piks,muks,Cks,Gamma);
}
accept = all_C((phi_omega < Upsilon));
in main_function_C(). Pretty sure you have an ?off by 1? error here. kappa
is an int, phi_omega has kappa elements (in elements 0 through kappa -1),
but you refer to elements 1-1=0 through kappa+1-1=kappa which is the
position of the kappa+1st elem.
I switched your loop to for(int i = 1; i < kappa+1; i++) and it is running
under Valgrind now (i.e. slowly) and it?s gotten farther than any other
run
thus far.
? Without having a conceptual understanding of what you are trying to do,
I
have no idea if this is the right fix for you (and I may be mistaken
altogether of course...).
HTH,
Jonathan?
?
On Tue, Oct 7, 2014 at 8:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
Hi Pierre,
On 8 October 2014 at 01:59, Pierre.Gloaguen at ifremer.fr wrote:
| I will do what I can to reduce the code and have to same error
occuring.
| Of course i don't expect you to read all of it :) I was just wondering
| if that kind of memory problem occured before, and if has some
| "typical/generic" solutions.
| I will try to have a shortest code to exhibit.
Really appreciate it.
Many of us found over the years that just by "creating a better example"
to
often drill down close enough to the problem core.
And the easier you make it for folks to help you, the likier it is that
some
kind soul from around here can give you a hand.
Just lowering the barriers, be it cognitive or just plain effort ...
Best, Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org