Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor test edits #18

Merged
merged 3 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 36 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,46 @@ set(UAMMD_INCLUDE include/third_party/uammd/src include/third_party/uammd/src/th
# find_package(UAMMD REQUIRED)
# set(UAMMD_INCLUDE ${UAMMD_INCLUDE_DIR})
set(BLA_STATIC OFF)
set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
if(BLAS_FOUND)
message("mkl environment detected")
add_compile_definitions(PUBLIC USE_MKL)
link_libraries(
BLAS::BLAS
)
find_path(BLAS_INCLUDE_DIRS mkl.h
$ENV{CONDA_PREFIX}/include
/usr/include
/usr/local/include
$ENV{MKLROOT}/include
$ENV{BLAS_HOME}/include
)
find_package(LAPACK)
if(BLAS_FOUND AND LAPACK_FOUND)
message(STATUS "BLAS and LAPACK found")
# Additional check for MKL
find_path(MKL_INCLUDE_DIR NAMES mkl.h PATHS $ENV{MKLROOT}/include)
if(MKL_INCLUDE_DIR)
message(STATUS "Intel MKL environment detected")
add_compile_definitions(PUBLIC USE_MKL)
include_directories(${MKL_INCLUDE_DIR})
else()
find_path(BLAS_INCLUDE_DIR NAMES lapacke.h PATHS
$ENV{CONDA_PREFIX}/include
$ENV{PREFIX}/include
$ENV{MKLROOT}/include
$ENV{BLAS_HOME}/include
/usr/include
/usr/local/include
)
find_path(LAPACKE_INCLUDE_DIR lapacke.h)
find_library(LAPACKE_LIBRARY NAMES lapacke)
if(LAPACKE_INCLUDE_DIR AND LAPACKE_LIBRARY)
set(LAPACKE_FOUND TRUE)
set(LAPACKE_LIBRARIES ${LAPACKE_LIBRARY})
set(LAPACKE_INCLUDE_DIRS ${LAPACKE_INCLUDE_DIR})
else()
message(FATAL_ERROR "LAPACKE not found.")
endif()
include_directories(${LAPACKE_INCLUDE_DIRS})
include_directories(${BLAS_INCLUDE_DIR})
link_libraries(${LAPACKE_LIBRARIES})
endif()
link_libraries(BLAS::BLAS LAPACK::LAPACK)
else()
unset(BLA_VENDOR)
find_package(LAPACK REQUIRED)
find_package(LAPACKE REQUIRED)
find_package(BLAS REQUIRED)
link_libraries(${LAPACK_LIBRARIES} ${LAPACKE_LIBRARIES})
find_path(BLAS_INCLUDE_DIRS cblas.h
$ENV{CONDA_PREFIX}/include
/usr/include
/usr/local/include
$ENV{MKLROOT}/include
$ENV{BLAS_HOME}/include
)
find_path(LAPACKE_INCLUDE_DIRS lapacke.h
$ENV{CONDA_PREFIX}/include
/usr/include
/usr/local/include
$ENV{MKLROOT}/include
$ENV{LAPACKE_HOME}/include
)

message(FATAL_ERROR "BLAS and LAPACK not found. Please install them.")
endif()

find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)
include_directories(${pybind11_INCLUDE_DIRS})
include_directories(${Python3_INCLUDE_DIRS})
include_directories(${UAMMD_INCLUDE} ${BLAS_INCLUDE_DIRS} ${LAPACKE_INCLUDE_DIRS})
include_directories(include/third_party/LanczosAlgorithm/include)
Expand Down
4 changes: 2 additions & 2 deletions solvers/DPStokes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ add_library(DPStokes.${Python3_SOABI} SHARED python_wrapper.cpp)
# Remove the "lib" prefix from the shared library
set_target_properties(DPStokes.${Python3_SOABI} PROPERTIES PREFIX "")
target_include_directories(libMobility_DPStokes PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(libMobility_DPStokes cufft cublas cusolver curand)
target_link_libraries(libMobility_DPStokes cufft cublas)
set_target_properties(libMobility_DPStokes PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set_target_properties(DPStokes.${Python3_SOABI} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python")
target_link_libraries(DPStokes.${Python3_SOABI} libMobility_DPStokes)
install(TARGETS DPStokes.${Python3_SOABI} DESTINATION ${Python3_SITEARCH}/libMobility)
install(TARGETS libMobility_DPStokes DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS libMobility_DPStokes DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobility.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/DPStokes)
file(GLOB EXTRA_HEADERS extra/*.h)
install(FILES ${EXTRA_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/DPStokes/extra)
2 changes: 1 addition & 1 deletion solvers/NBody/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set_target_properties(libMobility_NBody PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${C
set_target_properties(NBody.${Python3_SOABI} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python")
target_link_libraries(NBody.${Python3_SOABI} libMobility_NBody)
install(TARGETS NBody.${Python3_SOABI} DESTINATION ${Python3_SITEARCH}/libMobility)
install(TARGETS libMobility_NBody DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS libMobility_NBody DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobility.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/NBody)
file(GLOB EXTRA_HEADERS extra/*.h)
install(FILES ${EXTRA_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/NBody/extra)
4 changes: 2 additions & 2 deletions solvers/PSE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ add_library(PSE.${Python3_SOABI} SHARED python_wrapper.cpp)
# Remove the "lib" prefix from the shared library
set_target_properties(PSE.${Python3_SOABI} PROPERTIES PREFIX "")
target_include_directories(libMobility_PSE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(libMobility_PSE cufft cublas cusolver curand)
target_link_libraries(libMobility_PSE cufft cublas)
set_target_properties(libMobility_PSE PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set_target_properties(PSE.${Python3_SOABI} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python")
target_link_libraries(PSE.${Python3_SOABI} libMobility_PSE)
install(TARGETS PSE.${Python3_SOABI} DESTINATION ${Python3_SITEARCH}/libMobility)
install(TARGETS libMobility_PSE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS libMobility_PSE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobility.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/PSE)
file(GLOB EXTRA_HEADERS extra/*.h)
install(FILES ${EXTRA_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/PSE/extra)
2 changes: 1 addition & 1 deletion solvers/SelfMobility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ set_target_properties(libMobility_SelfMobility PROPERTIES RUNTIME_OUTPUT_DIRECTO
set_target_properties(SelfMobility.${Python3_SOABI} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python")
target_link_libraries(SelfMobility.${Python3_SOABI} libMobility_SelfMobility)
install(TARGETS SelfMobility.${Python3_SOABI} DESTINATION ${Python3_SITEARCH}/libMobility)
install(TARGETS libMobility_SelfMobility DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS libMobility_SelfMobility DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobility.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libMobility/solvers/SelfMobility)
2 changes: 1 addition & 1 deletion tests/test_fluctuation_dissipation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def fluctuation_dissipation_KS(M, fluctuation_method):
],
)
@pytest.mark.parametrize("hydrodynamicRadius", [0.95, 1.12])
@pytest.mark.parametrize("numberParticles", [1, 2, 3, 10])
@pytest.mark.parametrize("numberParticles", [10])
def test_fluctuation_dissipation(
Solver, periodicity, hydrodynamicRadius, numberParticles
):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mobility_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_self_mobility_selfmobility():


def test_self_mobility_nbody():
# Mobility should be just 1/(6\pi\eta R)*(1 - 2.83729748/L) for a single particle.
# Mobility should be just 1/(6\pi\eta R)
Solver = NBody
precision = np.float32 if Solver.precision == "float" else np.float64
solver = Solver("open", "open", "open")
Expand Down