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."
    )

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.

so I set (ouput from my messages below in cmake output window)

CUDA_TOOLKIT_DIR =
C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2
NVIDIA_SDK_DIR =
C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2

by doing:

SET( PLATFORM_DIR platform/3rdParty/Win )
SET( PATCH_DIR platform/3rdParty/patch )
SET( THIRD_PARTY_PACKAGE_DIR source/cpp/lib/3rdParty/Win )
SET( TOOLS_DIR platform/tools )

SET( THIRD_PARTY_SRC_DIR  3rdParty/Win )
SET( APP_SRC_DIR source/cpp/app )


set( DO_LOCAL_CUDA YES )
if( DEFINED DO_LOCAL_CUDA )

    SET( CUDA_VERSION 2.2 )
    SET( NVIDIA_PACKAGE_DIR
${PLATFORM_DIR}/NVIDIA/GPU_Computing/CUDA_${CUDA_VERSION} )

    SET( CUDA_TOOLKIT_DIR
${CMAKE_HOME_DIRECTORY}/${THIRD_PARTY_PACKAGE_DIR}/CUDA_Toolkit_${CUDA_VERSION}
)
    SET( NVIDIA_SDK_DIR
${CMAKE_HOME_DIRECTORY}/${THIRD_PARTY_PACKAGE_DIR}/NVIDIA_GPU_Computing_SDK_${CUDA_VERSION}
)

    MESSAGE( "CUDA_TOOLKIT_DIR =  ${CUDA_TOOLKIT_DIR}")
    MESSAGE( "NVIDIA_SDK_DIR = ${NVIDIA_SDK_DIR}" )


    unpack(  ${NVIDIA_PACKAGE_DIR}/CUDA_Toolkit_${CUDA_VERSION}.zip
${THIRD_PARTY_PACKAGE_DIR} )
    unpack(
${NVIDIA_PACKAGE_DIR}/NVIDIA_GPU_Computing_SDK_${CUDA_VERSION}.zip
${THIRD_PARTY_PACKAGE_DIR} )

    set( CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_DIR} CACHE STRING "" FORCE )
    set( CUDA_SDK_ROOT_DIR ${NVIDIA_SDK_DIR} CACHE STRING "" FORCE )

    find_package( cuda PATHS ${CUDA_TOOLKIT_DIR} ${NVIDIA_SDK_DIR}

C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2

C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2
        NO_DEFAULT_PATH)
    find_package( cuda )
endif()

The line

    find_package( cuda PATHS ${CUDA_TOOLKIT_DIR} ${NVIDIA_SDK_DIR}

C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2

C:/projects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2
        NO_DEFAULT_PATH)

Appears to have no effect, but:

    set( CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_DIR} CACHE STRING "" FORCE )
    set( CUDA_SDK_ROOT_DIR ${NVIDIA_SDK_DIR} CACHE STRING "" FORCE )

works,but I still get:

cuda_DIR-NOTFOUND

my project successfully builds with only SVN and VisualStudio as the only
host dependency, everything else including cmake, boost,dcmtk, vtk, itk,
gnuwin32 (unzip - why tar, bz2, and gz in cmake but no zip is anyone's
guess, patch, and diff), cuda toolkit, cuda sdk are now all in the svn repo.

Thanks for your help.

-- 
Brian J. Davis

--00504501474c2453f1047c8c8502
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">On Tue, Jan 5, 2010 at 12:23 PM, James B=
igler <span dir=3D"ltr">&lt;<a href=3D"mailto:jamesbigler at gmail.com">jamesb=
igler at gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" =
style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8=
ex; padding-left: 1ex;">
<br><div class=3D"gmail_quote"><div class=3D"im"><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>I ask my self two questions:<br><br>1) =
Why is CUDA_NVCC_FLAGS not set to some default build setting that would jus=
t work out of the box? - I get the answer to this question when I turn on C=
UDA_VERBOSE_BUILD_MODE - It is being set under the hood.<br>



