ME964CMake & CUDA DebuggingSpring 2011Brian J. DavisM.S. / PhD. Candidate Biomedical EngineeringResearch AssistantSchool of Medicine and Public HealthResearch Area Medical [email protected]© Dan Negrut, 2011ME964 UW-Madison© Brian J. Davis 2011CMake Build tools – What do they do? What is CMake? Why use CMake? What can CMake do? Example Project Don’t listen to me go to the source… hey man I am just spreading the word. Google Tech Talk CMake/CPack/CTest/CDash Open Source Tools to Build Test and Deploy C++ Software http://www.youtube.com/watch?v=8Ut9o4OdSC0&feature=youtube_gdata I am not affiliated in any way with Kitware. Just a poor schlep trying to get his code to compile.22The Source CMake by Kitware http://www.CMake.org/ Documentation http://www.cmake.org/cmake/help/documentation.html http://www.cmake.org/cmake/help/cmake-2-8-docs.html FAQ http://www.CMake.org/Wiki/CMake_FAQ Download http://www.CMake.org/CMake/resources/software.html Source Repository http://www.CMake.org/Wiki/CMake/Git Tutorial http://www.CMake.org/CMake/help/CMake_tutorial.html“Go right to the source and ask the horse. He’ll give you the answer that you’ll endorse. He’s always on a steady course. Talk to Mr. Ed” – Theme song to Mr. Ed, 1961-19663Build tools what do they do? Check dependencies You changed a source file and the .obj file needs to be rebuilt which then rebuilds the dll or exe. Controls what gets built in what order Execute generators Such as the compiler which coverts source to output files Generate configuration files Specify install and testing locations and put all files in correct locations. Generate code Lexx Yacc or Flex and Bison Extended Backus–Naur Form (EBNF) – context -free grammars SWIG C/C++/C# (Mono) Language integration in Linux Check system for build dependencies (some do VS not so much) CUDA, nvcc, Library dependencies (VTK, ITK, etc) What are capabilities/versions of C and C++ stdlib etc. Whatever you command them to doMESSAGE( “Executing world domination script now” )execute_process( COMMAND world_domination.batWORKING_DIRECTORY ./world_domination_scripts/milky_way_galaxy/earthINPUT_FILE world_domination.cfgOUTPUT_FILE world_domination_result.logERROR_FILE world_domination_error.log)4Build Tools What have I used? What comparisons can I make? BorlandBuilder 5.02/Builder C++ 4, and 6 MS VisualStudio GNU Make, autoconf, and friends BJam – BoostBuildV2 part of Boost C++ http://www.boost.org/boost-build2/ Perforce Software (not related to Boost) Jam Tutorial – only put here due to use of Jam http://www.perforce.com/perforce/conferences/us/2001/wingerd/WPLaura.pdf I have not used the Perforce version only Boost’s version CMake5Visual Studio as a build tool>>> MY OPINIONS <<< Based on What? – ~10 years experience Great for simple projects Unwieldy for complex projects Modal Dialog boxes that can’t be resized? Build Spec is not searchable Which spec am I changing? all, debug, release? Is this for 32 or x64? What did I change that made the build break? I know I can diff the .sln and .prjfiles. We will take a look at those (next slide) All seems hidden behind GUI which is difficult access, change, and maintain . Especially with broad sweeping changes. Ok there is project inheritance. Is this the best Microsoft can do? Well no they do have nmake. Of course laying out a path to (project) destruction is no help either. Wizards are no Merlin. Good for wear leveling of your mouse buttons through increased use of right clickRegistry Key use sadens me. The very concept (the registry) is an attack on my sensibilities. I must now cleanse my thoughts with a couple of pages of Linux kernel code and thoughts of apple pie :-) - Brian J. Davis – CMake Forums : CUDA, CMake, and an attempt to build nbody, 2010 6Looking at (diffing) VS project files WHEN things go wrong: .slnMicrosoft Visual Studio Solution File, Format Version 10.00# Visual Studio 2008Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CudaCollision", "CudaCollision\CudaCollision.vcproj", "{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}"EndProjectProject("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BulletValidation", "BulletValidation\BulletValidation.vcproj", "{8644F016-E5EF-432D-98C6-91D27D459746}"EndProjectProject("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataGeneration", "DataGeneration\DataGeneration.vcproj", "{A0B424D7-6CCD-465C-A90E-D5589E73954E}"EndProjectGlobalGlobalSection(SolutionConfigurationPlatforms) = preSolutionDebug|Win32 = Debug|Win32Debug|x64 = Debug|x64Release|Win32 = Release|Win32Release|x64 = Release|x64EndGlobalSectionGlobalSection(ProjectConfigurationPlatforms) = postSolution{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}.Debug|Win32.ActiveCfg = Debug|Win32{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}.Debug|Win32.Build.0 = Debug|Win32{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}.Debug|x64.ActiveCfg = Debug|x64{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}.Debug|x64.Build.0 = Debug|x64{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}.Release|Win32.ActiveCfg = Release|Win32… ……{A0B424D7-6CCD-465C-A90E-D5589E73954E}.Release|Win32.Build.0 = Release|Win32{A0B424D7-6CCD-465C-A90E-D5589E73954E}.Release|x64.ActiveCfg = Release|x64{A0B424D7-6CCD-465C-A90E-D5589E73954E}.Release|x64.Build.0 = Release|x64EndGlobalSectionGlobalSection(SolutionProperties) = preSolutionHideSolutionNode = FALSEEndGlobalSectionEndGlobal7<?xml version="1.0" encoding="Windows-1252"?><VisualStudioProjectProjectType="Visual C++"Version="9.00"Name="CudaCollision"ProjectGUID="{08C6F311-7AA6-46EB-BFB9-7F947F5DD014}"RootNamespace="CudaCollision"Keyword="x64Proj"TargetFrameworkVersion="0"><Platforms><PlatformName="x64"/><PlatformName="Win32"/></Platforms><ToolFiles><DefaultToolFileFileName="NvCudaRuntimeApi.v3.2.rules"/>…… Blah Blah Blah GOBS and GOBS more where this came from…<FileRelativePath=".\cuda_timer.cu"></File></Files><Globals></Globals></VisualStudioProject>Looking at (diffing) VS project files WHEN things go wrong: .sln8What does VS do? Ok well .prj is better than .sln not that I don’t like looking at hash codes or anything. I counted 698 lines (ok well SciTEhttp://www.scintilla.org/SciTE.html line numbering did) of good wholesome xml Seriously 698 lines of xml to specify 1 executable (CollisionDetection) to generate a
View Full Document