• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CHK_ERR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CHK_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ CHK_ERR函数的具体用法?C++ CHK_ERR怎么用?C++ CHK_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: initialize_ocl

void initialize_ocl(cl_vars_t& cv)
{
  cv.err = clGetPlatformIDs(1, &(cv.platform), &(cv.platforms));
  CHK_ERR(cv.err);

  cv.err = clGetDeviceIDs(cv.platform, CL_DEVICE_TYPE_GPU, 1, &(cv.device_id), NULL);
  CHK_ERR(cv.err);

  cv.context = clCreateContext(0, 1, &(cv.device_id), NULL, NULL, &(cv.err));
  CHK_ERR(cv.err);

  cv.commands = clCreateCommandQueue(cv.context, cv.device_id, 
				     CL_QUEUE_PROFILING_ENABLE, &(cv.err));
  CHK_ERR(cv.err);


#ifdef DEBUG
  std::cout << "CL fill vars success" << std::endl;

  // Device info
  cl_ulong mem_size;
  cv.err = clGetDeviceInfo(cv.device_id, CL_DEVICE_GLOBAL_MEM_SIZE, 
			   sizeof(cl_ulong), &mem_size, NULL);

  std::cout << "Global mem size: " << mem_size << std::endl;

  size_t max_work_item[3];
  cv.err = clGetDeviceInfo(cv.device_id, CL_DEVICE_MAX_WORK_ITEM_SIZES, 
			   sizeof(max_work_item), max_work_item, NULL);

  std::cout << "Max work item sizes: " 
	    << max_work_item[0] << ", " 
	    << max_work_item[1] << ", " 
	    << max_work_item[2] 
	    << std::endl;
#endif
}
开发者ID:AtonDev,项目名称:cs194,代码行数:37,代码来源:clhelp.cpp


示例2: objdet_input_alloc

/* ...buffer allocation from frontal camera (object detection engine) */
static int objdet_input_alloc(void *data, GstBuffer *buffer)
{
    app_data_t         *app = data;
    vsink_meta_t       *vmeta = gst_buffer_get_vsink_meta(buffer);
    int                 w = vmeta->width, h = vmeta->height;
    objdet_meta_t      *ometa;

    if (app->f_width)
    {
        /* ...verify buffer dimensions are valid */
        CHK_ERR(w == app->f_width && h == app->f_height, -EINVAL);
    }
    else
    {
        int     W = window_get_width(app->window);
        int     H = window_get_height(app->window);

        /* ...check dimensions are valid */
        CHK_ERR(w && h, -EINVAL);

        /* ...set buffer dimensions */
        app->f_width = w, app->f_height = h;

        /* ...initialize object detection engine */
        CHK_ERR(app->od = objdet_engine_init(&objdet_callback, app, w, h, __pixfmt_yuv_bpp(vmeta->format), app->od_cfg), -errno);

        /* ...create a viewport for data visualization */
        texture_scale_to_window(&app->view, app->window, w, h, &app->matrix);
        
        //texture_set_view_scale(&app->view, 0, 0, W, H, W, H, w, h);


        /* ...create transformation matrix */
        if (0)
        {
            cairo_matrix_t     *m = &app->matrix;
            
            m->xx = (double) W / w, m->xy = 0, m->x0 = 0;
            m->yx = 0, m->yy = (double) H / h, m->y0 = 0;
        }        
    }

    /* ...allocate texture to wrap the buffer */
    CHK_ERR(vmeta->priv = texture_create(w, h, vmeta->plane, vmeta->format), -errno);

    /* ...add custom buffer metadata */
    CHK_ERR(ometa = gst_buffer_add_objdet_meta(buffer), -(errno = ENOMEM));
    CHK_ERR(ometa->buf = texture_map(vmeta->priv, CL_MEM_READ_ONLY), -errno);
    GST_META_FLAG_SET(ometa, GST_META_FLAG_POOLED);

    /* ...add custom destructor to the buffer */
    gst_mini_object_weak_ref(GST_MINI_OBJECT(buffer), __destroy_od_texture, app);

    TRACE(INFO, _b("front-camera input buffer %p allocated (%p)"), buffer, ometa->buf);

    return 0;
}
开发者ID:CogentEmbedded,项目名称:utest-adas,代码行数:58,代码来源:utest-sv.c


示例3: clEnqueueWriteBuffer

