Posted By: GPEngine
enable printf in Train mode - 04/27/15 14:53
In Train mode all printf statements, even the ones directed at the Log or Diag file, are suppressed.
I have a Crash that only happens during Train mode. How can I debug it?
Posted By: GPEngine
Re: enable printf in Train mode - 04/27/15 15:26
For example The crash occurs in-between opt cycles
Diag has
Exit Loop TA-Lib Series
Parameter 4 step 7: 11.44 => 0.90 1634/1927
StepCycle: 7
Quit
The Quit represents a crash during the time Zorro was trying to get a reading for Step 8. It hasn't begun executing Step 8 yet. I know this because there the INITRUN sends an RPC.
Posted By: DdlV
Re: enable printf in Train mode - 04/27/15 16:23
Hi GPEngine. I suspect based on his comment in another thread jcl will recommend that you write debugging info to another file...
HTH.
Posted By: jcl
Re: enable printf in Train mode - 04/27/15 17:28
You could do a print(TO_DIAG,...) - that should work also in training mode.
Posted By: GPEngine
Re: enable printf in Train mode - 04/28/15 02:54
That's useful.
Perhaps it could adopt printf's features so I can easily print numeric values
Posted By: GPEngine
Re: enable printf in Train mode - 04/28/15 03:10
What do these lines mean in diag?
Asset EUR/GBP status EUR/GBP:L 32686008 1
Asset EUR/GBP status EUR/GBP:S 32686008 1
What does the 32686008 mean
Posted By: GPEngine
Re: enable printf in Train mode - 04/28/15 05:16
...And my problem was I was using a var as a loop boundary and assuming it would be treated as an int.
optimize only produces floats. So I had
var num_clusters = (optimize(10., 3., 25., -20));
Then, later, I used
int i
for (i = 0; i < num_clusters; i++) {
read_one_element_of_something_with_exactly_num_cluster_elements();
}
I expected num_clusters to be rounded down to nearest int. I don't know why I expected that. So when num_clusters=1.1, the for loop is executed 2x, leading to one more read than is possible. So, it crashed.
I guess, better to use
int num_clusters = (int)(optimize(10., 3., 25., -20));
when really needing an int.
Posted By: MatPed
Re: enable printf in Train mode - 04/28/15 08:54
GPEngine, good point! I was finding the same issue. Force casting on optimisation parameter coud be a solution. I'll give it a try.
Thank You
Posted By: jcl
Re: enable printf in Train mode - 04/28/15 11:35
Yes, cast it to int before comparison. When you have an int and a float in a C expression and no cast operator, the int is converted to float, not the float to int. - The Diag numbers look like a status flag, but I don't know exactly what they mean.
Posted By: jcl
Re: enable printf in Train mode - 05/01/15 10:48
FYI, the next update will contain a "TO_FILE" print target that can also print messages during the training process.