Parallel Computing GPU vs. CPU. Technical Details, Comments

The article “Nvidia Tesla K20 vs Intel Core i7: Speed Comparison”, published on the company's website, and, at the request of many readers, additional technical information regarding the computations performed on the NVIDIA Tesla K20 and NVIDIA Geforce GTX 560 Ti (see the original post on Nvidia web site) has been placed here on the corporate blog.

The first benchmark tests on the heat problem with phase transition (Stefan problem) calculation were executed for a sphere with a radius of 10 meters for 364 days. The summary table below gives the computational time taken by the corresponding graphics accelerator.

Number of cells along each axis X, Y, Z 100 150 200 250 300 350
Number of nodes (millions) 1,03 3,44 8,12 15,81 27,27 43,24
Time in seconds for NVIDIA Tesla K20 7 52 212 637 1625 3394
Time in seconds for NVIDIA GeForce GTX 560 Ti 10 75 311 923

Continue reading

How to Eliminate Blank Space Error While Building a New NVIDIA CUDA Runtime Project in Microsoft Visual Studio

Assume the developer has Microsoft Visual Studio 2008, 2010 or 2012 and NVIDIA CUDA Toolkit 5.5 installed on the PC. If the Windows username contains a blank space, then building a new NVIDIA CUDA 5.5 Runtime project might fail. Typically, this error is either “Could not setup the environment for Microsoft Visual Studio using …” referring to the files of vcvars32.bat or vsvars32.bat, or “stumbling” over a blank space in the name of the user’s home directory (see the screenshots below).

Build errors of a new NVIDIA CUDA 5.5 Runtime project in Microsoft Visual Studio 2012

Build error of a new NVIDIA CUDA 5.5 Runtime project in Microsoft Visual Studio 2008

Build errors of a new NVIDIA CUDA 5.5 Runtime project in Microsoft Visual Studio 2012. Error D8022

More details on these errors can be found in the build log if the verbose logging is on: use --verbose command line option of NVCC (CUDA C/C++ compilation driver).

To fix the problem you may choose any of the following ways:

  1. Create a new user account without a blank space in the name (be careful with the previous user data!),
  2. Set the user environment variable TEMP to a path that doesn’t contain a space (the folder at this path must exist), e.g. C:\Temp,
  3. Insert into the text file %CUDA_PATH%/bin/nvcc.profile, where %CUDA_PATH% may look like C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5, the line “TEMP=path_without_space”, where path_without_space is the path that doesn’t contain a blank space (the folder at the path must exist), e. g. C:\Temp.

CUDA Project Template for Microsoft Visual Studio 2008

The Microsoft Visual Studio 2008 IDE has a lot of standard templates for a New Visual C++ Project. But when using such parallel programming tool as NVidia CUDA Toolkit 5.0 (without any add-ins) one has to set every new C++ CUDA project manually.

Fortunately, the routine of setting becomes automated after installing the free CUDA VS Wizard 2.9. In few clicks one may create an empty CUDA project that compiles on Win32 configuration. To compile on x64 (see item 2) and to achieve purely cosmetic effects (items 3 and 4) complete the following steps.

1. Find the IDE installation folder, e.g. C:/Program Files (x86)/Microsoft Visual Studio 9.0. Further it is denoted as $(VSInstallDir).

2. Open the file $(VSInstallDir)/VC/VCWizards/CUDA/CUDAWinApp/Scripts/1033/default.js in a text editor. Find all occurrences of the path «$(CUDA_PATH)\lib» and replace them with «$(CUDA_PATH)/lib/$(PlatformName);».

3. Add the line «CUDAWinApp.vsz| |CUDAWinApp|1|A sample CUDA application.| |6777| |CUDAWinApp» to the text file $(VSInstallDir)/VC/vcprojects/vc.vsdir.

4. Correct the text of the hint «TODO: Wizard Description.», changing it to «A sample CUDA application.», in the file $(VSInstallDir)/VC/vcprojects/CUDA/CUDAWinApp.vsdir