error code (-11) :: ¿cuáles son todas las posibles razones para obtener el error "cl_build_program_failure" en OpenCL?
Estoy usando la tarjeta gráfica ATI RV770, OpenCl 1.0 y ati-stream-sdk-v2.3-lnx64 en Linux.
Mientras ejecuto mi código de host que incluye las siguientes dos secciones para compilar el programa del núcleo, obtengo un código de error (-11), es decir,cl_build_program_failure
. ¿Significa que se compiló el programa del kernel? Si no, ¿cómo se compila y se depura?
const char* KernelPath = "abc_kernel.cl"; //kernel program is in separate file but in same directory of host code..
/* Crear objeto de programa desde la fuente del núcleo* *** ***/
char* sProgramSource = readKernelSource(KernelPath);
size_t sourceSize = strlen(sProgramSource) ;
program = clCreateProgramWithSource(context, 1,(const char **) &sProgramSource,&sourceSize, &err);
checkStatus("error while creating program",err);
/* Programa Build (compilar y vincular)* *** ***/
char* options = (char* )malloc(10*sizeof(char));
strcpy(options, "-g");
err = clBuildProgram(program, num_devices, devices_id, options, NULL, NULL);
checkStatus("Build Program Failed", err); //This line throwing the error....
a función @ para leer el programa del núcleo es la siguiente ::
/ * leer el archivo fuente del programa * /
char* readKernelSource(const char* kernelSourcePath){
FILE *fp = NULL;
size_t sourceLength;
char *sourceString ;
fp = fopen( kernelSourcePath , "r");
if(fp == 0)
{
printf("failed to open file");
return NULL;
}
// get the length of the source code
fseek(fp, 0, SEEK_END);
sourceLength = ftell(fp);
rewind(fp);
// allocate a buffer for the source code string and read it in
sourceString = (char *)malloc( sourceLength + 1);
if( fread( sourceString, 1, sourceLength, fp) !=sourceLength )
{
printf("\n\t Error : Fail to read file ");
return 0;
}
sourceString[sourceLength+1]='\0';
fclose(fp);
return sourceString;
} // fin de readKernelSource
¿Alguien puede decir cómo solucionarlo?
¿Significa que es un error de compilación de OpenCl en tiempo de ejecución o algo más?
// Imprimir información de build_log usando clGetProgramBuildInfo () como se muestra a continuación, pero ¿por qué no se imprime nada?
char * build_log; size_t log_size;
// First call to know the proper size
err = clGetProgramBuildInfo(program, devices_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
build_log = (char* )malloc((log_size+1));
// Second call to get the log
err = clGetProgramBuildInfo(program, devices_id, CL_PROGRAM_BUILD_LOG, log_size, build_log, NULL);
build_log[log_size] = '\0';
printf("--- Build log ---\n ");
fprintf(stderr, "%s\n", build_log);
free(build_log);