Timothy R. Chavez wrote:
> Hi Gilles,
> 
> On Thu, 2008-10-16 at 11:22 +0200, Gilles Carry wrote:
>> Dimension (128) of statistics arrays must be a multiple of number of cpu.
>> This is a hassle as you have to recompile every time your arch changes
>> or if you want to disable cpus.
>> Failing to do so causes segfault when requiring statistics if
>> 128 modulo nr_cpus != 0 .
>>
>> This patch adds option -i to specify how many iterations are wanted
>> (still defaulting to 128).
>> It rounds down iterations to the nearest multiple of online cpus.
>> ---
>>  testcases/realtime/func/matrix_mult/matrix_mult.c |   33 
>> ++++++++++++++------
>>  1 files changed, 23 insertions(+), 10 deletions(-)
>>
>> diff --git a/testcases/realtime/func/matrix_mult/matrix_mult.c 
>> b/testcases/realtime/func/matrix_mult/matrix_mult.c
>> index 0a3904d..18c3e47 100644
>> --- a/testcases/realtime/func/matrix_mult/matrix_mult.c
>> +++ b/testcases/realtime/func/matrix_mult/matrix_mult.c
>> @@ -51,7 +51,7 @@
> <snip>
>> @@ -373,15 +378,23 @@ int main(int argc, char *argv[])
>>  {
>>      setup();
>>      pass_criteria = PASS_CRITERIA;
>> -    rt_init("jl:h", parse_args, argc, argv);
>> +    rt_init("jl:i:h", parse_args, argc, argv);
>>      numcpus = sysconf(_SC_NPROCESSORS_ONLN);
>>      /* the minimum avg concurrent multiplier to pass */
>>      criteria = pass_criteria * numcpus;
>>
>> +    /* Line below rounds down iterations to a multiple
>> +     * of numcpus.
>> +     * Without this, having iterations not a mutiple
>> +     * of numcpus causes stats to segfault (overflow
>> +     * stats array).
>> +     */
>> +    iterations = (int) (iterations / numcpus) * numcpus;
> 
> If the value of 'iterations' changes here, I think this should probably
> be reported on the console, e.g.
> 
> "Rounding down iterations value to nearest multiple of total online CPUs"
> 
> Sounds a little awkward, but something to that effect... what do you
> think?
> 
>> +
>>      printf("\n---------------------------------------\n");
>>      printf("Matrix Multiplication (SMP Performance)\n");
>>      printf("---------------------------------------\n\n");
>> -    printf("Running %d iterations\n", ITERATIONS);
>> +    printf("Running %d iterations\n", iterations);

I think that concern can be addressed here ^.  Perhaps with an 
annotation if the value is different than requested.

>>      printf("Matrix Dimensions: %dx%d\n", MATRIX_SIZE, MATRIX_SIZE);
>>      printf("Calculations per iteration: %d\n", ops);
>>      printf("Number of CPUs: %u\n", numcpus);


-- 
Darren Hart
IBM Linux Technology Center
Real-Time Linux Team

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to