void ArrayOperand::callUp(cl_vars_t clv)
{
  Array * v = dynamic_cast<Array*>(variable);
  // For each device

  for(int devId = 0 ; devId < partition.nd ; devId++)
  {
    ssize_t device_min = 0;
    ssize_t device_max = 0;
    if(partition.d == 0)
    {
      device_min = 0;
      device_max = v->getDim();
    }
    else
    {
      device_min = partition.d * devId;
      device_max = partition.d * (devId+1);
      device_max = (device_max > v->getDim()) ? v->getDim() : device_max;
    }
    ssize_t device_range = device_max - device_min;
    ssize_t bytes_range = device_range * v->bytes_per_element;
    ssize_t bytes_offset = device_min * v->bytes_per_element;

    if(bytes_range > 0)
    {
#ifdef VERBOSE_EXECUTION
      docs.execution_ss << "TRANSFER: Calling up variable: " << variable->properties["name"];
      docs.execution_ss << "\tnbytes: " << bytes_range;
      docs.execution_ss << "\tbytes_offset: " << bytes_offset;
      docs.execution_ss << "\tdevice id: " << devId << std::endl;
#endif
      cl_int err = CL_SUCCESS;

#ifdef PROFILE
      transfer_prof_t tp;
      tp.devId = devId;
      tp.variable = variable;
      err = clEnqueueWriteBuffer(clv.commands[devId], v->gpu_data[devId], CL_FALSE, 
          		  bytes_offset, bytes_range, v->cpu_data + bytes_offset, 0, NULL, &(tp.event));
      transfer_events.push_back(tp);
#else
      err = clEnqueueWriteBuffer(clv.commands[devId], v->gpu_data[devId], CL_FALSE, 
          		  bytes_offset, bytes_range, v->cpu_data + bytes_offset, 0, NULL, NULL);
#endif
      CHK_ERR(err);
    }
  }
}
开发者ID:chick,项目名称:hindemith,代码行数:49,代码来源:Array.cpp


示例4: PowerMeter_RecallState_ByName

void* DLLEXPORT PowerMeter_RecallState_ByName( int hInstrumentHandle , char *pszName ) 
{
	STD_ERROR					StdError					=	{0};
	
	int							iStateNumber				=	0;
	
	if ( pszName )
		iStateNumber = atoi( pszName );
	
	CHK_ERR(  age441x_loadFromRegister( hInstrumentHandle , iStateNumber ));  
	
Error:	
	
	RETURN_STDERR_POINTER;
}
开发者ID:ialexyi,项目名称:ATE,代码行数:15,代码来源:AgilentPowerMeter_441X.c


示例5: PowerMeter_FetchPower

void* DLLEXPORT PowerMeter_FetchPower( int hInstrumentHandle , int iChannel , double timeout , double *value )
{
	STD_ERROR					StdError					=	{0};
	
	double			 			lfPower						=	0;
	
	CHK_ERR(  age441x_fetch ( hInstrumentHandle , 1 , AGE441X_MEAS_SINGLE , &lfPower ));
	
	if ( value )
		*value = lfPower;
		
Error:	
	
	RETURN_STDERR_POINTER;
}
开发者ID:ialexyi,项目名称:ATE,代码行数:15,代码来源:AgilentPowerMeter_441X.c


示例6: SpectrumAnalyzer_PhaseNoise_GetMarker

void* DLLEXPORT SpectrumAnalyzer_PhaseNoise_GetMarker ( ViSession viInstrumentHandle , int channel , int marker , double *pPosition , double *pValue )
{
	STD_ERROR               StdError                    =   {0};     
	
	double					lfFrequency					=	0.0,
							lfPower						=	0.0;
	
	CHK_ERR( hp8563e_confMkr( viInstrumentHandle , VI_ON , VI_OFF ));
		
	CHK_ERR( hp8563e_perfmSwp ( viInstrumentHandle ));
	
	CHK_ERR( hp8563e_queryAmpl( viInstrumentHandle , 0 , &lfPower )); 
	CHK_ERR( hp8563e_queryFreq( viInstrumentHandle , 1 , &lfFrequency )); 

	if ( pPosition )
		*pPosition = lfFrequency;
	
	if ( pValue )
		*pValue = lfPower;
	
Error: 
	
	RETURN_STDERR_POINTER;
}
开发者ID:ialexyi,项目名称:ATE,代码行数:24,代码来源:HP_856e_Spectrum_Wrapper.c


