Skip to content

Commit

Permalink
Update EXP-libraries for latest change
Browse files Browse the repository at this point in the history
Signed-off-by: Georgia Stuart <gstuart@umass.edu>
  • Loading branch information
georgiastuart committed Sep 5, 2024
1 parent badc8b2 commit af414f8
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 77 deletions.
14 changes: 4 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ execute_process(
)

# Git submodule updates
if(USE_SUBMODULES)
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand All @@ -229,6 +230,7 @@ if(NOT GIT_SUBMOD_RESULT EQUAL "0")
else()
message(STATUS "Submodules updated successfully - good")
endif()
endif()

# Get the latest abbreviated commit hash of the working branch
execute_process(
Expand All @@ -247,20 +249,13 @@ execute_process(
)

if (USE_SUBMODULES)
message("Configuring build for ${GIT_BRANCH}/${GIT_COMMIT} at ${COMPILE_TIME}")
include_directories(${PROJECT_SOURCE_DIR}/extern/yaml-cpp/include)
include_directories(${PROJECT_SOURCE_DIR}/extern/pybind11/include)
endif()

find_package(yaml-cpp REQUIRED)

# Report to the user
message("Configuring build for ${GIT_BRANCH}/${GIT_COMMIT} at ${COMPILE_TIME}")

if (USE_SUBMODULES)
add_subdirectory(extern/yaml-cpp)
add_subdirectory(extern/pybind11)
else()

find_package(yaml-cpp REQUIRED)
endif()

# Set options for the HighFive git submodule in extern
Expand All @@ -279,7 +274,6 @@ endif()
# Configure the remaining native subdirectories
if (BUILD_COMMON_LIBRARIES)
add_subdirectory(exputil)
add_subdirectory(coefs)
add_subdirectory(expui)
endif()

Expand Down
19 changes: 19 additions & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: exp
channels:
- conda-forge
dependencies:
- python=3.12
- boost
- eigen=3
- fftw
- hdf5=1.14
- highfive
- openmpi
- yaml-cpp
- scikit-build
- gcc=13.2.0
- gfortran=13.2.0
- libpng
- libtirpc
- zlib
- gxx=13.2.0
108 changes: 74 additions & 34 deletions expui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
set(bin_PROGRAMS nativetoh5 h5compare viewcoefs h5power makecoefs testread)
set(common_LINKLIB ${OpenMP_CXX_LIBRARIES} ${MPI_CXX_LIBRARIES}
${YAML_CPP_LIBRARIES} $<$<NOT:$<BOOL:${EXPutil_LIBRARIES}>>:exputil>
${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}
$<$<BOOL:${HighFive_FOUND}>:HighFive>)

set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp exputil
${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
set(common_INCLUDE $<INSTALL_INTERFACE:include>
${DEP_INC} ${HDF5_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR} ${FFTW_INCLUDE_DIRS})

set(common_INCLUDE_DIRS_PRIVATE
${CMAKE_BINARY_DIR}/config
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/extern/>
${CMAKE_CURRENT_SOURCE_DIR})

if(PNG_FOUND)
list(APPEND common_LINKLIB PNG::PNG)
list(APPEND common_LINKLIB ${PNG_LIBRARIES})
endif()

set(common_INCLUDE $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/>
${CMAKE_BINARY_DIR} ${DEP_INC} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/.. ${HighFive_SOURCE_DIR}/include
${HDF5_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR} ${FFTW_INCLUDE_DIRS})


if(ENABLE_CUDA)
list(APPEND common_INCLUDE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${CUDAToolkit_INCLUDE_DIRS})
list(APPEND common_LINKLIB CUDA::cudart CUDA::nvToolsExt)
Expand All @@ -24,36 +26,74 @@ if(SLURM_FOUND)
list(APPEND common_LINKLIB ${SLURM_LIBRARY})
endif()

if(ENABLE_XDR AND TIRPC_FOUND)
list(APPEND common_INCLUDE ${TIRPC_INCLUDE_DIRS})
list(APPEND common_LINKLIB ${TIRPC_LIBRARIES})
endif()
# Appears to be an overlinker here...
# if(ENABLE_XDR AND TIRPC_FOUND)
# list(APPEND common_INCLUDE ${TIRPC_INCLUDE_DIRS})
# list(APPEND common_LINKLIB ${TIRPC_LIBRARIES})
# endif()

# Make the expui shared library
#
set(expui_SOURCES BasisFactory.cc BiorthBasis.cc FieldBasis.cc
CoefContainer.cc CoefStruct.cc FieldGenerator.cc expMSSA.cc
Coefficients.cc KMeans.cc Centering.cc ParticleIterator.cc
Koopman.cc BiorthBess.cc)
Koopman.cc)
add_library(expui ${expui_SOURCES})
set_target_properties(expui PROPERTIES OUTPUT_NAME expui)

# TODO: Replace this globbing with a list of actually public headers
file(GLOB expui_PUBLIC_HEADERS "*.[hH]")
set_target_properties (expui PROPERTIES OUTPUT_NAME expui)
set_target_properties (expui PROPERTIES EXPORT_NAME EXPui)
set_target_properties (expui PROPERTIES PUBLIC_HEADER "${expui_PUBLIC_HEADERS}")

target_include_directories(expui PUBLIC ${common_INCLUDE})
target_include_directories(expui PRIVATE ${common_INCLUDE_DIRS_PRIVATE})
target_link_libraries(expui PUBLIC ${common_LINKLIB})

install(TARGETS expui DESTINATION lib)

# Configure and build the test routines
#
add_executable(nativetoh5 coefstoh5.cc)
add_executable(h5compare h5compare.cc)
add_executable(viewcoefs viewcoefs.cc)
add_executable(h5power h5power.cc)
add_executable(makecoefs makecoefs.cc)
add_executable(testread testread.cc)

foreach(program ${bin_PROGRAMS})
target_link_libraries(${program} expui exputil ${common_LINKLIB})
target_include_directories(${program} PUBLIC ${common_INCLUDE})
target_compile_options(${program} PUBLIC ${OpenMP_CXX_FLAGS})
install(TARGETS ${program} DESTINATION bin)
endforeach()
if (ENABLE_TESTS)
set(bin_PROGRAMS nativetoh5 h5compare viewcoefs h5power makecoefs testread)

add_executable(nativetoh5 coefstoh5.cc)
add_executable(h5compare h5compare.cc)
add_executable(viewcoefs viewcoefs.cc)
add_executable(h5power h5power.cc)
add_executable(makecoefs makecoefs.cc)
add_executable(testread testread.cc)

foreach(program ${bin_PROGRAMS})
target_link_libraries(${program} expui exputil ${common_LINKLIB})
target_include_directories(${program} PUBLIC ${common_INCLUDE})
target_compile_options(${program} PUBLIC ${OpenMP_CXX_FLAGS})
endforeach()
endif()

install (TARGETS expui
EXPORT EXPuiTargets
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION include/expui)

if (INSTALL_CMAKE_FIND)
# Set up cmake configs
set(CMAKEPACKAGE_INSTALL_DIR share/EXPui/cmake)
install (EXPORT EXPuiTargets
FILE EXPuiTargets.cmake
NAMESPACE EXP::
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR})