</blockquote></div><div><br>I guess I don&#39;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><br>I am trying to remember what the issue he=
re 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 adding it =
to my project using add_subdirectroy( whereever/dcmtk ).=A0 DCMTK appears t=
o force cmake backwards compatibility version which if used with FindCuda m=
esses up the build.=A0 At least this is what I was experiencing. I am patch=
ing 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 &quot;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 &quot;Latest version of CMake when this project was releas=
ed.&quot; 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><br>This question tu=
rned out as I wrote the email to be a rhetorical question / documentation o=
f my experience.=A0 CUDA_NVCC_FLAGS does not appear in the CMakeCache.txt (=
and I was expecting it to).=A0 CUDA_NVCC_FLAGS and friends in CMakeCache.tx=
t:<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><br><br></div><blockquote class=3D"gmail_quo=
te" 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>

=A0<br></div><div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"b=
order-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; paddin=
g-left: 1ex;">2) There is a CUDA_TOOLKIT_INCLUDE, but no CUDA_SDK_INCLUDE (=
or _LIB)... why? (this would prevent ${CUDA_SDK_ROOT_DIR}/common/inc - see =
below)<br>


<br></blockquote></div><div><br>As you found out the include directories fo=
r 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&#39;t prevent you from doing so, but it wa=
s
decided that because the CUDA SDK won&#39;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></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 moved=
=A0 bin, common, etc there.=A0 If I could only create a ClairVoyantFindCUDA=
 to know of future changes such as these.<br>
<br>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 Wind=
ows using installer in an attempt to make the build computer not dependent =
on anything except the source control tool (subversion) and Visual Studio.=
=A0 I also take the CUDA SDK and CUDA Toolkit and put it in my tree after i=
nstalling on build computer and ziping contents at C:\cuda and C:\Nvidia Co=
rporation\.=A0 Then I uninstall the sdk and toolkit.=A0 After preforming a =
clean install on a machine and diffing the directory before 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(&lt;package&gt; PATHS paths... NO_DEFAULT_PATH)<br>
<br>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_R=
OOT_DIR<br>=A0=A0=A0 NAMES nvcc nvcc.exe<br>=A0=A0=A0 PATHS ENV CUDA_BIN_PA=
TH<br>=A0=A0=A0 DOC &quot;Toolkit location.&quot;<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 &quot;Toolkit location.&quot;<br>
=A0=A0=A0 )<br><br>Following the advice from <a href=3D"http://www.cmake.or=
g/cmake/help/cmake-2-8-docs.html">http://www.cmake.org/cmake/help/cmake-2-8=
-docs.html</a>:<br><br>The default search order is designed to be most-spec=
ific to least-specific for common use cases. Projects may override the orde=
r by simply calling the command multiple times and using the NO_* options:<=
br>
<br>=A0=A0 find_package(&lt;package&gt; PATHS paths... NO_DEFAULT_PATH)<br>=
=A0=A0 find_package(&lt;package&gt;)<br><br>This is urrr... umm... hokey (c=
alling multiple times).=A0 And I cannot seem to get it to work.<br><br>so I=
 set (ouput from my messages below in cmake output window)<br>
