HPCE / hpce-2016-cw5

0 stars 2 forks source link

mingw build error #18

Closed jeremych1000 closed 7 years ago

jeremych1000 commented 7 years ago

Hi,

I've just tried to build using mingw with opencl and tbb included in the library search paths, but have stumbled across this error. Has anyone seen this?

env: mingw64

Happens with CUDA 7.0/lib/Win32, 7.0/lib/x64, 8.0/lib/Win32, and 8.0/lib/x64.

Jeremy@JEREMY-PC /c/Users/Jeremy/Documents/GitHub/hpce-2016-cw5-cyk113
$ make -B all
cd provider && make all
make[1]: Entering directory `/c/Users/Jeremy/Documents/GitHub/hpce-2016-cw5-cyk113/provider'
g++  -std=c++11 -W -Wall  -g -O3 -I ../include -I C:/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v8.0/include -I C:/tbb2017_20161004oss/include -ltbb  -c -o puzzles.o puzzles.cpp
In file included from user_random_walk.hpp:10:0,
                 from puzzles.cpp:3:
../include/CL/cl.hpp:242:28: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
     const cl_int err(void) const { return err_; }
                            ^~~~~
../include/CL/cl.hpp:2421:28: warning: ignoring attributes on template argument 'cl_int {aka int}' [-Wignored-attributes]
         VECTOR_CLASS<cl_int>* binaryStatus = NULL,
                            ^
../include/CL/cl.hpp: In member function 'cl_int cl::CommandQueue::enqueueNativeKernel(void (*)(void*), std::pair<void*, unsigned int>, const std::vector<cl::Memory>*, const std::vector<const void*>*, const std::vector<cl::Event>*, cl::Event*) const':
../include/CL/cl.hpp:2996:34: error: invalid conversion from 'void (*)(void*)' to 'void (__attribute__((__stdcall__)) *)(void*)' [-fpermissive]
                 (cl_event*) event),
                                  ^
<..........>
make[1]: *** [puzzles.o] Error 1
make: *** [lib/libpuzzler.a] Error 2
m8pple commented 7 years ago

You've got a conflict between version of the opencl C++ API - this has been a pain for a while now (see previous complains about OpenCL2 and NVidia).

The problem is the addition of __stdcall, going from here:

void (*)(void*)

to

void (__attribute__((__stdcall__)) *)(void*)

which means that it is specifying a difference calling convention: __stdcall is a different way of pushing function parameters on a stack.

Your solutions are to: 1 - Switch from the version of cl.hpp in the include directory to the one that comes with the CUDA sdk

2 - Switch from the headers that come with OpenCL to the ones that were included in CW3 (copy the opencl_sdk file over).

I would suggest option 2, as that way you get to control the headers that are available in both you MinGW environment, and in AWS.

Note that for linking, I will be doing the compilation under my AWS runs, so it is my job to make sure that -lOpenCL is used and that it will be available.