CUDA 5.0: Replacement for cutil.h?
Yes, there is a replacement in the new SDK Examples.
It has been covered in a previous question:
CUDA5 Examples: Has anyone translated some cutil definitions to CUDA5?
Link to cutil in GPU Computing SDK
Your compilation statement is incorrect. It should look something like this:
nvcc -I$SDKROOT/C/common/inc -L$SDKROOT/C/lib cutiltest.cc -lcutil_x86_64
where SDKROOT holds the root path to the SDK, which looks to be
/home/sj755/NVIDIA_GPU_Computing_SDK
in your case. The key things to note here are that the library must be passed by name as a -l
option after the code and objects that require it. A concrete example on OS X using your code snippet:
$ cat cutiltest.cc
#include <iostream>
#include <cuda.h>
#include <cutil.h>
using namespace std;
int main(){
unsigned int time_total;
cutCreateTimer(&time_total);
return 0;
}
$ nvcc -I/Developer/GPU\ Computing/C/common/inc -L /Developer/GPU\ Computing/C/lib -o cutiltest cutiltest.cc -lcutil_i386
$ ls -l cutiltest
-rwxr-xr-x 1 talonmies talonmies 117548 May 25 07:57 cutiltest
But as a last remark, you really should rethink your choice of using the SDK cutils library at all. It is only intended for use with the SDK examples. It isn't part of CUDA, it has no documentation, it isn't guaranteed to work or not contain bugs, and isn't guaranteed to be consistent (or even present) from one SDK release to another.
cutil function compilation program
IF you right click your cu source file and select properties:
Then go to CUDA C/C++ and under Common add the location of the cutil.h to the Additional Include Directories folder.
For me this was: C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 3.2\C\common\inc
Dependencies on cutil when using CUDA 5.0
If you are planning on using CUDA 5 or later, it be necessary to modify the code you are trying compile to remove or replace dependencies on libcutil
. That was an unofficial component of the CUDA SDK in version 4 and earlier and has been deprecated and removed from CUDA 5.
The alternative would be to build the code with CUDA 4.2 or to try building the library from the CUDA 4.2 SDK source using the CUDA 5 toolchain. I have no personal experience with the latter and don't know whether it is feasible or not.
Cannot find -lcutil even though all the paths are correct
From the NVIDIA Forums:
On linux 64bit one has to rename libcutil_x86_64.a
into libcutil.a
.
So cd
into the folder $(HOME)/NVIDIA_GPU_Computing_SDK/C/lib/
(or where you installed CUDA) and enter: cp libcutil_x86_64.a libcutil.a
DISCLAIMER
As I already stumbled over this problem twice I added the question and the answer as a form of documentation.
Compiling Basic C-Language CUDA code in Linux (Ubuntu)
To fix the include problems add the cuda include directory to your compilation options (assuming it is /usr/local/cuda/include):
nvcc -I/usr/local/cuda/include -L/usr/local/cuda/lib test.cu -o test
Related Topics
How to Get Notified of Modification in The Memory in Linux
File Listed Twice in Rpm Spec File
Using for Loop to Move Files from Subdirectories to Parent Directories
Home Directory Is Not Created with Adding User Resource with Chef
How to Quickly Check If Linux 'Unzip' Is Installed Using Perl
Undefine Reference for Libraries, So How Could I Find The Right Path
How to Use Multiple Lower Layers in Overlayfs
How to Install Pysqlite for Python3.4.2
How to Run 16 Bit Code on 32 Bit Linux
Monodevelop - Runs Only Using Sudo
How to Check That Smart Card Is Working on Linux
Can You Explain This Sed One-Liner
How to Find The Byte Position of Specific Line in a File
How to Set Umask Default for an User
Mod_Perl Can't See Files in /Tmp
Difference Between Posix Reliable Signals and Posix Real-Time Signals in Linux
Postgres Copy Command, Binary File
Using Find But Only in Subdirectories Matching Certain Pattern