cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

endoerner
Adept I

cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Hi to everyone,

I have a very weird problem with an OpenCL project under VS2012 only when a use a PC with the AMD APP SDK.

It is a main .cl file that includes some source .cl files (specifically a RNG for GPU), the console message is as follows:

Platform[0]: AMD Accelerated Parallel Processing

Chosen Platform:0

Device[0]: Tahiti

Device[1]: Tahiti

Device[2]: AMD Phenom(tm) II X6 1100T Processor

Chosen Device:0

clBuildProgram: Error code -11

Build log: "C:\Users\EDGARD~1\AppData\Local\Temp\OCLB474.tmp.cl", line 1: catast

rophic error:

          cannot open source file "mwc64x_rng.cl"

  #include "mwc64x_rng.cl"

                          ^

1 catastrophic error detected in the compilation of "C:\Users\EDGARD~1\AppData\L

ocal\Temp\OCLB474.tmp.cl".

Compilation terminated.

Frontend phase failed compilation.

clCreateKernel: Error code -46

Press any key to continue . . .

The strange thing is that under a second PC with the Intel OpenCL SDK, under VS2012, the error does not appear and the

Kernel compiles and executes without problems. I attached the codes. Thanks for your help!

Tags (2)
0 Kudos
Reply
1 Solution

Accepted Solutions
gopal
Staff
Staff

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Hi,

Try changing the compiler option with -I when calling clBuildProgram() function.

clBuildProgram() allows you to specify compiler options which include the include file directories. In your case, for cl files directory, it will be something like the string:

-I myKernelSourceDir1 -I myKernelSourceDir2 ...

Please update us back, if you still see the same behavior.

The other alternative is to use clLinkProgram from OpenCL 1.2.

1. First create separate program objects from separate source files using clCreateProgramWithSource.

2. Then build the program separately using clBuildProgram.

3. After building, link these program objects using clLinkProgram.

4. Now this final Program object could be used to create OpenCL kernels.

Thanks

View solution in original post

0 Kudos
Reply
8 Replies
gopal
Staff
Staff

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Hi,

Try changing the compiler option with -I when calling clBuildProgram() function.

clBuildProgram() allows you to specify compiler options which include the include file directories. In your case, for cl files directory, it will be something like the string:

-I myKernelSourceDir1 -I myKernelSourceDir2 ...

Please update us back, if you still see the same behavior.

The other alternative is to use clLinkProgram from OpenCL 1.2.

1. First create separate program objects from separate source files using clCreateProgramWithSource.

2. Then build the program separately using clBuildProgram.

3. After building, link these program objects using clLinkProgram.

4. Now this final Program object could be used to create OpenCL kernels.

Thanks

View solution in original post

0 Kudos
Reply
endoerner
Adept I

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Thanks for the info!, I will try and give an update...

must be absolute paths? (like C:\Users\Documents\blah blah)

the alternative of clLinkProgram looks also interesting, I will also give it a try

0 Kudos
Reply
gopal
Staff
Staff

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Hi,

@must be absolute paths? (like C:\Users\Documents\blah blah)

As per the opencl specification, see the preprocessor options from clBuildProgram link, it is not mentioned that the directory to be search should be absolute or relative one, so i think it could be either absolute or relative.

I have tried with absolute path and it worked for me. You can try relative path say for example "-I ./" option, it will also work.

Thanks,

0 Kudos
Reply
nou
Exemplar

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

well beware that relative paths depends on what actual working directory is. that mean -I./ can be different directory than where is executable.

0 Kudos
Reply
gopal
Staff
Staff

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Hi nou,

Thanks for pointing it out.

I assumed that kernel source files to be included are in same directory where is executable. If it is not the case then one must use absolute path.

0 Kudos
Reply
endoerner
Adept I

Re: Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

Ok, I tried including the directory were the .cl files are and now I obtain a LLVM Error (!?), this:

Platform[0]: AMD Accelerated Parallel Processing

Chosen Platform:0

Device[0]: Tahiti

Device[1]: Tahiti

Device[2]: AMD Phenom(tm) II X6 1100T Processor

Chosen Device:0

LLVM ERROR: Cannot select: 0x66d4d0: i32 = setcc 0x66d008, 0x66cbc8, 0x66d910 [I

D=18]

  0x66d008: i64 = add 0x66cbc8, 0x66ce70 [ORD=13] [ID=14]

    0x66cbc8: i64,ch = CopyFromReg 0x706730, 0x66d338 [ORD=13] [ID=12]

      0x66d338: i64 = Register %vreg25 [ORD=13] [ID=1]

    0x66ce70: i64,ch = CopyFromReg 0x706730, 0x66d2b0 [ORD=13] [ID=13]

      0x66d2b0: i64 = Register %vreg27 [ORD=13] [ID=2]

  0x66cbc8: i64,ch = CopyFromReg 0x706730, 0x66d338 [ORD=13] [ID=12]

    0x66d338: i64 = Register %vreg25 [ORD=13] [ID=1]

Press any key to continue . . .

Is the following the correct way of including the directory in the build?

program.build(ctxDevices, "-I D:\\Programming\\OpenCL\\mwc64x\\mwc64x");

thanks for your help!

0 Kudos
Reply
gopal
Staff
Staff

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

@ Is the following the correct way of including the directory in the build?

There is no issue with the way you are including the .cl files, it will work. And I don't think there is any issue with your kernel code since the front-end compilation has passed. This issue is related to backend compiler which fails while linking all your .cl files.

Try the same with device type as CPU and see whats happen?

0 Kudos
Reply
endoerner
Adept I

Re: cannot open source file on .cl file only with AMD APP SDK under VS2012

Jump to solution

dear ratul,

I found this old thread in the forum with the same LLVM problem

LLVM error when compiling kernel

ufff... it seems that it is a conflict between the AMD SDK and this RNG... so bad... with Intel SDK and a Nvidia card I have no problems... it seems that I will have to downgrade the SDK version to 2.8... bad luck...

At this moment I do not have access to the PC (it is at my office in my University), so I will have to wait until Monday to test the program with the CPU...  I really appreciate your help!... and I hope that this conflict gets solved in the future...

EDIT : as you say, I tried to execute the kernel with the CPU and everything worked flawlessly...

0 Kudos
Reply