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


C++ clGetProgramInfo函数代码示例

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


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

示例1: wine_clGetProgramInfo

cl_int WINAPI wine_clGetProgramInfo(cl_program program, cl_program_info param_name,
                                    size_t param_value_size, void * param_value, size_t * param_value_size_ret)
{
    cl_int ret;
    TRACE("\n");
    ret = clGetProgramInfo(program, param_name, param_value_size, param_value, param_value_size_ret);
    return ret;
}
开发者ID:YongHaoWu,项目名称:wine-hub,代码行数:8,代码来源:opencl.c

示例2: printf

WebCLGetInfo WebCLProgram::getInfo(int param_name, ExceptionState& es) {
    cl_int err = 0;
    cl_uint uint_units = 0;
    char program_string[4096];
    RefPtr<WebCLContext> contextObj  = nullptr;
    RefPtr<WebCLDeviceList> deviceList =  nullptr;
    
    if (m_cl_program == NULL) {
        es.throwWebCLException(
                WebCLException::INVALID_PROGRAM,
                WebCLException::invalidProgramMessage);
        printf("Error: Invalid program object\n");
        return WebCLGetInfo();
    }

    switch(param_name) {   
        case WebCL::PROGRAM_NUM_DEVICES:
            err = clGetProgramInfo(m_cl_program, CL_PROGRAM_NUM_DEVICES, 
                                   sizeof(cl_uint), &uint_units, NULL);
            if (err == CL_SUCCESS)
                return WebCLGetInfo(static_cast<unsigned int>(uint_units));
            break;
        case WebCL::PROGRAM_SOURCE:
            err = clGetProgramInfo(m_cl_program, CL_PROGRAM_SOURCE, 
                                   sizeof(program_string), &program_string, 
                                   NULL);
            if (err == CL_SUCCESS)
                return WebCLGetInfo(String(program_string));
            break;
        case WebCL::PROGRAM_CONTEXT:
            return WebCLGetInfo(PassRefPtr<WebCLContext>(m_cl_context.get()));
            break;
        case WebCL::PROGRAM_DEVICES:
            return WebCLGetInfo(m_cl_context->getDevices());
            break;
        default:
            printf("Error: UNSUPPORTED program Info type = %d ",param_name);
            es.throwWebCLException(
                    WebCLException::INVALID_PROGRAM,
                    WebCLException::invalidProgramMessage);
            return WebCLGetInfo();
    }
    WebCLException::throwException(err, es);
    return WebCLGetInfo();
}
开发者ID:junmin-zhu,项目名称:blink,代码行数:45,代码来源:WebCLProgram.cpp

示例3: cl_printBinaries

	void cl_printBinaries(cl_program program) {

		cl_uint program_num_devices;

		clGetProgramInfo( program,
			CL_PROGRAM_NUM_DEVICES,
			sizeof(cl_uint),
			&program_num_devices,
			NULL
			);

		printf("Number of devices: %d\n", program_num_devices);

		//size_t binaries_sizes[program_num_devices];
		size_t * binaries_sizes = (size_t *)malloc(sizeof(size_t)*program_num_devices);

		clGetProgramInfo( program,
			CL_PROGRAM_BINARY_SIZES,
			program_num_devices*sizeof(size_t),
			binaries_sizes,
			NULL
			);

		char** binaries = (char**)malloc(sizeof(char*)*program_num_devices);

		for (unsigned int i = 0; i < program_num_devices; i++)
			binaries[i] = (char*)malloc(sizeof(char)*(binaries_sizes[i]+1));

		clGetProgramInfo(program, CL_PROGRAM_BINARIES, program_num_devices*sizeof(size_t), binaries, NULL);

		for (unsigned int i = 0; i < program_num_devices; i++)
		{
			binaries[i][binaries_sizes[i]] = '\0';

			printf("Program %d\n", i);
			printf("%s\n", binaries[i]);

		}


		for (unsigned int i = 0; i < program_num_devices; i++)
			free(binaries[i]);

		free(binaries);
	}
