/ani/mrses

To get this branch, use:
bzr branch http://suren.me/webbzr/ani/mrses
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _MRSES_IMPL_H
#define _MRSES_IMPL_H

#include <stdlib.h>
#include <math.h>

#include "mrses.h"
#include "hw_sched.h"
#include "tools.h"

#define HW_ALIGN 16		// For SPE support minimum 16 is required (should be multiple of MRSESDataType anyway)
#define SPE_BLOCK 16		// This indicates minimal block of processing by SPE code
#define SIMD_BLOCK 16		// In bytes
#define HW_ITERATE_BLOCKS 16

//#define TRACE_TIMINGS 1
//#define USE_FAST_RANDOM 1		//* default random/rand somehow sequentalize threads
//#define FIX_RANDOM 1
//#define HW_USE_BLOCKED_MULTIPLY	//* Alternative outdated way of processing in SPU (don't use)


#define blas_asum cblas_sasum
#define blas_scal cblas_sscal
#define blas_axpy cblas_saxpy
#define blas_gemv cblas_sgemv
#define blas_gemm cblas_sgemm
#define blas_syrk cblas_ssyrk
#define blas_trsm cblas_strsm
#define blas_trsv cblas_strsv
#define blas_dot  cblas_sdot
#define lapack_potrf spotrf_

struct MRSESContextT {
    MRSESDistance dist;

    int properties;		/**< Number of properties */
    int alloc;			/**< Size of vectors in A and B matrixes for alignment */
    int nA, nB;			/**< Number of samples */
    
    MRSESDataType *A;		/**< Actually: (A - mean(A))/sqrt(nA) */
    MRSESDataType *B;		/**< Actually: (B - mean(B))/sqrt(nB) */

    MRSESDataType *mean;	/**< Actually: mean(A) - mean(B) */

    HWSched sched;

    int iterate_size;		/**< Number of blocks per block group */
    
    int max_block_size;
    int block_size;
    int cur_chunk;

    int width; 
    int iterations;   
    MRSESIntType *index;	/**< In compute: provided by client app, no allocation, in iteration: allocated, indicates that iterations were started before */
    MRSESIntType *ires;		/**< Array of resulting indeces */
    MRSESDataType *result;	/**< Provided by client app, no allocation */
    
};
typedef struct MRSESContextT MRSESContextS;

#endif /* _MRSES_IMPL_H */