Archive for February, 2012

CUDA – Get Error From Kernel Call

February 21, 2012

When a kernel encounters an error it does not notify the runtime of any errors. One has to explicitly query the last error that occurred, if any. Below is an example of how to do this. // call the kernel SomeKernel<<<n,m>>>();  // wait for the kernel to finish executing before continuing cudaThreadSynchronize(); // check for [...]

Posted in CUDA, Programming No Comments »

Debugging CUDA Device in Visual Studio – Installing NVIDIA Nsight

February 20, 2012

This post assumes you already have Visual Studio and CUDA installed. It is quite a process to get Nsight installed if you are not yet registered as an NVIDIA developer (registration required). Below is a list of all the steps you need to follow to get Nsight up and running in Visual Studio assuming you [...]

Posted in CUDA, Programming 4 Comments »

List Files Folders in a Directory in C++ Windows

February 18, 2012

Below is an example of how to loop over all files and folders in a given location and output the names. #include <Windows.h> int main(int argc, char** argv) { HANDLE hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; hFind = FindFirstFile(TEXT(“C:\\temp\\*”), &ffd); do { Sleep(1000); bool isDirectory = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; if(isDirectory) { cout

Posted in C++, Programming No Comments »