Instead use CUDA_ADD_LIBRARY to build libgromacs. It builds all
non CUDA files using the standard build rules. Thus this should not
have any effect on non CUDA files. All CUDA files were compiled
with the same nvcc OPTIONS, and thus nothing should have changed
for them either.
This also removes the requirement for gmxManageNvccConfig to set
fPIC manually because now CUDA_ADD_LIBRARY knows when the library
is shared.
Change-Id: I23fe6b7a9766a39c525cdc1abfa3922ec24058d9
set(CUDA_HOST_COMPILER_OPTIONS "${CUDA_HOST_COMPILER_OPTIONS}-D__STRICT_ANSI__;")
endif()
set(CUDA_HOST_COMPILER_OPTIONS "${CUDA_HOST_COMPILER_OPTIONS}-D__STRICT_ANSI__;")
endif()
- # on Linux we need to add -fPIC when building shared gmx libs
- # Note: will add -fPIC for any compiler that supports it as it shouldn't hurt
- if(BUILD_SHARED_LIBS)
- GMX_TEST_CXXFLAG(CXXFLAG_FPIC "-fPIC" _FPIC_NVCC_FLAG)
- if(_FPIC_NVCC_FLAG)
- set(CUDA_HOST_COMPILER_OPTIONS "${CUDA_HOST_COMPILER_OPTIONS}-Xcompiler;${_FPIC_NVCC_FLAG}")
- endif()
- endif()
-
# the legacy CUDA kernels have been dropped, warn with CUDA 4.0
if (CUDA_VERSION VERSION_EQUAL "4.0")
message(WARNING "The legacy GPU kernels optimized for older CUDA compilers, including the detected version 4.0, have been removed. To avoid performance loss, we strongly recommend upgrading to a newer CUDA toolkit.
# the legacy CUDA kernels have been dropped, warn with CUDA 4.0
if (CUDA_VERSION VERSION_EQUAL "4.0")
message(WARNING "The legacy GPU kernels optimized for older CUDA compilers, including the detected version 4.0, have been removed. To avoid performance loss, we strongly recommend upgrading to a newer CUDA toolkit.
gmx_apply_gcc44_bug_workaround("mdlib/constr.c")
endif()
gmx_apply_gcc44_bug_workaround("mdlib/constr.c")
endif()
-add_library(libgromacs ${LIBGROMACS_SOURCES})
+if (GMX_GPU)
+ cuda_add_library(libgromacs ${LIBGROMACS_SOURCES}
+ OPTIONS
+ RELWITHDEBINFO -g
+ DEBUG -g -D_DEBUG_=1)
+else()
+ add_library(libgromacs ${LIBGROMACS_SOURCES})
+endif()
if (GMX_GIT_VERSION_INFO)
add_dependencies(libgromacs gmx-version)
endif()
if (GMX_GIT_VERSION_INFO)
add_dependencies(libgromacs gmx-version)
endif()
target_link_libraries(libgromacs
${EXTRAE_LIBRARIES}
target_link_libraries(libgromacs
${EXTRAE_LIBRARIES}
${GMX_EXTRA_LIBRARIES}
${TNG_IO_LIBRARIES}
${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
${GMX_EXTRA_LIBRARIES}
${TNG_IO_LIBRARIES}
${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
# The log file output queries Cuda if GPU support is enabled
add_subdirectory(cuda_tools)
add_subdirectory(gpu_utils)
# The log file output queries Cuda if GPU support is enabled
add_subdirectory(cuda_tools)
add_subdirectory(gpu_utils)
- set(GMX_GPU_LIBRARIES ${GMX_GPU_LIBRARIES} gpu_utils cuda_tools PARENT_SCOPE)
endif()
set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${NONBONDED_SOURCES} PARENT_SCOPE)
endif()
set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${NONBONDED_SOURCES} PARENT_SCOPE)
#
# This file is part of the GROMACS molecular simulation package.
#
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012, by the GROMACS development team, led by
+# Copyright (c) 2012,2014, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
if(GMX_GPU)
file(GLOB CUDA_TOOLS_SOURCES *.cu)
if(GMX_GPU)
file(GLOB CUDA_TOOLS_SOURCES *.cu)
- CUDA_ADD_LIBRARY(cuda_tools STATIC ${CUDA_TOOLS_SOURCES}
- OPTIONS
- RELWITHDEBINFO -g
- DEBUG -g -D_DEBUG_=1)
+ set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${CUDA_TOOLS_SOURCES} PARENT_SCOPE)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out 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.
-CUDA_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
file(GLOB GPU_UTILS_SOURCES *.cu)
file(GLOB GPU_UTILS_SOURCES *.cu)
-CUDA_ADD_LIBRARY(gpu_utils STATIC ${GPU_UTILS_SOURCES}
- OPTIONS ${_os_def}
- RELWITHDEBINFO -g
- DEBUG -g -D_DEBUG_=1 )
+set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${GPU_UTILS_SOURCES} PARENT_SCOPE)
-CUDA_BUILD_CLEAN_TARGET()
#
# This file is part of the GROMACS molecular simulation package.
#
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2010,2012,2013,2014, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
file(GLOB MDLIB_SOURCES nbnxn_kernels/simd_4xn/*.c nbnxn_kernels/simd_2xnn/*.c nbnxn_kernels/*.c *.c *.cpp)
# the research papers on the package. Check out http://www.gromacs.org.
file(GLOB MDLIB_SOURCES nbnxn_kernels/simd_4xn/*.c nbnxn_kernels/simd_2xnn/*.c nbnxn_kernels/*.c *.c *.cpp)
-set(MDLIB_SOURCES ${MDLIB_SOURCES} PARENT_SCOPE)
if(GMX_GPU)
add_subdirectory(nbnxn_cuda)
if(GMX_GPU)
add_subdirectory(nbnxn_cuda)
- set(GMX_GPU_LIBRARIES ${GMX_GPU_LIBRARIES} nbnxn_cuda PARENT_SCOPE)
+
+set(MDLIB_SOURCES ${MDLIB_SOURCES} PARENT_SCOPE)
#
# This file is part of the GROMACS molecular simulation package.
#
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
if(GMX_GPU)
file(GLOB CUDA_NB_SOURCES *.cu)
if(GMX_GPU)
file(GLOB CUDA_NB_SOURCES *.cu)
- CUDA_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
- CUDA_ADD_LIBRARY(nbnxn_cuda STATIC ${CUDA_NB_SOURCES}
- OPTIONS
- RELWITHDEBINFO -g
- DEBUG -g -D_DEBUG_=1)
- target_link_libraries(nbnxn_cuda cuda_tools)
+ set(MDLIB_SOURCES ${MDLIB_SOURCES} ${CUDA_NB_SOURCES} PARENT_SCOPE)