include(CMakePackageConfigHelpers)
configure_package_config_file(EXPuiConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/EXPuiConfig.cmake
INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}
PATH_VARS CMAKEPACKAGE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)

write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/EXPuiVersion.cmake
VERSION ${CMAKE_PROJECT_VERSION}
COMPATIBILITY SameMinorVersion )

install (FILES ${CMAKE_CURRENT_BINARY_DIR}/EXPuiConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/EXPuiVersion.cmake
DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} )
endif()
13 changes: 0 additions & 13 deletions expui/EXPcoefsConfig.cmake.in

This file was deleted.

13 changes: 13 additions & 0 deletions expui/EXPuiConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generates the cmake find_package files for EXPui

@PACKAGE_INIT@

if(NOT TARGET EXP::EXPui)
include(@PACKAGE_CMAKEPACKAGE_INSTALL_DIR@/EXPuiTargets.cmake)
endif()

set_and_check(EXPui_INCLUDE_DIRS @PACKAGE_CMAKE_INSTALL_PREFIX@/include/expui)
set_and_check(EXPui_LIBRARY_DIRS @PACKAGE_CMAKE_INSTALL_PREFIX@/lib)
set_and_check(EXPui_LIBRARIES @PACKAGE_CMAKE_INSTALL_PREFIX@/lib/libexpui.so)

