Skip to content

Commit

Permalink
add silo build support to build_ascent (#1342)
Browse files Browse the repository at this point in the history
* wip build_ascent silo support

* build ascent: add silo

* defend against symlinks attacking windows

* make a pattern, see

* silo patch for windows

* build_ascent: limit windows patch to windows

* build_ascent wire silo support to conduit build

* silo dlls loc for windows testing, build_ascent enable tests only wired to ascent proper

* config check for silo support in conduit
  • Loading branch information
cyrush authored Aug 1, 2024
1 parent bb0ee14 commit 6f877f1
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 20 deletions.
23 changes: 23 additions & 0 deletions scripts/build_ascent/2024_07_25_silo_4_11_cmake_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0dc4a5b..fd6baaf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,9 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
###
# grab the version string
###
-file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION SILO_VERSION)
+file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/SILO_VERSION SILO_VERSION)
+# Strip suffix
+string(REGEX REPLACE "-.*" "" SILO_VERSION "${SILO_VERSION}")

###-----------------------------------------------------------------------------
# project command will automatically create cmake vars for major, minor,
@@ -139,7 +141,9 @@ CMAKE_DEPENDENT_OPTION(SILO_ENABLE_HZIP "Enable Lindstrom hex/quad mesh compress
##
# Set up a default INSTALL prefix that is peer to the build directory
##
-set(CMAKE_INSTALL_PREFIX ${Silo_BINARY_DIR}/../SiloInstall CACHE PATH "install prefix" FORCE)
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX ${Silo_BINARY_DIR}/../SiloInstall CACHE PATH "install prefix" FORCE)
+endif()
10 changes: 10 additions & 0 deletions scripts/build_ascent/2024_07_29_silo-pr389-win32-bugfix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/src/silo/silo_win32_compatibility.h b/src/silo/silo_win32_compatibility.h
index bc4d38f..00b970c 100644
--- a/src/silo/silo_win32_compatibility.h
+++ b/src/silo/silo_win32_compatibility.h
@@ -1,4 +1,4 @@
-#ifdef WIN32
+#ifdef _WIN32
#ifndef SILO_WIN32_COMPATIBILITY
#define SILO_WIN32_COMPATIBILITY
#include <io.h> /* Include Windows IO *
105 changes: 85 additions & 20 deletions scripts/build_ascent/build_ascent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ build_shared_libs="${build_shared_libs:=ON}"
build_zlib="${build_zlib:=true}"
build_hdf5="${build_hdf5:=true}"
build_pyvenv="${build_pyvenv:=false}"
build_silo="${build_silo:=true}"
build_conduit="${build_conduit:=true}"
build_vtkm="${build_vtkm:=true}"
build_camp="${build_camp:=true}"
Expand Down Expand Up @@ -267,6 +268,63 @@ else
echo "**** Skipping HDF5 build, install found at: ${hdf5_install_dir}"
fi # build_hdf5

################
# Silo
################
silo_version=4.11.1
silo_src_dir=$(ospath ${source_dir}/Silo-${silo_version})
silo_build_dir=$(ospath ${build_dir}/silo-${silo_version}/)
silo_install_dir=$(ospath ${install_dir}/silo-${silo_version}/)
silo_tarball=$(ospath ${source_dir}/silo-${silo_version}.tar.gz)

# build only if install doesn't exist
if [ ! -d ${silo_install_dir} ]; then
if ${build_silo}; then
if [ ! -d ${silo_src_dir} ]; then
echo "**** Downloading ${silo_tarball}"
curl -L https://github.com/LLNL/Silo/archive/refs/tags/${silo_version}.tar.gz -o ${silo_tarball}
# untar and avoid symlinks (which windows despises)
tar ${tar_extra_args} -xzf ${silo_tarball} -C ${source_dir} \
--exclude="Silo-${silo_version}/config-site/*" \
--exclude="Silo-${silo_version}/README.md"
# apply silo patches
cd ${silo_src_dir}
patch -p1 < ${script_dir}/2024_07_25_silo_4_11_cmake_fix.patch

# windows specifc patch
if [[ "$build_windows" == "ON" ]]; then
patch -p1 < ${script_dir}/2024_07_29_silo-pr389-win32-bugfix.patch
fi

cd ${root_dir}
fi