示例7: setGlobalOffsets

    int setGlobalOffsets()
      {
        //only set the global offsets once.
        if (setGlobalOffsets_) return(0);

        if (matrixGraph_.get() == NULL) return(-1);

        MPI_Comm comm = matrixGraph_->getRowSpace()->getCommunicator();
        int num_procs = fei::numProcs(comm);
        int local_proc = fei::localProc(comm);

        std::vector<int> globalOffsets;
        std::vector<int> globalBlkOffsets;

        if (reducer_.get() != NULL) {
          int localsize = reducer_->getLocalReducedEqns().size();
          numLocalEqns_ = localsize;
          std::vector<int> lsizes(num_procs, 0);
          std::vector<int> gsizes(num_procs, 0);
          lsizes[local_proc] = localsize;
          fei::GlobalMax(comm, lsizes, gsizes);
          globalOffsets.resize(num_procs+1);
          int offset = 0;
          for(int p=0; p<num_procs; ++p) {
            globalOffsets[p] = offset;
            offset += gsizes[p];
          }
          globalOffsets[num_procs] = offset;
          globalBlkOffsets = globalOffsets;
        }
        else {
          fei::SharedPtr<fei::VectorSpace> vecSpace = 
            matrixGraph_->getRowSpace();

          vecSpace->getGlobalIndexOffsets(globalOffsets);
          vecSpace->getGlobalBlkIndexOffsets(globalBlkOffsets);

          numLocalEqns_ = globalOffsets[local_proc+1]-globalOffsets[local_proc];
        }

        CHK_ERR(linsyscore_->setGlobalOffsets(num_procs+1,
                                              &globalBlkOffsets[0],
                                              &globalOffsets[0],
                                              &globalBlkOffsets[0]));

        setGlobalOffsets_ = true;
        return(0);
      }
开发者ID:00liujj,项目名称:trilinos,代码行数:48,代码来源:snl_fei_Broker_LinSysCore.hpp


示例8: SpectrumAnalyzer_GetErrorTextMessage

void* DLLEXPORT SpectrumAnalyzer_GetErrorTextMessage ( ViSession vhInstrumentHandle , int iError , char *pErrorMessage )
{
	STD_ERROR				StdError					=	{0};    

	FREE_CALLOC( StdError.pszErrorDescription , STD_STRING , sizeof(char*));
				
	if ( StdError.pszErrorDescription )
		
	{
		CHK_ERR( hp8563e_errorMessage ( vhInstrumentHandle , iError ,(char*)StdError.pszErrorDescription ));
	}
	
Error: 
	
	RETURN_STDERR_POINTER;
}
开发者ID:ialexyi,项目名称:ATE,代码行数:16,代码来源:HP_856e_Spectrum_Wrapper.c


示例9: return

//----------------------------------------------------------------------------
int snl_fei::LinearSystem_General::setBCValuesOnVector(fei::Vector* vector)
{
  if (essBCvalues_ == NULL) {
    return(0);
  }

  if (essBCvalues_->size() == 0) {
    return(0);
  }

  CHK_ERR( vector->copyIn(essBCvalues_->size(),
			  &(essBCvalues_->indices())[0],
			  &(essBCvalues_->coefs())[0]) );

  return(0);
}
开发者ID:cakeisalie,项目名称:oomphlib_003,代码行数:17,代码来源:snl_fei_LinearSystem_General.cpp


示例10: ckOpLimitRule_CreateSliding

ckError ckOpLimitRule_CreateSliding(ckOpLimitRule** ruleOut, int allowed, ckTime window, ckBool wait)
{
    ckError err = cke_General;
    
    CHK_ERR( allocRule(ruleOut) );

    (*ruleOut)->allowedCount = allowed;
    (*ruleOut)->waitForSuccess = wait;

    (*ruleOut)->type = olrt_SlidingWindow;
    (*ruleOut)->data.sliding.window = window;
    
    err = cke_Success;
    
error:
    return err;
}
开发者ID:tomseago,项目名称:chokus,代码行数:17,代码来源:ck_ops.c


示例11: MYMAX

void Array::allocate(cl_vars_t clv)
{
  size_t dim0 = MYMAX(get_property_int("dim0"), 1);
  size_t dim1 = MYMAX(get_property_int("dim1"), 1);
  bytes_per_element = get_num_bytes(properties["dtype"]);
  nbytes = dim0 * dim1 * bytes_per_element;
#ifdef VERBOSE_COMPILATION
  docs.compilation_ss << "Allocating: " << nbytes << "\tFor array: " << properties["name"] << std::endl; 
#endif
  cpu_data = (char *) calloc(nbytes, sizeof(char));
  for(int i = 0 ; i < clv.num_devices ; i++)
  {
    cl_int err;
    gpu_data[i] = clCreateBuffer(clv.context, CL_MEM_READ_WRITE, nbytes, NULL, &err);
    CHK_ERR(err);
  }
}
开发者ID:chick,项目名称:hindemith,代码行数:17,代码来源:Array.cpp


