Skip to content

Commit

Permalink
#1609 clean up workspace before compiling vt-sample-project with vt a…
Browse files Browse the repository at this point in the history
…s TPL
  • Loading branch information
Jakub Strzebonski committed Nov 16, 2021
1 parent d5b21bb commit b6e5873
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 46 deletions.
54 changes: 9 additions & 45 deletions ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ else
git clone -b "${detector_rev}" --depth 1 https://github.com/DARMA-tasking/detector.git
export DETECTOR=$PWD/detector
export DETECTOR_BUILD=${build_dir}/detector
export DETECTOR_INSTALL=${DETECTOR_BUILD}/install
mkdir -p "$DETECTOR_BUILD"
cd "$DETECTOR_BUILD"
mkdir build
cd build
cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-DCMAKE_INSTALL_PREFIX="$DETECTOR_BUILD/install" \
-DCMAKE_INSTALL_PREFIX="$DETECTOR_INSTALL" \
"$DETECTOR"
cmake --build . --target install
fi
Expand All @@ -79,13 +80,14 @@ else
git clone -b "${checkpoint_rev}" --depth 1 https://github.com/DARMA-tasking/checkpoint.git
export CHECKPOINT=$PWD/checkpoint
export CHECKPOINT_BUILD=${build_dir}/checkpoint
export CHECKPOINT_INSTALL=${CHECKPOINT_BUILD}/install
mkdir -p "$CHECKPOINT_BUILD"
cd "$CHECKPOINT_BUILD"
mkdir build
cd build
cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-DCMAKE_INSTALL_PREFIX="$CHECKPOINT_BUILD/install" \
-Ddetector_DIR="$DETECTOR_BUILD/install" \
-DCMAKE_INSTALL_PREFIX="$CHECKPOINT_INSTALL" \
-Ddetector_DIR="$DETECTOR_INSTALL" \
"$CHECKPOINT"
cmake --build . --target install
fi
Expand All @@ -98,6 +100,7 @@ fi