check_required_components(EXPui)
4 changes: 2 additions & 2 deletions exputil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ find_library(QUADMATH_LIBRARY NAMES quadmath)
set(common_LINKLIBS ${DEP_LIB} ${OpenMP_CXX_LIBRARIES} ${MPI_CXX_LIBRARIES}
${YAML_CPP_LIBRARIES} ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}
${FFTW_DOUBLE_LIB} ${GFORTRAN_LIBRARY} ${QUADMATH_LIBRARY}
$<BOOL:${HighFive_FOUND}>:HighFive>)
$<$<BOOL:${HighFive_FOUND}>:HighFive>)

if(ENABLE_CUDA)
list(APPEND common_INCLUDE_DIRS ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} ${CUDAToolkit_INCLUDE_DIRS})
list(APPEND common_LINKLIB CUDA::cudart CUDA::nvToolsExt)
list(APPEND common_LINKLIBS CUDA::cudart CUDA::nvToolsExt)
endif()

if(ENABLE_XDR AND TIRPC_FOUND)
Expand Down
4 changes: 3 additions & 1 deletion packaging/pypi/EXP-libraries/README_explib.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ This package requires...
- FFTW
- Eigen3
- HighFive
- yaml-cpp
- yaml-cpp
- png
- zlib
10 changes: 5 additions & 5 deletions packaging/pypi/EXP-libraries/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from skbuild import setup

version="7.7.28"
version="7.7.99"

# Setup for the CopyAndSdist subclass

