Skip to content

Commit

Permalink
optional fortran compiler, adjustable cmake config installation (#2946)
Browse files Browse the repository at this point in the history
* optional fortran and modifiable cmakedir

* try to fix mac ecosys

* no long qcf jobs on mac

* add marker

* remove last qcf master cli snowflake
  • Loading branch information
loriab committed May 2, 2023
1 parent 4d69612 commit 6e7e94b
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 24 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ option(ENABLE_Libint1t "Enables Libint1 in special _t variety" OFF)
# These options are relevant to pasture, expert only
option(ENABLE_ccsort "Enables ccsort plugin installed from psi4pasture" OFF)
option(ENABLE_transqt2 "Enables transqt2 plugin installed from psi4pasture" OFF)
option(psi4_SKIP_ENABLE_Fortran "Suppress enabling Fortran language even when Fortran addons enabled. Use when only linking pre-built, not compiling addon code." OFF)

# Append modules added to pasture as needed
if(ENABLE_ccsort OR ENABLE_transqt2)
Expand All @@ -130,9 +131,13 @@ if(ENABLE_ccsort OR ENABLE_transqt2)
endif()

if(ENABLE_gdma OR ENABLE_dkh OR ENABLE_erd OR ENABLE_PCMSolver)
if(psi4_SKIP_ENABLE_Fortran)
message(STATUS "NOT Enabling Fortran")
else()
enable_language(Fortran)
set(Fortran_ENABLED ON) # communicate required languages with psi4-core
message(STATUS "Enabling Fortran")
endif()
endif()

if(ENABLE_erd)
Expand Down Expand Up @@ -167,6 +172,9 @@ option_with_default(FC_SYMBOL "The type of Fortran name mangling" 2)
option_with_default(BUILD_FPIC "Compile static libraries with position independent code" ON)
option_with_default(CMAKE_INSTALL_LIBDIR "Directory to which libraries installed" lib)
option_with_default(PYMOD_INSTALL_LIBDIR "Location within CMAKE_INSTALL_LIBDIR to which python modules are installed" /)
option_with_default(psi4_INSTALL_CMAKEDIR "Directory to which psi4 CMake config files installed." share/cmake/psi4)
option_with_default(TargetLAPACK_INSTALL_CMAKEDIR "Directory to which psi4 CMake config files installed." share/cmake/TargetLAPACK)
option_with_default(TargetHDF5_INSTALL_CMAKEDIR "Directory to which psi4 CMake config files installed." share/cmake/TargetHDF5)
option_with_default(ENABLE_GENERIC "Enables mostly static linking of language libraries for shared library" OFF)
option_with_default(CMAKE_INSTALL_MESSAGE "Specify verbosity of installation messages" LAZY)
option_with_default(psi4_CXX_STANDARD "Specify C++ standard for core Psi4" 17)
Expand Down Expand Up @@ -262,6 +270,7 @@ ExternalProject_Add(psi4-core
-DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
-DCMAKE_INSTALL_DATADIR=${CMAKE_INSTALL_DATADIR}
-DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
-Dpsi4_INSTALL_CMAKEDIR=${psi4_INSTALL_CMAKEDIR}
-DCMAKE_INSTALL_MESSAGE=${CMAKE_INSTALL_MESSAGE}
-DPYMOD_INSTALL_LIBDIR=${PYMOD_INSTALL_LIBDIR}
-DMAX_AM_ERI=${MAX_AM_ERI}
Expand Down
4 changes: 2 additions & 2 deletions external/common/hdf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(ENABLE_ambit OR ENABLE_CheMPS2)

include(CMakePackageConfigHelpers)

set(CMAKECONFIG_INSTALL_DIR "share/cmake/${PN}")
set(CMAKECONFIG_INSTALL_DIR "${TargetHDF5_INSTALL_CMAKEDIR}")
configure_package_config_file(${PN}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
Expand All @@ -47,7 +47,7 @@ if(ENABLE_ambit OR ENABLE_CheMPS2)
${CMAKE_COMMAND} "-DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake"
COMMENT "Installing Psi4-detected HDF5")

set(${PN}_DIR ${STAGED_INSTALL_PREFIX}/share/cmake/${PN} CACHE PATH "path to externally detected ${PN}Config.cmake" FORCE)
set(${PN}_DIR ${STAGED_INSTALL_PREFIX}/${TargetHDF5_INSTALL_CMAKEDIR} CACHE PATH "path to externally detected ${PN}Config.cmake" FORCE)
else()
add_library(hdf5_external INTERFACE) # dummy
endif()
4 changes: 2 additions & 2 deletions external/common/lapack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ install(TARGETS blas lapk lapack

include(CMakePackageConfigHelpers)

set(CMAKECONFIG_INSTALL_DIR "share/cmake/${PN}")
set(CMAKECONFIG_INSTALL_DIR "${TargetLAPACK_INSTALL_CMAKEDIR}")
configure_package_config_file(${PN}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PN}Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
Expand All @@ -79,4 +79,4 @@ add_custom_target(lapack_external
${CMAKE_COMMAND} "-DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake"
COMMENT "Installing Psi4-detected BLAS/LAPACK")

set(${PN}_DIR ${STAGED_INSTALL_PREFIX}/share/cmake/${PN} CACHE PATH "path to externally detected ${PN}Config.cmake" FORCE)
set(${PN}_DIR ${STAGED_INSTALL_PREFIX}/${TargetLAPACK_INSTALL_CMAKEDIR} CACHE PATH "path to externally detected ${PN}Config.cmake" FORCE)
4 changes: 2 additions & 2 deletions external/upstream/ambit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if(${ENABLE_ambit})
-DLIBC_INTERJECT=${LIBC_INTERJECT}
-DENABLE_TESTS=OFF
-DOpenMP_LIBRARY_DIRS=${OpenMP_LIBRARY_DIRS}
-DTargetLAPACK_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/TargetLAPACK
-DTargetHDF5_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/TargetHDF5
-DTargetLAPACK_DIR=${TargetLAPACK_DIR}
-DTargetHDF5_DIR=${TargetHDF5_DIR}
-Dpybind11_DIR=${pybind11_DIR}
-DCMAKE_INSIST_FIND_PACKAGE_pybind11=ON
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
Expand Down
4 changes: 2 additions & 2 deletions external/upstream/chemps2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ if(${ENABLE_CheMPS2})
-DCMAKE_NM=${CMAKE_NM}
-DENABLE_TESTS=OFF
-DOpenMP_LIBRARY_DIRS=${OpenMP_LIBRARY_DIRS}
-DTargetLAPACK_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/TargetLAPACK
-DTargetHDF5_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/TargetHDF5
-DTargetLAPACK_DIR=${TargetLAPACK_DIR}
-DTargetHDF5_DIR=${TargetHDF5_DIR}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
CMAKE_CACHE_ARGS -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
Expand Down
2 changes: 1 addition & 1 deletion external/upstream/libefp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(${ENABLE_libefp})
-DFRAGLIB_UNDERSCORE_L=OFF
-DFRAGLIB_DEEP=OFF
-DOpenMP_LIBRARY_DIRS=${OpenMP_LIBRARY_DIRS}
-DTargetLAPACK_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/TargetLAPACK
-DTargetLAPACK_DIR=${TargetLAPACK_DIR}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
CMAKE_CACHE_ARGS -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
Expand Down
2 changes: 1 addition & 1 deletion external/upstream/pylibefp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if(${ENABLE_libefp})
-DPYTHON_EXECUTABLE=${Python_EXECUTABLE}
-DPYTHON_INCLUDE_DIR=${Python_INCLUDE_DIRS}
-DPYTHON_LIBRARY=${Python_LIBRARIES}
-DTargetLAPACK_DIR=${STAGED_INSTALL_PREFIX}/share/cmake/TargetLAPACK
-DTargetLAPACK_DIR=${TargetLAPACK_DIR}
-Dlibefp_DIR=${libefp_DIR}
-Dpybind11_DIR=${pybind11_DIR}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
Expand Down
13 changes: 6 additions & 7 deletions psi4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ if(${endianness})
else()
set(_endian_ext ".little")
endif()
# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share".
set(CMAKECONFIG_INSTALL_DIR "share/cmake/psi4")
set(CMAKECONFIG_INSTALL_DIR "${psi4_INSTALL_CMAKEDIR}")

# <<< Marshal Dependencies & Add-ons >>>

Expand Down Expand Up @@ -400,7 +399,7 @@ install(FILES ${CMAKE_BINARY_DIR}/psi4PluginCache.cmake
${PSI4_ROOT}/cmake/custom_static_library.cmake
${PSI4_ROOT}/cmake/custom_cxxstandard.cmake
${PSI4_ROOT}/cmake/xhost.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR})

# <<< Export Config for Plugins >>>
# Determine relative path from Psi4's include directory to PyBind11's
Expand All @@ -409,8 +408,8 @@ file(RELATIVE_PATH RELATIVE_PYBIND11_INCLUDE_DIR
${pybind11_INCLUDE_DIR})
configure_package_config_file(
psi4Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/share/cmake/psi4/psi4Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${psi4_INSTALL_CMAKEDIR}/psi4Config.cmake
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/cmake/psi4/psi4Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/share/cmake/psi4/psi4ConfigVersion.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${psi4_INSTALL_CMAKEDIR}/psi4Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${psi4_INSTALL_CMAKEDIR}/psi4ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR})
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ markers =
v2rdm_casscf
qcdb
qcfractal: "tests using QCFractal software; skip if unavailable"
qcfractal_next: "tests using QCFractal software, next branch; skip if unavailable"
qcportal: "tests using QCPortal software; skip if unavailable"
psi4

2 changes: 1 addition & 1 deletion tests/cbs-xtpl-energy/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@ctest_labeler("quick;cbs")
@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
def test_cbs_xtpl_energy(distributed):
setenv = ["_PSI4_USE_QCF"] if distributed else None
Expand Down
2 changes: 1 addition & 1 deletion tests/cbs-xtpl-wrapper/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@ctest_labeler("cbs")
@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
def test_cbs_xtpl_wrapper(distributed):
setenv = ["_PSI4_USE_QCF"] if distributed else None
Expand Down
2 changes: 1 addition & 1 deletion tests/ddd-deriv/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@ctest_labeler("findif;quick;smoke")
@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
def test_ddd_deriv(distributed):
setenv = ["_PSI4_USE_QCF"] if distributed else None
Expand Down
2 changes: 1 addition & 1 deletion tests/nbody-cp-gradient/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
@ctest_labeler("nbody;gradient")
def test_nbody_cp_gradient(distributed):
Expand Down
2 changes: 1 addition & 1 deletion tests/nbody-he-4b/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
@ctest_labeler("nbody;cart")
def test_nbody_he_4b(distributed):
Expand Down
2 changes: 1 addition & 1 deletion tests/nbody-multi-level/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@ctest_labeler("nbody;extern")
@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
def test_nbody_multi_level(distributed):
setenv = ["_PSI4_USE_QCF"] if distributed else None
Expand Down
2 changes: 1 addition & 1 deletion tests/nbody-vmfc-hessian/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@pytest.mark.parametrize("distributed", [
pytest.param(False, id="internal"),
pytest.param(True, id="snowflake", marks=using("qcfractal")),
pytest.param(True, id="snowflake", marks=using("qcfractal_next")),
])
def test_nbody_vmfc_hessian(distributed):
setenv = ["_PSI4_USE_QCF"] if distributed else None
Expand Down
8 changes: 8 additions & 0 deletions tests/pytests/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def is_psi4_new_enough(version_feature_introduced):
return parse_version(psi4.__version__) >= parse_version(version_feature_introduced)


def is_qcfractal_new_enough(version_feature_introduced):
if not which_import('qcfractal', return_bool=True):
return False
import qcfractal
return parse_version(qcfractal.__version__) >= parse_version(version_feature_introduced)


def is_nvidia_gpu_present():
try:
import GPUtil
Expand Down Expand Up @@ -81,6 +88,7 @@ def is_nvidia_gpu_present():
"v2rdm_casscf": which_import("v2rdm_casscf", return_bool=True),
"qcdb": False, # capabilities of in-psi and out-of-psi qcdb not aligned
"qcfractal": which_import("qcfractal", return_bool=True),
"qcfractal_next": is_qcfractal_new_enough("0.49"),
"qcportal": which_import("qcportal", return_bool=True),
"bse": which_import("basis_set_exchange", return_bool=True),
}
Expand Down

0 comments on commit 6e7e94b

Please sign in to comment.