/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.h

  • 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:
 
1
#ifndef _MRSES_IMPL_H
 
2
#define _MRSES_IMPL_H
 
3
 
 
4
#include <stdlib.h>
 
5
#include <math.h>
 
6
 
 
7
#include "mrses.h"
 
8
#include "hw_sched.h"
 
9
#include "tools.h"
 
10
 
 
11
#define HW_ALIGN 16             // For SPE support minimum 16 is required (should be multiple of MRSESDataType anyway)
 
12
#define SPE_BLOCK 16            // This indicates minimal block of processing by SPE code
 
13
#define SIMD_BLOCK 16           // In bytes
 
14
#define HW_ITERATE_BLOCKS 16
 
15
 
 
16
//#define TRACE_TIMINGS 1
 
17
//#define USE_FAST_RANDOM 1             //* default random/rand somehow sequentalize threads
 
18
//#define FIX_RANDOM 1
 
19
//#define HW_USE_BLOCKED_MULTIPLY       //* Alternative outdated way of processing in SPU (don't use)
 
20
 
 
21
 
 
22
#define blas_asum cblas_sasum
 
23
#define blas_scal cblas_sscal
 
24
#define blas_axpy cblas_saxpy
 
25
#define blas_gemv cblas_sgemv
 
26
#define blas_gemm cblas_sgemm
 
27
#define blas_syrk cblas_ssyrk
 
28
#define blas_trsm cblas_strsm
 
29
#define blas_trsv cblas_strsv
 
30
#define blas_dot  cblas_sdot
 
31
#define lapack_potrf spotrf_
 
32
 
 
33
struct MRSESContextT {
 
34
    MRSESDistance dist;
 
35
 
 
36
    int properties;             /**< Number of properties */
 
37
    int alloc;                  /**< Size of vectors in A and B matrixes for alignment */
 
38
    int nA, nB;                 /**< Number of samples */
 
39
    
 
40
    MRSESDataType *A;           /**< Actually: (A - mean(A))/sqrt(nA) */
 
41
    MRSESDataType *B;           /**< Actually: (B - mean(B))/sqrt(nB) */
 
42
 
 
43
    MRSESDataType *mean;        /**< Actually: mean(A) - mean(B) */
 
44
 
 
45
    HWSched sched;
 
46
 
 
47
    int iterate_size;           /**< Number of blocks per block group */
 
48
    
 
49
    int max_block_size;
 
50
    int block_size;
 
51
    int cur_chunk;
 
52
 
 
53
    int width; 
 
54
    int iterations;   
 
55
    MRSESIntType *index;        /**< In compute: provided by client app, no allocation, in iteration: allocated, indicates that iterations were started before */
 
56
    MRSESIntType *ires;         /**< Array of resulting indeces */
 
57
    MRSESDataType *result;      /**< Provided by client app, no allocation */
 
58
    
 
59
};
 
60
typedef struct MRSESContextT MRSESContextS;
 
61
 
 
62
#endif /* _MRSES_IMPL_H */