/ani/mrses

To get this branch, use:
bzr branch http://suren.me/webbzr/ani/mrses

« back to all changes in this revision

Viewing changes to cell/mrses_impl.c

  • Committer: Suren A. Chilingaryan
  • Date: 2010-04-28 04:30:08 UTC
  • Revision ID: csa@dside.dyndns.org-20100428043008-vd9z0nso9axezvlp
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    ctx->nB = nB;
61
61
    ctx->alloc = alloc;
62
62
    ctx->properties = properties;    
63
 
    ctx->palloc = calc_alloc(properties * sizeof(MRSESIntType), HW_ALIGN) / sizeof(MRSESIntType);
64
63
 
65
64
    posix_memalign((void*)&ctx->A, HW_ALIGN, (alloc * properties)*sizeof(MRSESDataType));
66
65
    posix_memalign((void*)&ctx->B, HW_ALIGN, (alloc * properties)*sizeof(MRSESDataType));
194
193
    ctx->nB = nB;
195
194
    ctx->alloc = alloc;
196
195
    ctx->properties = properties;    
197
 
    ctx->palloc = calc_alloc(properties * sizeof(MRSESIntType), HW_ALIGN) / sizeof(MRSESIntType);
198
196
 
199
197
    posix_memalign((void*)&ctx->A, HW_ALIGN, (alloc * properties)*sizeof(MRSESDataType));
200
198
    posix_memalign((void*)&ctx->B, HW_ALIGN, (alloc * properties)*sizeof(MRSESDataType));
390
388
}
391
389
 
392
390
int mrses_iterate(MRSESContext ctx, int iterations, int block_size, MRSESIntType *ires) {
393
 
    int i, width, properties, palloc;
 
391
    int i, width, properties;
394
392
#ifndef FIX_RANDOM
395
393
    struct timeval tv;
396
394
#endif /* FIX_RANDOM */
406
404
 
407
405
    width = ctx->width;
408
406
    properties = ctx->properties;
409
 
    palloc = ctx->palloc;
410
407
 
411
408
#ifdef FIX_RANDOM
412
409
    srandom(FIX_RANDOM);
419
416
        if (!ires) hw_sched_wait_task(ctx->sched);
420
417
        index = ctx->index;
421
418
    } else {
422
 
        posix_memalign((void*)&index, HW_ALIGN, (block_size * palloc)*sizeof(MRSESIntType));
 
419
        posix_memalign((void*)&index, HW_ALIGN, (block_size * properties)*sizeof(MRSESIntType));
423
420
        if (!index) {
424
421
            return 1;
425
422
        }
429
426
        index[i] = i;
430
427
    }
431
428
 
432
 
    iend = index + block_size * palloc;    
433
 
    for (iptr = index + palloc; iptr < iend; iptr += palloc) {
 
429
    iend = index + block_size * properties;    
 
430
    for (iptr = index + properties; iptr < iend; iptr += properties) {
434
431
        memcpy(iptr, index, properties * sizeof(MRSESIntType));
435
432
        
436
433
        for (i = 0; i < width; i++) {