echo "**** Configuring Silo ${silo_version}"
cmake -S ${silo_src_dir} -B ${silo_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DCMAKE_INSTALL_PREFIX=${silo_install_dir} \
-DSILO_ENABLE_SHARED=${build_shared_libs} \
-DCMAKE_C_FLAGS=-Doff64_t=off_t \
-DSILO_ENABLE_HDF5=ON \
-DSILO_ENABLE_TESTS=OFF \
-DSILO_BUILD_FOR_BSD_LICENSE=ON \
-DSILO_ENABLE_FORTRAN=OFF \
-DSILO_HDF5_DIR=${hdf5_install_dir}/cmake/ \
-DCMAKE_PREFIX_PATH=${zlib_install_dir}


echo "**** Building Silo ${silo_version}"
cmake --build ${silo_build_dir} --config ${build_config} -j${build_jobs}
echo "**** Installing Silo ${silo_version}"
cmake --install ${silo_build_dir} --config ${build_config}

fi
else
echo "**** Skipping Silo build, install found at: ${silo_install_dir}"
fi # build_silo

############################
# Python Virtual Env
############################
Expand Down Expand Up @@ -305,18 +363,25 @@ if ${build_conduit}; then
if [ ! -d ${conduit_src_dir} ]; then
echo "**** Downloading ${conduit_tarball}"
curl -L https://github.com/LLNL/conduit/releases/download/${conduit_version}/conduit-${conduit_version}-src-with-blt.tar.gz -o ${conduit_tarball}
tar ${tar_extra_args} --exclude="conduit-${conduit_version}/src/tests/relay/data/silo/*" -x -v -f ${conduit_tarball} -C ${source_dir}
# untar and avoid symlinks (which windows despises)
tar ${tar_extra_args} -xzf ${conduit_tarball} -C ${source_dir} \
--exclude="conduit-${conduit_version}/src/tests/relay/data/silo/*"
fi

#
# python settings
# extrat cmake args
#
conduit_py_cmake_opts=-DENABLE_PYTHON=${enable_python}
conduit_extra_cmake_opts=-DENABLE_PYTHON=${enable_python}
if ${build_pyvenv}; then
conduit_py_cmake_opts="${conduit_py_cmake_opts} -DPYTHON_EXECUTABLE=${venv_python_exe}"
conduit_py_cmake_opts="${conduit_py_cmake_opts} -DSPHINX_EXECUTABLE=${venv_sphinx_exe}"
conduit_extra_cmake_opts="${conduit_extra_cmake_opts} -DPYTHON_EXECUTABLE=${venv_python_exe}"
conduit_extra_cmake_opts="${conduit_extra_cmake_opts} -DSPHINX_EXECUTABLE=${venv_sphinx_exe}"
fi

if ${build_silo}; then
conduit_extra_cmake_opts="${conduit_extra_cmake_opts} -DSILO_DIR=${silo_install_dir}"
fi


echo "**** Configuring Conduit ${conduit_version}"
cmake -S ${conduit_src_dir} -B ${conduit_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose} \
Expand All @@ -326,8 +391,8 @@ cmake -S ${conduit_src_dir} -B ${conduit_build_dir} ${cmake_compiler_settings} \
-DENABLE_FORTRAN=${enable_fortran} \
-DENABLE_MPI=${enable_mpi} \
-DENABLE_FIND_MPI=${enable_find_mpi} \
${conduit_py_cmake_opts} \
-DENABLE_TESTS=${enable_tests} \
${conduit_extra_cmake_opts} \
-DENABLE_TESTS=OFF \
-DHDF5_DIR=${hdf5_install_dir} \
-DZLIB_DIR=${zlib_install_dir}

Expand Down Expand Up @@ -442,8 +507,8 @@ cmake -S ${vtkm_src_dir} -B ${vtkm_build_dir} ${cmake_compiler_settings} \
-DVTKm_ENABLE_MPI=${enable_mpi} \
-DVTKm_ENABLE_OPENMP=${enable_openmp}\
-DVTKm_ENABLE_RENDERING=ON \
-DVTKm_ENABLE_TESTING=${enable_tests} \
-DBUILD_TESTING=${enable_tests} \
-DVTKm_ENABLE_TESTING=OFF\
-DBUILD_TESTING=OFF \
-DVTKm_ENABLE_BENCHMARKS=OFF ${vtkm_extra_cmake_args} \
-DCMAKE_INSTALL_PREFIX=${vtkm_install_dir}

Expand Down Expand Up @@ -494,8 +559,8 @@ cmake -S ${camp_src_dir} -B ${camp_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose}\
-DCMAKE_BUILD_TYPE=${build_config} \
-DBUILD_SHARED_LIBS=${build_shared_libs} \
-DENABLE_TESTS=${enable_tests} \
-DENABLE_EXAMPLES=${enable_tests} ${camp_extra_cmake_args} \
-DENABLE_TESTS=OFF \
-DENABLE_EXAMPLES=OFF ${camp_extra_cmake_args} \
-DCMAKE_INSTALL_PREFIX=${camp_install_dir}

echo "**** Building Camp ${camp_version}"
Expand Down Expand Up @@ -547,10 +612,10 @@ cmake -S ${raja_src_dir} -B ${raja_build_dir} ${cmake_compiler_settings} \
-DBUILD_SHARED_LIBS=${build_shared_libs} \
-Dcamp_DIR=${camp_install_dir} \
-DENABLE_OPENMP=${enable_openmp} \
-DENABLE_TESTS=${enable_tests} \
-DRAJA_ENABLE_TESTS=${enable_tests} \
-DENABLE_EXAMPLES=${enable_tests} \
-DENABLE_EXERCISES=${enable_tests} ${raja_extra_cmake_args} \
-DENABLE_TESTS=OFF \
-DRAJA_ENABLE_TESTS=OFF \
-DENABLE_EXAMPLES=OFF \
-DENABLE_EXERCISES=OFF ${raja_extra_cmake_args} \
-DCMAKE_INSTALL_PREFIX=${raja_install_dir} \
-DRAJA_ENABLE_VECTORIZATION=${raja_enable_vectorization}

Expand Down Expand Up @@ -606,9 +671,9 @@ cmake -S ${umpire_src_dir} -B ${umpire_build_dir} ${cmake_compiler_settings} \
-DBUILD_SHARED_LIBS=${build_shared_libs} \
-Dcamp_DIR=${camp_install_dir} \
-DENABLE_OPENMP=${enable_openmp} \
-DENABLE_TESTS=${enable_tests} \
-DENABLE_TESTS=OFF \
-DUMPIRE_ENABLE_TOOLS=Off \
-DUMPIRE_ENABLE_BENCHMARKS=${enable_tests} ${umpire_extra_cmake_args} \
-DUMPIRE_ENABLE_BENCHMARKS=OFF ${umpire_extra_cmake_args} \
-DCMAKE_INSTALL_PREFIX=${umpire_install_dir}

echo "**** Building Umpire ${umpire_version}"
Expand Down Expand Up @@ -654,8 +719,8 @@ cmake -S ${mfem_src_dir} -B ${mfem_build_dir} ${cmake_compiler_settings} \
-DBUILD_SHARED_LIBS=${build_shared_libs} \
-DMFEM_USE_CONDUIT=ON ${mfem_extra_cmake_args} \
-DCMAKE_PREFIX_PATH="${conduit_install_dir}" \
-DMFEM_ENABLE_TESTING=${enable_tests} \
-DMFEM_ENABLE_EXAMPLES=${enable_tests} \
-DMFEM_ENABLE_TESTING=OFF \
-DMFEM_ENABLE_EXAMPLES=OFF \
-DCMAKE_INSTALL_PREFIX=${mfem_install_dir}

echo "**** Building MFEM ${mfem_version}"
Expand Down Expand Up @@ -691,7 +756,7 @@ echo "**** Configuring Catalyst ${catalyst_version}"
cmake -S ${catalyst_src_dir} -B ${catalyst_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose}\
-DCMAKE_BUILD_TYPE=${build_config} \
-DCATALYST_BUILD_TESTING=${enable_tests} \
-DCATALYST_BUILD_TESTING=OFF \
-DCATALYST_USE_MPI=${enable_mpi} \
-DCMAKE_INSTALL_PREFIX=${catalyst_install_dir} \

Expand Down
9 changes: 9 additions & 0 deletions src/cmake/thirdparty/SetupConduit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ if(EXISTS ${CONDUIT_DIR}/include/conduit/conduit_relay_io_hdf5.hpp)
message(STATUS "FOUND conduit HDF5 support")
endif()

if(EXISTS ${CONDUIT_DIR}/include/conduit/conduit_relay_io_silo.hpp)
set(CONDUIT_SILO_ENABLED TRUE)
message(STATUS "FOUND conduit Silo support")
endif()

if(EXISTS ${CONDUIT_DIR}/include/conduit/conduit_relay_adios_api.hpp)
set(CONDUIT_ADIOS_ENABLED TRUE)
Expand Down Expand Up @@ -158,4 +162,9 @@ if(ASCENT_ENABLE_TESTS AND WIN32 AND BUILD_SHARED_LIBS)
list(APPEND ASCENT_TPL_DLL_PATHS ${CONDUIT_HDF5_DIR}/bin)
endif()

# silo dlls
if(CONDUIT_SILO_ENABLED)
list(APPEND ASCENT_TPL_DLL_PATHS ${CONDUIT_SILO_DIR}/bin)
endif()

endif()

0 comments on commit 6f877f1

Please sign in to comment.