开发者ID:tofergregg,项目名称:OpenCLKernelScheduler,代码行数:45,代码来源:clutils.cpp

示例4: oclLogBinary

void oclLogBinary(cl_program clProg, cl_device_id clDev)
{
  // Grab the number of devices associated with the program
  cl_uint num_devices;
  clGetProgramInfo(clProg, CL_PROGRAM_NUM_DEVICES, sizeof(cl_uint), &num_devices, NULL);

  // Grab the device ids
  cl_device_id* devices = (cl_device_id*) malloc(num_devices * sizeof(cl_device_id));
  clGetProgramInfo(clProg, CL_PROGRAM_DEVICES, num_devices * sizeof(cl_device_id), devices, 0);

  // Grab the sizes of the binaries
  size_t* binary_sizes = (size_t*)malloc(num_devices * sizeof(size_t));
  clGetProgramInfo(clProg, CL_PROGRAM_BINARY_SIZES, num_devices * sizeof(size_t), binary_sizes, NULL);

  // Now get the binaries
  char** ptx_code = (char**)malloc(num_devices * sizeof(char*));
  for( unsigned int i=0; i<num_devices; ++i)
  {
    ptx_code[i] = (char*)malloc(binary_sizes[i]);
  }
  clGetProgramInfo(clProg, CL_PROGRAM_BINARIES, 0, ptx_code, NULL);

  // Find the index of the device of interest
  unsigned int idx = 0;
  while((idx < num_devices) && (devices[idx] != clDev))
  {
    ++idx;
  }

  // If the index is associated, log the result
  if( idx < num_devices )
  {
    MITK_INFO<< "\n ---------------- \n Program Binary: \n -----------------------\n";
    MITK_INFO<< ptx_code[idx];
  }

  free( devices );
  free( binary_sizes );
  for(unsigned int i=0; i<num_devices; ++i)
  {
    free(ptx_code[i]);
  }
  free( ptx_code );
}
开发者ID:151706061,项目名称:MITK,代码行数:44,代码来源:mitkOclUtils.cpp

示例5: cb

void cb(cl_program p,void* data)
{
    clRetainProgram(p);
    cl_device_id devid[1];
    clGetProgramInfo(p,CL_PROGRAM_DEVICES,sizeof(cl_device_id),(void*)devid,NULL);
    char bug[65536];
    clGetProgramBuildInfo(p,devid[0],CL_PROGRAM_BUILD_LOG,65536*sizeof(char),bug,NULL);
    clReleaseProgram(p);
    LOGE("Build log \n %s\n",bug);
}
开发者ID:khaled777b,项目名称:AndroidOpenCL-Filter,代码行数:10,代码来源:processor.cpp

示例6: programInfo

 bool programInfo(cl_program id, cl_program_info info, Value* buf, size_t length)
 {
     cl_int error = 0;
     if((error = clGetProgramInfo(id, info, 
             sizeof(Value) * length, buf, nullptr)) != CL_SUCCESS)
     {
         reportError("programInfo(): ", error);
         return false;
     }
     return true;
 }
开发者ID:k0zmo,项目名称:clw,代码行数:11,代码来源:Program.cpp

示例7: CL_CPP_CONDITIONAL_RETURN_FALSE

bool CL_Program::GetCompiledBinaries(cl_uchar** ppBinaryArrayOutput) const
{
	CL_CPP_CONDITIONAL_RETURN_FALSE(m_uNumDevices == 0);
	CL_CPP_CONDITIONAL_RETURN_FALSE(!ppBinaryArrayOutput);

	//	Dynamically retreive the compiled source buffers.
	cl_int iErrorCode = clGetProgramInfo(m_Program, CL_PROGRAM_BINARIES, 0, ppBinaryArrayOutput, NULL);

	CL_CPP_CATCH_ERROR(iErrorCode);
	CL_CPP_FORCE_RETURN_BOOL_BY_ERROR(iErrorCode);
}
开发者ID:brandonmbare,项目名称:CLcpp,代码行数:11,代码来源:CL_Program.cpp

