From c96e4cc9bdb78679ca471b9aba6443bdad7c05fa Mon Sep 17 00:00:00 2001 From: GregorySchwing Date: Mon, 23 Aug 2021 08:31:47 -0500 Subject: [PATCH] modified checkpoint file to only use cereal, removed compiler pragma from Config, and removed inclusion of Find Boost in Cmake List, and removed Boost compiling in GTest --- CMake/FindBoost.cmake | 179 ---------------------------------- CMake/GOMCCPUSetup.cmake | 24 ----- CMake/GOMCCUDASetup.cmake | 24 ----- CMake/boost/CMakeLists.txt.in | 15 --- CMakeLists.txt | 24 +---- GOMC_Config.h.in | 3 - src/Checkpoint.h | 27 ----- test/GoogleTest.cmake | 5 - 8 files changed, 1 insertion(+), 300 deletions(-) delete mode 100644 CMake/FindBoost.cmake delete mode 100644 CMake/boost/CMakeLists.txt.in diff --git a/CMake/FindBoost.cmake b/CMake/FindBoost.cmake deleted file mode 100644 index eb7330bfb..000000000 --- a/CMake/FindBoost.cmake +++ /dev/null @@ -1,179 +0,0 @@ -# - Find Boost -# -# Copyright (c) 2016 Thiago Barroso Perrotta -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -# the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# This module finds if Boost is installed and determines where the -# executables are. It sets the following variables: -# -# BOOST_FOUND : boolean - system has Boost -# BOOST_LIBRARIES : list(filepath) - the libraries needed to use Boost -# BOOST_INCLUDE_DIRS : list(path) - the Boost include directories -# -# If Boost is not found, this module downloads it according to the -# following variables: -# -# BOOST_ROOT_DIR : path - the Path where Boost will be installed on -# BOOST_REQUESTED_VERSION : string - the Boost version to be downloaded -# -# You can also specify its components: -# -# find_package(Boost COMPONENTS program_options system) -# -# which are stored in Boost_FIND_COMPONENTS : list(string) -# -# You can also specify its behavior: -# -# BOOST_USE_STATIC_LIBS : boolean (default: OFF) - -option(CMAKE_DOWNLOAD_BOOST "Download and build the boost library" OFF) - -if(NOT Boost_FIND_COMPONENTS) - message(FATAL_ERROR "No COMPONENTS specified for Boost") -endif() - -set(BOOST_USE_STATIC_LIBS false) - -# Set the library prefix and library suffix properly. -if(BOOST_USE_STATIC_LIBS) - set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_STATIC_LIBRARY_PREFIX}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX}) - set(LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) -else() - set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_SHARED_LIBRARY_PREFIX}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX}) - set(LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) -endif() - -# Create a list(string) for the build command (e.g. --with-program_options;--with-system) -# and assigns it to BOOST_COMPONENTS_FOR_BUILD -foreach(component ${Boost_FIND_COMPONENTS}) - list(APPEND BOOST_COMPONENTS_FOR_BUILD --with-${component}) -endforeach() - -# Create a string for the first component (e.g. boost_program_options) -# and assigns it to Boost_FIND_COMPONENTS -list(GET Boost_FIND_COMPONENTS 0 BOOST_FIRST_COMPONENT) -set(BOOST_FIRST_COMPONENT "boost_${BOOST_FIRST_COMPONENT}") - -#include(FindPackageHandleStandardArgs) - -macro(DO_FIND_BOOST_SYSTEM) - find_path(BOOST_INCLUDE_DIR boost/config.hpp - PATHS /usr/local/include /usr/include - ) - find_library(BOOST_LIBRARY - NAMES ${BOOST_FIRST_COMPONENT} - PATHS /usr/local/lib /usr/lib - ) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Boost DEFAULT_MSG - BOOST_INCLUDE_DIR BOOST_LIBRARY - ) - set(BOOST_LIBRARIES ${BOOST_LIBRARY}) - set(BOOST_INCLUDE_DIRS ${BOOST_INCLUDE_DIR}) - mark_as_advanced(BOOST_LIBRARIES BOOST_INCLUDE_DIRS) -endmacro() - -macro(DO_FIND_BOOST_ROOT) - if(NOT BOOST_ROOT_DIR) - message(STATUS "BOOST_ROOT_DIR is not defined, using lib/boost directory.") - set(BOOST_ROOT_DIR "${PROJECT_SOURCE_DIR}/lib/boost") - endif() - - set(BOOST_ROOT_DIR "${PROJECT_SOURCE_DIR}/lib/boost") - find_path(BOOST_INCLUDE_DIR boost/config.hpp ${BOOST_ROOT_DIR}/include) - find_library(BOOST_LIBRARY ${BOOST_FIRST_COMPONENT} HINTS ${BOOST_ROOT_DIR}/lib) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Boost DEFAULT_MSG - BOOST_INCLUDE_DIR BOOST_LIBRARY - ) - set(BOOST_LIBRARIES ${BOOST_LIBRARY}) - set(BOOST_INCLUDE_DIRS ${BOOST_INCLUDE_DIR}) - mark_as_advanced(BOOST_LIBRARIES BOOST_INCLUDE_DIRS) -endmacro() - -macro(DO_FIND_BOOST_DOWNLOAD) - - if(NOT BOOST_REQUESTED_VERSION) - set(BOOST_REQUESTED_VERSION 1.76.0) - message(STATUS "BOOST_REQUESTED_VERSION is not defined. Using 1.76.0") - endif() - - string(REPLACE "." "_" BOOST_REQUESTED_VERSION_UNDERSCORE ${BOOST_REQUESTED_VERSION}) - - set(BOOST_MAYBE_STATIC) - if(BOOST_USE_STATIC_LIBS) - set(BOOST_MAYBE_STATIC "link=static") - endif() - - include(ExternalProject) - # Download and unpack googletest at configure time - configure_file(${PROJECT_SOURCE_DIR}/CMake/boost/CMakeLists.txt.in ${BOOST_ROOT_DIR}/boost-download/CMakeLists.txt) - execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - RESULT_VARIABLE result - WORKING_DIRECTORY ${BOOST_ROOT_DIR}/boost-download ) - if(result) - message(FATAL_ERROR "CMake step for boost failed: ${result}") - endif() - execute_process(COMMAND ${CMAKE_COMMAND} --build . - RESULT_VARIABLE result - WORKING_DIRECTORY ${BOOST_ROOT_DIR}/boost-download ) - if(result) - message(FATAL_ERROR "Build step for boost failed: ${result}") - endif() - - #ExternalProject_Get_Property(Boost install_dir) - set(BOOST_INCLUDE_DIRS ${BOOST_ROOT_DIR}/include) - include_directories(${BOOST_INCLUDE_DIRS}) - - - macro(libraries_to_fullpath varname) - set(${varname}) - foreach(component ${Boost_FIND_COMPONENTS}) - list(APPEND ${varname} ${BOOST_ROOT_DIR}/lib/${LIBRARY_PREFIX}boost_${component}${LIBRARY_SUFFIX}) - endforeach() - endmacro() - libraries_to_fullpath(BOOST_LIBRARIES) - - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Boost DEFAULT_MSG - BOOST_INCLUDE_DIRS BOOST_LIBRARIES - ) - mark_as_advanced(BOOST_LIBRARIES BOOST_INCLUDE_DIRS) - message(STATUS "Finished Downloading Boost") - set(GOMC_BOOST_LIB 1 CACHE INTERNAL - "Build a Boost-enabled version of GOMC" FORCE) -endmacro() - - -if(NOT BOOST_FOUND) - DO_FIND_BOOST_SYSTEM() -endif() - -if(NOT BOOST_FOUND) - DO_FIND_BOOST_ROOT() -endif() - -if(NOT BOOST_FOUND) - if(CMAKE_DOWNLOAD_BOOST) - message(STATUS "Downloading Boost") - DO_FIND_BOOST_DOWNLOAD() - endif() -endif() - diff --git a/CMake/GOMCCPUSetup.cmake b/CMake/GOMCCPUSetup.cmake index c38c1fd5a..567963ca2 100644 --- a/CMake/GOMCCPUSetup.cmake +++ b/CMake/GOMCCPUSetup.cmake @@ -21,9 +21,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED true) if(ENSEMBLE_NVT) add_executable(NVT ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(NVT PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(NVT PROPERTIES OUTPUT_NAME ${NVT_name} COMPILE_FLAGS "${NVT_flags}") @@ -34,16 +31,10 @@ if(ENSEMBLE_NVT) if(MPI_FOUND) target_link_libraries(NVT ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(NVT ${BOOST_LIBRARIES}) - endif() endif() if(ENSEMBLE_GEMC) add_executable(GEMC ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(GEMC PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(GEMC PROPERTIES OUTPUT_NAME ${GE_name} COMPILE_FLAGS "${GE_flags}") @@ -54,16 +45,10 @@ if(ENSEMBLE_GEMC) if(MPI_FOUND) target_link_libraries(GEMC ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(GEMC ${BOOST_LIBRARIES}) - endif() endif() if(ENSEMBLE_GCMC) add_executable(GCMC ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(GCMC PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(GCMC PROPERTIES OUTPUT_NAME ${GC_name} COMPILE_FLAGS "${GC_flags}") @@ -74,16 +59,10 @@ if(ENSEMBLE_GCMC) if(MPI_FOUND) target_link_libraries(GCMC ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(GCMC ${BOOST_LIBRARIES}) - endif() endif() if(ENSEMBLE_NPT) add_executable(NPT ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(NPT PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(NPT PROPERTIES OUTPUT_NAME ${NPT_name} COMPILE_FLAGS "${NPT_flags}") @@ -94,8 +73,5 @@ if(ENSEMBLE_NPT) if(MPI_FOUND) target_link_libraries(NPT ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(NPT ${BOOST_LIBRARIES}) - endif() endif() diff --git a/CMake/GOMCCUDASetup.cmake b/CMake/GOMCCUDASetup.cmake index 6173245f0..6b6fd3f83 100644 --- a/CMake/GOMCCUDASetup.cmake +++ b/CMake/GOMCCUDASetup.cmake @@ -40,9 +40,6 @@ include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) if(ENSEMBLE_GPU_NVT) add_executable(GPU_NVT ${cudaSources} ${cudaHeaders} ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(GPU_NVT PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(GPU_NVT PROPERTIES CUDA_SEPARABLE_COMPILATION ON OUTPUT_NAME ${GPU_NVT_name} @@ -57,17 +54,11 @@ if(ENSEMBLE_GPU_NVT) if(MPI_FOUND) target_link_libraries(GPU_NVT ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(GPU_NVT ${BOOST_LIBRARIES}) - endif() endif() if(ENSEMBLE_GPU_GEMC) add_executable(GPU_GEMC ${cudaSources} ${cudaHeaders} ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(GPU_GEMC PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(GPU_GEMC PROPERTIES CUDA_SEPARABLE_COMPILATION ON OUTPUT_NAME ${GPU_GE_name} @@ -82,17 +73,11 @@ if(ENSEMBLE_GPU_GEMC) if(MPI_FOUND) target_link_libraries(GPU_GEMC ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(GPU_GEMC ${BOOST_LIBRARIES}) - endif() endif() if(ENSEMBLE_GPU_GCMC) add_executable(GPU_GCMC ${cudaSources} ${cudaHeaders} ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(GPU_GCMC PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(GPU_GCMC PROPERTIES CUDA_SEPARABLE_COMPILATION ON OUTPUT_NAME ${GPU_GC_name} @@ -107,17 +92,11 @@ if(ENSEMBLE_GPU_GCMC) if(MPI_FOUND) target_link_libraries(GPU_GCMC ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(GPU_GCMC ${BOOST_LIBRARIES}) - endif() endif() if(ENSEMBLE_GPU_NPT) add_executable(GPU_NPT ${cudaSources} ${cudaHeaders} ${sources} ${headers} ${libHeaders} ${libSources}) - if(Boost_FOUND) - target_sources(GPU_NPT PRIVATE ${BOOST_INCLUDE_DIRS}) - endif() set_target_properties(GPU_NPT PROPERTIES CUDA_SEPARABLE_COMPILATION ON OUTPUT_NAME ${GPU_NPT_name} @@ -132,7 +111,4 @@ if(ENSEMBLE_GPU_NPT) if(MPI_FOUND) target_link_libraries(GPU_NPT ${MPI_LIBRARIES}) endif() - if(Boost_FOUND) - target_link_libraries(GPU_NPT ${BOOST_LIBRARIES}) - endif() endif() diff --git a/CMake/boost/CMakeLists.txt.in b/CMake/boost/CMakeLists.txt.in deleted file mode 100644 index c025cd347..000000000 --- a/CMake/boost/CMakeLists.txt.in +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -project(boost-download NONE) - -include(ExternalProject) -ExternalProject_Add( - Boost - URL https://sourceforge.net/projects/boost/files/boost/${BOOST_REQUESTED_VERSION}/boost_${BOOST_REQUESTED_VERSION_UNDERSCORE}.zip/download - UPDATE_COMMAND "" - CONFIGURE_COMMAND ./bootstrap.sh --prefix=${BOOST_ROOT_DIR} - BUILD_COMMAND ./b2 ${BOOST_MAYBE_STATIC} --prefix=${BOOST_ROOT_DIR} ${BOOST_COMPONENTS_FOR_BUILD} install - BUILD_IN_SOURCE true - INSTALL_COMMAND "" - INSTALL_DIR ${BOOST_ROOT_DIR} -) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index fedb36dde..40d813646 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,28 +53,7 @@ endif() # Set Source and Header files include(${PROJECT_SOURCE_DIR}/CMake/FileLists.cmake) - -# find Boost, and if not found download and install serialization library for checkpointing -# Set Source and Header files -#set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/FindBoost.cmake") - set(GOMC_BOOST_LIB 0 CACHE INTERNAL - "Build a Boost-enabled version of GOMC" FORCE) - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") -message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") -find_package(Boost COMPONENTS serialization ) - -if(Boost_FOUND) - message(STATUS "Boost_INCLUDE_DIRS: ${BOOST_INCLUDE_DIRS}") - message(STATUS "Boost_LIBRARIES: ${BOOST_LIBRARIES}") - message(STATUS "Boost_VERSION: ${Boost_VERSION_STRING}") - set(GOMC_BOOST_LIB 1 CACHE INTERNAL - "Build a Boost-enabled version of GOMC" FORCE) - include_directories(${BOOST_INCLUDE_DIRS}) -else() - message(STATUS "Using native checkpointing. To download boost -DCMAKE_DOWNLOAD_BOOST=ON") - include_directories(lib/cereal-1.3.0/include) -endif() +include_directories(lib/cereal-1.3.0/include) #enable config header configure_file( @@ -82,7 +61,6 @@ configure_file( "${PROJECT_BINARY_DIR}/GOMC_Config.h" ) - # Enable google test # for now we will disable testing for intel compiler if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") diff --git a/GOMC_Config.h.in b/GOMC_Config.h.in index 461e04f8f..8754954d4 100644 --- a/GOMC_Config.h.in +++ b/GOMC_Config.h.in @@ -15,6 +15,3 @@ /* MPI_IN_PLACE exists for collective operations */ #cmakedefine01 MPI_IN_PLACE_EXISTS - -/* Boost serialization library exists for checkpointing */ -#cmakedefine01 GOMC_BOOST_LIB \ No newline at end of file diff --git a/src/Checkpoint.h b/src/Checkpoint.h index 245c02166..839da458f 100644 --- a/src/Checkpoint.h +++ b/src/Checkpoint.h @@ -10,20 +10,12 @@ along with this program, also can be found at . #include "GOMC_Config.h" #include -#if GOMC_BOOST_LIB -#include -#include -#include -#include -#else #include #include #include #include #include -#endif - #include "MoveSettings.h" #include "MoleculeLookup.h" #include "Molecules.h" @@ -108,31 +100,16 @@ class Checkpoint uint32_t seedLocationPT, seedLeftPT, seedValuePT; #endif -#if GOMC_BOOST_LIB - friend class boost::serialization::access; - // When the class Archive corresponds to an output archive, the - // & operator is defined similar to <<. Likewise, when the class Archive - // is a type of input archive the & operator is defined similar to >>. -#else friend class cereal::access; -#endif template void serialize(Archive & ar, const unsigned int version) { // GOMC Version -#if GOMC_BOOST_LIB - ar & boost::serialization::make_array(gomc_version, 5); -#else ar & gomc_version; -#endif // Step ar & stepNumber; // PRNG Vars -#if GOMC_BOOST_LIB - ar & boost::serialization::make_array(saveArray, N_array_size + 1); -#else ar & saveArray; -#endif ar & seedLocation; ar & seedLeft; ar & seedValue; @@ -162,11 +139,7 @@ class Checkpoint ar & parallelTemperingEnabled; if((bool)parallelTemperingEnabled){ // PRNG PT Vars - #if GOMC_BOOST_LIB - ar & boost::serialization::make_array(saveArrayPT, N_array_size + 1); - #else ar & saveArrayPT; - #endif ar & seedLocationPT; ar & seedLeftP T; ar & seedValuePT; diff --git a/test/GoogleTest.cmake b/test/GoogleTest.cmake index 276a0c800..29e404612 100644 --- a/test/GoogleTest.cmake +++ b/test/GoogleTest.cmake @@ -35,11 +35,6 @@ include(test/FileList.cmake) # Now simply link against gtest or gtest_main as needed. Eg add_executable(GOMC_Test ${TestHeaders} ${TestSources} ${GOMCHeaders} ${GOMCSources}) -if(Boost_FOUND) - message(STATUS "I think I found boost in GTEST") - target_sources(GOMC_Test PRIVATE ${BOOST_INCLUDE_DIRS}) - target_link_libraries(GOMC_Test ${BOOST_LIBRARIES}) -endif() target_link_libraries(GOMC_Test gtest_main) add_test(NAME BasicTypesTest COMMAND BasicTypesTest) add_test(NAME CircuitTester COMMAND DialaTest)