diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ab0fa6..ef4ae26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,91 +1,125 @@ -################################################################################################### -# Copyright (c) 2021, Lawrence Livermore National Security, LLC and LvArray contributors. -# All rights reserved. -# See the LICENSE file for details. -# SPDX-License-Identifier: (BSD-3-Clause) -################################################################################################### - -cmake_minimum_required( VERSION 3.23.1 ) - -# Set version number -set( SHIVA_VERSION_MAJOR 0 ) -set( SHIVA_VERSION_MINOR 1 ) -set( SHIVA_VERSION_PATCHLEVEL 0 ) - -# check if Shiva is build as a submodule or a separate project -get_directory_property( parent_dir PARENT_DIRECTORY ) -if(parent_dir) - set( SHIVA_IS_SUBMODULE ON ) -else() - set( SHIVA_IS_SUBMODULE OFF ) +cmake_minimum_required(VERSION 3.23.1) +project(Shiva VERSION 0.1.0) + +# Portable install dir vars: ${CMAKE_INSTALL_INCLUDEDIR}, ${CMAKE_INSTALL_LIBDIR}, etc. +include(GNUInstallDirs) + +# -------- Options (lean) ------------------------------------------------------- +option( SHIVA_ENABLE_BLT "Enable BLT integration (testing, packaging, etc.)" OFF ) +option( SHIVA_ENABLE_CUDA "Enable CUDA code paths in headers (interface define only)" OFF ) +option( SHIVA_ENABLE_HIP "Enable HIP code paths in headers (interface define only)" OFF ) +option( SHIVA_ENABLE_UNIT_TESTS "Build unit tests (standalone only)" OFF ) +option( SHIVA_ENABLE_CAMP "Link against CAMP if available" OFF ) +option( SHIVA_BUILD_OBJ_LIBS "Build object libraries...useful for dependency trees" OFF ) +option( SHIVA_ENABLE_BOUNDS_CHECK "Enable bounds checking in shiva::CArray" OFF ) + +if( ENABLE_CUDA ) + set( SHIVA_ENABLE_CUDA ON ) endif() -if( NOT SHIVA_IS_SUBMODULE ) - message( "not a submodule") - project( Shiva LANGUAGES CXX C ) - - set( BLT_CXX_STD "c++17" CACHE STRING "Version of C++ standard" FORCE ) - set( ENABLE_WARNINGS_AS_ERRORS "ON" CACHE PATH "" ) - - option( SHIVA_ENABLE_UNIT_TESTS "Builds tests" ON ) - option( SHIVA_ENABLE_EXAMPLES "Builds examples" ON ) - option( SHIVA_ENABLE_BENCHMARKS "Builds benchmarks" ON ) - option( SHIVA_ENABLE_DOCS "Builds documentation" ON ) - - option( ENABLE_CUDA "Build with CUDA" OFF ) - option( ENABLE_HIP "Build with HIP" OFF ) - - if( NOT BLT_LOADED ) - if( DEFINED BLT_SOURCE_DIR ) - if( NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake ) - message( FATAL_ERROR "Given BLT_SOURCE_DIR does not contain SetupBLT.cmake" ) - endif() - else () - set( BLT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/cmake/blt CACHE PATH "" ) - - if( NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake ) - message( FATAL_ERROR "The BLT submodule is not present. If in git repository run the following two commands:\n \ - git submodule init\n \ - git submodule update" ) - endif () - endif () - - include( ${BLT_SOURCE_DIR}/SetupBLT.cmake ) - endif() +if( ENABLE_HIP ) + set( SHIVA_ENABLE_HIP ON ) +endif() - include( cmake/CMakeBasics.cmake ) - #include( cmake/SetupTPL.cmake ) -else() - if( NOT BLT_LOADED ) - message( FATAL_ERROR "When using Shiva as a submodule you must have already loaded BLT." ) - endif() - include( cmake/CMakeBasics.cmake ) +if( SHIVA_ENABLE_CUDA AND SHIVA_ENABLE_HIP ) + message( FATAL_ERROR "CUDA and HIP are mutually exclusive; enable only one." ) endif() -include( cmake/Macros.cmake ) -include( cmake/Config.cmake ) +# Top-level or subproject? +set( SHIVA_IS_TOPLEVEL "${PROJECT_IS_TOP_LEVEL}" ) -set(SHIVA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) -set(SHIVA_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) +# Convenience dirs +set( SHIVA_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ) +set( SHIVA_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) -message( STATUS "SHIVA_BINARY_DIR: ${SHIVA_BINARY_DIR}" ) -message( STATUS "SHIVA_SOURCE_DIR: ${SHIVA_SOURCE_DIR}" ) +# -------- Generate config header ---------------------------------------------- +# Expects: include/shiva/ShivaConfig.hpp.in +include( "${CMAKE_CURRENT_LIST_DIR}/cmake/Config.cmake" ) +# -------- Header-only target --------------------------------------------------- +add_library(Shiva INTERFACE) +add_library(Shiva::shiva ALIAS Shiva) -add_subdirectory( src ) +target_include_directories( Shiva INTERFACE + "$" # include/shiva/... + "$" # build/include/shiva/ShivaConfig.hpp + "$" ) -if( SHIVA_ENABLE_CAMP ) - add_subdirectory( tpl/camp ) - target_compile_options( camp PRIVATE "-Wno-shadow") +target_compile_features(Shiva INTERFACE cxx_std_17) - configure_file(tpl/camp/include/camp/config.in.hpp - ${PROJECT_BINARY_DIR}/include/camp/config.hpp) -endif() +# -------- BLT (optional; usable as top-level or submodule) --------------------- +if( SHIVA_ENABLE_BLT ) + set( BLT_CXX_STD "c++17" ) + # Load BLT if Shiva is standalone + if( SHIVA_IS_TOPLEVEL ) + set(BLT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/cmake/blt" CACHE PATH "Path to BLT") + if (NOT EXISTS "${BLT_SOURCE_DIR}/SetupBLT.cmake") + message(FATAL_ERROR "BLT not found at '${BLT_SOURCE_DIR}'.") + endif() + include("${BLT_SOURCE_DIR}/SetupBLT.cmake") + else() + endif( SHIVA_IS_TOPLEVEL ) -if( SHIVA_ENABLE_DOCS ) - add_subdirectory( docs ) -endif() + if( BLT_LOADED ) + message( STATUS "BLT loaded successfully." ) + else() + message( FATAL_ERROR "BLT requested but failed to load." ) + endif( BLT_LOADED ) + + + + if( SHIVA_ENABLE_CAMP ) + add_subdirectory(tpl/camp) # vendored fallback when standalone + target_link_libraries(Shiva INTERFACE camp) + endif() + + if( SHIVA_ENABLE_UNIT_TESTS ) + # Enable GPU languages **only** for tests/examples at the top level + if ( SHIVA_ENABLE_CUDA AND NOT CMAKE_CUDA_COMPILER ) + enable_language ( CUDA ) + endif () + if ( SHIVA_ENABLE_HIP AND NOT CMAKE_HIP_COMPILER ) + enable_language ( HIP ) + endif () + message( STATUS "Building unit tests." ) + add_subdirectory(tests) + else() + message( STATUS "Skipping unit tests." ) + endif() + + include( "${CMAKE_CURRENT_LIST_DIR}/cmake/Macros.cmake" ) + shiva_add_code_checks( PREFIX shiva + EXCLUDES build* blt/* camp/* ) + +endif( SHIVA_ENABLE_BLT) + + +# -------- Install & package ---------------------------------------------------- +install(TARGETS Shiva EXPORT ShivaTargets) + +# Install public headers and generated config header tree +install( DIRECTORY "${SHIVA_SOURCE_DIR}/include/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) +install( DIRECTORY "${SHIVA_BINARY_DIR}/include/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + OPTIONAL ) + +include( CMakePackageConfigHelpers ) + +write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/ShivaConfigVersion.cmake" + VERSION "${PROJECT_VERSION}" + COMPATIBILITY SameMajorVersion ) + +configure_package_config_file( "${CMAKE_CURRENT_LIST_DIR}/cmake/ShivaConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/ShivaConfig.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Shiva" ) +install( FILES "${CMAKE_CURRENT_BINARY_DIR}/ShivaConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ShivaConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Shiva" ) +install( EXPORT ShivaTargets + FILE ShivaTargets.cmake + NAMESPACE Shiva:: + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Shiva" ) diff --git a/cmake/CMakeBasics.cmake b/cmake/CMakeBasics.cmake deleted file mode 100644 index 82a64a7..0000000 --- a/cmake/CMakeBasics.cmake +++ /dev/null @@ -1,46 +0,0 @@ -set(CMAKE_ENABLE_EXPORTS ON) - -if( CMAKE_BUILD_TYPE MATCHES "Debug" ) - -else() - -endif() - -set( SHIVA_BUILD_OBJ_LIBS OFF CACHE BOOL "" ) - - -option( SHIVA_ENABLE_BOUNDS_CHECK "Enable bounds checking in shiva::CArray" ON ) - -if( CMAKE_CXX_STANDARD IN_LIST "98; 11; 14" ) - MESSAGE(FATAL_ERROR "Shiva requires at least c++17") -endif() - - -blt_append_custom_compiler_flag( FLAGS_VAR CMAKE_CXX_FLAGS DEFAULT "${OpenMP_CXX_FLAGS}") -blt_append_custom_compiler_flag( FLAGS_VAR CMAKE_CXX_FLAGS - GNU "-Wpedantic -pedantic-errors -Wshadow -Wfloat-equal -Wcast-align -Wcast-qual" - CLANG "-Wpedantic -pedantic-errors -Wshadow -Wfloat-equal -Wcast-align -Wcast-qual" - ) - -blt_append_custom_compiler_flag( FLAGS_VAR CMAKE_CXX_FLAGS_DEBUG - GNU "" - CLANG "-fstandalone-debug" - ) - -option( SHIVA_ENABLE_CAMP OFF ) -option( CAMP_ENABLE_TESTS OFF ) - - -if( ENABLE_CUDA ) - if( CUDA_VERSION AND CUDA_VERSION_MAJOR AND CUDA_VERSION_MINOR ) - set( SHIVA_CUDA_VERSION ${CUDA_VERSION} ) - set( SHIVA_CUDA_MAJOR ${CUDA_VERSION_MAJOR} ) - set( SHIVA_CUDA_MINOR ${CUDA_VERSION_MINOR} ) - else() - message(FATAL_ERROR "CUDA_VERSION_MAJOR and CUDA_VERSION_MINOR not defined") - endif() -else() - set( SHIVA_CUDA_VERSION 0 ) - set( SHIVA_CUDA_MAJOR 0 ) - set( SHIVA_CUDA_MINOR 0 ) -endif() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 849955d..1622087 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -1,65 +1,36 @@ -# -set( PREPROCESSOR_DEFINES CUDA - HIP - CAMP - BOUNDS_CHECK - ) - -set( USE_CONFIGFILE ON CACHE BOOL "" ) -foreach( DEP in ${PREPROCESSOR_DEFINES}) - if( ${DEP}_FOUND OR ENABLE_${DEP} OR SHIVA_ENABLE_${DEP} ) - set( SHIVA_USE_${DEP} TRUE ) - endif() -endforeach() - -if( ENABLE_ADDR2LINE ) - if ( NOT DEFINED ADDR2LINE_EXEC ) - set( ADDR2LINE_EXEC /usr/bin/addr2line CACHE PATH "" ) - endif() - - if ( NOT EXISTS ${ADDR2LINE_EXEC} ) - message( FATAL_ERROR "The addr2line executable does not exist: ${ADDR2LINE_EXEC}" ) - endif() - - set( SHIVA_ADDR2LINE_EXEC ${ADDR2LINE_EXEC} ) +# cmake/Config.cmake +include_guard(DIRECTORY) + +# ---------- Version numbers expected by the header ---------- +# Your header expects *_PATCHLEVEL; map from project() version. +set(SHIVA_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") +set(SHIVA_VERSION_MINOR "${PROJECT_VERSION_MINOR}") +set(SHIVA_VERSION_PATCHLEVEL "${PROJECT_VERSION_PATCH}") + + +# ---------- CUDA version numbers (if available) ---------- +set(SHIVA_CUDA_MAJOR 0) +set(SHIVA_CUDA_MINOR 0) +if (SHIVA_ENABLE_CUDA AND DEFINED CMAKE_CUDA_COMPILER_VERSION) + # CMAKE_CUDA_COMPILER_VERSION like "12.4" + string(REPLACE "." ";" _cuda_ver_list "${CMAKE_CUDA_COMPILER_VERSION}") + list(GET _cuda_ver_list 0 SHIVA_CUDA_MAJOR) + list(LENGTH _cuda_ver_list _cuda_len) + if (_cuda_len GREATER 1) + list(GET _cuda_ver_list 1 SHIVA_CUDA_MINOR) + endif() endif() -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/ShivaConfig.hpp.in - ${CMAKE_BINARY_DIR}/include/ShivaConfig.hpp ) - -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/ShivaConfig.hpp.in - ${CMAKE_CURRENT_SOURCE_DIR}/docs/doxygen/ShivaConfig.hpp ) - -# Install the generated header. -install( FILES ${CMAKE_BINARY_DIR}/include/ShivaConfig.hpp - DESTINATION include ) - -# Configure and install the CMake config - -# Set up cmake package config file - -set(SHIVA_INSTALL_INCLUDE_DIR "include" CACHE STRING "") -set(SHIVA_INSTALL_CONFIG_DIR "lib" CACHE STRING "") -set(SHIVA_INSTALL_LIB_DIR "lib" CACHE STRING "") -set(SHIVA_INSTALL_BIN_DIR "bin" CACHE STRING "") -set(SHIVA_INSTALL_CMAKE_MODULE_DIR "${SHIVA_INSTALL_CONFIG_DIR}/cmake" CACHE STRING "") -set(SHIVA_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "" FORCE) - - -include(CMakePackageConfigHelpers) -configure_package_config_file( - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/shiva-config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/shiva-config.cmake - INSTALL_DESTINATION - ${SHIVA_INSTALL_CONFIG_DIR} - PATH_VARS - SHIVA_INSTALL_INCLUDE_DIR - SHIVA_INSTALL_LIB_DIR - SHIVA_INSTALL_BIN_DIR - SHIVA_INSTALL_CMAKE_MODULE_DIR - ) +# ---------- Emit the generated header(s) ---------- +set(_shiva_gen_inc "${SHIVA_BINARY_DIR}/include/shiva") +file(MAKE_DIRECTORY "${_shiva_gen_inc}") +configure_file( "${SHIVA_SOURCE_DIR}/include/shiva/ShivaConfig.hpp.in" + "${_shiva_gen_inc}/ShivaConfig.hpp" ) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/shiva-config.cmake - DESTINATION share/shiva/cmake/) +# Optional: a copy for Doxygen without touching the source tree +set(_shiva_gen_doc "${SHIVA_BINARY_DIR}/docs/doxygen") +file(MAKE_DIRECTORY "${_shiva_gen_doc}") +configure_file( "${SHIVA_SOURCE_DIR}/include/shiva/ShivaConfig.hpp.in" + "${_shiva_gen_doc}/ShivaConfig.hpp" ) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index cafe3dd..7fc55ec 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -69,6 +69,6 @@ macro(shiva_add_code_checks) if (ENABLE_COVERAGE) blt_add_code_coverage_target(NAME ${arg_PREFIX}_coverage RUNNER ctest -E 'blt_gtest_smoke|testCppCheck|testClangTidy|testUncrustifyCheck|testDoxygenCheck|testCppCheck|testClangTidy' - SOURCE_DIRECTORIES ${PROJECT_SOURCE_DIR}/src ) + SOURCE_DIRECTORIES ${PROJECT_SOURCE_DIR}/include ) endif() endmacro(shiva_add_code_checks) \ No newline at end of file diff --git a/cmake/ShivaConfig.cmake.in b/cmake/ShivaConfig.cmake.in new file mode 100644 index 0000000..5310614 --- /dev/null +++ b/cmake/ShivaConfig.cmake.in @@ -0,0 +1,12 @@ +# cmake/ShivaConfig.cmake.in +@PACKAGE_INIT@ # sets up PACKAGE_PREFIX_DIR etc. + +# If Shiva has installed-time deps, find them here (optional): +include(CMakeFindDependencyMacro) +# find_dependency(camp CONFIG) # uncomment if you install+use camp externally + +# Import the exported targets for this package +include("${CMAKE_CURRENT_LIST_DIR}/ShivaTargets.cmake") + +# (Optional) convenience vars +set(Shiva_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@") diff --git a/cmake/blt b/cmake/blt index 9ff7734..e783e30 160000 --- a/cmake/blt +++ b/cmake/blt @@ -1 +1 @@ -Subproject commit 9ff77344f0b2a6ee345e452bddd6bfd46cbbfa35 +Subproject commit e783e30f2823ee1a208f7f90741b41c1f5a08063 diff --git a/cmake/shiva-config.cmake.in b/cmake/shiva-config.cmake.in deleted file mode 100644 index b1cb6c3..0000000 --- a/cmake/shiva-config.cmake.in +++ /dev/null @@ -1,11 +0,0 @@ -if( NOT SHIVA_FOUND ) - include(${CMAKE_CURRENT_LIST_DIR}/../../../lib/cmake/shiva/shiva.cmake) - - - set(SHIVA_FOUND TRUE) - - # Export version number - set( SHIVA_VERSION_MAJOR @SHIVA_VERSION_MAJOR@ ) - set( SHIVA_VERSION_MINOR @SHIVA_VERSION_MINOR@ ) - set( SHIVA_VERSION_PATCHLEVEL @SHIVA_VERSION_PATCHLEVEL@ ) -endif() \ No newline at end of file diff --git a/docs/doxygen/ShivaConfig.hpp b/docs/doxygen/ShivaConfig.hpp index 8e64b01..b590b18 100644 --- a/docs/doxygen/ShivaConfig.hpp +++ b/docs/doxygen/ShivaConfig.hpp @@ -2,21 +2,21 @@ #pragma once -#define SHIVA_VERSION_MAJOR 0 +#define SHIVA_VERSION_MAJOR -#define SHIVA_VERSION_MINOR 1 +#define SHIVA_VERSION_MINOR -#define SHIVA_VERSION_PATCHLEVEL 0 +#define SHIVA_VERSION_PATCHLEVEL -/* #undef SHIVA_USE_CUDA */ +/* #undef SHIVA_ENABLE_CUDA */ -/* #undef SHIVA_USE_HIP */ +/* #undef SHIVA_ENABLE_HIP */ -/* #undef SHIVA_USE_CALIPER */ +/* #undef SHIVA_ENABLE_CALIPER */ -#define SHIVA_USE_CAMP +/* #undef SHIVA_ENABLE_CAMP */ -#define SHIVA_USE_BOUNDS_CHECK +/* #undef SHIVA_ENABLE_BOUNDS_CHECK */ -#define SHIVA_CUDA_MAJOR 0 -#define SHIVA_CUDA_MINOR 0 +#define SHIVA_CUDA_MAJOR +#define SHIVA_CUDA_MINOR diff --git a/hostconfigs/apple/macOS_base.cmake b/hostconfigs/apple/macOS_base.cmake index 50b7ab6..965b244 100644 --- a/hostconfigs/apple/macOS_base.cmake +++ b/hostconfigs/apple/macOS_base.cmake @@ -18,8 +18,6 @@ set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "" FORCE) set(ENABLE_CUDA "OFF" CACHE PATH "" FORCE) set(ENABLE_OPENMP "OFF" CACHE PATH "" FORCE) -set(ENABLE_CALIPER "OFF" CACHE PATH "" FORCE ) - set(ENABLE_DOXYGEN ON CACHE BOOL "" FORCE) set( DOXYGEN_EXECUTABLE "${HOMEBREW_DIR}/bin/doxygen" CACHE PATH "" FORCE) @@ -31,4 +29,6 @@ set( GCOV_EXECUTABLE "/usr/bin/gcov" CACHE PATH "" FORCE) set( LCOV_EXECUTABLE "${HOMEBREW_DIR}/bin/lcov" CACHE PATH "" FORCE) -set(SHIVA_BUILD_OBJ_LIBS ON CACHE BOOL "" FORCE) +set( SHIVA_ENABLE_BLT ON CACHE BOOL "" FORCE) +set( SHIVA_ENABLE_UNIT_TESTS ON CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_BOUNDS_CHECK ON CACHE BOOL "" FORCE) diff --git a/hostconfigs/environment.cmake b/hostconfigs/environment.cmake index 2a1b752..7e961f4 100644 --- a/hostconfigs/environment.cmake +++ b/hostconfigs/environment.cmake @@ -20,4 +20,8 @@ if(ENABLE_CUDA) set(CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc CACHE STRING "") set(CMAKE_CUDA_FLAGS "-restrict --expt-extended-lambda --expt-relaxed-constexpr -Werror cross-execution-space-call,reorder,deprecated-declarations" CACHE STRING "") -endif() \ No newline at end of file +endif() + +set( SHIVA_ENABLE_BLT ON CACHE BOOL "" FORCE) +set( SHIVA_ENABLE_UNIT_TESTS ON CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_BOUNDS_CHECK ON CACHE BOOL "" FORCE) diff --git a/src/.clang-format b/include/.clang-format similarity index 100% rename from src/.clang-format rename to include/.clang-format diff --git a/src/Shiva.hpp b/include/shiva/Shiva.hpp similarity index 100% rename from src/Shiva.hpp rename to include/shiva/Shiva.hpp diff --git a/src/ShivaConfig.hpp.in b/include/shiva/ShivaConfig.hpp.in similarity index 65% rename from src/ShivaConfig.hpp.in rename to include/shiva/ShivaConfig.hpp.in index 7103b82..f147792 100644 --- a/src/ShivaConfig.hpp.in +++ b/include/shiva/ShivaConfig.hpp.in @@ -8,15 +8,13 @@ #define SHIVA_VERSION_PATCHLEVEL @SHIVA_VERSION_PATCHLEVEL@ -#cmakedefine SHIVA_USE_CUDA +#cmakedefine SHIVA_ENABLE_CUDA -#cmakedefine SHIVA_USE_HIP +#cmakedefine SHIVA_ENABLE_HIP -#cmakedefine SHIVA_USE_CALIPER +#cmakedefine SHIVA_ENABLE_CAMP -#cmakedefine SHIVA_USE_CAMP - -#cmakedefine SHIVA_USE_BOUNDS_CHECK +#cmakedefine SHIVA_ENABLE_BOUNDS_CHECK #define SHIVA_CUDA_MAJOR @SHIVA_CUDA_MAJOR@ #define SHIVA_CUDA_MINOR @SHIVA_CUDA_MINOR@ diff --git a/src/common/CArray.hpp b/include/shiva/common/CArray.hpp similarity index 99% rename from src/common/CArray.hpp rename to include/shiva/common/CArray.hpp index 63204c9..d7cb7d5 100644 --- a/src/common/CArray.hpp +++ b/include/shiva/common/CArray.hpp @@ -19,7 +19,7 @@ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" #include "CArrayHelper.hpp" @@ -230,7 +230,7 @@ CArray< T, DATA_BUFFER, DIMS ... >::squareBracketOperatorHelper( index_type inde { static_assert( sizeof...(DIMS) >= 1, "operator[] is only valid for sizeof...(DIMS) >= 1" ); -#if defined( SHIVA_USE_BOUNDS_CHECK ) +#if defined( SHIVA_ENABLE_BOUNDS_CHECK ) constexpr int DIM = CArrayHelper::IntPeeler< DIMS... >::first; SHIVA_ASSERT_MSG( index >= 0 && index < DIM, "Index out of bounds: 0 < index(%jd) < dim(%jd)", diff --git a/src/common/CArrayHelper.hpp b/include/shiva/common/CArrayHelper.hpp similarity index 98% rename from src/common/CArrayHelper.hpp rename to include/shiva/common/CArrayHelper.hpp index 2529909..9ec7a1a 100644 --- a/src/common/CArrayHelper.hpp +++ b/include/shiva/common/CArrayHelper.hpp @@ -19,8 +19,8 @@ #pragma once -#include "common/ShivaErrorHandling.hpp" -#include "common/types.hpp" +#include "shiva/common/ShivaErrorHandling.hpp" +#include "shiva/common/types.hpp" #include #include #include @@ -113,7 +113,7 @@ struct linearIndexHelper static constexpr SHIVA_HOST_DEVICE SHIVA_FORCE_INLINE int level( INDEX_TYPE const index, INDICES_TYPE const ... indices ) { -#if defined( SHIVA_USE_BOUNDS_CHECK ) +#if defined( SHIVA_ENABLE_BOUNDS_CHECK ) SHIVA_ASSERT_MSG( index >= 0 && index < DIM, "Index out of bounds: 0 < index(%jd) < dim(%jd)", static_cast< intmax_t >( index ), diff --git a/src/common/IndexTypes.hpp b/include/shiva/common/IndexTypes.hpp similarity index 100% rename from src/common/IndexTypes.hpp rename to include/shiva/common/IndexTypes.hpp diff --git a/src/common/LinearIndex.hpp b/include/shiva/common/LinearIndex.hpp similarity index 100% rename from src/common/LinearIndex.hpp rename to include/shiva/common/LinearIndex.hpp diff --git a/src/common/MathUtilities.hpp b/include/shiva/common/MathUtilities.hpp similarity index 99% rename from src/common/MathUtilities.hpp rename to include/shiva/common/MathUtilities.hpp index 0d152ea..c9d1521 100644 --- a/src/common/MathUtilities.hpp +++ b/include/shiva/common/MathUtilities.hpp @@ -17,7 +17,7 @@ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" #include diff --git a/src/common/MultiIndex.hpp b/include/shiva/common/MultiIndex.hpp similarity index 98% rename from src/common/MultiIndex.hpp rename to include/shiva/common/MultiIndex.hpp index 72ba7ef..0826173 100644 --- a/src/common/MultiIndex.hpp +++ b/include/shiva/common/MultiIndex.hpp @@ -18,7 +18,7 @@ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" #include "SequenceUtilities.hpp" #include diff --git a/src/common/NestedSequenceUtilities.hpp b/include/shiva/common/NestedSequenceUtilities.hpp similarity index 98% rename from src/common/NestedSequenceUtilities.hpp rename to include/shiva/common/NestedSequenceUtilities.hpp index 03d6b7b..79b29a7 100644 --- a/src/common/NestedSequenceUtilities.hpp +++ b/include/shiva/common/NestedSequenceUtilities.hpp @@ -13,7 +13,7 @@ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" #include #include diff --git a/src/common/SequenceUtilities.hpp b/include/shiva/common/SequenceUtilities.hpp similarity index 99% rename from src/common/SequenceUtilities.hpp rename to include/shiva/common/SequenceUtilities.hpp index 6e8eeaa..02eeee4 100644 --- a/src/common/SequenceUtilities.hpp +++ b/include/shiva/common/SequenceUtilities.hpp @@ -18,7 +18,7 @@ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" #include #include diff --git a/src/common/ShivaErrorHandling.hpp b/include/shiva/common/ShivaErrorHandling.hpp similarity index 100% rename from src/common/ShivaErrorHandling.hpp rename to include/shiva/common/ShivaErrorHandling.hpp diff --git a/src/common/ShivaMacros.hpp b/include/shiva/common/ShivaMacros.hpp similarity index 96% rename from src/common/ShivaMacros.hpp rename to include/shiva/common/ShivaMacros.hpp index f8ddd3d..add0299 100644 --- a/src/common/ShivaMacros.hpp +++ b/include/shiva/common/ShivaMacros.hpp @@ -18,7 +18,7 @@ #pragma once -#include "ShivaConfig.hpp" +#include "shiva/ShivaConfig.hpp" #include #include @@ -26,13 +26,13 @@ #include #include -#if defined( SHIVA_USE_HIP ) +#if defined( SHIVA_ENABLE_HIP ) #include #endif -#if defined(SHIVA_USE_CUDA) || defined(SHIVA_USE_HIP) +#if defined(SHIVA_ENABLE_CUDA) || defined(SHIVA_ENABLE_HIP) /// This macro is used to indicate that the code is being compiled for device. -#define SHIVA_USE_DEVICE +#define SHIVA_ENABLE_DEVICE #endif #if defined( __CUDA_ARCH__ ) || defined( __HIP_DEVICE_COMPILE__ ) @@ -40,7 +40,7 @@ #endif -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) /// This macro is used to indicate that the code is being compiled for host /// execution. #define SHIVA_HOST __host__ diff --git a/src/common/pmpl.hpp b/include/shiva/common/pmpl.hpp similarity index 97% rename from src/common/pmpl.hpp rename to include/shiva/common/pmpl.hpp index eb8d3b8..a6f133e 100644 --- a/src/common/pmpl.hpp +++ b/include/shiva/common/pmpl.hpp @@ -27,8 +27,8 @@ #include namespace shiva { -#if defined(SHIVA_USE_DEVICE) -#if defined(SHIVA_USE_CUDA) +#if defined(SHIVA_ENABLE_DEVICE) +#if defined(SHIVA_ENABLE_CUDA) #define deviceMalloc( PTR, BYTES ) cudaMalloc( PTR, BYTES ); #define deviceMallocManaged( PTR, BYTES ) cudaMallocManaged( PTR, BYTES ); #define deviceDeviceSynchronize() cudaDeviceSynchronize(); @@ -38,7 +38,7 @@ namespace shiva #define deviceGetErrorString cudaGetErrorString #define deviceMemcpyDeviceToHost cudaMemcpyDeviceToHost constexpr cudaError_t deviceSuccess = cudaSuccess; -#elif defined(SHIVA_USE_HIP) +#elif defined(SHIVA_ENABLE_HIP) #define deviceMalloc( PTR, BYTES ) hipMalloc( PTR, BYTES ); #define deviceMallocManaged( PTR, BYTES ) hipMallocManaged( PTR, BYTES ); #define deviceDeviceSynchronize() hipDeviceSynchronize(); @@ -99,7 +99,7 @@ SHIVA_GLOBAL void genericKernel( LAMBDA func ) template< typename LAMBDA > void genericKernelWrapper( LAMBDA && func, bool const abortOnError = true ) { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) // UNCRUSTIFY-OFF genericKernel <<< 1, 1 >>> ( std::forward< LAMBDA >( func ) ); // UNCRUSTIFY-ON @@ -156,7 +156,7 @@ template< typename DATA_TYPE, typename LAMBDA > void genericKernelWrapper( int const N, DATA_TYPE * const hostData, LAMBDA && func, bool const abortOnError = true ) { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) DATA_TYPE * deviceData; deviceMalloc( &deviceData, N * sizeof(DATA_TYPE) ); deviceMemCpy( deviceData, hostData, N * sizeof(DATA_TYPE), cudaMemcpyHostToDevice ); @@ -192,7 +192,7 @@ void genericKernelWrapper( int const N, DATA_TYPE * const hostData, LAMBDA && fu template< typename DATA_TYPE > SHIVA_CONSTEXPR_HOSTDEVICE_FORCEINLINE void deallocateData( DATA_TYPE * data ) { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) deviceFree( data ); #else delete[] data; diff --git a/src/common/types.hpp b/include/shiva/common/types.hpp similarity index 94% rename from src/common/types.hpp rename to include/shiva/common/types.hpp index 9c1ce28..3db772f 100644 --- a/src/common/types.hpp +++ b/include/shiva/common/types.hpp @@ -17,14 +17,14 @@ */ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" /// @brief Macro to define whether or not to use camp. -#if defined(SHIVA_USE_CAMP) +#if defined(SHIVA_ENABLE_CAMP) #include #else -#if defined(SHIVA_USE_CUDA) +#if defined(SHIVA_ENABLE_CUDA) #include #else #include @@ -35,7 +35,7 @@ namespace shiva { -#if defined(SHIVA_USE_CAMP) +#if defined(SHIVA_ENABLE_CAMP) /** * @brief Wrapper for camp::tuple. @@ -59,7 +59,7 @@ make_tuple( T && ... t ) } #else -#if defined(SHIVA_USE_CUDA) +#if defined(SHIVA_ENABLE_CUDA) /** * @brief Wrapper for cuda::std::tuple. * @tparam T Types of the elements of the tuple. diff --git a/src/discretizations/finiteElementMethod/parentElements/ParentElement.hpp b/include/shiva/discretizations/finiteElementMethod/parentElements/ParentElement.hpp similarity index 96% rename from src/discretizations/finiteElementMethod/parentElements/ParentElement.hpp rename to include/shiva/discretizations/finiteElementMethod/parentElements/ParentElement.hpp index 9d4bdb1..20c8a99 100644 --- a/src/discretizations/finiteElementMethod/parentElements/ParentElement.hpp +++ b/include/shiva/discretizations/finiteElementMethod/parentElements/ParentElement.hpp @@ -13,11 +13,11 @@ #pragma once -#include "common/NestedSequenceUtilities.hpp" -#include "common/ShivaMacros.hpp" -#include "common/types.hpp" +#include "shiva/common/NestedSequenceUtilities.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/types.hpp" -#include "functions/bases/BasisProduct.hpp" +#include "shiva/functions/bases/BasisProduct.hpp" //#include diff --git a/src/functions/bases/BasisProduct.hpp b/include/shiva/functions/bases/BasisProduct.hpp similarity index 98% rename from src/functions/bases/BasisProduct.hpp rename to include/shiva/functions/bases/BasisProduct.hpp index 28f1075..2e19417 100644 --- a/src/functions/bases/BasisProduct.hpp +++ b/include/shiva/functions/bases/BasisProduct.hpp @@ -13,9 +13,9 @@ #pragma once -#include "common/NestedSequenceUtilities.hpp" -#include "common/MultiIndex.hpp" -#include "common/CArray.hpp" +#include "shiva/common/NestedSequenceUtilities.hpp" +#include "shiva/common/MultiIndex.hpp" +#include "shiva/common/CArray.hpp" namespace shiva { diff --git a/src/functions/bases/LagrangeBasis.hpp b/include/shiva/functions/bases/LagrangeBasis.hpp similarity index 98% rename from src/functions/bases/LagrangeBasis.hpp rename to include/shiva/functions/bases/LagrangeBasis.hpp index e18bb4a..9330885 100644 --- a/src/functions/bases/LagrangeBasis.hpp +++ b/include/shiva/functions/bases/LagrangeBasis.hpp @@ -18,8 +18,8 @@ #pragma once -#include "common/SequenceUtilities.hpp" -#include "common/ShivaMacros.hpp" +#include "shiva/common/SequenceUtilities.hpp" +#include "shiva/common/ShivaMacros.hpp" #include diff --git a/src/functions/quadrature/Quadrature.hpp b/include/shiva/functions/quadrature/Quadrature.hpp similarity index 100% rename from src/functions/quadrature/Quadrature.hpp rename to include/shiva/functions/quadrature/Quadrature.hpp diff --git a/src/functions/spacing/Spacing.hpp b/include/shiva/functions/spacing/Spacing.hpp similarity index 99% rename from src/functions/spacing/Spacing.hpp rename to include/shiva/functions/spacing/Spacing.hpp index de7c197..8f5ca29 100644 --- a/src/functions/spacing/Spacing.hpp +++ b/include/shiva/functions/spacing/Spacing.hpp @@ -18,7 +18,7 @@ #pragma once -#include "common/ShivaMacros.hpp" +#include "shiva/common/ShivaMacros.hpp" namespace shiva { diff --git a/src/geometry/mapping/JacobianTransforms.hpp b/include/shiva/geometry/mapping/JacobianTransforms.hpp similarity index 100% rename from src/geometry/mapping/JacobianTransforms.hpp rename to include/shiva/geometry/mapping/JacobianTransforms.hpp diff --git a/src/geometry/mapping/LinearTransform.hpp b/include/shiva/geometry/mapping/LinearTransform.hpp similarity index 97% rename from src/geometry/mapping/LinearTransform.hpp rename to include/shiva/geometry/mapping/LinearTransform.hpp index 7fde65f..63e78e3 100644 --- a/src/geometry/mapping/LinearTransform.hpp +++ b/include/shiva/geometry/mapping/LinearTransform.hpp @@ -18,12 +18,12 @@ #pragma once -#include "common/MathUtilities.hpp" -#include "common/ShivaMacros.hpp" -#include "common/types.hpp" -#include "common/IndexTypes.hpp" -#include "common/NestedSequenceUtilities.hpp" -#include "common/CArray.hpp" +#include "shiva/common/MathUtilities.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/types.hpp" +#include "shiva/common/IndexTypes.hpp" +#include "shiva/common/NestedSequenceUtilities.hpp" +#include "shiva/common/CArray.hpp" /** * namespace to encapsulate all shiva code diff --git a/src/geometry/mapping/Scaling.hpp b/include/shiva/geometry/mapping/Scaling.hpp similarity index 97% rename from src/geometry/mapping/Scaling.hpp rename to include/shiva/geometry/mapping/Scaling.hpp index d9a4e47..0cbccfe 100644 --- a/src/geometry/mapping/Scaling.hpp +++ b/include/shiva/geometry/mapping/Scaling.hpp @@ -17,9 +17,9 @@ #pragma once -#include "common/ShivaMacros.hpp" -#include "common/types.hpp" -#include "common/CArray.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/types.hpp" +#include "shiva/common/CArray.hpp" namespace shiva { diff --git a/src/geometry/mapping/UniformScaling.hpp b/include/shiva/geometry/mapping/UniformScaling.hpp similarity index 96% rename from src/geometry/mapping/UniformScaling.hpp rename to include/shiva/geometry/mapping/UniformScaling.hpp index 5b69dcb..72d25d4 100644 --- a/src/geometry/mapping/UniformScaling.hpp +++ b/include/shiva/geometry/mapping/UniformScaling.hpp @@ -17,10 +17,10 @@ #pragma once -#include "common/ShivaMacros.hpp" -#include "common/IndexTypes.hpp" -#include "common/types.hpp" -#include "common/CArray.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/IndexTypes.hpp" +#include "shiva/common/types.hpp" +#include "shiva/common/CArray.hpp" namespace shiva { diff --git a/src/geometry/shapes/InterpolatedShape.hpp b/include/shiva/geometry/shapes/InterpolatedShape.hpp similarity index 95% rename from src/geometry/shapes/InterpolatedShape.hpp rename to include/shiva/geometry/shapes/InterpolatedShape.hpp index 28afddb..e4c82f7 100644 --- a/src/geometry/shapes/InterpolatedShape.hpp +++ b/include/shiva/geometry/shapes/InterpolatedShape.hpp @@ -13,11 +13,10 @@ #pragma once -#include "common/SequenceUtilities.hpp" -#include "common/ShivaMacros.hpp" -#include "common/types.hpp" - -#include "functions/bases/BasisProduct.hpp" +#include "shiva/common/SequenceUtilities.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/types.hpp" +#include "shiva/functions/bases/BasisProduct.hpp" #include diff --git a/src/geometry/shapes/NCube.hpp b/include/shiva/geometry/shapes/NCube.hpp similarity index 97% rename from src/geometry/shapes/NCube.hpp rename to include/shiva/geometry/shapes/NCube.hpp index cd891c8..dc1b370 100644 --- a/src/geometry/shapes/NCube.hpp +++ b/include/shiva/geometry/shapes/NCube.hpp @@ -17,10 +17,10 @@ #pragma once -#include "common/ShivaMacros.hpp" -#include "common/IndexTypes.hpp" -#include "common/types.hpp" -#include "common/MathUtilities.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/IndexTypes.hpp" +#include "shiva/common/types.hpp" +#include "shiva/common/MathUtilities.hpp" namespace shiva { diff --git a/src/geometry/shapes/NSimplex.hpp b/include/shiva/geometry/shapes/NSimplex.hpp similarity index 97% rename from src/geometry/shapes/NSimplex.hpp rename to include/shiva/geometry/shapes/NSimplex.hpp index 4df2fa7..5fec076 100644 --- a/src/geometry/shapes/NSimplex.hpp +++ b/include/shiva/geometry/shapes/NSimplex.hpp @@ -17,10 +17,10 @@ #pragma once -#include "common/ShivaMacros.hpp" -#include "common/IndexTypes.hpp" -#include "common/types.hpp" -#include "common/MathUtilities.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/IndexTypes.hpp" +#include "shiva/common/types.hpp" +#include "shiva/common/MathUtilities.hpp" namespace shiva { diff --git a/src/namespaceDocumentation.hpp b/include/shiva/namespaceDocumentation.hpp similarity index 100% rename from src/namespaceDocumentation.hpp rename to include/shiva/namespaceDocumentation.hpp diff --git a/src/uncrustify.cfg b/include/uncrustify.cfg similarity index 100% rename from src/uncrustify.cfg rename to include/uncrustify.cfg diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index b680057..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ - -set( shiva_headers - Shiva.hpp - ) - -set( shiva_sources - ) - -set( shiva_dependencies - geometry - ) - -add_subdirectory( common ) -add_subdirectory( functions ) -add_subdirectory( discretizations ) -add_subdirectory( geometry ) - -blt_add_library( NAME shiva -# SOURCES ${shiva_sources} - HEADERS ${shiva_headers} - DEPENDS_ON ${shiva_dependencies} - ) - -target_include_directories( shiva - INTERFACE - $ - $ - $ ) - -install( FILES ${shiva_headers} - DESTINATION include ) - - -install( TARGETS shiva - EXPORT shiva - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib ) - -install( EXPORT shiva - DESTINATION lib/cmake/shiva ) - -shiva_add_code_checks( PREFIX shiva - EXCLUDES "blt/*" ) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt deleted file mode 100644 index bc450a1..0000000 --- a/src/common/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ - -set( common_headers - CArray.hpp - CArrayHelper.hpp - IndexTypes.hpp - LinearIndex.hpp - MathUtilities.hpp - MultiIndex.hpp - pmpl.hpp - SequenceUtilities.hpp - NestedSequenceUtilities.hpp - ShivaErrorHandling.hpp - ShivaMacros.hpp - types.hpp - ) - -set( common_sources - ) - -if( ENABLE_HIP ) - list( APPEND common_dependencies blt::hip camp ) -endif() - -if( ENABLE_CUDA ) - list( APPEND common_dependencies cuda ) -endif() - -blt_add_library( NAME common -# SOURCES ${common_sources} - HEADERS ${common_headers} - DEPENDS_ON ${common_dependencies} - ) - - - -target_include_directories( common - INTERFACE - $ - $ - $ ) - -target_include_directories( common - SYSTEM INTERFACE - $ - $ ) - -install( FILES ${common_headers} - DESTINATION include/common ) - -install( TARGETS common - EXPORT shiva - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib ) - -if( SHIVA_ENABLE_UNIT_TESTS ) - add_subdirectory( unitTests ) -endif() \ No newline at end of file diff --git a/src/discretizations/CMakeLists.txt b/src/discretizations/CMakeLists.txt deleted file mode 100644 index 03e3c80..0000000 --- a/src/discretizations/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ - -set( discretizations_headers - finiteElementMethod/parentElements/ParentElement.hpp - ) - -set( discretizations_sources - ) - -set( discretizations_dependencies - common - functions - ) - -blt_add_library( NAME discretizations -# SOURCES ${discretizations_sources} - HEADERS ${discretizations_headers} - DEPENDS_ON ${discretizations_dependencies} - ) - -install( FILES ${discretizations_headers} - DESTINATION include/discretizations ) - -install( TARGETS discretizations - EXPORT shiva - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib ) - -if( SHIVA_ENABLE_UNIT_TESTS ) - add_subdirectory( unitTests ) -endif() \ No newline at end of file diff --git a/src/functions/CMakeLists.txt b/src/functions/CMakeLists.txt deleted file mode 100644 index 0c4c2ff..0000000 --- a/src/functions/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ - -set( functions_headers - bases/BasisProduct.hpp - bases/LagrangeBasis.hpp - quadrature/Quadrature.hpp - spacing/Spacing.hpp - ) - -set( functions_sources - ) - -set( functions_dependencies - common - ) - -blt_add_library( NAME functions -# SOURCES ${functions_sources} - HEADERS ${functions_headers} - DEPENDS_ON ${functions_dependencies} - ) - -foreach( _header ${functions_headers} ) - get_filename_component( _header_dir ${_header} DIRECTORY ) - install( FILES ${_header} - DESTINATION include/functions/${_header_dir} ) -endforeach() - -install( TARGETS functions - EXPORT shiva - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib ) - - -if( SHIVA_ENABLE_UNIT_TESTS ) - add_subdirectory( unitTests ) -endif() \ No newline at end of file diff --git a/src/geometry/CMakeLists.txt b/src/geometry/CMakeLists.txt deleted file mode 100644 index 31a2380..0000000 --- a/src/geometry/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ - -set( geometry_headers - mapping/JacobianTransforms.hpp - mapping/LinearTransform.hpp - mapping/Scaling.hpp - mapping/UniformScaling.hpp - shapes/InterpolatedShape.hpp - shapes/NCube.hpp - shapes/NSimplex.hpp - ) - -set( geometry_sources - ) - -set( geometry_dependencies - common - ) - - -blt_add_library( NAME geometry -# SOURCES ${geometry_sources} - HEADERS ${geometry_headers} - DEPENDS_ON ${geometry_dependencies} - ) - -foreach( _header ${geometry_headers} ) - get_filename_component( _header_dir ${_header} DIRECTORY ) - install( FILES ${_header} - DESTINATION include/geometry/${_header_dir} ) -endforeach() - -# install( FILES ${geometry_headers} -# DESTINATION include/geometry ) - -install( TARGETS geometry - EXPORT shiva - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib ) - - -if( SHIVA_ENABLE_UNIT_TESTS ) - add_subdirectory( mapping/unitTests ) - add_subdirectory( shapes/unitTests ) -endif() \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..f8c83ad --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.23.1) + +# Define only when BLT is loaded and tests are enabled +# (guard this in your tests/CMakeLists.txt or top-level) +# require: blt_add_executable, blt_add_test, and Shiva target + +# Default output dir if you didn't set one elsewhere +if(NOT DEFINED TEST_OUTPUT_DIRECTORY) + set(TEST_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tests") +endif() + +# Default output dir (optional) +if(NOT DEFINED TEST_OUTPUT_DIRECTORY) + set(TEST_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tests") +endif() + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -Wpedantic -pedantic-errors -Wshadow -Wfloat-equal -Wcast-align -Wcast-qual" ) + +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # For Clang or AppleClang + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstandalone-debug" ) +endif() + + +macro(shiva_add_gtest) + set(options) + set(oneValueArgs NAME) + set(multiValueArgs SOURCES HEADERS DEPENDS_ON) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ARG_NAME) + message(FATAL_ERROR "shiva_add_gtest: NAME is required") + endif() + if(NOT ARG_SOURCES) + message(FATAL_ERROR "shiva_add_gtest(${ARG_NAME}): SOURCES is required") + endif() + + # Base deps: always link Shiva (propagates include paths + interface defs) + set(_deps Shiva gtest) + + # User-specified extras + if(ARG_DEPENDS_ON) + list(APPEND _deps ${ARG_DEPENDS_ON}) + endif() + + # Turn on toolchain deps as available in BLT + if(ENABLE_CUDA) + list(APPEND _deps cuda) + endif() + if(ENABLE_HIP) + # BLT usually exposes blt::hip; fallback to 'hip' if that’s your setup + if(TARGET blt::hip) + list(APPEND _deps blt::hip) + else() + list(APPEND _deps hip) + endif() + endif() + + blt_add_executable( + NAME ${ARG_NAME} + SOURCES ${ARG_SOURCES} + HEADERS ${ARG_HEADERS} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${_deps} + ) + + blt_add_test(NAME ${ARG_NAME} COMMAND ${ARG_NAME}) +endmacro() + + +shiva_add_gtest( NAME shiva_test_carray SOURCES common/testCArray.cpp ) +shiva_add_gtest( NAME shiva_test_index_types SOURCES common/testIndexTypes.cpp ) +shiva_add_gtest( NAME shiva_test_nested_seq_utils SOURCES common/testNestedSequenceUtilities.cpp ) +shiva_add_gtest( NAME shiva_test_seq_utils SOURCES common/testSequenceUtilities.cpp ) +shiva_add_gtest( NAME shiva_test_err_handling SOURCES common/testShivaErrorHandling.cpp ) + +shiva_add_gtest( NAME shiva_test_parent_element SOURCES discretizations/finiteElementMethod/testParentElement.cpp ) + +shiva_add_gtest( NAME shiva_test_lagrange_basis SOURCES functions/testLagrangeBasis.cpp ) +shiva_add_gtest( NAME shiva_test_quadrature SOURCES functions/testQuadrature.cpp ) +shiva_add_gtest( NAME shiva_test_spacing SOURCES functions/testSpacing.cpp ) + +shiva_add_gtest( NAME shiva_test_linear_transform SOURCES geometry/mapping/testLinearTransform.cpp ) +shiva_add_gtest( NAME shiva_test_scaling SOURCES geometry/mapping/testScaling.cpp ) +shiva_add_gtest( NAME shiva_test_uniform_scaling SOURCES geometry/mapping/testUniformScaling.cpp ) +shiva_add_gtest( NAME shiva_test_interpolated SOURCES geometry/shapes/testInterpolatedShape.cpp ) +shiva_add_gtest( NAME shiva_test_ncube SOURCES geometry/shapes/testNCube.cpp ) +shiva_add_gtest( NAME shiva_test_nsimplex SOURCES geometry/shapes/testNSimplex.cpp ) + +# --- CUDA variants (only built when CUDA is enabled by parent or standalone) --- +# Example: add CUDA-only tests or CUDA-flavored versions: +# shiva_add_cuda_test(shiva_test_carray_cuda common/testCArrayCuda.cu) diff --git a/src/common/unitTests/CMakeLists.txt b/tests/common/CMakeLists.txt similarity index 100% rename from src/common/unitTests/CMakeLists.txt rename to tests/common/CMakeLists.txt diff --git a/src/common/unitTests/testCArray.cpp b/tests/common/testCArray.cpp similarity index 96% rename from src/common/unitTests/testCArray.cpp rename to tests/common/testCArray.cpp index 9f7ea7d..739048c 100644 --- a/src/common/unitTests/testCArray.cpp +++ b/tests/common/testCArray.cpp @@ -12,10 +12,9 @@ */ -#include "../CArray.hpp" - -#include "../SequenceUtilities.hpp" -#include "common/pmpl.hpp" +#include "shiva/common/CArray.hpp" +#include "shiva/common/SequenceUtilities.hpp" +#include "shiva/common/pmpl.hpp" #include @@ -133,7 +132,7 @@ TEST( testCArray, testStrides ) testStridesHelper(); } -#if !defined( SHIVA_USE_BOUNDS_CHECK ) || !defined(SHIVA_USE_DEVICE) +#if !defined( SHIVA_ENABLE_BOUNDS_CHECK ) || !defined(SHIVA_ENABLE_DEVICE) void testLinearIndexCT() { pmpl::genericKernelWrapper( [] SHIVA_DEVICE () @@ -193,13 +192,13 @@ void testLinearIndexRT() TEST( testCArray, testLinearIndex ) { -#if !defined( SHIVA_USE_BOUNDS_CHECK ) || !defined(SHIVA_USE_DEVICE) +#if !defined( SHIVA_ENABLE_BOUNDS_CHECK ) || !defined(SHIVA_ENABLE_DEVICE) testLinearIndexCT(); #endif testLinearIndexRT(); } -#if !defined( SHIVA_USE_BOUNDS_CHECK ) || !defined(SHIVA_USE_DEVICE) +#if !defined( SHIVA_ENABLE_BOUNDS_CHECK ) || !defined(SHIVA_ENABLE_DEVICE) void testParenthesesOperatorCT() { using Array = TestCArrayHelper::Array3d; @@ -265,7 +264,7 @@ void testParenthesesOperatorRT() } TEST( testCArray, testParenthesesOperator ) { -#if !defined( SHIVA_USE_BOUNDS_CHECK ) || !defined(SHIVA_USE_DEVICE) +#if !defined( SHIVA_ENABLE_BOUNDS_CHECK ) || !defined(SHIVA_ENABLE_DEVICE) testParenthesesOperatorCT(); #endif testParenthesesOperatorRT(); diff --git a/src/common/unitTests/testIndexTypes.cpp b/tests/common/testIndexTypes.cpp similarity index 97% rename from src/common/unitTests/testIndexTypes.cpp rename to tests/common/testIndexTypes.cpp index 9b39004..0bd3da2 100644 --- a/src/common/unitTests/testIndexTypes.cpp +++ b/tests/common/testIndexTypes.cpp @@ -12,8 +12,8 @@ */ -#include "../IndexTypes.hpp" -#include "common/pmpl.hpp" +#include "shiva/common/IndexTypes.hpp" +#include "shiva/common/pmpl.hpp" #include diff --git a/src/common/unitTests/testNestedSequenceUtilities.cpp b/tests/common/testNestedSequenceUtilities.cpp similarity index 96% rename from src/common/unitTests/testNestedSequenceUtilities.cpp rename to tests/common/testNestedSequenceUtilities.cpp index 5539bdd..fc51356 100644 --- a/src/common/unitTests/testNestedSequenceUtilities.cpp +++ b/tests/common/testNestedSequenceUtilities.cpp @@ -12,8 +12,8 @@ */ -#include "../NestedSequenceUtilities.hpp" -#include "common/pmpl.hpp" +#include "shiva/common/NestedSequenceUtilities.hpp" +#include "shiva/common/pmpl.hpp" #include @@ -37,7 +37,7 @@ SHIVA_GLOBAL void testSequenceExpansionHelper( FUNC func ) template< typename FUNC > void kernelLaunch( FUNC && func ) { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) testSequenceExpansionHelper << < 1, 1 >> > ( std::forward< FUNC >( func ) ); #else testSequenceExpansionHelper( std::forward< FUNC >( func ) ); diff --git a/src/common/unitTests/testSequenceUtilities.cpp b/tests/common/testSequenceUtilities.cpp similarity index 97% rename from src/common/unitTests/testSequenceUtilities.cpp rename to tests/common/testSequenceUtilities.cpp index 7764e96..c0a6ae1 100644 --- a/src/common/unitTests/testSequenceUtilities.cpp +++ b/tests/common/testSequenceUtilities.cpp @@ -12,8 +12,8 @@ */ -#include "../SequenceUtilities.hpp" -#include "common/pmpl.hpp" +#include "shiva/common/SequenceUtilities.hpp" +#include "shiva/common/pmpl.hpp" #include @@ -35,7 +35,7 @@ SHIVA_GLOBAL void testSequenceExpansionHelper( FUNC func ) template< typename FUNC > void kernelLaunch( FUNC && func ) { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) testSequenceExpansionHelper << < 1, 1 >> > ( std::forward< FUNC >( func ) ); #else testSequenceExpansionHelper( std::forward< FUNC >( func ) ); diff --git a/src/common/unitTests/testShivaErrorHandling.cpp b/tests/common/testShivaErrorHandling.cpp similarity index 94% rename from src/common/unitTests/testShivaErrorHandling.cpp rename to tests/common/testShivaErrorHandling.cpp index 43146f3..604c27b 100644 --- a/src/common/unitTests/testShivaErrorHandling.cpp +++ b/tests/common/testShivaErrorHandling.cpp @@ -12,8 +12,8 @@ */ -#include "../ShivaErrorHandling.hpp" -#include "../pmpl.hpp" +#include "shiva/common/ShivaErrorHandling.hpp" +#include "shiva/common/pmpl.hpp" #include diff --git a/src/discretizations/unitTests/CMakeLists.txt b/tests/discretizations/finiteElementMethod/CMakeLists.txt similarity index 100% rename from src/discretizations/unitTests/CMakeLists.txt rename to tests/discretizations/finiteElementMethod/CMakeLists.txt diff --git a/src/discretizations/unitTests/testParentElement.cpp b/tests/discretizations/finiteElementMethod/testParentElement.cpp similarity index 97% rename from src/discretizations/unitTests/testParentElement.cpp rename to tests/discretizations/finiteElementMethod/testParentElement.cpp index 72ce6c5..9931904 100644 --- a/src/discretizations/unitTests/testParentElement.cpp +++ b/tests/discretizations/finiteElementMethod/testParentElement.cpp @@ -12,12 +12,12 @@ */ -#include "../finiteElementMethod/parentElements/ParentElement.hpp" -#include "functions/bases/LagrangeBasis.hpp" -#include "functions/spacing/Spacing.hpp" -#include "geometry/shapes/NCube.hpp" -#include "common/ShivaMacros.hpp" -#include "common/pmpl.hpp" +#include "shiva/discretizations/finiteElementMethod/parentElements/ParentElement.hpp" +#include "shiva/functions/bases/LagrangeBasis.hpp" +#include "shiva/functions/spacing/Spacing.hpp" +#include "shiva/geometry/shapes/NCube.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/pmpl.hpp" @@ -132,7 +132,7 @@ SHIVA_GLOBAL void compileTimeKernel() template< typename TEST_PARENT_ELEMENT_HELPER > void testParentElementAtCompileTime() { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) compileTimeKernel< TEST_PARENT_ELEMENT_HELPER ><< < 1, 1 >> > (); #else compileTimeKernel< TEST_PARENT_ELEMENT_HELPER >(); @@ -169,7 +169,7 @@ void testParentElementAtRunTime() fieldValues.data()[i] = TEST_PARENT_ELEMENT_HELPER::fieldValues.data()[i]; } -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) constexpr int bytes = sizeof(double); double * value; double * gradient; diff --git a/src/functions/unitTests/CMakeLists.txt b/tests/functions/CMakeLists.txt similarity index 100% rename from src/functions/unitTests/CMakeLists.txt rename to tests/functions/CMakeLists.txt diff --git a/src/functions/unitTests/testLagrangeBasis.cpp b/tests/functions/testLagrangeBasis.cpp similarity index 94% rename from src/functions/unitTests/testLagrangeBasis.cpp rename to tests/functions/testLagrangeBasis.cpp index 4c875a8..07fcb4e 100644 --- a/src/functions/unitTests/testLagrangeBasis.cpp +++ b/tests/functions/testLagrangeBasis.cpp @@ -12,11 +12,11 @@ */ -#include "../bases/LagrangeBasis.hpp" -#include "../spacing/Spacing.hpp" -#include "../../common/ShivaMacros.hpp" -#include "common/pmpl.hpp" -#include "common/types.hpp" +#include "shiva/functions/bases/LagrangeBasis.hpp" +#include "shiva/functions/spacing/Spacing.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/pmpl.hpp" +#include "shiva/common/types.hpp" #include #include @@ -70,7 +70,7 @@ SHIVA_GLOBAL void compileTimeKernel() template< typename BASIS_HELPER_TYPE > void testBasisAtCompileTime() { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) compileTimeKernel< BASIS_HELPER_TYPE ><< < 1, 1 >> > (); #else compileTimeKernel< BASIS_HELPER_TYPE >(); @@ -99,7 +99,7 @@ void testBasisAtRunTime() { constexpr int order = BASIS_HELPER_TYPE::order; constexpr int N = order + 1; -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) constexpr int bytes = N * sizeof(double); double * values; double * gradients; @@ -120,7 +120,7 @@ void testBasisAtRunTime() EXPECT_NEAR( gradients[a], BASIS_HELPER_TYPE::refGradients[a], fabs( BASIS_HELPER_TYPE::refGradients[a] * tolerance ) ); } -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) deviceFree( values ); deviceFree( gradients ); #endif diff --git a/src/functions/unitTests/testQuadrature.cpp b/tests/functions/testQuadrature.cpp similarity index 99% rename from src/functions/unitTests/testQuadrature.cpp rename to tests/functions/testQuadrature.cpp index 8fe6356..4f44d34 100644 --- a/src/functions/unitTests/testQuadrature.cpp +++ b/tests/functions/testQuadrature.cpp @@ -12,7 +12,7 @@ */ -#include "../quadrature/Quadrature.hpp" +#include "shiva/functions/quadrature/Quadrature.hpp" #include #include diff --git a/src/functions/unitTests/testSpacing.cpp b/tests/functions/testSpacing.cpp similarity index 96% rename from src/functions/unitTests/testSpacing.cpp rename to tests/functions/testSpacing.cpp index 738924d..59f81ac 100644 --- a/src/functions/unitTests/testSpacing.cpp +++ b/tests/functions/testSpacing.cpp @@ -13,9 +13,9 @@ -#include "../spacing/Spacing.hpp" -#include "common/SequenceUtilities.hpp" -#include "common/pmpl.hpp" +#include "shiva/functions/spacing/Spacing.hpp" +#include "shiva/common/SequenceUtilities.hpp" +#include "shiva/common/pmpl.hpp" #include #include @@ -122,7 +122,7 @@ void testSpacingValuesAtRuntime() using SpacingType = SPACING< REAL_TYPE, N >; using Ref = ReferenceSolution< SpacingType >; -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) constexpr int bytes = N * sizeof(REAL_TYPE); REAL_TYPE *values; deviceMallocManaged( &values, bytes ); @@ -138,7 +138,7 @@ void testSpacingValuesAtRuntime() EXPECT_NEAR( values[a], Ref::coords[a], 1e-14 ); } -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) deviceFree( values ); #endif } @@ -162,7 +162,7 @@ SHIVA_GLOBAL void compileTimeValuesKernel( std::index_sequence< I... > ) template< template< typename, int > typename SPACING, typename REAL_TYPE, typename INDEX_SEQUENCE > void testSpacingValuesAtCompileTime( INDEX_SEQUENCE iSeq ) { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) compileTimeValuesKernel< SPACING, REAL_TYPE ><< < 1, 1 >> > ( iSeq ); #else compileTimeValuesKernel< SPACING, REAL_TYPE >( iSeq ); diff --git a/src/geometry/mapping/unitTests/CMakeLists.txt b/tests/geometry/mapping/CMakeLists.txt similarity index 100% rename from src/geometry/mapping/unitTests/CMakeLists.txt rename to tests/geometry/mapping/CMakeLists.txt diff --git a/src/geometry/mapping/unitTests/LinearTransformSolutions.nb b/tests/geometry/mapping/LinearTransformSolutions.nb similarity index 100% rename from src/geometry/mapping/unitTests/LinearTransformSolutions.nb rename to tests/geometry/mapping/LinearTransformSolutions.nb diff --git a/src/geometry/mapping/unitTests/testGeometryHelpers.hpp b/tests/geometry/mapping/testGeometryHelpers.hpp similarity index 100% rename from src/geometry/mapping/unitTests/testGeometryHelpers.hpp rename to tests/geometry/mapping/testGeometryHelpers.hpp diff --git a/src/geometry/mapping/unitTests/testLinearTransform.cpp b/tests/geometry/mapping/testLinearTransform.cpp similarity index 96% rename from src/geometry/mapping/unitTests/testLinearTransform.cpp rename to tests/geometry/mapping/testLinearTransform.cpp index 5a575bf..4c8aa5c 100644 --- a/src/geometry/mapping/unitTests/testLinearTransform.cpp +++ b/tests/geometry/mapping/testLinearTransform.cpp @@ -12,15 +12,15 @@ */ -#include "geometry/shapes/NCube.hpp" -#include "../LinearTransform.hpp" -#include "../JacobianTransforms.hpp" -#include "functions/bases/LagrangeBasis.hpp" -#include "functions/spacing/Spacing.hpp" -#include "geometry/shapes/InterpolatedShape.hpp" +#include "shiva/geometry/shapes/NCube.hpp" +#include "shiva/geometry/mapping/LinearTransform.hpp" +#include "shiva/geometry/mapping/JacobianTransforms.hpp" +#include "shiva/functions/bases/LagrangeBasis.hpp" +#include "shiva/functions/spacing/Spacing.hpp" +#include "shiva/geometry/shapes/InterpolatedShape.hpp" -#include "common/pmpl.hpp" +#include "shiva/common/pmpl.hpp" #include @@ -305,7 +305,7 @@ void testInvJacobianFunctionReturnByValueHelper() auto cell = makeLinearTransform( Xref ); for ( int q = 0; q < 8; ++q ) { -#if defined(SHIVA_USE_CUDA) && SHIVA_CUDA_MAJOR < 12 +#if defined(SHIVA_ENABLE_CUDA) && SHIVA_CUDA_MAJOR < 12 auto tmp = inverseJacobian( cell, qCoords[q] ); auto detJ = shiva::get< 0 >( tmp ); auto invJ = shiva::get< 1 >( tmp ); diff --git a/src/geometry/mapping/unitTests/testScaling.cpp b/tests/geometry/mapping/testScaling.cpp similarity index 95% rename from src/geometry/mapping/unitTests/testScaling.cpp rename to tests/geometry/mapping/testScaling.cpp index b83bbb2..4f14fc9 100644 --- a/src/geometry/mapping/unitTests/testScaling.cpp +++ b/tests/geometry/mapping/testScaling.cpp @@ -12,9 +12,9 @@ */ -#include "../Scaling.hpp" -#include "../JacobianTransforms.hpp" -#include "common/pmpl.hpp" +#include "shiva/geometry/mapping/Scaling.hpp" +#include "shiva/geometry/mapping/JacobianTransforms.hpp" +#include "shiva/common/pmpl.hpp" #include @@ -143,7 +143,7 @@ void testInvJacobianFunctionReturnByValueHelper() { auto cell = makeScaling( h ); -#if defined(SHIVA_USE_CUDA) && SHIVA_CUDA_MAJOR < 12 +#if defined(SHIVA_ENABLE_CUDA) && SHIVA_CUDA_MAJOR < 12 auto tmp = inverseJacobian( cell ); auto detJ = shiva::get< 0 >( tmp ); auto invJ = shiva::get< 1 >( tmp ); diff --git a/src/geometry/mapping/unitTests/testUniformScaling.cpp b/tests/geometry/mapping/testUniformScaling.cpp similarity index 93% rename from src/geometry/mapping/unitTests/testUniformScaling.cpp rename to tests/geometry/mapping/testUniformScaling.cpp index 543ae70..ead9f57 100644 --- a/src/geometry/mapping/unitTests/testUniformScaling.cpp +++ b/tests/geometry/mapping/testUniformScaling.cpp @@ -12,9 +12,9 @@ */ -#include "../UniformScaling.hpp" -#include "../JacobianTransforms.hpp" -#include "common/pmpl.hpp" +#include "shiva/geometry/mapping/UniformScaling.hpp" +#include "shiva/geometry/mapping/JacobianTransforms.hpp" +#include "shiva/common/pmpl.hpp" #include @@ -100,7 +100,7 @@ TEST( testUniformScaling, testInvJacobianFunctionReturnByValue ) auto cell = makeUniformScaling( h ); // libcudacxx in CUDA 11 lacks SB support for cuda::std::tuple -#if defined(SHIVA_USE_CUDA) && SHIVA_CUDA_MAJOR < 12 +#if defined(SHIVA_ENABLE_CUDA) && SHIVA_CUDA_MAJOR < 12 auto tmp = inverseJacobian( cell ); auto detJ = shiva::get< 0 >( tmp ); auto invJ = shiva::get< 1 >( tmp ); diff --git a/src/geometry/shapes/unitTests/CMakeLists.txt b/tests/geometry/shapes/CMakeLists.txt similarity index 100% rename from src/geometry/shapes/unitTests/CMakeLists.txt rename to tests/geometry/shapes/CMakeLists.txt diff --git a/src/geometry/shapes/unitTests/testInterpolatedShape.cpp b/tests/geometry/shapes/testInterpolatedShape.cpp similarity index 95% rename from src/geometry/shapes/unitTests/testInterpolatedShape.cpp rename to tests/geometry/shapes/testInterpolatedShape.cpp index 83dbbaa..c1e6cd1 100644 --- a/src/geometry/shapes/unitTests/testInterpolatedShape.cpp +++ b/tests/geometry/shapes/testInterpolatedShape.cpp @@ -12,12 +12,12 @@ */ -#include "../InterpolatedShape.hpp" -#include "functions/bases/LagrangeBasis.hpp" -#include "functions/spacing/Spacing.hpp" -#include "geometry/shapes/NCube.hpp" -#include "common/ShivaMacros.hpp" -#include "common/pmpl.hpp" +#include "shiva/geometry/shapes/InterpolatedShape.hpp" +#include "shiva/functions/bases/LagrangeBasis.hpp" +#include "shiva/functions/spacing/Spacing.hpp" +#include "shiva/geometry/shapes/NCube.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/pmpl.hpp" @@ -69,7 +69,7 @@ SHIVA_GLOBAL void compileTimeKernel() template< typename TEST_INTERPOLATED_SHAPE_HELPER > void testInterpolatedShapeAtCompileTime() { -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) compileTimeKernel< TEST_INTERPOLATED_SHAPE_HELPER ><< < 1, 1 >> > (); #else compileTimeKernel< TEST_INTERPOLATED_SHAPE_HELPER >(); @@ -117,7 +117,7 @@ void testInterpolatedShapeAtRunTime() constexpr int order = TEST_INTERPOLATED_SHAPE_HELPER::order; constexpr int N = order + 1; -#if defined(SHIVA_USE_DEVICE) +#if defined(SHIVA_ENABLE_DEVICE) constexpr int bytes = N * N * N * sizeof(double); double * values; double * gradients; diff --git a/src/geometry/shapes/unitTests/testInterpolatedShapeSolutions.hpp b/tests/geometry/shapes/testInterpolatedShapeSolutions.hpp similarity index 100% rename from src/geometry/shapes/unitTests/testInterpolatedShapeSolutions.hpp rename to tests/geometry/shapes/testInterpolatedShapeSolutions.hpp diff --git a/src/geometry/shapes/unitTests/testNCube.cpp b/tests/geometry/shapes/testNCube.cpp similarity index 98% rename from src/geometry/shapes/unitTests/testNCube.cpp rename to tests/geometry/shapes/testNCube.cpp index 9c7ecc5..afcde80 100644 --- a/src/geometry/shapes/unitTests/testNCube.cpp +++ b/tests/geometry/shapes/testNCube.cpp @@ -12,8 +12,8 @@ */ -#include "../NCube.hpp" -#include "common/pmpl.hpp" +#include "shiva/geometry/shapes/NCube.hpp" +#include "shiva/common/pmpl.hpp" #include diff --git a/src/geometry/shapes/unitTests/testNSimplex.cpp b/tests/geometry/shapes/testNSimplex.cpp similarity index 98% rename from src/geometry/shapes/unitTests/testNSimplex.cpp rename to tests/geometry/shapes/testNSimplex.cpp index bf0302c..5964c51 100644 --- a/src/geometry/shapes/unitTests/testNSimplex.cpp +++ b/tests/geometry/shapes/testNSimplex.cpp @@ -12,8 +12,8 @@ */ -#include "../NSimplex.hpp" -#include "common/pmpl.hpp" +#include "shiva/geometry/shapes/NSimplex.hpp" +#include "shiva/common/pmpl.hpp" #include diff --git a/tpl/camp b/tpl/camp index 0f07de4..4070ce9 160000 --- a/tpl/camp +++ b/tpl/camp @@ -1 +1 @@ -Subproject commit 0f07de4240c42e0b38a8d872a20440cb4b33d9f5 +Subproject commit 4070ce93a802849d61037310a87c50cc24c9e498