Skip to content

Commit

Permalink
MAINT: Added searching for libxsmm
Browse files Browse the repository at this point in the history
  • Loading branch information
NateAM committed Apr 1, 2024
1 parent 99d586a commit 26286b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(SPHINX_SRC_PATH "docs/sphinx")

# Add a flag for whether the python bindings should be built or not
set(TARDIGRADE_HYDRA_BUILD_PYTHON_BINDINGS ON CACHE BOOL "Flag for whether the python bindings should be built for hydra")
set(TARDIGRADE_HYDRA_USE_LIBXSMM OFF CACHE BOOL "Flag for whether to use libxsmm for matrix math")

# Set the internal support libraries
set(INTERNAL_SUPPORT_LIBRARIES "tardigrade_hydraMicromorphic" "tardigrade_hydraLinearElasticity" "tardigrade_hydraLinearViscoelasticity" "tardigrade_hydraThermalExpansion" "tardigrade_hydraPeryznaViscoplasticity" "tardigrade_hydraMicromorphicLinearElasticity" "tardigrade_hydraPeryznaViscodamage" "tardigrade_hydraMicromorphicDruckerPragerPlasticity")
Expand All @@ -23,7 +24,12 @@ foreach(package ${INTERNAL_SUPPORT_LIBRARIES})
set(PROJECT_SOURCE_FILES ${PROJECT_SOURCE_FILES} ${package}.cpp ${package}.h)
set(PROJECT_PRIVATE_HEADERS ${PROJECT_PRIVATE_HEADERS} ${package}.h)
endforeach(package)
set(PROJECT_LINK_LIBRARIES ${PROJECT_LINK_LIBRARIES} "xsmm" "blas")
if(TARDIGRADE_HYDRA_USE_LIBXSMM)
message(STATUS "Using libxsmm for matrix math")
find_library(libxsmm_DIR xsmm REQUIRED PATHS "$ENV{CONDA_PREFIX}/lib")
add_definitions(-DTARDIGRADE_HYDRA_USE_LLXSMM )
set(PROJECT_LINK_LIBRARIES ${PROJECT_LINK_LIBRARIES} "xsmm" "blas")
endif()
set(TARDIGRADE_HYDRAMICROMORPHIC_UPSTREAM_LIBRARIES "tardigrade_constitutive_tools")
set(TARDIGRADE_HYDRALINEARELASTICITY_UPSTREAM_LIBRARIES "tardigrade_constitutive_tools")
set(TARDIGRADE_HYDRALINEARVISCOELASTICITY_UPSTREAM_LIBRARIES "tardigrade_constitutive_tools" "tardigrade_stress_tools")
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/tardigrade_hydra.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ namespace tardigradeHydra{
typedef std::vector< floatType > floatVector; //!< Define a vector of floats
typedef std::vector< std::vector< floatType > > floatMatrix; //!< Define a matrix of floats

#ifdef TARDIGRADE_HYDRA_USE_LLXSMM
typedef libxsmm_mmfunction<floatType> kernel_type; //!< The libxsmm kernel type
#endif

typedef void ( hydraBase::*hydraBaseFxn )( ); //!< Typedef for passing pointers to hydraBase functions

Expand Down

0 comments on commit 26286b5

Please sign in to comment.