C ++ / CLI with OpenCL in Visual Studio 10

First of all, I would like to start by saying that I am relatively new to openCL and kind of rusty in C ++. Also this is the first time I ask a question, so feel free to correct me or point out what I could improve in this post.

I am interested in creating a project that will create a mixed mode assembly DLL (CLR library project) for loading and use by CLR Form applications. The DLL imports the openCL header files of the openCL static library (native code) and uses the managed wrapper class to use it for CLR validation.

However, I always fall into the trap of the fatal error C1001, which really is not very much.

1>C:\Program Files (x86)\AMD APP\include\cl\cl.hpp(1270): warning C4290: C++ exception      specification ignored except to indicate a function is not __declspec(nothrow)
1>C:\Program Files (x86)\AMD APP\include\cl\cl.hpp(3708): fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1420)
1>To work around this problem, try simplifying or changing the program near the locations listed above.
1>Please choose the Technical Support command on the Visual C++ 

      

Which indicates

cl_int enqueueNativeKernel(
void (CL_CALLBACK *userFptr)(void *),  

      

I am using amd APP SDK v2.6 with openCL 1.2 options, Visual Studio 2010 Ultimate and linking / lib header provided by SDK. In theory, switching from unmanaged to unmanaged code shouldn't be a buut issue, since it's compiled with / CLR I have included #pragmas to indicate unmanaged passing anyway

#pragma once
#pragma managed(push,off)
#define __NO_STD_STRING
#define __NO_STD_VECTOR
#include <cl\cl.hpp>

#pragma comment(lib,"OpenCL.lib")
#pragma managed(pop)

//rest of code

      

Always having terrible C1001 error and compiler crashing (CL.exe due to c1xx.dll) and no matter how I play with switches I am at a loss.

The switches are as follows: CLR, MDD, optimization disabled, EHa for exception handling. And removing #defines or any of the wrapper code doesn't change anything or remove #pragmas.

It should be noted that the project is compiled using the C API (CL \ cl.h) and I know I could use it instead.

Has anyone else encountered this problem? Or am I doing something terribly wrong? I would really appreciate some information on this.

+3


source to share


1 answer


An internal compiler error means your compiler has crashed. He didn't find a bug in your code; the compiler itself broke. This is due to a compiler bug, but if your code is wrong, it might help to cause the error.



Since "your code" in this case is not your code, but OpenCL code, it may not be able to be compiled by the C ++ / CLI compiler.

+2


source







All Articles