Re: [CMake] Moving large MSVS projects to CUDA
On Mon, May 7, 2012 at 4:04 PM, Ming ymy...@wisc.edu wrote: ** *By design, CMake should detect configuration changes and reconfigure before the build starts. The VS plugin was designed to provide a single dialog box that would allow for reloading of the entire solution with a single click rather than having to click reload for each project one at a time. This plugin doesn't work properly in VS 2010, because MS broke something. To run the configuration manually, you would need to configure your build from the CMake-GUI instead of relying on VS to run the configuration during the build. You would use the same build and source directory. This should work fine. * Hello again James and thank you helpful replies, I have managed to perform iterative configure-build steps until I’ve reached an equilibrium in my number of failures. Unfortunately, there are still errors (attached in files) that I am having much difficulties with, they seem to fall under the following categories: - Syntax errors? I am not sure why, but the c++ compiler is now taking issue with identical code that it did not before. Examples include: *compiler limit: blocks nested too deeply* *syntax error: missing ‘;’ before ‘’* *: is not a class or namespace name... etc* - Command line errors (These two are due to a “command line too long” issue that I have searched for resolutions on. I noticed Mr. Bigler, that you had posted regarding this issue for other people having issues with a program called ITK? It seems to be persisting and unresolved?) - Linker errors (these seem to be due to lack of objects to link to due to issues 1 and 2.) One of my questions is now, is it possible that cmake with findcuda is pointing MSVS to a different compiler than cmake itself would have specified? Thanks, Ming p.s. outputs are attached. apologies for so much text, it is a large toolkit. 1. You probably shouldn't rename all your files .cu instead of .cpp. I would advise that you separate as much as possible the CUDA code and your host code. CUDA can deal with a lot of template code, but you've obviously reached some limit of CUDA. 2. Yes the long command line is still a problem. I haven't had the occasion to fix this. Probably the best thing you could do to work around it is to place all your device code into a separate directory (new CMake scope) and set the include paths to only the paths you absolutely need. Read the documentation for CMake then ask the mailing list how to do this if you can't figure out how to do this, as I don't have the time to go into setting this. See the documentation for include_directories and the directory property called INCLUDE_DIRECTORIES (get_directory_proprty/set_directory_properties). James James -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
On Sat, May 5, 2012 at 3:32 AM, Ming ymy...@wisc.edu wrote: *From: **James Bigler* jamesbig...@gmail.com* * *Sent: Saturday, May 05, 2012 1:51 AM* *To: **Ming* ymy...@wisc.edu* * *Cc: **cmake@cmake.org* cmake@cmake.org* * *Subject: Re: [CMake] Moving large MSVS projects to CUDA* ** *On Fri, May 4, 2012 at 12:39 PM, Ming ymy...@wisc.edu wrote: * *Hello CMake community,* ** *I have experience using CMake to generate sime cuda-enabled executables (where the cpp’s reside in one folder, etc.).* *I am attempting to move a large project that utilizes CMake, from just c++ to CUDA enabled c++. * ** *It is a project that generates a large set of libraries (comprising a toolkit), using various cmake scripts. I have modified the “add_libraries” call to be “cuda_add_libraries”, and changed all of the .cc files to .cu (but with no additional CUDA code). An approach I thought would be similar to changing a simple program from add_executable to “cuda_add_executable” and renaming the extension to “.cu”* *My goal was first to have it compile properly in its original form post migration, but am met with some very strange errors in visual studio. * ** *I am wondering if anyone else has undertaken such a migration before (libraries or binaries), and if so, what types of general steps need to be taken other than just telling CMake we’re adding “.cu” files?* ** *Thanks all in advance,* *Ming* *-- Powered by **www.kitware.com* http://www.kitware.com *Visit other Kitware open-source projects at ** http://www.kitware.com/opensource/opensource.html*http://www.kitware.com/opensource/opensource.html *Please keep messages on-topic and check the CMake FAQ at: ** http://www.cmake.org/Wiki/CMake_FAQ*http://www.cmake.org/Wiki/CMake_FAQ *Follow this link to subscribe/unsubscribe: **http://www.cmake.org/mailman/listinfo/cmake*http://www.cmake.org/mailman/listinfo/cmake *What kind of strange errors? Typically when adding a new CUDA enabled library, you simply start adding the .cu files with the host/device code mixed to a cuda_add_* target. James * Thank you all for the reply, -The code in question is the Geant4 ( http://geant4.web.cern.ch/geant4/support/download.shtml) toolkit, which uses CMake to handle its cross-platform configurations. The end result of the toolkit is to compile a large set of libraries. -I’ve changed all of the source files from .cc to .cu, and changed all *“add_library” *terms to *“cuda_add_library”* -I’ve also updated all of the *“include directories”* to * “cuda_include_directories”* -The end result is that I am able to generate a build directory (without any errors) using cmake, for VS2010. However when I attempt to build the package in an analagous fashion, I get errors from visual studio informing me mid-build that it: *Cannot load macro project “ for the following reason:* *C:\...\Projects\VSMacros80\Samples\Samples.vsmacros’ is an invalid or inaccessible macro project file* ** Once I acknowledge this message, it then says: *CMake has regenerated 3 .sln and/or .vcproj files.* *Click:* *--Yes to reload the whole solution...* *--No to reload the solution ...* *--Cancel to do nothing* This message shows up even though CMake was done generating files and was closed prior to the build. The same thing happens on my work computer, and I am able to compile other programs just fine, so I do not believe it to be a corrupt install of visual studio. Any suggestions on why this would occur is appreciated! Thanks, Ming Uploaded screenshots of the error messages: https://mywebspace.wisc.edu/ymyang/web/macroerr1.png https://mywebspace.wisc.edu/ymyang/web/macroerr2.png I believe the macro error is a known problem with the CMake VS macro in VS 2010 (MS broke it). The regeneration of the project files is also a known behavior of FindCUDA. The dependencies are computed by nvcc during build and saved in a file. When the dependency file is regenerated CMake will want to reconfigure to add those new dependencies to the project file. This is the expected behavior. My current recommendation for CUDA + VS 2010 is to specify CMAKE_SUPPRESS_REGENERATION OFF in your project file's CMakeLists.txt: option(CMAKE_SUPPRESS_REGENERATION Suppress regeneration of build scripts during build ON) This will disable the VS CMake plugin, requiring you to manually configure with CMake when you change the build scripts. I also recommend configuring CMake after your first build to pick up the file level dependencies that CUDA generates. James -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
-The code in question is the Geant4 (http://geant4.web.cern.ch/geant4/support/download.shtml) toolkit, which uses CMake to handle its cross-platform configurations. The end result of the toolkit is to compile a large set of libraries. -I’ve changed all of the source files from .cc to .cu, and changed all “add_library” terms to “cuda_add_library” -I’ve also updated all of the “include directories” to “cuda_include_directories” -The end result is that I am able to generate a build directory (without any errors) using cmake, for VS2010. However when I attempt to build the package in an analagous fashion, I get errors from visual studio informing me mid-build that it: Cannot load macro project “ for the following reason: C:\...\Projects\VSMacros80\Samples\Samples.vsmacros’ is an invalid or inaccessible macro project file Once I acknowledge this message, it then says: CMake has regenerated 3 .sln and/or .vcproj files. Click: --Yes to reload the whole solution... --No to reload the solution ... --Cancel to do nothing This message shows up even though CMake was done generating files and was closed prior to the build. The same thing happens on my work computer, and I am able to compile other programs just fine, so I do not believe it to be a corrupt install of visual studio. Any suggestions on why this would occur is appreciated! Thanks, Ming Uploaded screenshots of the error messages: https://mywebspace.wisc.edu/ymyang/web/macroerr1.png https://mywebspace.wisc.edu/ymyang/web/macroerr2.png I believe the macro error is a known problem with the CMake VS macro in VS 2010 (MS broke it). The regeneration of the project files is also a known behavior of FindCUDA. The dependencies are computed by nvcc during build and saved in a file. When the dependency file is regenerated CMake will want to reconfigure to add those new dependencies to the project file. This is the expected behavior. My current recommendation for CUDA + VS 2010 is to specify CMAKE_SUPPRESS_REGENERATION OFF in your project file's CMakeLists.txt: option(CMAKE_SUPPRESS_REGENERATION Suppress regeneration of build scripts during build ON) This will disable the VS CMake plugin, requiring you to manually configure with CMake when you change the build scripts. I also recommend configuring CMake after your first build to pick up the file level dependencies that CUDA generates. James Hey James, Thanks you for the reply. I am a bit new to this (and definitely jumping into the deep end with what I am attempting). Could you elaborate on what you mean by “manually configure with CMake” after the initial build? Is it safe to interpret that as re-running CMake-gui after a build, for the same source and build directories?. Or is there something else implied? I’ve had issues in the past trying to perform a configure command in CMake-gui when the buidl directory already existed..? Thanks! Ming-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
I’ve had issues in the past trying to perform a configure command in CMake-gui when the buidl directory already existed..? I do this all the time for years. No problems at all. John -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
On Mon, May 7, 2012 at 11:41 AM, Ming ymy...@wisc.edu wrote: ** * -The code in question is the Geant4 (** http://geant4.web.cern.ch/geant4/support/download.shtml*http://geant4.web.cern.ch/geant4/support/download.shtml *) toolkit, which uses CMake to handle its cross-platform configurations. The end result of the toolkit is to compile a large set of libraries.* *-I’ve changed all of the source files from .cc to .cu, and changed all “add_library” terms to “cuda_add_library”* *-I’ve also updated all of the “include directories” to “cuda_include_directories”* *-The end result is that I am able to generate a build directory (without any errors) using cmake, for VS2010. * ** *However when I attempt to build the package in an analagous fashion, I get errors from visual studio informing me mid-build that it:* ** *Cannot load macro project “ for the following reason:* *C:\...\Projects\VSMacros80\Samples\Samples.vsmacros’ is an invalid or inaccessible macro project file* ** *Once I acknowledge this message, it then says:* ** *CMake has regenerated 3 .sln and/or .vcproj files.* *Click:* *--Yes to reload the whole solution...* *--No to reload the solution ...* *--Cancel to do nothing* ** *This message shows up even though CMake was done generating files and was closed prior to the build.* *The same thing happens on my work computer, and I am able to compile other programs just fine, so I do not believe it to be a corrupt install of visual studio. Any suggestions on why this would occur is appreciated!* ** *Thanks,* *Ming* ** *Uploaded screenshots of the error messages:* *https://mywebspace.wisc.edu/ymyang/web/macroerr1.png*https://mywebspace.wisc.edu/ymyang/web/macroerr1.png * * *https://mywebspace.wisc.edu/ymyang/web/macroerr2.png*https://mywebspace.wisc.edu/ymyang/web/macroerr2.png * * *I believe the macro error is a known problem with the CMake VS macro in VS 2010 (MS broke it). The regeneration of the project files is also a known behavior of FindCUDA. The dependencies are computed by nvcc during build and saved in a file. When the dependency file is regenerated CMake will want to reconfigure to add those new dependencies to the project file. This is the expected behavior. My current recommendation for CUDA + VS 2010 is to specify CMAKE_SUPPRESS_REGENERATION OFF in your project file's CMakeLists.txt: option(CMAKE_SUPPRESS_REGENERATION Suppress regeneration of build scripts during build ON) This will disable the VS CMake plugin, requiring you to manually configure with CMake when you change the build scripts. I also recommend configuring CMake after your first build to pick up the file level dependencies that CUDA generates. James * Hey James, Thanks you for the reply. I am a bit new to this (and definitely jumping into the deep end with what I am attempting). Could you elaborate on what you mean by “manually configure with CMake” after the initial build? Is it safe to interpret that as re-running CMake-gui after a build, for the same source and build directories?. Or is there something else implied? I’ve had issues in the past trying to perform a configure command in CMake-gui when the buidl directory already existed..? Thanks! Ming By design, CMake should detect configuration changes and reconfigure before the build starts. The VS plugin was designed to provide a single dialog box that would allow for reloading of the entire solution with a single click rather than having to click reload for each project one at a time. This plugin doesn't work properly in VS 2010, because MS broke something. To run the configuration manually, you would need to configure your build from the CMake-GUI instead of relying on VS to run the configuration during the build. You would use the same build and source directory. This should work fine. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
On Fri, May 4, 2012 at 12:39 PM, Ming ymy...@wisc.edu wrote: Hello CMake community, I have experience using CMake to generate sime cuda-enabled executables (where the cpp’s reside in one folder, etc.). I am attempting to move a large project that utilizes CMake, from just c++ to CUDA enabled c++. It is a project that generates a large set of libraries (comprising a toolkit), using various cmake scripts. I have modified the “add_libraries” call to be “cuda_add_libraries”, and changed all of the .cc files to .cu (but with no additional CUDA code). An approach I thought would be similar to changing a simple program from add_executable to “cuda_add_executable” and renaming the extension to “.cu” My goal was first to have it compile properly in its original form post migration, but am met with some very strange errors in visual studio. I am wondering if anyone else has undertaken such a migration before (libraries or binaries), and if so, what types of general steps need to be taken other than just telling CMake we’re adding “.cu” files? Thanks all in advance, Ming -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake What kind of strange errors? Typically when adding a new CUDA enabled library, you simply start adding the .cu files with the host/device code mixed to a cuda_add_* target. James -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
From: James Bigler Sent: Saturday, May 05, 2012 1:51 AM To: Ming Cc: cmake@cmake.org Subject: Re: [CMake] Moving large MSVS projects to CUDA On Fri, May 4, 2012 at 12:39 PM, Ming ymy...@wisc.edu wrote: Hello CMake community, I have experience using CMake to generate sime cuda-enabled executables (where the cpp’s reside in one folder, etc.). I am attempting to move a large project that utilizes CMake, from just c++ to CUDA enabled c++. It is a project that generates a large set of libraries (comprising a toolkit), using various cmake scripts. I have modified the “add_libraries” call to be “cuda_add_libraries”, and changed all of the .cc files to .cu (but with no additional CUDA code). An approach I thought would be similar to changing a simple program from add_executable to “cuda_add_executable” and renaming the extension to “.cu” My goal was first to have it compile properly in its original form post migration, but am met with some very strange errors in visual studio. I am wondering if anyone else has undertaken such a migration before (libraries or binaries), and if so, what types of general steps need to be taken other than just telling CMake we’re adding “.cu” files? Thanks all in advance, Ming -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake What kind of strange errors? Typically when adding a new CUDA enabled library, you simply start adding the .cu files with the host/device code mixed to a cuda_add_* target. James Thank you all for the reply, -The code in question is the Geant4 (http://geant4.web.cern.ch/geant4/support/download.shtml) toolkit, which uses CMake to handle its cross-platform configurations. The end result of the toolkit is to compile a large set of libraries. -I’ve changed all of the source files from .cc to .cu, and changed all “add_library” terms to “cuda_add_library” -I’ve also updated all of the “include directories” to “cuda_include_directories” -The end result is that I am able to generate a build directory (without any errors) using cmake, for VS2010. However when I attempt to build the package in an analagous fashion, I get errors from visual studio informing me mid-build that it: Cannot load macro project “ for the following reason: C:\...\Projects\VSMacros80\Samples\Samples.vsmacros’ is an invalid or inaccessible macro project file Once I acknowledge this message, it then says: CMake has regenerated 3 .sln and/or .vcproj files. Click: --Yes to reload the whole solution... --No to reload the solution ... --Cancel to do nothing This message shows up even though CMake was done generating files and was closed prior to the build. The same thing happens on my work computer, and I am able to compile other programs just fine, so I do not believe it to be a corrupt install of visual studio. Any suggestions on why this would occur is appreciated! Thanks, Ming Uploaded screenshots of the error messages: https://mywebspace.wisc.edu/ymyang/web/macroerr1.png https://mywebspace.wisc.edu/ymyang/web/macroerr2.png -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] Moving large MSVS projects to CUDA
Hello CMake community, I have experience using CMake to generate sime cuda-enabled executables (where the cpp’s reside in one folder, etc.). I am attempting to move a large project that utilizes CMake, from just c++ to CUDA enabled c++. It is a project that generates a large set of libraries (comprising a toolkit), using various cmake scripts. I have modified the “add_libraries” call to be “cuda_add_libraries”, and changed all of the .cc files to .cu (but with no additional CUDA code). An approach I thought would be similar to changing a simple program from add_executable to “cuda_add_executable” and renaming the extension to “.cu” My goal was first to have it compile properly in its original form post migration, but am met with some very strange errors in visual studio. I am wondering if anyone else has undertaken such a migration before (libraries or binaries), and if so, what types of general steps need to be taken other than just telling CMake we’re adding “.cu” files? Thanks all in advance, Ming-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Moving large MSVS projects to CUDA
2012/5/4 Ming ymy...@wisc.edu: Hello CMake community, I have experience using CMake to generate sime cuda-enabled executables (where the cpp’s reside in one folder, etc.). I am attempting to move a large project that utilizes CMake, from just c++ to CUDA enabled c++. It is a project that generates a large set of libraries (comprising a toolkit), using various cmake scripts. I have modified the “add_libraries” call to be “cuda_add_libraries”, and changed all of the .cc files to .cu (but with no additional CUDA code). An approach I thought would be similar to changing a simple program from add_executable to “cuda_add_executable” and renaming the extension to “.cu” My goal was first to have it compile properly in its original form post migration, but am met with some very strange errors in visual studio. I am wondering if anyone else has undertaken such a migration before (libraries or binaries), and if so, what types of general steps need to be taken other than just telling CMake we’re adding “.cu” files? I don't know for the migration but did you have a look at the FindCUDA module shipped with CMake. I'm no CUDA user but the module has a lot of features that may interest you. like CUDA_ADD_LIBRARY or CUDA_ADD_EXECUTABLE macros. see: cmake --help-module FindCUDA -- Erk Le gouvernement représentatif n'est pas la démocratie -- http://www.le-message.org -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake