34 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_ISOTOPEWAVELETPARALLELFOR_H 
   35 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_ISOTOPEWAVELETPARALLELFOR_H 
   37 #include <tbb/blocked_range.h> 
   47   template <
typename PeakType, 
typename FeatureType>
 
   48   class FeatureFinderAlgorithmIsotopeWavelet;
 
   51   template <
typename PeakType, 
typename FeatureType>
 
   64     void operator()(
const tbb::blocked_range<size_t> & r)
 const 
   66       for (
size_t t = r.begin(); t != r.end(); ++t)       
 
   68         cudaSetDevice(
ff_->gpu_ids_[t]);
 
   71         UInt num_gpus = 
ff_->gpu_ids_.size();
 
   72         UInt block_size = (int)(
ff_->map_->size() / num_gpus); 
UInt additional = 
ff_->map_->size() - num_gpus * block_size;
 
   73         UInt from = t * block_size;
 
   74         UInt up_to = (t >= num_gpus - 1) ? from + block_size + additional : from + block_size;
 
   76         for (
UInt i = from; i < up_to; ++i)
 
   79           if (c_ref.size() <= 1)               
 
   82             ff_->ff_->setProgress(
ff_->progress_counter_ += 2);
 
   90             std::cout << 
"Parallel for: here we are" << std::endl;
 
   99                 c_iwt->getTransformCuda(*c_trans, 
c);
 
  101 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  102                 std::stringstream stream;
 
  103                 stream << 
"gpu_lowres_" << ((*
ff_->map_)[i]).getRT() << 
"_" << 
c + 1 << 
".trans\0";
 
  104                 std::ofstream ofile(stream.str().c_str());
 
  112 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  113                 std::cout << 
"cuda transform for charge " << 
c + 1 << 
"  O.K. ... "; std::cout.flush();
 
  115                 ff_->ff_->setProgress(++
ff_->progress_counter_);
 
  117                 c_iwt->identifyChargeCuda(*c_trans, i, c, 
ff_->intensity_threshold_, 
ff_->check_PPMs_);
 
  119 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  120                 std::cout << 
"cuda charge recognition for charge " << c + 1 << 
" O.K." << std::endl;
 
  122                 ff_->ff_->setProgress(++
ff_->progress_counter_);
 
  124               c_iwt->finalizeScanCuda();
 
  128               std::cout << 
"Warning/Error generated at scan " << i << 
" (" << ((*
ff_->map_)[i]).getRT() << 
")." << std::endl;
 
  133             c_trans = 
ff_->prepareHRDataCuda(i, c_iwt);
 
  136               c_iwt->getTransformCuda(*c_trans, 
c);
 
  138 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  139               std::stringstream stream;
 
  140               stream << 
"gpu_highres_" << ((*
ff_->map_)[i]).getRT() << 
"_" << 
c + 1 << 
".trans\0";
 
  141               std::ofstream ofile(stream.str().c_str());
 
  149 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  150               std::cout << 
"cuda transform for charge " << 
c + 1 << 
"  O.K. ... "; std::cout.flush();
 
  152               ff_->ff_->setProgress(++
ff_->progress_counter_);
 
  154               c_iwt->identifyChargeCuda(*c_trans, i, c, 
ff_->intensity_threshold_, 
ff_->check_PPMs_);
 
  156 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  157               std::cout << 
"cuda charge recognition for charge " << c + 1 << 
" O.K." << std::endl;
 
  159               ff_->ff_->setProgress(++
ff_->progress_counter_);
 
  163             c_iwt->finalizeScanCuda();
 
  166           delete (c_trans); c_trans = 
NULL;
 
  169 #ifdef OPENMS_DEBUG_ISOTOPE_WAVELET 
  170           std::cout << 
"updated box states." << std::endl;
 
  182     std::vector<IsotopeWaveletTransform<PeakType> *> & 
iwts_;
 
const int CUDA_INIT_SUCCESS
Definition: IsotopeWaveletConstants.h:92
IsotopeWaveletParallelFor(std::vector< IsotopeWaveletTransform< PeakType > * > &iwts, FeatureFinderAlgorithmIsotopeWavelet< PeakType, FeatureType > *ff)
Constructor. 
Definition: IsotopeWaveletParallelFor.h:57
void operator()(const tbb::blocked_range< size_t > &r) const 
The working horse of the class. The operator initializes the computation on the individual GPU...
Definition: IsotopeWaveletParallelFor.h:64
#define NULL
Definition: IsotopeWaveletParallelFor.h:41
Implements the isotope wavelet feature finder. 
Definition: FeatureFinderAlgorithmIsotopeWavelet.h:76
std::vector< IsotopeWaveletTransform< PeakType > * > & iwts_
Definition: IsotopeWaveletParallelFor.h:182
A class for distributing the data over several GPUs using Intel Threading Building Blocks...
Definition: IsotopeWaveletParallelFor.h:52
FeatureFinderAlgorithmIsotopeWavelet< PeakType, FeatureType > * ff_
Definition: IsotopeWaveletParallelFor.h:183