Note that there are some explanatory texts on larger screens.

plurals
  1. POCUDA & VS2010 problem
    primarykey
    data
    text
    <p>I have scoured the internets looking for an answer to this one, but couldn't find any. I've installed the CUDA 3.2 SDK (and, just now, CUDA 4.0 RC) and everything seems to work fine after long hours of fooling around with include directories, NSight, and all the rest. Well, except this one thing: it keeps highlighting the <code>&lt;&lt;&lt; &gt;&gt;&gt;</code> operator as a mistake. Only on VS2010--not on VS2008. </p> <p>On VS2010 I also get several warnings of the following sort:</p> <pre><code>C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xdebug(109): warning C4251: 'std::_String_val&lt;_Ty,_Alloc&gt;::_Alval' : class 'std::_DebugHeapAllocator&lt;_Ty&gt;' needs to have dll-interface to be used by clients of class 'std::_String_val&lt;_Ty,_Alloc&gt;' </code></pre> <p><strong>Update:</strong> If I try and include an entry point in a <code>.cpp</code> file that calls a CUDA kernel, instead of writing <code>main()</code> in a <code>.cu</code> file as I was doing, the operator is actually flagged as an error, besides highlighting it! The same thing happens with VS2008.</p> <p>Anyone know how this can be fixed?</p> <p><strong>Update 2:</strong> Here is the code. The <code>main.cpp</code> file:</p> <pre><code>#include "kernel.cu" int main() { doStuff(); return 0; } </code></pre> <p>and the <code>.cu</code> file:</p> <pre><code>#include &lt;iostream&gt; #include "cuda.h" #include "cuda_runtime.h" #include "device_launch_parameters.h" #include &lt;cutil_inline.h&gt; #include &lt;time.h&gt; using namespace std; #define N 16 __global__ void MatAdd(float A[N][N], float B[N][N], float C[N][N]) { int i = blockIdx.x * blockDim.x + threadIdx.x; int j = blockIdx.y * blockDim.y + threadIdx.y; if (i &lt; N &amp;&amp; j &lt; N) C[i][j] = A[i][j] + B[i][j]; } int doStuff() { dim3 threadsPerBlock(8, 8); dim3 numBlocks(N / threadsPerBlock.x, N / threadsPerBlock.y); float A[N][N], B[N][N], C[N][N]; for (int i = 0; i &lt; N; ++i) for (int j = 0; j &lt; N; ++j) { A[i][j] = 0; B[i][j] = 0; C[i][j] = 0; } clock_t start = clock(); MatAdd&lt;&lt;&lt;numBlocks, threadsPerBlock&gt;&gt;&gt;(A, B, C); clock_t end = clock(); cout &lt;&lt; "Took " &lt;&lt; float(end - start) &lt;&lt; "ms to work out." &lt;&lt; endl; cin.get(); return 0; } </code></pre> <p><strong>Update 3:</strong> Alright, I was (idiotically) including the CUDA code in the <code>.cpp</code> file, so of course it couldn't compile. Now I have CUDA 4.0 up and running on VS2010, but I still get several warnings of the kind explained above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload