From 70bd052976f2653dae8f4956041cecd12bb14af4 Mon Sep 17 00:00:00 2001 From: Zhi Wang Date: Thu, 9 Nov 2023 12:11:35 -0800 Subject: [PATCH] fix build for fp32 cpu --- CMakeLists.txt | 2 +- include/math/libfunc.h | 3 ++- src/CMakeLists.txt | 2 +- src/acc/CMakeLists.txt | 2 +- src/cu/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca382e504..94a529d70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -598,7 +598,7 @@ add_subdirectory (test) ## executables add_library (__t9_main_o OBJECT src/main.cc) -target_link_libraries (__t9_main_o PRIVATE __t9_intf PRIVATE tinkerFToCpp) +target_link_libraries (__t9_main_o PRIVATE __t9_intf tinkerFToCpp) set_target_properties (__t9_main_o PROPERTIES CXX_STANDARD ${T9_CPPSTD}) ## tinker9 and all.tests list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") diff --git a/include/math/libfunc.h b/include/math/libfunc.h index 223d47345..e6dbce893 100644 --- a/include/math/libfunc.h +++ b/include/math/libfunc.h @@ -52,7 +52,8 @@ extern "C" # endif # if TINKER_REAL_SIZE == 4 -# define REAL_ABS std::fabsf +// Bug. Cannot use std::fabsf. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700 +# define REAL_ABS ::fabsf # endif #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f20c6e8e..a71e733cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,7 @@ cudart/thrustcache.cpp ) endif () add_library (tinker9_cpp STATIC "${__T9_CPP_SRC}") -target_link_libraries (tinker9_cpp PRIVATE __t9_intf PRIVATE tinkerFToCpp) +target_link_libraries (tinker9_cpp PRIVATE __t9_intf tinkerFToCpp) set_target_properties (tinker9_cpp PROPERTIES CXX_STANDARD ${T9_CPPSTD}) add_library (tinker9_version OBJECT diff --git a/src/acc/CMakeLists.txt b/src/acc/CMakeLists.txt index 234e68826..dcb4d4a02 100644 --- a/src/acc/CMakeLists.txt +++ b/src/acc/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required (VERSION 3.18) ## libtinker9_acc.a include (cmakesrc.txt) add_library (tinker9_acc STATIC "${__T9_ACC_SRC}") -target_link_libraries (tinker9_acc PRIVATE __t9_intf PRIVATE tinkerFToCpp) +target_link_libraries (tinker9_acc PRIVATE __t9_intf tinkerFToCpp) set_target_properties (tinker9_acc PROPERTIES CXX_STANDARD ${T9_CPPSTD}) diff --git a/src/cu/CMakeLists.txt b/src/cu/CMakeLists.txt index 7c48d6fc7..ca10964c7 100644 --- a/src/cu/CMakeLists.txt +++ b/src/cu/CMakeLists.txt @@ -16,7 +16,7 @@ set_target_properties (tinker9_cu CUDA_ARCHITECTURES "${T9_CUCCLIST}" ) target_include_directories (tinker9_cu PRIVATE "${PROJECT_SOURCE_DIR}/include/syntax/cu") -target_link_libraries (tinker9_cu PRIVATE __t9_intf PRIVATE tinkerFToCpp) +target_link_libraries (tinker9_cu PRIVATE __t9_intf tinkerFToCpp) target_link_libraries (tinker9_cu PUBLIC cufft cublas) # ## -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0d620b4fa..98b0d4666 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required (VERSION 3.18) ## test files include (cmakesrc.txt) add_library (__t9_all_tests_o OBJECT ${__T9_TEST_SRC}) -target_link_libraries (__t9_all_tests_o PRIVATE __t9_intf PRIVATE tinkerFToCpp) +target_link_libraries (__t9_all_tests_o PRIVATE __t9_intf tinkerFToCpp) set_target_properties (__t9_all_tests_o PROPERTIES CXX_STANDARD ${T9_CPPSTD}) if (14 LESS_EQUAL ${T9_CPPSTD}) find_package (Catch2 PATHS "${CMAKE_BINARY_DIR}/catch2")