示例8: save_binary

	bool save_binary(const string& clbin)
	{
		size_t size = 0;
		clGetProgramInfo(cpProgram, CL_PROGRAM_BINARY_SIZES, sizeof(size_t), &size, NULL);

		if(!size)
			return false;

		vector<uint8_t> binary(size);
		uint8_t *bytes = &binary[0];

		clGetProgramInfo(cpProgram, CL_PROGRAM_BINARIES, sizeof(uint8_t*), &bytes, NULL);

		if(!path_write_binary(clbin, binary)) {
			opencl_error(string_printf("OpenCL failed to write cached binary %s.", clbin.c_str()));
			return false;
		}

		return true;
	}
开发者ID:fabiosantoscode,项目名称:emcycles,代码行数:20,代码来源:device_opencl.cpp

示例9: pclu_dump_binary

void 
pclu_dump_binary(pclu_program* pgm, const char* path)
{
    int errcode;
    size_t bin_size;

    errcode = clGetProgramInfo(pgm->program, CL_PROGRAM_BINARY_SIZES,
            sizeof(size_t), &bin_size, 0);
    pclu_check_call("clGetProgramInfo(BIN_SIZE)", errcode);

    cl_uchar* binary = (cl_uchar*) malloc(bin_size);
    errcode = clGetProgramInfo(pgm->program, CL_PROGRAM_BINARIES, bin_size, &binary, 0);
    pclu_check_call("clGetProgramInfo(BINARIES)", errcode);

    FILE* bf = fopen(path, "w");
    fwrite((void*)binary, bin_size, 1, bf);
    fclose(bf);

    free(binary);
}
开发者ID:NatTuck,项目名称:cakemark,代码行数:20,代码来源:pclu.c

示例10: clGetProgramInfo

    void Program::getInfo(cl_program_info paramName, size_t paramValueSize, void *paramValue) const
    {
        cl_int err = 0;
        size_t written = 0;

        err = clGetProgramInfo(programHandle(), paramName, paramValueSize, paramValue, &written);

        if(err != CL_SUCCESS) {
            throw OpenCLException(err);
        }
    }
开发者ID:mvaldenegro,项目名称:Epic-Framework,代码行数:11,代码来源:Program.cpp

示例11: oclGetProgBinary

// ****************************************************************************
// Method:  oclGetProgBinary
//
// Purpose:
//   Get the binary (PTX) of the program associated with the device
//
// Arguments:
//       cpProgram    OpenCL program
//       cdDevice     device of interest
//       binary       returned code
//       length       length of returned code
//
// Copyright 1993-2013 NVIDIA Corporation
//
// ****************************************************************************
inline void
oclGetProgBinary (cl_program cpProgram, cl_device_id cdDevice, char** binary, size_t* length)
{
    // Grab the number of devices associated witht the program
    cl_uint num_devices;
    clGetProgramInfo(cpProgram, CL_PROGRAM_NUM_DEVICES, sizeof(cl_uint), &num_devices, NULL);

    // Grab the device ids
    cl_device_id* devices = (cl_device_id*) malloc(num_devices * sizeof(cl_device_id));
    clGetProgramInfo(cpProgram, CL_PROGRAM_DEVICES, num_devices * sizeof(cl_device_id), devices, 0);

    // Grab the sizes of the binaries
    size_t* binary_sizes = (size_t*)malloc(num_devices * sizeof(size_t));
    clGetProgramInfo(cpProgram, CL_PROGRAM_BINARY_SIZES, num_devices * sizeof(size_t), binary_sizes, NULL);

    // Now get the binaries
    char** ptx_code = (char**) malloc(num_devices * sizeof(char*));
    for( unsigned int i=0; i<num_devices; ++i) {
        ptx_code[i]= (char*)malloc(binary_sizes[i]);
    }
    clGetProgramInfo(cpProgram, CL_PROGRAM_BINARIES, 0, ptx_code, NULL);

    // Find the index of the device of interest
    unsigned int idx = 0;
    while( idx<num_devices && devices[idx] != cdDevice ) ++idx;

    // If it is associated prepare the result
    if( idx < num_devices )
    {
        *binary = ptx_code[idx];
        *length = binary_sizes[idx];
    }

    // Cleanup
    free( devices );
    free( binary_sizes );
    for( unsigned int i=0; i<num_devices; ++i) {
        if( i != idx ) free(ptx_code[i]);
    }
    free( ptx_code );
}
开发者ID:BuaaCompile,项目名称:Opencl-Benchmark,代码行数:56,代码来源:MathBasic.cpp

