/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_cpu/hst_cpu.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:
144
144
#ifdef PYHST_USE_FFTW
145
145
    ctx->sched = thr->sched;
146
146
    hw_sched_lock(ctx->sched, sync);
 
147
    printf("dim_fft %lu\n", setup->dim_fft);
147
148
    ctx->forward_plan = fftwf_plan_dft_r2c_1d(setup->dim_fft, ctx->WORK, (fftwf_complex*)ctx->WORK, 0);
148
149
    ctx->inverse_plan = fftwf_plan_dft_c2r_1d(setup->dim_fft, (fftwf_complex*)ctx->WORK, ctx->WORK, 0);
149
150
    hw_sched_unlock(ctx->sched, sync);
288
289
    pente_zone = setup->pente_zone;
289
290
 
290
291
 
291
 
#ifdef PYHST_MEASURE_TIMINGS
292
 
    g_timer_continue(ctx->pre_timer);
293
 
#endif /* PYHST_MEASURE_TIMINGS */
294
 
 
295
292
    for (projection = 0; projection < num_projections; projection++) {
296
293
        axis_position_corr = axis_position_corr_s[projection];
297
294
        memcpy(WORK, SINOGRAMS + projection * num_bins, num_bins * sizeof(float));
308
305
            }
309
306
        }
310
307
 
 
308
#ifdef PYHST_MEASURE_TIMINGS
 
309
    g_timer_continue(ctx->pre_timer);
 
310
#endif /* PYHST_MEASURE_TIMINGS */
311
311
 
312
312
#ifdef PYHST_USE_FFTW
313
313
        fftwf_execute(ctx->forward_plan);
326
326
        /******************************************************
327
327
        * Multiply the Fourier transformed array with filter *
328
328
        ******************************************************/
329
 
 
 
329
if (0) {
330
330
#ifdef PYHST_USE_FFTW
331
331
        for (i = 0;i <= dim_fft;i++) {
332
332
#else /* PYHST_USE_FFTW */
337
337
#endif /* PYHST_USE_FFTW */
338
338
            WORK[i] = WORK[i] * FILTER[i]; // fft e inv lasciano un fattore dim_fft, filter nella forma a rampa arriva fino a 1/dim_fft 
339
339
        }
340
 
 
 
340
}
341
341
        /***************************************************
342
342
        * Inverse Fourier transform to give convolution *
343
343
        ***************************************************/
348
348
        hst_ffs8__(&dim_fft, &dim_fft, &ctx->dim_exponts, ctx->EXPONENTS, &True, WORK, &status);
349
349
#endif /* PYHST_USE_FFTW */
350
350
 
 
351
#ifdef PYHST_MEASURE_TIMINGS
 
352
    g_timer_stop(ctx->pre_timer);
 
353
#endif /* PYHST_MEASURE_TIMINGS */
 
354
 
 
355
 
351
356
        if (setup->fai360) {
352
357
            if (2*axis_position_corr > num_bins) {
353
358
                overlapping = (num_bins - axis_position_corr);
399
404
        }
400
405
    } // end of projections loop
401
406
 
402
 
#ifdef PYHST_MEASURE_TIMINGS
403
 
    g_timer_stop(ctx->pre_timer);
404
 
#endif /* PYHST_MEASURE_TIMINGS */
405
 
    
 
407
 
406
408
    return 0;
407
409
}
408
410
 
474
476
HSTReconstructor *hst_cpu_init(int flags) {
475
477
    // Detect number of cores (embedded FFT is thread-unsafe)
476
478
#ifdef PYHST_USE_FFTW
477
 
    hst_cpu_info.devices = hw_sched_get_cpu_count();
 
479
    hst_cpu_info.devices = hw_sched_get_cpu_count()/2;
478
480
#endif /* PYHST_USE_FFTW */
479
481
 
480
482
    return &hst_cpu_info;