示例12: FEI_OFSTREAM

int fei::Vector_core::writeToFile(const char* filename,
                                    bool matrixMarketFormat)
{
  int numProcs = fei::numProcs(comm_);
  int localProc =fei::localProc(comm_);

  double coef;

  static char mmbanner[] = "%%MatrixMarket matrix array real general";

  for(int p=0; p<numProcs; ++p) {
    fei::Barrier(comm_);
    if (p != localProc) continue;

    FEI_OFSTREAM* outFile = NULL;
    if (p==0) {
      outFile = new FEI_OFSTREAM(filename, IOS_OUT);
      FEI_OFSTREAM& ofref = *outFile;
      if (matrixMarketFormat) {
        ofref << mmbanner << FEI_ENDL;
        ofref << eqnComm_->getGlobalOffsets()[numProcs] << " 1" << FEI_ENDL;
      }
      else {
        ofref << eqnComm_->getGlobalOffsets()[numProcs] << FEI_ENDL;
      }
    }
    else outFile = new FEI_OFSTREAM(filename, IOS_APP);
    FEI_OFSTREAM& ofref = *outFile;
    ofref.setf(IOS_SCIENTIFIC, IOS_FLOATFIELD);
    ofref.precision(13);

    for(int i=firstLocalOffset_; i<=lastLocalOffset_; ++i) {
      CHK_ERR( copyOut(1, &i, &coef) );
      if (matrixMarketFormat) {
        ofref << " " << coef << FEI_ENDL;
      }
      else {
        ofref << i << " " << coef << FEI_ENDL;
      }
    }
    
    delete outFile;
  } 
    
  return(0);
}
开发者ID:haripandey,项目名称:trilinos,代码行数:46,代码来源:fei_Vector_core.cpp


示例13: load_BC_data

//==============================================================================
int load_BC_data(FEI* fei, PoissonData& poissonData)
{
  //first, have the data object generate the BC data
  poissonData.calculateBCs();

  int numBCNodes = poissonData.getNumBCNodes();
  GlobalID* nodeIDs = poissonData.getBCNodeIDs();
  int fieldID = poissonData.getBCFieldID();
  double* values = poissonData.getBCValues();

  std::vector<int> offsets(numBCNodes, 0);

  CHK_ERR( fei->loadNodeBCs(numBCNodes, nodeIDs, fieldID,
			    &offsets[0], values) );

  return(0);
}
开发者ID:cakeisalie,项目名称:oomphlib_003,代码行数:18,代码来源:PoissonData.cpp


示例14: CHK_ERR

int
DirichletBCManager::finalizeBCEqns(EqnBuffer& bcEqns)
{
  //copy the boundary-condition prescribed values into bcEqns.

  bc_map::iterator iter = bcs_.begin(), iter_end = bcs_.end();

  for(; iter!=iter_end; ++iter) {
    int eqn = iter->first;
    double coef = iter->second;

    CHK_ERR( bcEqns.addEqn(eqn, &coef, &eqn, 1, false) );
  }

  bcs_.clear();
  return(0);
}
开发者ID:00liujj,项目名称:trilinos,代码行数:17,代码来源:fei_DirichletBCManager.cpp


示例15: ckOpLimitRule_CreateBucket

ckError ckOpLimitRule_CreateBucket(ckOpLimitRule** ruleOut, int allowed, ckTime length, ckTime epoch, ckBool wait)
{
    ckError err = cke_General;
    
    CHK_ERR( allocRule(ruleOut) );
    
    (*ruleOut)->allowedCount = allowed;
    (*ruleOut)->waitForSuccess = wait;
    
    (*ruleOut)->type = olrt_Buckets;
    (*ruleOut)->data.bucket.length = length;
    (*ruleOut)->data.bucket.epoch = epoch;
    
    err = cke_Success;
    
error:
    return err;
}
开发者ID:tomseago,项目名称:chokus,代码行数:18,代码来源:ck_ops.c


示例16: PowerMeter_FetchPower

void* DLLEXPORT PowerMeter_FetchPower( int hInstrumentHandle , int iChannel , double timeout , double *value )
{
	errEV					ret					=	{0};
	errEV					*pRet				=	NULL;
	
	double			 		lfPower				=	0;
	
	CHK_ERR(  age441x_fetch ( hInstrumentHandle , 2 , AGE441X_MEAS_SINGLE , &lfPower ));
	
	if ( value )
		*value = lfPower;
		
Error:	
	
	CALLOC_COPY(pRet,1,sizeof(errEV),&ret,sizeof(errEV));
	
	return ((void*)pRet);
}
开发者ID:ialexyi,项目名称:ATE,代码行数:18,代码来源:AgilentPowerMeter_E4417A.c