export VT=${source_dir}
export VT_BUILD=${build_dir}/vt
export VT_INSTALL=${VT_BUILD}/install
mkdir -p "$VT_BUILD"
cd "$VT_BUILD"
rm -Rf ./*
Expand Down Expand Up @@ -134,10 +137,10 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-DCMAKE_CXX_COMPILER="${CXX:-c++}" \
-DCMAKE_C_COMPILER="${CC:-cc}" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS:-}" \
-Ddetector_DIR="$DETECTOR_BUILD/install" \
-Dcheckpoint_DIR="$CHECKPOINT_BUILD/install" \
-Ddetector_DIR="$DETECTOR_INSTALL" \
-Dcheckpoint_DIR="$CHECKPOINT_INSTALL" \
-DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH:-}" \
-DCMAKE_INSTALL_PREFIX="$VT_BUILD/install" \
-DCMAKE_INSTALL_PREFIX="$VT_INSTALL" \
-Dvt_ci_build="${VT_CI_BUILD:-0}" \
-Dvt_debug_verbose="${VT_DEBUG_VERBOSE:-}" \
-Dvt_tests_num_nodes="${VT_TESTS_NUM_NODES:-}" \
Expand Down Expand Up @@ -225,42 +228,3 @@ then
echo "There was an error during compilation"
exit "$compilation_ret"
fi

inclusion_type=""
if test "$VT_INCLUSION_TYPE" = "TPL"
then
inclusion_type="-Dbuild_with_tpl=1"
elif test "$VT_INCLUSION_TYPE" = "EXT_LIB"
then
inclusion_type="-Dbuild_with_libs=1"
fi

# Don't build vt-sample on Alpine Linux
is_alpine="$(grep ID < /etc/os-release | grep -c alpine || true)"
if test "$is_alpine" -eq 0 && test "${VT_CI_BUILD:-0}" -eq 1 && test "${target}" = "install"
then
git clone https://github.com/DARMA-tasking/vt-sample-project
mkdir -p vt-sample-project/build
cd vt-sample-project/build
export vt_DIR="$VT_BUILD/install"
cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-Dvt_DIR="${VT}" \
-Dcheckpoint_DIR="${CHECKPOINT}" \
-Ddetector_DIR="${DETECTOR}" \
-Dkokkos_DISABLE:BOOL=1 \
-Dkokkos_kernels_DISABLE:BOOL=1 \
-Dvt_trace_only="1" \
-DVT_BUILD_EXAMPLES="0" \
-DVT_BUILD_TESTS="0" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" \
-DCMAKE_CXX_COMPILER="${CXX:-c++}" \
-DCMAKE_C_COMPILER="${CC:-cc}" \
"$inclusion_type" \
..
cmake --build .

# Try to actually run samples
mpiexec -n 2 ./vt-runtime-sample
mpiexec -n 2 ./vt-trace-only-sample
fi
65 changes: 65 additions & 0 deletions ci/build_vt_sample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

set -ex

source_dir=${1}
build_dir=${2}

inclusion_type=""
if test "$VT_INCLUSION_TYPE" = "TPL"
then
inclusion_type="-Dbuild_with_tpl=1"
elif test "$VT_INCLUSION_TYPE" = "EXT_LIB"
then
inclusion_type="-Dbuild_with_libs=1"
fi

# Don't build vt-sample on Alpine Linux
is_alpine="$(grep ID < /etc/os-release | grep -c alpine || true)"
if test "$is_alpine" -eq 0 && test "${VT_CI_BUILD:-0}" -eq 1
then
export VT=${source_dir}
export VT_BUILD=${build_dir}/vt
export VT_INSTALL=${VT_BUILD}/install
export DETECTOR=${build_dir}/detector
export CHECKPOINT=${DETECTOR}/build/checkpoint

cd "$VT_BUILD"

if test "$VT_INCLUSION_TYPE" = "TPL"
then
echo "Clean up before building vt-sample-project"
cmake --build . --target clean
rm -rf "$VT_INSTALL"
fi

if test "$VT_INCLUSION_TYPE" = "EXT_LIB"
then
export vt_DIR="$VT_INSTALL"
fi

git clone https://github.com/DARMA-tasking/vt-sample-project
mkdir -p vt-sample-project/build
cd vt-sample-project/build || exit

cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-Dvt_DIR="${VT}" \
-Dcheckpoint_DIR="${CHECKPOINT}" \
-Ddetector_DIR="${DETECTOR}" \
-Dkokkos_DISABLE:BOOL=1 \
-Dkokkos_kernels_DISABLE:BOOL=1 \
-Dvt_trace_only="1" \
-DVT_BUILD_EXAMPLES="0" \
-DVT_BUILD_TESTS="0" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" \
-DCMAKE_CXX_COMPILER="${CXX:-c++}" \
-DCMAKE_C_COMPILER="${CC:-cc}" \
"$inclusion_type" \
..
cmake --build .

# Try to actually run samples
mpiexec -n 2 ./vt-runtime-sample
mpiexec -n 2 ./vt-trace-only-sample
fi
1 change: 1 addition & 0 deletions ci/docker/develop.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ ENV VT_LB_ENABLED=${VT_LB_ENABLED} \

RUN /vt/ci/build_cpp.sh /vt /build
RUN /vt/ci/test_cpp.sh /vt /build
RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-18.04-clang-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-18.04-gnu-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-18.04-intel-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-18.04-intel-oneapi-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-18.04-nvidia-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-20.04-clang-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-20.04-gnu-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
2 changes: 2 additions & 0 deletions ci/docker/ubuntu-20.04-gnu-openmpi-cpp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,5 @@ RUN /vt/ci/build_cpp.sh /vt /build

FROM build as test
RUN /vt/ci/test_cpp.sh /vt /build

RUN /vt/ci/build_vt_sample.sh /vt /build
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ services:
command: &vt-cpp-command >
/bin/bash -c "
/vt/ci/build_cpp.sh /vt /build &&
/vt/ci/test_cpp.sh /vt /build"
/vt/ci/test_cpp.sh /vt /build &&
/vt/ci/build_vt_sample.sh /vt /build"

##############################################################################
# C++ build/test/clean target for VT on ubuntu platform from container
Expand All @@ -219,6 +220,7 @@ services:
/bin/bash -c "
/vt/ci/build_cpp.sh /vt /build &&
/vt/ci/test_cpp.sh /vt /build &&
/vt/ci/build_vt_sample.sh /vt /build &&
/vt/ci/clean_cpp.sh /vt /build"

##############################################################################
Expand All @@ -230,6 +232,7 @@ services:
# You will get a command line where you can run the build command:
# $ /vt/ci/build_cpp.sh /vt /build
# $ /vt/ci/test_cpp.sh /vt /build
# $ /vt/ci/build_vt_sample.sh /vt /build
ubuntu-cpp-interactive:
image: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-${COMPILER}-cpp
build:
Expand Down
1 change: 1 addition & 0 deletions docs/md/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ $ cd vt
$ docker-compose run -e BUILD_TYPE=debug -e VT_TRACE=1 ubuntu-cpp-interactive
# /vt/ci/build_cpp.sh /vt /build
# /vt/ci/test_cpp.sh /vt /build
# /vt/ci/build_vt_sample.sh /vt /build
```

The same call applies to alpine distro builds if you swap
Expand Down

0 comments on commit b6e5873

Please sign in to comment.