示例12: clGetProgramVersion

struct _cl_version clGetProgramVersion(cl_program program)
{
    struct _cl_version version;
    version.major = 0;
    version.minor = 0;
    cl_context context = NULL;
    cl_int flag =  clGetProgramInfo(program, CL_PROGRAM_CONTEXT,
                                    sizeof(cl_context), &context, NULL);
    if(flag != CL_SUCCESS)
        return version;
    return clGetContextVersion(context);
}
开发者ID:sanguinariojoe,项目名称:ocland,代码行数:12,代码来源:ocland_version.c

示例13: getProgramInfo

SEXP getProgramInfo(SEXP sProgram, SEXP sProgramInfo){
    Rcpp::XPtr<cl_program> program(sProgram);
    std::string programInfo = Rcpp::as<std::string>(sProgramInfo);
    char cBuffer[1024];
    
    if(programInfo == "CL_PROGRAM_SOURCE"){
        std::cout << "get Program source\n";
        clGetProgramInfo(*program, CL_PROGRAM_SOURCE,	sizeof(cBuffer), cBuffer, NULL);
    }
    std::string retVal = cBuffer;
    return Rcpp::wrap(retVal);
}
开发者ID:RyanHope,项目名称:ROpenCL,代码行数:12,代码来源:createContext.cpp

示例14: CL_CPP_CONDITIONAL_RETURN_VALUE

cl_uint CL_Program::GetReferenceCount() const
{
	CL_CPP_CONDITIONAL_RETURN_VALUE(!m_Program, 0);

	//	Dynamically retrieve the current reference count for this kernel.
	cl_uint uRefCount = 0;
	cl_int iErrorCode = clGetProgramInfo(m_Program, CL_PROGRAM_REFERENCE_COUNT, sizeof(cl_uint), &uRefCount, NULL);

	CL_CPP_CATCH_ERROR(iErrorCode);

	return uRefCount;
}
开发者ID:brandonmbare,项目名称:CLcpp,代码行数:12,代码来源:CL_Program.cpp

示例15: create_kernel

static cl_kernel
create_kernel (UfoResourcesPrivate *priv,
               cl_program program,
               const gchar *kernel_name,
               GError **error)
{
    cl_kernel kernel;
    gchar *name;
    cl_int errcode = CL_SUCCESS;

    if (kernel_name == NULL) {
        gchar *source;
        gsize size;

        UFO_RESOURCES_CHECK_CLERR (clGetProgramInfo (program, CL_PROGRAM_SOURCE, 0, NULL, &size));
        source = g_malloc0 (size);
        UFO_RESOURCES_CHECK_CLERR (clGetProgramInfo (program, CL_PROGRAM_SOURCE, size, source, NULL));
        name = get_first_kernel_name (source);
        g_free (source);
    }
    else {
        name = g_strdup (kernel_name);
    }

    kernel = clCreateKernel (program, name, &errcode);
    g_free (name);

    if (kernel == NULL || errcode != CL_SUCCESS) {
        g_set_error (error,
                     UFO_RESOURCES_ERROR,
                     UFO_RESOURCES_ERROR_CREATE_KERNEL,
                     "Failed to create kernel `%s`: %s", kernel_name, ufo_resources_clerr (errcode));
        return NULL;
    }

    priv->kernels = g_list_append (priv->kernels, kernel);
    return kernel;
}
开发者ID:Dynalon,项目名称:ufo-core,代码行数:38,代码来源:ufo-resources.c


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