/tomo/pyhst

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/pyhst

« back to all changes in this revision

Viewing changes to hst.c

  • Committer: Suren A. Chilingaryan
  • Date: 2013-06-14 15:30:33 UTC
  • Revision ID: csa@dside.dyndns.org-20130614153033-t9b56hr4jdkd3ul8
Placeholders for DFI implementation

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
#include <sys/mman.h>
28
28
 
 
29
 
 
30
#undef HW_USE_SIMD
 
31
 
29
32
#ifdef HW_USE_SIMD
30
33
# include <xmmintrin.h>
31
34
#endif /* HW_USE_SIMD */
38
41
 
39
42
#ifdef HW_USE_CUDA
40
43
# include "hst_cuda/hst_cuda.h"
 
44
# include "dfi_cuda/dfi_cuda.h"
41
45
#endif /* HW_USE_CUDA */
42
46
 
43
47
#ifdef HW_USE_OPENCL
56
60
 
57
61
#ifdef HW_USE_CUDA
58
62
static HSTReconstructor *cuda_recon = NULL;
 
63
static HSTReconstructor *cuda_fbp_recon = NULL;
 
64
static HSTReconstructor *cuda_dfi_recon = NULL;
59
65
#endif /* HW_USE_CUDA */
60
66
 
61
67
#ifdef HW_USE_OPENCL
70
76
    hw_sched_init();
71
77
 
72
78
#ifdef HW_USE_CUDA
73
 
    cuda_recon = hst_cuda_init(HW_USE_CUDA);
 
79
    cuda_fbp_recon = hst_cuda_init(HW_USE_CUDA);
 
80
    cuda_dfi_recon = dfi_cuda_init(HW_USE_CUDA);
74
81
#endif /* HW_USE_CUDA */
75
82
 
76
83
#ifdef HW_USE_OPENCL
90
97
#endif /* HW_USE_CPU */
91
98
 
92
99
#ifdef HW_USE_CUDA
 
100
    dfi_cuda_free();
93
101
    hst_cuda_free();
94
102
#endif /* HW_USE_CUDA */
95
103
 
103
111
 
104
112
#ifdef HW_USE_THREADS
105
113
# ifdef HW_USE_CUDA
106
 
    count += cuda_recon->devices;
 
114
    count += cuda_fbp_recon->devices;
107
115
# endif /* HW_USE_OPENCL */
108
116
 
109
117
# ifdef HW_USE_OPENCL
200
208
 
201
209
        // Computing FFT dimensions, hard to understand why the -1 is there but it works nicely
202
210
        // DS: This is actually two times more than the closest power of 2. Do we need that?
203
 
    ctx->setup.dim_fft = 1<<((int)(log((2. * ctx->setup.num_bins - 1)) / log(2.0) + 0.9999));
 
211
    ctx->setup.dim_fft = 1<<((int)(log((1. * ctx->setup.fft_oversampling * ctx->setup.num_bins - 1)) / log(2.0) + 0.9999));
204
212
    ctx->setup.filter = malloc((2 * ctx->setup.dim_fft) * sizeof(float));
205
213
    check_alloc(ctx->setup.filter, " FILTER");
206
214
 
1120
1128
    threads = 0;
1121
1129
 
1122
1130
# ifdef HW_USE_CUDA
 
1131
    switch (setup->method) {
 
1132
     case HST_METHOD_FBP: 
 
1133
        cuda_recon = cuda_fbp_recon;
 
1134
        break;
 
1135
     case HST_METHOD_DFI:
 
1136
        cuda_recon = cuda_dfi_recon;
 
1137
        break;
 
1138
    }
 
1139
 
1123
1140
    threads += cuda_recon->devices;
1124
1141
# endif /* HW_USE_CUDA */
1125
1142