No subject
Wed Oct 7 22:37:18 EDT 2009
>
> # Search in the CUDA_BIN_PATH first.
> find_path(CUDA_TOOLKIT_ROOT_DIR
> NAMES nvcc nvcc.exe
> PATHS ENV CUDA_BIN_PATH
> DOC "Toolkit location."
> NO_DEFAULT_PATH
> )
> # Now search default paths
> find_path(CUDA_TOOLKIT_ROOT_DIR
> NAMES nvcc nvcc.exe
> PATHS /usr/local/bin
> /usr/local/cuda/bin
> DOC "Toolkit location."
> )
>
>
I think the reason that the find_path(CUDA_TOOLKIT_ROOT_DIR doesn't work
with the paths supplied by find_package is that your paths don't include the
bin directory, and thus misses the executable. I'll have to look into that
more, but for now you should just specify the locations with
CUDA_TOOLKIT_ROOT_DIR (as per the documentation in FindCUDA.cmake).
> Following the advice from
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html:
>
> The default search order is designed to be most-specific to least-specific
> for common use cases. Projects may override the order by simply calling the
> command multiple times and using the NO_* options:
>
> find_package(<package> PATHS paths... NO_DEFAULT_PATH)
> find_package(<package>)
>
> This is urrr... umm... hokey (calling multiple times). And I cannot seem
> to get it to work.
>
I use this construct, because CMake will favor default paths before supplied
paths, and I want to make sure that the stuff in my path is found first.
James
--0016e64b96e2ba673e047c98988a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wed, Jan 6, 2010 at 10:41 PM, Brian Davis <span dir=3D"ltr"><<a href=
=3D"mailto:bitminer at gmail.com">bitminer at gmail.com</a>></span> wrote:<br>=
<div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"borde=
r-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-le=
ft: 1ex;">
<br><br><div class=3D"gmail_quote"><div class=3D"im">On Tue, Jan 5, 2010 at=
12:23 PM, James Bigler <span dir=3D"ltr"><<a href=3D"mailto:jamesbigler=
@gmail.com" target=3D"_blank">jamesbigler at gmail.com</a>></span> wrote:<b=
r><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204=
, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div class=3D"gmail_quote"><div><blockquote class=3D"gmail_quote" style=
=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; p=
adding-left: 1ex;"><br>I ask my self two questions:<br><br>1) Why is CUDA_N=
VCC_FLAGS not set to some default build setting that would just work out of=
the box? - I get the answer to this question when I turn on CUDA_VERBOSE_B=
UILD_MODE - It is being set under the hood.<br>
</blockquote></div><div><br>I guess I don't understand your question.=
=A0 The CUDA_NVCC_FLAGS are the flags used by all targets all the time.=A0 =
Occasionally additional flags are added (such as -fPIC on certain systems a=
s well as other flags) that make it work based on your individual project c=
onfiguration.=A0 It does work out of the box for many applications.<br>
</div></div></blockquote></div><div><br>I am trying to remember what the is=
sue here was.=A0 I think it was that I could not see all the build settings=
AND (this is important) at the time I was using the dcmtk library and addi=
ng it to my project using add_subdirectroy( whereever/dcmtk ).=A0 DCMTK app=
ears to force cmake backwards compatibility version which if used with Find=
Cuda messes up the build.=A0 At least this is what I was experiencing. I am=
patching dcmtk with:<br>
=A0<br>diff -rupN dcmtk-3.5.4-original/CMakeLists.txt dcmtk-3.5.4/CMakeList=
s.txt<br>--- dcmtk-3.5.4-original/CMakeLists.txt=A0=A0=A0 2010-01-04 10:05:=
14.426524200 -0600<br>+++ dcmtk-3.5.4/CMakeLists.txt=A0=A0=A0 2010-01-02 10=
:38:17.792807400 -0600<br>
@@ -8,9 +8,9 @@ ENDIF(NOT WIN32)<br>=A0<br>=A0# check required version of C=
Make<br>=A0CMAKE_MINIMUM_REQUIRED(VERSION 2.0)<br>-IF(CMAKE_BACKWARDS_COMPA=
TIBILITY GREATER 2.0.6)<br>-=A0 SET(CMAKE_BACKWARDS_COMPATIBILITY 2.0.6 CAC=
HE STRING "Latest version of CMake when this project was released.&quo=
t; FORCE)<br>
-ENDIF(CMAKE_BACKWARDS_COMPATIBILITY GREATER 2.0.6)<br>+#IF(CMAKE_BACKWARDS=
_COMPATIBILITY GREATER 2.0.6)<br>+#=A0 SET(CMAKE_BACKWARDS_COMPATIBILITY 2.=
0.6 CACHE STRING "Latest version of CMake when this project was releas=
ed." FORCE)<br>
+#ENDIF(CMAKE_BACKWARDS_COMPATIBILITY GREATER 2.0.6)<br>=A0<br>=A0# default=
build type<br>=A0SET(CMAKE_BUILD_TYPE RELEASE)<br><br></div></div></blockq=
uote><div><br>What kind of errors were you getting?<br><br>The FindCUDA.cma=
ke script will definitely not work with anything less than 2.6.3.=A0 There =
are script features that require that version, so I'm not sure what CMa=
ke would do in that case.<br>
=A0<br></div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px so=
lid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div=
class=3D"gmail_quote"><div><br>This question turned out as I wrote the ema=
il to be a rhetorical question / documentation of my experience.=A0 CUDA_NV=
CC_FLAGS does not appear in the CMakeCache.txt (and I was expecting it to).=
=A0 CUDA_NVCC_FLAGS and friends in CMakeCache.txt:<div class=3D"im">
<br>
<br><br>//Semi-colon delimit multiple arguments.<br>CUDA_NVCC_FLAGS:STRING=
=3D<br><br>//Semi-colon delimit multiple arguments.<br>CUDA_NVCC_FLAGS_DEBU=
G:STRING=3D<br><br>//Semi-colon delimit multiple arguments.<br>CUDA_NVCC_FL=
AGS_MINSIZEREL:STRING=3D<br>
<br>//Semi-colon delimit multiple arguments.<br>CUDA_NVCC_FLAGS_RELEASE:STR=
ING=3D<br><br>//Semi-colon delimit multiple arguments.<br>CUDA_NVCC_FLAGS_R=
ELWITHDEBINFO:STRING=3D<br><br></div></div></div></blockquote><div><br>Agai=
n these are the the user supplied flags that will be applied to *everyone*.=
=A0 They don't take into consideration flags that were added on a per c=
onfiguration basis.=A0 This is why I added the CUDA_VERBOSE_BUILD flag, sin=
ce each target can have their own unique set of flags.<br>
<br></div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid=
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div cl=
ass=3D"gmail_quote"><div><div class=3D"im"><br><br></div></div><blockquote =
class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); m=
argin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class=3D"gmail_quote"><div>
=A0<br></div><div><blockquote class=3D"gmail_quote" style=3D"border-left: 1=
px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"=
>2) There is a CUDA_TOOLKIT_INCLUDE, but no CUDA_SDK_INCLUDE (or _LIB)... w=
hy? (this would prevent ${CUDA_SDK_ROOT_DIR}/common/inc - see below)<br>
<br></blockquote></div><div class=3D"im"><div><br>As you found out the incl=
ude directories for the
CUDA SDK are not supported by FindCUDA.=A0 Those libraries and
headers are designed to be used by the SDK, and not particularly by
external packages.=A0 That doesn't prevent you from doing so, but it wa=
s
decided that because the CUDA SDK won't maintain backward compatibility
and is only designed for the SDK that external use would not be
supported by FindCUDA.=A0 As a compromise I chose to have as a bare minimum=
a path to the
SDK be supported for those who wished to poke in the SDK to find
things such as libraries or header files.=A0 There is documentation in
the help files and in the FindCUDA.cmake file as well as examples of
what to do with the CUDA_SDK_ROOT_DIR variable.<br>=A0
<br></div></div></div></blockquote><div><br>Yes it looks as though from 2.2=
to 2.3 and 3.0_Beta_1 they (NVIDIA) added a /C/ directory in the sdk and m=
oved=A0 bin, common, etc there.=A0 If I could only create a ClairVoyantFind=
CUDA to know of future changes such as these.<br>
<br></div></div></blockquote><div><br>Yes, it's hard to keep up with th=
ose guys, though there are some registry keys and environment variables tha=
t I believe will persist (which is what I try to make use of).<br>=A0<br>
</div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb=
(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class=
=3D"gmail_quote"><div>So lets say that I take CMake compresed as a zip file=
cmake-2.8.0-win32-x86.zip and make it a part of my repository tree.=A0 Not=
installed in Windows using installer in an attempt to make the build compu=
ter not dependent on anything except the source control tool (subversion) a=
nd Visual Studio.=A0 I also take the CUDA SDK and CUDA Toolkit and put it i=
n my tree after installing on build computer and ziping contents at C:\cuda=
and C:\Nvidia Corporation\.=A0 Then I uninstall the sdk and toolkit.=A0 Af=
ter preforming a clean install on a machine and diffing the directory befor=
e and after. This *might* be possible with the follwing exception:<br>
=A0<br>01/06/2010=A0 11:53 AM=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 151,552 nvRegDe=
v.dll<br><br>So I was also experiencing, just today, that I am unable to ge=
t FindCUDA working with PATHS specified or HINTS (if I am using it correctl=
y):<br><br>find_package(<package> PATHS paths... NO_DEFAULT_PATH)<br>
<br></div></div></blockquote><div><br>First off, to be truthful, this is th=
e first time I've become aware of these extra options to find_package.=
=A0 I'm not sure what they would do at the moment, so setting CUDA_TOOL=
KIT_ROOT_DIR and CUDA_SDK_ROOT_DIR is the right way to do this for now.<br>
<br><br></div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px s=
olid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><di=
v class=3D"gmail_quote"><div>From FindCuda (with cmake now in my build tree=
so I can patch it):<br>
<br>=A0 # Search in the CUDA_BIN_PATH first.<br>=A0 find_path(CUDA_TOOLKIT_=
ROOT_DIR<br>=A0=A0=A0 NAMES nvcc nvcc.exe<br>=A0=A0=A0 PATHS ENV CUDA_BIN_P=
ATH<br>=A0=A0=A0 DOC "Toolkit location."<br>
=A0=A0=A0 NO_DEFAULT_PATH<br>=A0=A0=A0 )<br>=A0 # Now search default paths<=
br>=A0 find_path(CUDA_TOOLKIT_ROOT_DIR<br>=A0=A0=A0 NAMES nvcc nvcc.exe<br>=
=A0=A0=A0 PATHS /usr/local/bin<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0 /usr/local/cu=
da/bin<br>=A0=A0=A0 DOC "Toolkit location."<br>
=A0=A0=A0 )<br><br></div></div></blockquote><div><br>I think the reason tha=
t the find_path(CUDA_TOOLKIT_ROOT_DIR doesn't
work with the paths supplied by find_package is that your paths don't
include the bin directory, and thus misses the executable.=A0 I'll have
to look into that more, but for now you should just specify the
locations with CUDA_TOOLKIT_ROOT_DIR (as per the documentation in
FindCUDA.cmake).<br>
<br>=A0
<br></div><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid=
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div cl=
ass=3D"gmail_quote"><div>Following the advice from <a href=3D"http://www.cm=
ake.org/cmake/help/cmake-2-8-docs.html" target=3D"_blank">http://www.cmake.=
org/cmake/help/cmake-2-8-docs.html</a>:<br>
<br>The default search order is designed to be most-specific to least-speci=
fic for common use cases. Projects may override the order by simply calling=
the command multiple times and using the NO_* options:<br>
<br>=A0=A0 find_package(<package> PATHS paths... NO_DEFAULT_PATH)<br>=
=A0=A0 find_package(<package>)<br><br>This is urrr... umm... hokey (c=
alling multiple times).=A0 And I cannot seem to get it to work.<br></div></=
div></blockquote>
<div><br>I use this construct, because CMake will favor default paths befor=
e supplied paths, and I want to make sure that the stuff in my path is foun=
d first.<br>=A0<br></div>James<br></div>
--0016e64b96e2ba673e047c98988a--
More information about the CMake
mailing list