Open bwh10 opened 9 years ago
I tried compiling test_Opencl.cpp on Cygwin but to no avail as well. The problem is somehow linked to CL\cl.hpp and it gives the following error:
mkdir -p bin
g++ -I include -Wall -std=c++11 -O2 -I /cygdrive/c/Users/Bryan/Dropbox/School/EE4_HPC/hpce-2014-cw4/opencl_sdk/include test_opencl.cpp -o bin/test_opencl -L /cygdrive/c/Users/Bryan/Dropbox/School/EE4_HPC/hpce-2014-cw4/opencl_sdk/lib/cygwin/x86_64 -lOpenCL
In file included from test_opencl.cpp:19:0:
/cygdrive/c/Users/Bryan/Dropbox/School/EE4_HPC/hpce-2014-cw4/opencl_sdk/include/CL/cl.hpp: In member function ‘clint cl::CommandQueue::enqueueNativeKernel(void ()(void), std::pair<void*, unsigned int>, const std::vectorcl::Memory, const std::vector
Any ideas on how to fix this?
After spending 2 days fiddling around with this issue, I finally managed to compile the test_opencl code under Cygwin. The problem was that I was using a 32 bit version rather than the 64 bit version of Cygwin. Apparently, using the 32 bit Cygwin does not work even though I linked it to the 32 bit OpenCL library. This is a very strange problem indeed! However, when I ran test_opencl.exe on my home laptop, it gave:
$ ./test_opencl Segmentation fault (core dumped)
Could it be because I do not have the appropriate OpenCL drivers installed on my home Windows 7 laptop?
Hrmm, my sympathies - the OpenCL stuff should be somewhat easier to compile than the TBB stuff.
Going through the things you tried:
CL/cl.h
, I don't
see why it wouldn't be able to find CL/cl_platform.h
. The opencl_sdk\include
directory
looks fine to me.extern "C"
and the other is not. But that should not be causing a
problem, as this is all using standard OpenCL headers. Sorry, no idea again./cygdrive/c/Users/Bryan/Dropbox/School/EE4_HPC/hpce-2014-cw4/opencl_sdk/include/CL/cl.hpp:2996:34: error: invalid conversion from ‘void ()(void)’ to ‘void (attribute((stdcall)) *)(void)’ -fpermissive event),
so the stdcall
part is complaining about the calling convention, saying that the way they
pass function arguments is different.
I'm beginning to suspect that there is something wrong with cl.hpp. I updated it to a newer version in commit d95ee76423 in response to issue #1, but I wonder if that is causing problems in other clients. For me it worked ok when I tried the updated version, but what you're seeing suggests it isn't.
Ok, anyway, let's focus on getting things working now it compiles.
Yes, the crash could be caused by the lack of an OpenCL support library, as your program will try to dynamically load OpenCL.dll at run-time. That is only the ICD, a sort of wrapper which dispatches to the hardware drivers, but if the program can't link to it it will crash.
On my (64-bit, Win 7) machine I can see OpenCL.dll in C:\Windows\System32. Is there anything there, or anywhere similar?
Things to try would be:
I've also got a similar error when I initially set up the environment (Cuda Toolkit 6.5, VS2013, Win8.1):
Error 2 error C2664: 'cl_int clEnqueueNativeKernel(cl_command_queue,void (stdcall _)(void ),void ,size_t,cl_uint,const clmem ,const void ,cl_uint,const cl_event ,cl_event )' : cannot convert argument 2 from 'void (cdecl )(void )' to 'void (__stdcall )(void )' F:\Skydrive\Documents\Work\EE4\HPCE\CW4\hpce-2014-cw4\include\CL\cl.hpp 2996 1 CW4
That was with 32 bit. I also tried compiling 64 bit by forcing it to compile 64 bit in the Configuration Manager:
And now I just get a load of symbol errors:
No mention of the C2664 errors I've seen previously. I suspect this might be because the .lib files included in the project are not 64 bit? Or I've set up the 64 bit environment wrongly somehow?
Thought I would try one last thing before going to bed:
This fixed it!
Been trying to run the test cpp but it seem to got stuck looking for a PDB file, but the dll files are there. Anyone had the same error?
Try installing the Intel OpenCL SDK. It looks like it's running on your CPU and not your nvidia card.
I agree with @yuchen-w
Additionally, the pdb only contains debugging information, and shouldn't be needed just to run the program. Is it because the programming is crashing and trying to find the debug info, or for something else?
It just "break" stating the pdb files are missing. What I've done so far is to change the system variable in the test_opencl.cpp so that it has to use my Nvidia chip and that seemed to be a work around solution (although totally not legit I suppose)
I was not able to run OpenCL code on my CPU until I installed the Intel CPU run-time. Did you install that?
https://software.intel.com/en-us/articles/opencl-drivers
@m8pple has posted about this previously.
I am having massive problems setting up my OpenCL environment for Windows 7.
I set up the "Additional Include Directories" under C/C++->General to point to the "include" directory in the opencl_sdk which you gave. However, Visual Studio always cannot find certain header files:
1>H:\VS2013\opencl_sdk\include\CL/cl.h(33): fatal error C1083: Cannot open include file: 'CL/cl_platform.h': No such file or directory
I am pretty sure I setup the include dependencies correct on VS:
I used the following Makefile to try and compile the test_opencl program:
all: addition
addition: g++ -std=gnu++0x -c -I "H:\VS2013\opencl_sdk\include" test_opencl.cpp -o test_opencl.o g++ test_opencl.o -o test_opencl.exe -L "H:\VS2013\opencl_sdk\lib\windows\x86" -lOpenCL
However, it throws me the following error:
I am at a complete loss of what to do next. Could you perhaps provide steps to show how to correctly setup the OpenCL environment on Windows?
Thanks for your help in advance.