OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

How to specify source file when multiple files are used?

Seynhaeve__Dirk
Beginner
307 Views

I have multiple physical files (.cl) which I distribute over devices. This distribution is not fixed (which is why I don't bother combining the separate files into a single file.

I am combining the files into a program with the traditional:

    // Read Files
    for (i = 0; i < NUM_FILES; i++) {
        fp = fopen(file, "r");
        fseek(fp, 0, SEEK_END);
        src_size = ftell(fp);
        rewind(fp);
        src = (char*)malloc(src_size);
        fread(src, 1, src_size, fp);
        fclose(fp);
    }
    // Create Program
    program = clCreateProgramWithSource(context, NUM_FILES, (const char**)src, src_size, &err);

 

HOWEVER, to compile my program with the debugging option, I'm not sure how I can specify the same list of files? The -s option only seems to allow for ONE source file name:

// Build Program (for each device that will execute kernels from this program)
err = clBuildProgram(program, num_devices, devices, "-g -s \"???????\"', NULL, NULL);

How do I specify a list of files?

I know I can combine my source files into a single file, but logistically, that is not what I prefer.

 

0 Kudos
1 Reply
Yuri_K_Intel
Employee
307 Views
Hi, Sorry, but there is no way to specify several cl files currently. For debugging purposes (unded #ifdef _DEBUG probably) I propose creating a single temporary file which content should be passed to clCreateProgramWithSource function. This will ensure that no line mismatching occur. Thanks, Yuri
Reply