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

OpenCL 2.0 + MinGW + C++ bindings

Matthias_G_
Beginner
595 Views

Hi all,

I'm using Intel and NVIDIA OpenCL using the C++ bindings under Windows 7 64-bit with Intel Xeon 2687 CPU's using the MinGW compiler. It worked like a charm. However, after installing the latest Intel OpenCL 2.0 the program compiles without errors, just some warnings from deprecated declarations, but then stops working at the first OpenCL statement that collects platform info. I eventually managed to get it working again compiling from the Visual Studio 2012 command line using the 'cl' compiler. My programs are relatively small and I like to write them outside of an IDE and then compile them using a makefile. This makes it straightforward to me to copy and compile on a different operating system. A minimal code to reproduce the error is this:

 

// Get device and platform
    std::vector<cl::Platform> platforms;
    std::vector<cl::Device> devices, device;
//    cl::Device device;
    cl::Platform platform;
    std::string devicename;
    cl::Platform::get(&platforms);

The program stops on the last statement. It would be nice to get it working under MinGW again. Is this possible?

Many thanks and best wishes!

0 Kudos
2 Replies
Seynhaeve__Dirk
Beginner
595 Views

This is an older request, but since I see no replies, I'm taking the liberty to offer some suggestions:

I had the same problem (but with the C bindings), and got it fixed. I don't remember what exactly got it fixed, but here is what I paid attention to:

1.Don't use the import library (the .lib file), MinGW wants to compile directly against the DLL, and Cygwin wants to use the DLL as an actual library. To explain the MinGW approach: Their GCC version appearantly figures out directly from the DLL what needs to happen, without flagging it as a shared library. So in my Makefiles, you now find:

ifneq (,$(findstring mingw,$(SYS)))
LDLIBS          += C:/Windows/System32/OpenCL.dll
endif
ifneq (,$(findstring cygwin,$(SYS)))
LDLIBS          += -LC:/Windows/System32/ -lOpenCL
endif

2. Don't use both the 32-bit and 64-bit version of MinGW. I had the original MinGW (from MinGW.org), which is a 32-bit version. I also had the 64-bit version from SourceForge. Once I got rid of the 32-bit version, a lot of my problems went away.

 

3. The latest driver (as recommended by the Intel Driver Update Utility) is not necessarily the driver that works with OpenCL (as found on https://software.intel.com/en-us/articles/opencl-drivers). Make sure you have the "correct" driver installed.

 

I put quotes around the last suggestion, because I just stumbled into another problem, which is probably related to my drivers: MinGW/Cygwin/Microsoft Visual Studio all worked fine. Including the debugging facilities in the Microsoft Visual Studio plugin (Object Tree, Trace View,...). However, just recently, my applications still all compile and work just fine on all three. But my debugging windows come up blank. Which I think is related to the driver, but no matter what driver I plug in, I can't fix it...

 

Robert_I_Intel
Employee
595 Views

Dirk,

Regarding #3: what worked for me in the past is reinstalling INDE (fully uninstalling it and installing it again). Your mileage may vary.

Reply