Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First krino commit #9825

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PackagesList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ TRIBITS_REPOSITORY_DEFINE_PACKAGES(
Compadre packages/compadre ST
STK packages/stk PT # Depends on boost
Percept packages/percept PT # Depends on boost
Krino packages/krino PT # Depends on boost
SCORECapf_zoltan SCOREC/zoltan ST
SCORECapf_stk SCOREC/stk ST
SCORECma SCOREC/ma ST
Expand Down
13 changes: 13 additions & 0 deletions packages/krino/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

message("Building Krino as a Trilinos package")
TRIBITS_PACKAGE(Krino)

TRIBITS_ADD_DEBUG_OPTION()
TRIBITS_ADD_SHOW_DEPRECATED_WARNINGS_OPTION()

if (${Trilinos_ENABLE_Krino})
add_subdirectory(krino)
add_subdirectory(delete_small_elements)
endif()

TRIBITS_PACKAGE_POSTPROCESS()
30 changes: 30 additions & 0 deletions packages/krino/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright 2002 - 2008, 2010, 2011 National Technology & Engineering
Solutions of Sandia, LLC (NTESS).

Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government
retains certain rights in this software.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 8 additions & 0 deletions packages/krino/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SET(LIB_REQUIRED_DEP_PACKAGES SEACASIoss SEACASExodus STKBalance STKMath STKIO STKSearch STKTopology STKUtil STKTools STKEmend Percept Intrepid)
SET(LIB_OPTIONAL_DEP_PACKAGES)
SET(TEST_REQUIRED_DEP_PACKAGES Gtest STKUnit_test_utils)
SET(TEST_OPTIONAL_DEP_PACKAGES)
SET(LIB_REQUIRED_DEP_TPLS Boost)
SET(LIB_OPTIONAL_DEP_TPLS MPI yaml-cpp)
SET(TEST_REQUIRED_DEP_TPLS)
SET(TEST_OPTIONAL_DEP_TPLS)
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/sh

function execute() {
stdbuf -o0 -e0 echo "% $@" ;
eval "$@" ;
if [ $? -ne 0 ] ; then
echo "'$@' failed.";
exit 1;
fi
}

function cd_to_new_dir()
{
execute rm -rf $1
execute mkdir $1
execute cd $1
}

function exit_with_message()
{
echo $1
exit 1
}

function make_and_install()
{
make -j 16 || exit_with_message "Failed building $1"
make install || exit_with_message "Failed installing $1"
}

function build_yaml()
{
productName=yaml

cd_to_new_dir ${output_dir}/${productName}
execute tar -xzf ${sierra_proj}/TPLs_src/spack/spack_tpls/yaml-cpp/*.tar.gz
cd_to_new_dir ${productName}_build

export CC=gcc
export CXX=g++
execute cmake -DCMAKE_BUILD_TYPE=${build_type^^} -DYAML_CPP_BUILD_TESTS=false -DCMAKE_INSTALL_PREFIX=../${productName}_install ../yaml-cpp
make_and_install $productName
unset CC
unset CXX
}

function build_trilinos_with_krino()
{
productName=trilinos

trilinos_dir=${output_dir}/${productName}
if [ ! -d ${trilinos_dir} ] ; then
execute mkdir ${trilinos_dir}
fi
execute cd ${trilinos_dir}

if [ ! -d Trilinos ] ; then
execute git clone -b develop https://github.com/trilinos/Trilinos.git Trilinos
#else
#execute cd Trilinos
#execute git checkout develop
#execute git reset --hard origin/develop
#execute git pull
#execute cd ..
fi

if [ -d Trilinos/packages/krino ] ; then
execute rm -rf Trilinos/packages/krino;
fi
if [ ! -L Trilinos/packages/krino ] ; then
execute ln -s ${sierra_proj}/krino Trilinos/packages
fi

rm -rf ${productName}_install
cd_to_new_dir ${productName}_build

export TRILINOS_INSTALL_DIR=../${productName}_install
$sierra_proj/krino/cmake_install_test/run_cmake_krino
make_and_install $productName
}

function runTests()
{
cd $1
ctest -j 16 || exit_with_message "$2 tests failed"
cd ../..
}

sierra_proj=${SIERRA_PROJ:-${PWD}}
output_dir=${OUTPUT_DIR:-${PWD}/../krino-cmake-testing}

cuda_on_or_off=${CUDA:-OFF}
build_type=${CMAKE_BUILD_TYPE:-release}
date_suffix=`date +%F_%H-%M-%S`

source $sierra_proj/krino/cmake_install_test/load_gcc_modules

if [ ! -d ${output_dir} ] ; then
execute mkdir ${output_dir}
fi

build_yaml
build_trilinos_with_krino

#runTests morph/morph_build "Morph"
#runTests morph_and_sgm/morph_and_sgm_build "Morph and SGM"
#runTests morphWithExe/morphWithExe_build "MorphWithExe"

13 changes: 13 additions & 0 deletions packages/krino/cmake_install_test/load_gcc_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

module load cde/v2/cmake/3.19.2
module load cde/v2/compiler/gcc/7.2.0
module load cde/v2/gcc/7.2.0/openmpi/4.0.5
module load cde/v2/gcc/7.2.0/netlib-lapack/3.8.0
module load cde/v2/gcc/7.2.0/boost/1.73.0
module load cde/v2/gcc/7.2.0/hdf5/1.10.6
module load cde/v2/gcc/7.2.0/netcdf-c/4.7.3
module load cde/v2/gcc/7.2.0/parallel-netcdf/1.12.1
module load cde/v2/gcc/7.2.0/metis/5.1.0
module load cde/v2/gcc/7.2.0/parmetis/4.0.3

52 changes: 52 additions & 0 deletions packages/krino/cmake_install_test/run_cmake_krino
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

trilinos_src_dir=${TRILINOS_DIR:-${PWD}/../Trilinos}
build_dir=${BUILD_DIR:-${PWD}}
build_type=${CMAKE_BUILD_TYPE:-release}
trilinos_install_dir=${TRILINOS_INSTALL_DIR:-${PWD}/../trilinos_install_dir}

yaml_install_dir=${YAML_INSTALL_DIR:-${build_dir}/../../yaml/yaml_install}

printf "\nTRILINOS_DIR=${trilinos_src_dir}\n";
printf "BUILD_DIR=${build_dir}\n";
printf "CMAKE_BUILD_TYPE=${build_type}\n";
printf "TRILINOS_INSTALL_DIR=${trilinos_install_dir}\n";
printf "YAML_INSTALL_DIR=${yaml_install_dir}\n";
printf "\nTo change these vars, set as env vars or pass to this script like 'VAR=value run_cmake_stk'\n\n";

if [ ! -d ${trilinos_src_dir}/packages/seacas ] && [ ! -L ${trilinos_src_dir}/packages/seacas ] ; then
echo "Trilinos dir (${trilinos_src_dir}) doesn't have packages/seacas directory. If using a Sierra project, make a soft-link to Sierra's seacas directory.";
exit 1;
fi
if [ ! -d ${trilinos_src_dir}/packages/stk ] && [ ! -L ${trilinos_src_dir}/packages/stk ]; then
echo "Trilinos dir (${trilinos_src_dir}) doesn't have packages/stk directory. If using a Sierra project, make a soft-link to Sierra's stk directory.";
exit 1;
fi
if [ ! -d ${trilinos_src_dir}/packages/krino ] && [ ! -L ${trilinos_src_dir}/packages/krino ]; then
echo "Trilinos dir (${trilinos_src_dir}) doesn't have packages/krino directory. If using a Sierra project, make a soft-link to Sierra's krino directory.";
exit 1;
fi

mkdir -p $trilinos_install_dir
mkdir -p $build_dir

cd ${build_dir}

# Cleanup old cache before we configure
rm -rf CMakeFiles CMakeCache.txt

cmake \
-DCMAKE_INSTALL_PREFIX=$trilinos_install_dir \
-DCMAKE_BUILD_TYPE=${build_type^^} \
-DKrino_ENABLE_TESTS:BOOL=ON \
-DTrilinos_ENABLE_Krino:BOOL=ON \
-DTrilinos_ENABLE_Fortran:BOOL=ON \
-DTPL_ENABLE_yaml-cpp=ON \
-Dyaml-cpp_INCLUDE_DIRS=${yaml_install_dir}/include \
-Dyaml-cpp_LIBRARY_DIRS=${yaml_install_dir}/lib \
-DTPL_ENABLE_Boost:BOOL=ON \
-DTPL_ENABLE_MPI=ON \
-DTPL_ENABLE_Pnetcdf:BOOL=ON \
-DTPL_ENABLE_HDF5:BOOL=ON \
${trilinos_src_dir}/

Loading