示例17: ERReturn

//------------------------------------------------------------------------------
int NodeCommMgr::getSendMessage(int destProc, std::vector<int>& message)
{
  std::vector<int>::iterator
   rs_iter = std::lower_bound(remoteSharingProcs_.begin(),
                              remoteSharingProcs_.end(), destProc);
  if (rs_iter == remoteSharingProcs_.end() || destProc != *rs_iter) {
    ERReturn(-1);
  }

  int idx = rs_iter - remoteSharingProcs_.begin();
  int len = 0;
  CHK_ERR( getSendMessageLength(destProc, len) );
  message.resize(len);

  packLocalNodesAndData(&message[0], destProc,
			nodesPerSharingProc_[idx], len);
  return(0);
}
开发者ID:00liujj,项目名称:trilinos,代码行数:19,代码来源:fei_NodeCommMgr.cpp


示例18: CHK_ERR

int test_Algebraic::runtests()
{
  if (numProcs_ < 2) {
    CHK_ERR( serialtest1() );
    CHK_ERR( serialtest2() );
  }

  CHK_ERR( test1() );
  CHK_ERR( test2() );
  CHK_ERR( test3() );
  CHK_ERR( test4() );
  return(0);
}
开发者ID:cakeisalie,项目名称:oomphlib_003,代码行数:13,代码来源:test_Algebraic.cpp


示例19: runKernel

void runKernel(cl_vars_t cv,
            cl_kernel cl_kern,
            kernel kern,
            std::map<std::string, cl_mem_data> gpu_data,
            double* vars)
{
    int num_arrays = kern.num_arrays;
    string* arrays = kern.arrays;
    int num_vars = kern.num_vars;

    cl_int err = CL_SUCCESS;
    //set up the out array
    err = clSetKernelArg(cl_kern, 0, sizeof(cl_mem), &(gpu_data["out"].array));
    CHK_ERR(err);
    err = clSetKernelArg(cl_kern, 0 + num_arrays, sizeof(int), &(gpu_data["out"].len));
    CHK_ERR(err);
 
    for (int i = 1; i < num_arrays; i++)
    {
        std::string array_name = arrays[i];
        err = clSetKernelArg(cl_kern, i, sizeof(cl_mem), &(gpu_data[array_name].array));
        CHK_ERR(err);
        err = clSetKernelArg(cl_kern, i + num_arrays, sizeof(int), &(gpu_data[array_name].len));
        CHK_ERR(err);
    }

    for (int i = 0; i < num_vars; i++)
    {
        err = clSetKernelArg(cl_kern, i + 2*num_arrays, sizeof(double), &(vars[i]));
        CHK_ERR(err); 
    }
    size_t global_work_size[1] = {gpu_data[arrays[0]].len};
    size_t local_work_size[1] = {256};
 
    adjustWorkSize(global_work_size[0], local_work_size[0]);//pad work groups
    global_work_size[0] = std::max(local_work_size[0], global_work_size[0]);

    err = clEnqueueNDRangeKernel(cv.commands,
                                 cl_kern,
                                 1,
                                 NULL,
                                 global_work_size,
                                 local_work_size,
                                 0,
                                 NULL,
                                 NULL
                                );
    CHK_ERR(err);

}
开发者ID:jasclark,项目名称:indicator_optimizer,代码行数:50,代码来源:opencl_setup.cpp


示例20: CHK_ERR

int test_MatrixGraph::runtests()
{
  if (numProcs_ < 2) {
    CHK_ERR( serialtest1() );
  }

  CHK_ERR( test1() );
  CHK_ERR( test2() );
  CHK_ERR( test3() );
  CHK_ERR( test4() );
  CHK_ERR( test5() );

  CHK_ERR( test_MatrixGraph_test6(comm_, numProcs_, localProc_, path_) );

  test_MatrixGraph_test7(comm_, numProcs_, localProc_);
  test_MatrixGraph_test8(comm_, numProcs_, localProc_);

  return(0);
}
开发者ID:cakeisalie,项目名称:oomphlib_003,代码行数:19,代码来源:test_MatrixGraph.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CHK_ORET函数代码示例发布时间:2022-05-30
下一篇:
C++ CHKERRQ函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap