without card

i am new to cuda…i am working in WINDOWS XP…i dont have graphic card…the following program i complie in the emulation mode…


#include “stdafx.h”

#include <stdio.h>

#include <cuda.h>

// Kernel that executes on the CUDA device

global void square_array(float *a, int N)


int idx = blockIdx.x * blockDim.x + threadIdx.x;

if (idx<N) a[idx] = a[idx] * a[idx];


// main routine that executes on the host

int main(void)


float *a_h, *a_d; // Pointer to host & device arrays

const int N = 10; // Number of elements in arrays

size_t size = N * sizeof(float);

a_h = (float *)malloc(size); // Allocate array on host

cudaMalloc((void **) &a_d, size); // Allocate array on device

// Initialize host array and copy it to CUDA device

for (int i=0; i<N; i++) a_h[i] = (float)i;

cudaMemcpy(a_d, a_h, size, cudaMemcpyHostToDevice);

// Do calculation on device:

int block_size = 4;

int n_blocks = N/block_size + (N%block_size == 0 ? 0:1);

square_array <<< n_blocks, block_size >>> (a_d, N);

// Retrieve result from device and store it in host array

cudaMemcpy(a_h, a_d, sizeof(float)*N, cudaMemcpyDeviceToHost);

// Print results

for (int i=0; i<N; i++) printf("%d %f\n", i, a_h[i]);

// Cleanup

free(a_h); cudaFree(a_d);


After compling program. I have the following problem:

------ Build started: Project: example1, Configuration: Debug Win32 ------
LINK : fatal error LNK1181: cannot open input file ‘cutil32D.lib’
Build log was saved at “file://c:\Documents and Settings\srividhya.y\My Documents\example\example1\example1\Debug\BuildLog.htm”
example1 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What else do I need to do… please suggest me quickly…

Simply put, the linker can’t find all the libraries it needs. You need to include a link to ‘cutil32D.lib’ in the Project Configuration Properties. From within Visual Studio, go to Project->Properties, then in the tree on the left, Configuration Properties->Linker->General. In the field “Additional Library Dependencies”, you need to include the path to the SDK libraries directory. For me it’s “C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib”. Instead of hardcoding the whole path like that, you could also declare an environment variable such as NVSDKCUDA_ROOT to point to “C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK”, then put “$(NVSDKCUDA_ROOT)\common\lib” in the Additional Library Dependencies field.

Hope that helps.