Skip to content

Commit

Permalink
#2174: cmake: add vt-tv as a build option detected at compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Aug 9, 2023
1 parent 9f2b735 commit c88ea8a
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ set(PROJECT_EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples)
# Import the linking macros for VT-related targets
include(cmake/link_vt.cmake)

# Load packages that are required for core VT build
include(cmake/load_packages.cmake)

include(cmake/check_compiler.cmake)

option(vt_gold_linker_enabled "Build VT using the `gold' linker" ON)

option(vt_unity_build_enabled "Build VT with Unity/Jumbo mode enabled" OFF)
Expand Down Expand Up @@ -93,6 +88,11 @@ option(vt_werror_enabled "Build VT with -Werror enabled" OFF)
include(cmake/nvcc_no_deprecated_gpu_targets.cmake)
include(cmake/load_bundled_libraries.cmake)

# Load packages that are required for core VT build
# We need to do this after bundled libraries so we avoid library duplication
include(cmake/load_packages.cmake)
include(cmake/check_compiler.cmake)

option(vt_trace_only "Build VT with trace-only mode enabled" OFF)
if (vt_trace_only)
message(STATUS "Building additional target for VT in trace-only mode")
Expand Down
13 changes: 13 additions & 0 deletions ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ else
fi
fi

if test "${VT_TV_ENABLED}" -eq 1
then
if test -d "${source_dir}/lib/vt-tv"
then
{ echo "vt-tv already in lib... not downloading"; } 2>/dev/null
else
cd "${source_dir}/lib"
vt_tv_rev="master"
git clone -b "${vt_tv_rev}" --depth 1 https://github.com/DARMA-tasking/vt-tv.git
cd -
fi
fi

if test "${VT_ZOLTAN_ENABLED:-0}" -eq 1
then
export Zoltan_DIR=${ZOLTAN_DIR:-""}
Expand Down
71 changes: 71 additions & 0 deletions ci/deps/vtk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash

set -exo pipefail

if test $# -lt 2
then
echo "usage: ./$0 <vtk-version> <installation-dir>"
exit 1
fi

vtk_version="$1"
vtk_tar_name="v${vtk_version}.tar.gz"
vtk_name="VTK-${vtk_version}"
install_dir="${2-}"
build_dir=/vtk-build/

wget "https://github.com/Kitware/VTK/archive/refs/tags/$vtk_tar_name"
tar xzf ${vtk_tar_name}
rm ${vtk_tar_name}
cd ${vtk_name}

mkdir -p ${build_dir}
mkdir -p ${install_dir}

cd ${build_dir}
cmake \
-DCMAKE_INSTALL_PREFIX:FILEPATH=${install_dir} \
../${vtk_name}
cmake --build ${build_dir} --target install
# echo "${mpich_version}"
# echo "${mpich_name}"
# echo "${mpich_tar_name}"
# echo "${make_flags}"

# wget http://www.mpich.org/static/downloads/${mpich_version}/${mpich_tar_name}
# tar xzf ${mpich_tar_name}
# rm ${mpich_tar_name}
# cd ${mpich_name}
# ./configure \
# --enable-static=false \
# --enable-alloca=true \
# --disable-long-double \
# --enable-threads=single \
# --enable-fortran=no \
# --enable-fast=all \
# --enable-g=none \
# --enable-timing=none \
# ${installation_prefix:+ --prefix"=${installation_prefix}"}
# make ${make_flags}
# make install
# cd -
# rm -rf ${mpich_name}


# # Clone VTK source
# RUN mkdir -p /opt/src/vtk
# RUN git clone --recursive --branch v9.2.2 https://gitlab.kitware.com/vtk/vtk.git /opt/src/vtk

# # Build VTK
# RUN mkdir -p /opt/build/vtk-build
# WORKDIR /opt/build/vtk-build
# RUN cmake \
# -DCMAKE_C_COMPILER=gcc-11 \
# -DCMAKE_CXX_COMPILER=g++-11 \
# -DCMAKE_BUILD_TYPE:STRING=Release \
# -DBUILD_TESTING:BOOL=OFF \
# -DVTK_Group_Rendering:BOOL=OFF \
# -DBUILD_TESTING:BOOL=OFF \
# -DBUILD_SHARED_LIBS:BOOL=ON \
# -S /opt/src/vtk -B /opt/build/vtk-build
# RUN cmake --build /opt/build/vtk-build -j$(nproc)
10 changes: 10 additions & 0 deletions ci/docker/ubuntu-gnu-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ RUN apt-get update -y -q && \
wget \
zlib1g \
zlib1g-dev \
libncurses5-dev \
m4 \
libgl1-mesa-dev \
libglu1-mesa-dev \
mesa-common-dev \
brotli \
python3 \
python3-brotli \
Expand Down Expand Up @@ -64,6 +69,11 @@ RUN ./cmake.sh 3.23.4 ${arch}
ENV PATH=/cmake/bin/:$PATH
ENV LESSCHARSET=utf-8

COPY ./ci/deps/vtk.sh vtk.sh
RUN if [ "$VT_TV_ENABLED" -eq 1]; then \
./vtk.sh 9.2.2 /vtk-install \
fi

COPY ./ci/deps/mpich.sh mpich.sh
RUN if [ "$ubuntu" = "18.04" ]; then \
./mpich.sh 3.3.2 -j4; else \
Expand Down
9 changes: 9 additions & 0 deletions cmake/link_vt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function(link_target_with_vt)
LINK_FORT
LINK_JSON
LINK_BROTLI
LINK_VT_TV
)
set(
multiValueArg
Expand Down Expand Up @@ -70,6 +71,14 @@ function(link_target_with_vt)
endif()
endif()

if (NOT DEFINED ARG_LINK_VT_TV AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_VT_TV)
if (TV_LIBRARY)
target_link_libraries(
${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} ${TV_LIBRARY}
)
endif()
endif()

if (NOT DEFINED ARG_LINK_ZOLTAN AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_ZOLTAN)
if (vt_zoltan_enabled)
if (${ARG_DEBUG_LINK})
Expand Down
6 changes: 6 additions & 0 deletions cmake/load_local_packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ else()
endif()

set(CHECKPOINT_LIBRARY vt::lib::checkpoint)

if (EXISTS "${PROJECT_LIB_DIR}/vt-tv")
set(vt_tv_python_bindings_enabled OFF)
add_subdirectory(${PROJECT_LIB_DIR}/vt-tv)
set(TV_LIBRARY vt::lib::vt-tv)
endif()
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ x-vtopts: &vtopts
CODECOV_TOKEN: ${CODECOV_TOKEN:-}
TEST_LB_SCHEMA: ${TEST_LB_SCHEMA:-0}
CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD:-17}
VT_TV_ENABLED: ${VT_TV:-0}

services:
##############################################################################
Expand Down

0 comments on commit c88ea8a

Please sign in to comment.