Proper fix for copyrite cuda dependence
authorRoland Schulz <roland@utk.edu>
Wed, 28 Nov 2012 00:23:28 +0000 (19:23 -0500)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 13 Jan 2013 22:42:58 +0000 (23:42 +0100)
Change-Id: I3d3329dcdfde86b954854aff7c83b518b8c49c2d

src/gmxlib/CMakeLists.txt
src/gmxlib/copyrite.c
src/gmxlib/cuda_tools/copyrite_gpu.cu [new file with mode: 0644]

index 5ba3ded2d9696a2a77a8dfc99967591ac8d8e380..05411029a362a65f9a50a25f61b8134b52d8c856 100644 (file)
@@ -57,7 +57,6 @@ endif()
 # conditionally built, so we cannot use a GLOB_RECURSE here.
 file(GLOB GMXLIB_SOURCES *.c selection/*.c trajana/*.c statistics/*.c)
 
-
 if(NOT GMX_USE_PLUGINS)
   list(REMOVE_ITEM GMXLIB_SOURCES vmdio.c vmddlopen.c)
 endif()
@@ -76,15 +75,6 @@ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/version.c
                 PROPERTIES GENERATED true)
 endif()
 
-# The log file output queries Cuda if GPU support is enabled
-if(GMX_GPU)
-    if(WIN32)
-        include_directories(${CUDA_TOOLKIT_INCLUDE})
-    else()
-        set_source_files_properties(copyrite.c PROPERTIES COMPILE_FLAGS "-I${CUDA_TOOLKIT_INCLUDE}")
-    endif()
-endif()
-
 if(NOT GMX_EXTERNAL_BLAS)
   file(GLOB BLAS_SOURCES gmx_blas/*.c)
 endif(NOT GMX_EXTERNAL_BLAS)
index a1187f7978ae98aca74ca5dfc9257211216b917a..0be330108131239777547c731cb4ffdab2099733 100644 (file)
 #ifdef HAVE_LIBMKL
 #include <mkl.h>
 #endif
-#ifdef GMX_GPU
-#include <cuda.h>
-#include <cuda_runtime_api.h>
-#endif
 #ifdef GMX_FFT_FFTW3
 #include <fftw3.h>
 #endif
@@ -632,12 +628,10 @@ const char *GromacsVersion()
   return _gmx_ver_string;
 }
 
+void gmx_print_version_info_gpu(FILE *fp);
+
 void gmx_print_version_info(FILE *fp)
 {
-#ifdef GMX_GPU
-    int cuda_driver,cuda_runtime;
-#endif
-
     fprintf(fp, "Gromacs version:    %s\n", _gmx_ver_string);
 #ifdef USE_VERSION_H
     fprintf(fp, "GIT SHA1 hash:      %s\n", _gmx_full_git_hash);
@@ -731,12 +725,6 @@ void gmx_print_version_info(FILE *fp)
             __INTEL_MKL__,__INTEL_MKL_MINOR__,__INTEL_MKL_UPDATE__);
 #endif
 #ifdef GMX_GPU
-    fprintf(fp, "CUDA compiler:      %s\n",CUDA_NVCC_COMPILER_INFO);
-    cuda_driver = 0;
-    cudaDriverGetVersion(&cuda_driver);
-    cuda_runtime = 0;
-    cudaRuntimeGetVersion(&cuda_runtime);
-    fprintf(fp, "CUDA driver:        %d.%d\n",cuda_driver/1000, cuda_driver%100);
-    fprintf(fp, "CUDA runtime:       %d.%d\n",cuda_runtime/1000, cuda_runtime%100);
+    gmx_print_version_info_gpu(fp);
 #endif
 }
diff --git a/src/gmxlib/cuda_tools/copyrite_gpu.cu b/src/gmxlib/cuda_tools/copyrite_gpu.cu
new file mode 100644 (file)
index 0000000..001ca53
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+ * Copyright (c) 2012, by the GROMACS development team, led by
+ * David van der Spoel, Berk Hess, Erik Lindahl, and including many
+ * others, as listed in the AUTHORS file in the top-level source
+ * directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <cuda.h>
+#include <cuda_runtime_api.h>
+
+#include "buildinfo.h"
+
+extern "C" void gmx_print_version_info_gpu(FILE *fp) 
+{
+    int cuda_driver,cuda_runtime;
+    fprintf(fp, "CUDA compiler:      %s\n",CUDA_NVCC_COMPILER_INFO);
+    cuda_driver = 0;
+    cudaDriverGetVersion(&cuda_driver);
+    cuda_runtime = 0;
+    cudaRuntimeGetVersion(&cuda_runtime);
+    fprintf(fp, "CUDA driver:        %d.%d\n",cuda_driver/1000, cuda_driver%100);
+    fprintf(fp, "CUDA runtime:       %d.%d\n",cuda_runtime/1000, cuda_runtime%100);
+}