<br>CUDA_TOOLKIT_DIR =3D=A0 C:/projects/NIH2009/source/branches/trunk/sourc=
e/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2<br>NVIDIA_SDK_DIR =3D C:/projects/N=
IH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GPU_Computi=
ng_SDK_2.2<br>
<br>by doing:<br><br>SET( PLATFORM_DIR platform/3rdParty/Win )<br>SET( PATC=
H_DIR platform/3rdParty/patch )<br>SET( THIRD_PARTY_PACKAGE_DIR source/cpp/=
lib/3rdParty/Win )<br>SET( TOOLS_DIR platform/tools )<br><br>SET( THIRD_PAR=
TY_SRC_DIR=A0 3rdParty/Win )<br>
SET( APP_SRC_DIR source/cpp/app )<br><br><br>set( DO_LOCAL_CUDA YES )<br>if=
( DEFINED DO_LOCAL_CUDA )<br><br>=A0=A0=A0 SET( CUDA_VERSION 2.2 )<br>=A0=
=A0=A0 SET( NVIDIA_PACKAGE_DIR ${PLATFORM_DIR}/NVIDIA/GPU_Computing/CUDA_${=
CUDA_VERSION} )<br>
<br>=A0=A0=A0 SET( CUDA_TOOLKIT_DIR ${CMAKE_HOME_DIRECTORY}/${THIRD_PARTY_P=
ACKAGE_DIR}/CUDA_Toolkit_${CUDA_VERSION} )<br>=A0=A0=A0 SET( NVIDIA_SDK_DIR=
 ${CMAKE_HOME_DIRECTORY}/${THIRD_PARTY_PACKAGE_DIR}/NVIDIA_GPU_Computing_SD=
K_${CUDA_VERSION} )<br>
<br>=A0=A0=A0 MESSAGE( &quot;CUDA_TOOLKIT_DIR =3D=A0 ${CUDA_TOOLKIT_DIR}&qu=
ot;)<br>=A0=A0=A0 MESSAGE( &quot;NVIDIA_SDK_DIR =3D ${NVIDIA_SDK_DIR}&quot;=
 )<br>=A0=A0=A0 <br><br>=A0=A0=A0 unpack(=A0 ${NVIDIA_PACKAGE_DIR}/CUDA_Too=
lkit_${CUDA_VERSION}.zip ${THIRD_PARTY_PACKAGE_DIR} )<br>
=A0=A0=A0 unpack(=A0 ${NVIDIA_PACKAGE_DIR}/NVIDIA_GPU_Computing_SDK_${CUDA_=
VERSION}.zip ${THIRD_PARTY_PACKAGE_DIR} )<br>=A0=A0=A0 <br>=A0=A0=A0 set( C=
UDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_DIR} CACHE STRING &quot;&quot; FORCE )<=
br>=A0=A0=A0 set( CUDA_SDK_ROOT_DIR ${NVIDIA_SDK_DIR} CACHE STRING &quot;&q=
uot; FORCE )<br>
=A0=A0=A0 <br>=A0=A0=A0 find_package( cuda PATHS ${CUDA_TOOLKIT_DIR} ${NVID=
IA_SDK_DIR} <br>=A0=A0=A0 =A0=A0=A0 C:/projects/NIH2009/source/branches/tru=
nk/source/cpp/lib/3rdParty/Win/CUDA_Toolkit_2.2<br>=A0=A0=A0 =A0=A0=A0 C:/p=
rojects/NIH2009/source/branches/trunk/source/cpp/lib/3rdParty/Win/NVIDIA_GP=
U_Computing_SDK_2.2<br>
=A0=A0=A0 =A0=A0=A0 NO_DEFAULT_PATH)<br>=A0=A0=A0 find_package( cuda )<br>e=
ndif()<br><br>The line<br><br>=A0=A0=A0 find_package( cuda PATHS ${CUDA_TOO=
LKIT_DIR} ${NVIDIA_SDK_DIR} <br>
=A0=A0=A0 =A0=A0=A0 C:/projects/NIH2009/source/branches/trunk/source/cpp/li=
b/3rdParty/Win/CUDA_Toolkit_2.2<br>
=A0=A0=A0 =A0=A0=A0 C:/projects/NIH2009/source/branches/trunk/source/cpp/li=
b/3rdParty/Win/NVIDIA_GPU_Computing_SDK_2.2<br>
=A0=A0=A0 =A0=A0=A0 NO_DEFAULT_PATH)<br><br>Appears to have no effect, but:=
<br>=A0<br>=A0=A0=A0 set( CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_DIR} CACHE S=
TRING &quot;&quot; FORCE )<br>
=A0=A0=A0 set( CUDA_SDK_ROOT_DIR ${NVIDIA_SDK_DIR} CACHE STRING &quot;&quot=
; FORCE )<br>=A0
<br>works,but I still get:<br><br>cuda_DIR-NOTFOUND<br><br>my project succe=
ssfully builds with only SVN and VisualStudio as the only host dependency, =
everything else including cmake, boost,dcmtk, vtk, itk, gnuwin32 (unzip - w=
hy tar, bz2, and gz in cmake but no zip is anyone&#39;s guess, patch, and d=
iff), cuda toolkit, cuda sdk are now all in the svn repo.<br>
<br>Thanks for your help.<br clear=3D"all"></div></div><br>-- <br>Brian J. =
Davis<br><br>

--00504501474c2453f1047c8c8502--


More information about the CMake mailing list