当前位置: 首页>>代码示例>>C++>>正文


C++ TimeSeries::from_file方法代码示例

本文整理汇总了C++中TimeSeries::from_file方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSeries::from_file方法的具体用法?C++ TimeSeries::from_file怎么用?C++ TimeSeries::from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeSeries的用法示例。


在下文中一共展示了TimeSeries::from_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void)
{
  //std::cout << "Generating a time series on device "<< tim.get_nsamps() << std::endl;
  //DeviceTimeSeries<float> d_tim(8388608);
  //d_tim.set_tsamp(0.000064);
  TimeSeries<float> tim;
  tim.from_file("/lustre/home/ebarr/Soft/peasoup/tmp5.tim");
  DeviceTimeSeries<float> d_tim(tim);
  
  unsigned int size = d_tim.get_nsamps();
  
  TimeSeriesFolder folder(size);
  
  //DeviceTimeSeries<float> d_tim_r(fft_size); //<----for resampled data
  //TimeDomainResampler resampler;
  

  float* folded_buffer;
  cudaError_t error;
  cufftResult result;
  error = cudaMalloc((void**)&folded_buffer, sizeof(float)*size);
  ErrorChecker::check_cuda_error(error);


  unsigned nints = 64;
  unsigned nbins = 32;

  cufftComplex* fft_out;
  error = cudaMalloc((void**)&fft_out, sizeof(cufftComplex)*nints*nbins);
  cufftHandle plan;
  result = cufftPlan1d(&plan,nbins,CUFFT_R2C, nints);
  ErrorChecker::check_cufft_error(result);
  Stopwatch timer;

  FoldedSubints<float> folded_array(nbins,nints);
  //folder.fold(d_tim,folded_array,0.007453079228);

  std::cout << "made it here" << std::endl;
  

  FoldOptimiser optimiser(nbins,nints);
  timer.start();
  for (int ii=0;ii<1;ii++){
    //FoldedSubints<float> folded_array(nbins,nints);
    folder.fold(d_tim,folded_array,0.007453099228);
    Utils::dump_device_buffer<float>(folded_array.get_data(),nints*nbins,"original_fold.bin");
    
    optimiser.optimise(folded_array);
  }
  timer.stop();
  
  /*
  float* temp = new float [nints*nbins];
  
  cudaMemcpy(temp,folded_buffer,nints*nbins*sizeof(float),cudaMemcpyDeviceToHost);
  ErrorChecker::check_cuda_error();

  for (int ii=0;ii<nints*nbins;ii++)
    std::cout << temp[ii] << std::endl;
  */

  
  std::cout << "Total execution time (s): " << timer.getTime()<<std::endl;
  std::cout << "Average execution time (s): " << timer.getTime()/1000.0 << std::endl;



  return 0;
}
开发者ID:SixByNine,项目名称:Bifrost,代码行数:69,代码来源:folder_test.cpp


注:本文中的TimeSeries::from_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。