Skip to content

Asadchev/refactor/unit tests #239

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

Merged
merged 4 commits into from
Dec 28, 2020
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
38 changes: 14 additions & 24 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ stages:
default:
tags: [ docker ]

variables:
# to run OpenMPI in docker
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_btl_vader_single_copy_mechanism: none

before_script:
- echo 'localhost slots=8' > /etc/openmpi/openmpi-default-hostfile
- apt-get install -yq intel-mkl-core-c-2020.4-304
Expand All @@ -18,36 +12,32 @@ before_script:
build:
stage: build
timeout: 3h
interruptible: true
image: valeevgroup/${IMAGE}
variables:
CXX: ${CXX}
TA_PYTHON : "TA_PYTHON=OFF"
ENABLE_MKL : "ENABLE_MKL=OFF"
ENABLE_SCALAPACK : "ENABLE_SCALAPACK=OFF"
script:
- mkdir build
- cd build
- cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/gitlab-ci.cmake
-DCMAKE_BUILD_TYPE=${BUILD_TYPE}
-D${TA_PYTHON}
-D${ENABLE_MKL}
-D${ENABLE_SCALAPACK}
- make tiledarray
- make examples
- make ta_test
- make check
- ../bin/gitlab-ci.sh ..
CMAKE_BUILD_TYPE=${BUILD_TYPE}
${TA_PYTHON}
${ENABLE_MKL}
${ENABLE_SCALAPACK}
MPIEXEC_PREFLAGS="--allow-run-as-root"
blacs_LIBRARIES=scalapack-openmpi
scalapack_LIBRARIES=scalapack-openmpi
lapack_LIBRARIES=lapack
parallel:
matrix:
- CXX: [ g++ ]
IMAGE : [ "ubuntu:20.04" ]
- IMAGE : [ "ubuntu:20.04" ]
CXX: [ g++, clang++-9 ]
BUILD_TYPE : [ "Release", "Debug" ]
ENABLE_MKL : [ "ENABLE_MKL=ON", "ENABLE_MKL=OFF" ]
ENABLE_SCALAPACK : [ "ENABLE_SCALAPACK=ON", "ENABLE_SCALAPACK=OFF" ]
- CXX: [ g++ ]
IMAGE : [ "ubuntu:20.04" ]
- IMAGE : [ "ubuntu:18.04", "ubuntu:20.04" ]
CXX: [ g++ ]
BUILD_TYPE : [ "Release", "Debug" ]
TA_PYTHON : [ "TA_PYTHON=ON" ]
- CXX: [ clang++-9 ]
IMAGE : [ "ubuntu:20.04" ]
BUILD_TYPE : [ "Release", "Debug" ]
ENABLE_MKL : [ "ENABLE_MKL=ON", "ENABLE_MKL=OFF" ]
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ cmake --build build --target install
- [CMake](https://cmake.org/), version 3.15 or higher; if CUDA support is needed, CMake 3.18 or higher is required.
- [Git](https://git-scm.com/) 1.8 or later (required to obtain TiledArray and MADNESS source code from GitHub)
- [Eigen](http://eigen.tuxfamily.org/), version 3.3 or higher; if CUDA is enabled then 3.3.7 is required (will be downloaded automatically, if missing)
- [Boost libraries](www.boost.org/), version 1.68 or higher (will be downloaded automatically, if missing). The following principal Boost components are used:
- [Boost libraries](www.boost.org/), version 1.59 or higher (will be downloaded automatically, if missing). The following principal Boost components are used:
- Boost.Iterator: header-only
- Boost.Container: header-only
- Boost.Test: header-only or (optionally) as a compiled library, *only used for unit testing*
Expand Down
35 changes: 35 additions & 0 deletions bin/gitlab-ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

echo "$ $0 $@"

if [ "$#" -lt 1 ]; then
echo "CMake project directory argument required"
exit 1
fi

project_dir=$1
shift

cmake_args="-DTA_BUILD_UNITTEST=TRUE"

for arg in $@; do
cmake_args+=" -D$arg"
done

cmake_build_target="cmake --build . --target "

set -e
set -x

# to run OpenMPI in docker as root
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
export OMPI_MCA_btl_vader_single_copy_mechanism="none"

cmake $project_dir $cmake_args

$cmake_build_target tiledarray
$cmake_build_target examples
$cmake_build_target ta_test
$cmake_build_target check

4 changes: 0 additions & 4 deletions cmake/toolchains/gitlab-ci.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion examples/dgemm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# Create example executable

foreach(_exec blas eigen ta_band ta_dense ta_sparse ta_dense_nonuniform
foreach(_exec ta_blas ta_eigen ta_band ta_dense ta_sparse ta_dense_nonuniform
ta_dense_asymm ta_sparse_grow ta_dense_new_tile
ta_cc_abcd)

Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions external/versions.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# for each dependency track both current and previous id (the variable for the latter must contain PREVIOUS)
# to be able to auto-update them

set(TA_TRACKED_BOOST_VERSION 1.68)
set(TA_TRACKED_BOOST_PREVIOUS_VERSION 1.33)
# Boost explicitly downgraded to 1.59 from 1.68
set(TA_TRACKED_BOOST_VERSION 1.59)
set(TA_TRACKED_BOOST_PREVIOUS_VERSION 1.68)
set(TA_INSTALL_BOOST_VERSION 1.70.0)
set(TA_INSTALL_BOOST_PREVIOUS_VERSION 1.70.0)
set(TA_INSTALL_BOOST_URL_HASH 882b48708d211a5f48e60b0124cf5863c1534cd544ecd0664bb534a4b5d506e9)
Expand Down
13 changes: 10 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#

CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_config_h.in
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_config.h.in
${PROJECT_BINARY_DIR}/tests/unit_test_config.h
)

Expand Down Expand Up @@ -158,9 +158,16 @@ add_test(build_${executable} "${CMAKE_COMMAND}" --build ${PROJECT_BINARY_DIR} --

# Add a test(s)
if(ENABLE_MPI)
set (${executable}_np_1_args --run_test=!@distributed)
set (${executable}_np_2_args --run_test=!@serial)
foreach(p RANGE 1 2)
add_test(NAME ${executable}-np-${p}
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${p} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${executable}> --log_level=warning --show-progress ${MPIEXEC_POSTFLAGS})
add_test(
NAME ${executable}-np-${p}
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${p}
${MPIEXEC_PREFLAGS}
$<TARGET_FILE:${executable}> --log_level=warning --show-progress ${${executable}_np_${p}_args}
${MPIEXEC_POSTFLAGS}
)
set_tests_properties(${executable}-np-${p} PROPERTIES DEPENDS build_${executable})
if (p GREATER 1)
set_tests_properties(${executable}-np-${p} PROPERTIES ENVIRONMENT TA_UT_DISTRIBUTED=1)
Expand Down
2 changes: 1 addition & 1 deletion tests/bipartite_index_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct BipartiteIndexListFixture {
};

BOOST_FIXTURE_TEST_SUITE(bipartite_index_list_suite, BipartiteIndexListFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

/* This unit test ensures that the typedefs are what we think they are. Since no
* template meta-programming occurs in the class these tests serve more as a
Expand Down
2 changes: 1 addition & 1 deletion tests/bitset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const std::size_t BitsetFixture::blocks = 11;
// =============================================================================
// Bitset Test Suite

BOOST_FIXTURE_TEST_SUITE(bitset_suite, BitsetFixture, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_FIXTURE_TEST_SUITE(bitset_suite, BitsetFixture, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(size_constructor) {
// Check for error free construction
Expand Down
2 changes: 1 addition & 1 deletion tests/block_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Range BlockRangeFixture::r(std::array<int, 3>{{0, 1, 2}},
std::array<int, 3>{{5, 11, 8}});

BOOST_FIXTURE_TEST_SUITE(block_range_suite, BlockRangeFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

const auto target_count = 20;

Expand Down
2 changes: 1 addition & 1 deletion tests/cutt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct cuTTFixture {
int C;
};

BOOST_FIXTURE_TEST_SUITE(cutt_suite, cuTTFixture, TA_UT_SKIP_IF_DISTRIBUTED);
BOOST_FIXTURE_TEST_SUITE(cutt_suite, cuTTFixture, TA_UT_LABEL_SERIAL);

BOOST_AUTO_TEST_CASE(cutt_gpu_mem) {
int* a_host = (int*)std::malloc(A * A * sizeof(int));
Expand Down
2 changes: 1 addition & 1 deletion tests/math_blas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct BlasFixture {

const double BlasFixture::tol = 0.001;

BOOST_FIXTURE_TEST_SUITE(blas_suite, BlasFixture, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_FIXTURE_TEST_SUITE(blas_suite, BlasFixture, TA_UT_LABEL_SERIAL)

typedef boost::mpl::list<int, long, unsigned int, unsigned long> int_types;

Expand Down
2 changes: 1 addition & 1 deletion tests/math_outer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct OuterFixture {
}; // OuterFixture

BOOST_FIXTURE_TEST_SUITE(math_outer_suite, OuterFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(outer_kernel) {
const std::vector<int> reference = result;
Expand Down
2 changes: 1 addition & 1 deletion tests/math_partial_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct PartialReduceFixture {
}; // PartialReduceFixture

BOOST_FIXTURE_TEST_SUITE(math_partial_reduce_suite, PartialReduceFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(unary_row_reduce) {
// Create a copy of the result for later use.
Expand Down
2 changes: 1 addition & 1 deletion tests/math_transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct TransposeFixture {
}; // TransposeFixture

BOOST_FIXTURE_TEST_SUITE(transpose_suite, TransposeFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(copy) {
const std::size_t m = 20;
Expand Down
2 changes: 1 addition & 1 deletion tests/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

struct MetaFixture {}; // MetaFixture

BOOST_FIXTURE_TEST_SUITE(meta_suite, MetaFixture, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_FIXTURE_TEST_SUITE(meta_suite, MetaFixture, TA_UT_LABEL_SERIAL)

double sin(double x) { return std::sin(x); }
double cos(double x) { return std::cos(x); }
Expand Down
2 changes: 1 addition & 1 deletion tests/perm_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const std::array<std::size_t, 4> PermIndexFixture::finish = {
{3ul, 5ul, 7ul, 11ul}};

BOOST_FIXTURE_TEST_SUITE(perm_index_suite, PermIndexFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(default_constructor) {
BOOST_CHECK_NO_THROW(PermIndex x;);
Expand Down
2 changes: 1 addition & 1 deletion tests/permutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ typedef boost::mpl::list<TiledArray::Permutation> ptypes0;
typedef boost::mpl::list<TiledArray::symmetry::Permutation> ptypes1;

BOOST_FIXTURE_TEST_SUITE(permutation_suite, PermutationFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE_TEMPLATE(constructor, Permutation, ptypes0) {
// check default constructor
Expand Down
2 changes: 1 addition & 1 deletion tests/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using true_types = boost::mpl::list<int, float, double, std::complex<float>,
std::complex<double>>;
} // namespace

BOOST_AUTO_TEST_SUITE(can_make_random, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_AUTO_TEST_SUITE(can_make_random, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE_TEMPLATE(can_make_random_false, ValueType, false_types) {
using can_make_random_t = CanMakeRandom<ValueType>;
Expand Down
2 changes: 1 addition & 1 deletion tests/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const RangeFixture::index RangeFixture::p4(GlobalFixture::dim, 4);
const RangeFixture::index RangeFixture::p5(GlobalFixture::dim, 5);
const RangeFixture::index RangeFixture::p6(GlobalFixture::dim, 6);

BOOST_FIXTURE_TEST_SUITE(range_suite, RangeFixture, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_FIXTURE_TEST_SUITE(range_suite, RangeFixture, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(dimension_accessor) {
BOOST_CHECK_EQUAL_COLLECTIONS(r.lobound_data(), r.lobound_data() + r.rank(),
Expand Down
2 changes: 1 addition & 1 deletion tests/s_t_t_contract_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace TiledArray;
using namespace TiledArray::expressions;

BOOST_AUTO_TEST_SUITE(s_t_t_contract_fxn, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_AUTO_TEST_SUITE(s_t_t_contract_fxn, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(i_i) {
Tensor<double> lhs(Range{4}, {80, 36, 4, 36});
Expand Down
2 changes: 1 addition & 1 deletion tests/symm_irrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct IrrepFixture {
using TiledArray::Irrep;

BOOST_FIXTURE_TEST_SUITE(symm_irrep_suite, IrrepFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(constructor) {
{
Expand Down
2 changes: 1 addition & 1 deletion tests/symm_permutation_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct PermutationGroupFixture {
}; // PermutationGroupFixture

BOOST_FIXTURE_TEST_SUITE(symm_group_suite, PermutationGroupFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(constructor) {
// SymmetricGroup "degree" ctor
Expand Down
2 changes: 1 addition & 1 deletion tests/symm_representation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ U1_Operator identity<U1_Operator>() {
} // namespace symmetry
} // namespace TiledArray

BOOST_FIXTURE_TEST_SUITE(symm_representation_suite, GroupRepresentationFixture, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_FIXTURE_TEST_SUITE(symm_representation_suite, GroupRepresentationFixture, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(constructor) {
// representation for permutation symmetry
Expand Down
2 changes: 1 addition & 1 deletion tests/t_s_t_contract_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace TiledArray;
using namespace TiledArray::expressions;

BOOST_AUTO_TEST_SUITE(t_s_t_contract_fxn, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_AUTO_TEST_SUITE(t_s_t_contract_fxn, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(i_i) {
double lhs = 3.0;
Expand Down
2 changes: 1 addition & 1 deletion tests/t_t_t_contract_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace TiledArray;
using namespace TiledArray::expressions;

BOOST_AUTO_TEST_SUITE(t_t_t_contract_fxn, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_AUTO_TEST_SUITE(t_t_t_contract_fxn, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(ij_i_j) {
Tensor<double> lhs(Range{4}, {24, 95, 2, 37});
Expand Down
2 changes: 1 addition & 1 deletion tests/t_tot_tot_contract_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace TiledArray;
using namespace TiledArray::expressions;

BOOST_AUTO_TEST_SUITE(t_tot_tot_contract_fxn, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_AUTO_TEST_SUITE(t_tot_tot_contract_fxn, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(ij_eq_i_k_times_j_k){
Tensor<double> lhs_elem_0(Range{6}, {94, 83, 18, 33, 12, 74});
Expand Down
2 changes: 1 addition & 1 deletion tests/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

const TensorFixture::range_type TensorFixture::r = make_range(81);

BOOST_FIXTURE_TEST_SUITE(tensor_suite, TensorFixture, TA_UT_SKIP_IF_DISTRIBUTED)
BOOST_FIXTURE_TEST_SUITE(tensor_suite, TensorFixture, TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(default_constructor) {
// check constructor
Expand Down
2 changes: 1 addition & 1 deletion tests/tensor_of_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const BipartitePermutation TensorOfTensorFixture::bperm(Permutation{1, 0, 3, 2},
2);

BOOST_FIXTURE_TEST_SUITE(tensor_of_tensor_suite, TensorOfTensorFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

#ifdef TILEDARRAY_HAS_BTAS
typedef boost::mpl::list<TiledArray::Tensor<int>, bTensorI> itensor_types;
Expand Down
2 changes: 1 addition & 1 deletion tests/tensor_shift_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct ShiftWrapperFixture {
}; // ShiftWrapperFixture

BOOST_FIXTURE_TEST_SUITE(tensor_shift_wrapper_suite, ShiftWrapperFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(constructor) {
BOOST_CHECK_NO_THROW(shift(t1));
Expand Down
2 changes: 1 addition & 1 deletion tests/tensor_tensor_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const std::array<int, 3> TensorViewFixture::lower_bound{{0, 1, 2}};
const std::array<int, 3> TensorViewFixture::upper_bound{{5, 7, 11}};

BOOST_FIXTURE_TEST_SUITE(tensor_view_suite, TensorViewFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(non_const_view) {
for (auto lower_it = t.range().begin(); lower_it != t.range().end();
Expand Down
2 changes: 1 addition & 1 deletion tests/tensor_um.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct TensorUMFixture {
const TensorUMFixture::range_type TensorUMFixture::r = make_range(81);

BOOST_FIXTURE_TEST_SUITE(tensor_um_suite, TensorUMFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(default_constructor) {
// check constructor
Expand Down
2 changes: 1 addition & 1 deletion tests/tile_op_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct AddFixture : public RangeFixture {
}; // AddFixture

BOOST_FIXTURE_TEST_SUITE(tile_op_add_suite, AddFixture,
TA_UT_SKIP_IF_DISTRIBUTED)
TA_UT_LABEL_SERIAL)

BOOST_AUTO_TEST_CASE(constructor) {
// Check that the constructors can be called without throwing exceptions
Expand Down
Loading