Skip to content

Commit

Permalink
Correctly support both static and dynamic hdf5 and move BLA only when…
Browse files Browse the repository at this point in the history
… torch is enabled (#58)

* Correctly support both static and dynamic hdf5
* Do not use the default HDF5_Dir variable but use an AMS specific one
* Provide correct find_package for shared/static hdf5
  • Loading branch information
koparasy authored Mar 14, 2024
1 parent 01fc432 commit 3e4b410
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
-DWITH_CALIPER=On \
-DWITH_HDF5=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_CUDA=Off \
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
-DWITH_CALIPER=Off \
-DWITH_HDF5=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_CUDA=Off \
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
-DWITH_CALIPER=On \
-DWITH_HDF5=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_CUDA=Off \
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DWITH_CALIPER=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DWITH_HDF5=On \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
-DWITH_CALIPER=On \
-DWITH_HDF5=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DCUDA_ARCH=70 \
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
-DWITH_CALIPER=On \
-DWITH_HDF5=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DCUDA_ARCH=70 \
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
-DCMAKE_PREFIX_PATH=$INSTALL_DIR \
-DWITH_CALIPER=On \
-DWITH_EXAMPLES=On \
-DHDF5_Dir=$AMS_HDF5_PATH \
-DAMS_HDF5_DIR=$AMS_HDF5_PATH \
-DWITH_HDF5=On \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,19 @@ if (WITH_REDIS)
list(APPEND AMS_APP_LIBRARIES ${REDIS_PLUS_PLUS_LIB})
endif() # WITH_REDIS


if (WITH_HDF5)
find_package(HDF5 NAMES hdf5 COMPONENTS C shared REQUIRED NO_DEFAULT_PATH PATHS ${HDF5_Dir} ${HDF5_Dir}/share/cmake)
list(APPEND AMS_APP_INCLUDES ${HDF5_INCLUDE_DIR})
if (HDF5_USE_STATIC_LIBRARIES)
find_package(HDF5 NAMES hdf5 COMPONENTS C static NO_DEFAULT_PATH PATHS ${AMS_HDF5_DIR} ${AMS_HDF5_DIR}/share/cmake)
list(APPEND AMS_APP_LIBRARIES ${HDF5_C_STATIC_LIBRARY})
message(STATUS "HDF5 Static Library : ${HDF5_C_STATIC_LIBRARY}")
else()
find_package(HDF5 NAMES hdf5 COMPONENTS C shared NO_DEFAULT_PATH PATHS ${AMS_HDF5_DIR} ${AMS_HDF5_DIR}/share/cmake)
list(APPEND AMS_APP_LIBRARIES ${HDF5_C_SHARED_LIBRARY})
message(STATUS "HDF5 Shared Library : ${HDF5_C_SHARED_LIBRARY}")
endif()
list(APPEND AMS_APP_INCLUDES ${HDF5_INCLUDE_DIR})
list(APPEND AMS_APP_DEFINES "-D__ENABLE_HDF5__")
message(STATUS "HDF5 Shared Library: ${HDF5_C_SHARED_LIBRARY}")
message(STATUS "HDF5 Include directories: ${HDF5_INCLUDE_DIR}")
endif() # WITH_HDF5

Expand Down Expand Up @@ -191,6 +198,9 @@ if (WITH_TORCH)
list(APPEND AMS_APP_LIBRARIES "${TORCH_LIBRARIES}")

list(APPEND AMS_APP_DEFINES "-D__ENABLE_TORCH__")
set(BLA_VENDER OpenBLAS)
find_package(BLAS REQUIRED)
list(APPEND AMS_APP_LIBRARIES "${BLAS_LIBRARIES}")
endif()

# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -242,10 +252,6 @@ if (WITH_PERFFLOWASPECT)
list(APPEND AMS_APP_LIBRARIES "perfflow_runtime")
endif()

# TODO: currently we are focusing only on BLASS. Try out other libraries.
set(BLA_VENDER OpenBLAS)
find_package(BLAS REQUIRED)
list(APPEND AMS_APP_LIBRARIES "${BLAS_LIBRARIES}")

add_subdirectory(src)

Expand Down

0 comments on commit 3e4b410

Please sign in to comment.