Expand Down Expand Up @@ -78,7 +78,7 @@ def copy_src(cls):
# Directories
CopyAndSdist.directory_list = [
'cmake',
'coefs',
'expui',
'exputil',
'extern/rapidxml',
'extern/png++',
Expand All @@ -90,15 +90,15 @@ def copy_src(cls):

setup(
name="EXP-libraries",
version="7.7.28",
version=version,
description="Nbody EXPansion Code - Libraries",
author="",
license="GPL-3.0",
packages=["EXP-libexputil", "EXP-libexpcoefs"],
packages=["EXP-libexputil", "EXP-libexpui"],
python_requires=">=3.8",
package_dir={
"EXP-libexputil": "exputil",
"EXP-libexpcoefs": "coefs"
"EXP-libexpui": "expui"
},
cmdclass={
"sdist": CopyAndSdist,
Expand Down
4 changes: 2 additions & 2 deletions packaging/pypi/EXP-nbody/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from skbuild import setup

version="7.7.28"
version="7.7.99"

# Setup for the CopyAndSdist subclass

Expand Down Expand Up @@ -86,7 +86,7 @@ def copy_src(cls):

setup(
name="EXP-nbody",
version="7.7.28",
version=version,
description="Nbody EXPansion Code - Nbody",
author="",
license="GPL-3.0",
Expand Down
10 changes: 5 additions & 5 deletions pyEXP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
find_package(Python3 COMPONENTS Development REQUIRED)
find_package(pybind11 REQUIRED)
find_package(EXPutil)
find_package(EXPcoefs)
find_package(EXPui)
find_package(EXPcommon)
message(STATUS "EXPutil_FOUND=${EXPutil_FOUND} ${EXPutil_INCLUDE_DIRS} ${EXPutil_INCLUDE_DIR}")

# Default build environment
#
# set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp
# EXP::EXPutil EXP::EXPcoefs EXP::EXPcommon HighFive ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
# EXP::EXPutil EXP::EXPui EXP::EXPcommon HighFive ${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
set(common_LINKLIB ${OpenMP_CXX_LIBRARIES} ${MPI_CXX_LIBRARIES}
# ${YAML_CPP_LIBRARIES} # Not directly used in pyexp
${VTK_LIBRARIES} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}
$<IF:$<BOOL:${EXPutil_LIBRARIES}>,${EXPutil_LIBRARIES},exputil>
$<IF:$<BOOL:${EXPcoefs_LIBRARIES}>,${EXPcoefs_LIBRARIES},expcoef>
$<IF:$<BOOL:${EXPui_LIBRARIES}>,${EXPui_LIBRARIES},expui>
$<$<BOOL:${HighFive_FOUND}>:HighFive>)
# $<$<BOOL:${PNG_FOUND}>:${PNG_LIBRARIES}>)

Expand All @@ -25,12 +25,12 @@ set(common_LINKLIB ${OpenMP_CXX_LIBRARIES} ${MPI_CXX_LIBRARIES}
set(common_INCLUDE $<INSTALL_INTERFACE:include>
${DEP_INC} ${CMAKE_CURRENT_SOURCE_DIR}
${HDF5_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR}
${EXPutil_INCLUDE_DIRS} ${EXPcoefs_INCLUDE_DIRS} ${EXPcommon_INCLUDE_DIRS})
${EXPutil_INCLUDE_DIRS} ${EXPui_INCLUDE_DIRS} ${EXPcommon_INCLUDE_DIRS})

set(common_INCLUDE_DIRS_PRIVATE
${CMAKE_BINARY_DIR}/config)

if (NOT (EXPutil_FOUND AND EXPcoefs_FOUND))
if (NOT (EXPutil_FOUND AND EXPui_FOUND))
list(APPEND common_INCLUDE_DIRS_PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
Expand Down
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
find_package(EXPutil)
find_package(EXPcoefs)
find_package(EXPui)
find_package(EXPcommon)

set(CUDA_SRC)
Expand Down Expand Up @@ -27,14 +27,14 @@ set(exp_SOURCES Basis.cc Bessel.cc Component.cc

set(common_INCLUDE_DIRS $<INSTALL_INTERFACE:include>
${HDF5_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR}
${EXPutil_INCLUDE_DIRS} ${EXPcoefs_INCLUDE_DIRS} ${EXPcommon_INCLUDE_DIRS})
${EXPutil_INCLUDE_DIRS} ${EXPui_INCLUDE_DIRS} ${EXPcommon_INCLUDE_DIRS})

set(common_INCLUDE_DIRS_PRIVATE
${CMAKE_BINARY_DIR}/config
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/extern/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)

if (NOT (EXPutil_FOUND AND EXPcoefs_FOUND))
if (NOT (EXPutil_FOUND AND EXPui_FOUND))
list(APPEND common_INCLUDE_DIRS_PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
Expand All @@ -59,8 +59,8 @@ endif()

set(common_LINKLIB ${DSMC_LIBS}
$<IF:$<BOOL:${EXPutil_LIBRARIES}>,${EXPutil_LIBRARIES},exputil>
$<IF:$<BOOL:${EXPcoefs_LIBRARIES}>,${EXPcoefs_LIBRARIES},expcoef>
$<BOOL:${HighFive_FOUND}>:HighFive>
$<IF:$<BOOL:${EXPui_LIBRARIES}>,${EXPui_LIBRARIES},expui>
$<$<BOOL:${HighFive_FOUND}>:HighFive>
${OpenMP_CXX_LIBRARIES} ${MPI_CXX_LIBRARIES}
${YAML_CPP_LIBRARIES} ${VTK_LIBRARIES})

Expand Down

0 comments on commit af414f8

Please sign in to comment.