Skip to content

Commit

Permalink
optionally reduce test input sizes for a few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Apr 11, 2021
1 parent 9771e12 commit c89c458
Show file tree
Hide file tree
Showing 19 changed files with 140 additions and 23 deletions.
16 changes: 16 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ stages:
BUILD_CUDA: "OFF"
BUILD_HIP: "OFF"
BUILD_HWLOC: "ON"
FAST_TESTS: "OFF"
RUN_EXAMPLES: "OFF"
CONFIG_LOG: "ON"
CXX_FLAGS: ""
Expand Down Expand Up @@ -68,6 +69,7 @@ stages:
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_HWLOC=${BUILD_HWLOC}
-DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON
-DGINKGO_FAST_TESTS=${FAST_TESTS}
-DGINKGO_RUN_EXAMPLES=${RUN_EXAMPLES}
-DGINKGO_CONFIG_LOG_DETAILED=${CONFIG_LOG}
-DGINKGO_EXPORT_BUILD_DIR=${EXPORT_BUILD_DIR}
Expand Down Expand Up @@ -100,6 +102,7 @@ stages:
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_HWLOC=${BUILD_HWLOC}
-DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON
-DGINKGO_FAST_TESTS=${FAST_TESTS}
-DGINKGO_CONFIG_LOG_DETAILED=${CONFIG_LOG}
-DGINKGO_RUN_EXAMPLES=${RUN_EXAMPLES}
-DGINKGO_EXPORT_BUILD_DIR=${EXPORT_BUILD_DIR}
Expand Down Expand Up @@ -169,6 +172,7 @@ build/cuda90/gcc/all/debug/shared:
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
RUN_EXAMPLES: "ON"
CUDA_ARCH: 35
only:
Expand Down Expand Up @@ -208,6 +212,7 @@ build/cuda91/gcc/all/debug/static:
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_SHARED_LIBS: "OFF"
CUDA_ARCH: 35
only:
Expand Down Expand Up @@ -292,6 +297,7 @@ build/cuda100/gcc/all/debug/shared:
BUILD_CUDA: "ON"
BUILD_HIP: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
CUDA_ARCH: 35
only:
variables:
Expand Down Expand Up @@ -351,6 +357,7 @@ build/cuda101/gcc/all/debug/shared:
BUILD_CUDA: "ON"
BUILD_HIP: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
CUDA_ARCH: 35
only:
variables:
Expand Down Expand Up @@ -412,6 +419,7 @@ build/clang-cuda101/clang/cuda/debug/static:
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_SHARED_LIBS: "OFF"
CUDA_ARCH: 35
only:
Expand All @@ -434,6 +442,7 @@ build/cuda102/gcc/all/debug/shared:
BUILD_CUDA: "ON"
BUILD_HIP: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_HWLOC: "OFF"
CUDA_ARCH: 35
only:
Expand Down Expand Up @@ -476,6 +485,7 @@ build/cuda102/intel/cuda/debug/static:
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_SHARED_LIBS: "OFF"
CUDA_ARCH: 35
only:
Expand All @@ -495,6 +505,7 @@ build/cuda110/gcc/cuda/debug/shared:
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
CUDA_ARCH: 35
only:
variables:
Expand Down Expand Up @@ -534,6 +545,7 @@ build/cuda110/intel/cuda/debug/static:
BUILD_OMP: "ON"
BUILD_CUDA: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_SHARED_LIBS: "OFF"
CUDA_ARCH: 35
only:
Expand All @@ -554,6 +566,7 @@ build/amd/gcc/hip/debug/shared:
BUILD_HIP: "ON"
RUN_EXAMPLES: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
only:
variables:
- $RUN_CI_TAG
Expand Down Expand Up @@ -589,6 +602,7 @@ build/nocuda/gcc/core/debug/static:
<<: *default_variables
BUILD_REFERENCE: "OFF"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_SHARED_LIBS: "OFF"
BUILD_HWLOC: "OFF"
only:
Expand Down Expand Up @@ -623,6 +637,7 @@ build/nocuda/intel/core/debug/shared:
CXX_COMPILER: "icpc"
BUILD_REFERENCE: "OFF"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
only:
variables:
- $RUN_CI_TAG
Expand Down Expand Up @@ -654,6 +669,7 @@ build/nocuda/clang/omp/debug/static:
CXX_COMPILER: "clang++"
BUILD_OMP: "ON"
BUILD_TYPE: "Debug"
FAST_TESTS: "ON"
BUILD_SHARED_LIBS: "OFF"
only:
variables:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ option(GINKGO_BUILD_DPCPP
option(GINKGO_BUILD_CUDA "Compile kernels for NVIDIA GPUs" ${GINKGO_HAS_CUDA})
option(GINKGO_BUILD_HIP "Compile kernels for AMD or NVIDIA GPUs" ${GINKGO_HAS_HIP})
option(GINKGO_BUILD_DOC "Generate documentation" OFF)
option(GINKGO_FAST_TESTS "Reduces the input size for a few tests known to be time-intensive" OFF)
option(GINKGO_SKIP_DEPENDENCY_UPDATE
"Do not update dependencies each time the project is rebuilt" ON)
option(GINKGO_EXPORT_BUILD_DIR
Expand Down
28 changes: 23 additions & 5 deletions cmake/create_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ function(ginkgo_create_test test_name)
)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES
OUTPUT_NAME ${test_name})
if (GINKGO_FAST_TESTS)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE GINKGO_FAST_TESTS)
endif()
if (GINKGO_CHECK_CIRCULAR_DEPS)
target_link_libraries(${TEST_TARGET_NAME} PRIVATE "${GINKGO_CIRCULAR_DEPS_FLAGS}")
endif()
Expand All @@ -30,6 +33,9 @@ function(ginkgo_create_dpcpp_test test_name)
)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES
OUTPUT_NAME ${test_name})
if (GINKGO_FAST_TESTS)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE GINKGO_FAST_TESTS)
endif()
if (GINKGO_CHECK_CIRCULAR_DEPS)
target_link_libraries(${TEST_TARGET_NAME} PRIVATE "${GINKGO_CIRCULAR_DEPS_FLAGS}")
endif()
Expand All @@ -51,6 +57,9 @@ function(ginkgo_create_thread_test test_name)
)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES
OUTPUT_NAME ${test_name})
if (GINKGO_FAST_TESTS)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE GINKGO_FAST_TESTS)
endif()
if (GINKGO_CHECK_CIRCULAR_DEPS)
target_link_libraries(${TEST_TARGET_NAME} PRIVATE "${GINKGO_CIRCULAR_DEPS_FLAGS}")
endif()
Expand All @@ -72,6 +81,9 @@ function(ginkgo_create_test_cpp_cuda_header test_name)
)
set_target_properties(${TEST_TARGET_NAME} PROPERTIES
OUTPUT_NAME ${test_name})
if (GINKGO_FAST_TESTS)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE GINKGO_FAST_TESTS)
endif()
if (GINKGO_CHECK_CIRCULAR_DEPS)
target_link_libraries(${TEST_TARGET_NAME} PRIVATE "${GINKGO_CIRCULAR_DEPS_FLAGS}")
endif()
Expand All @@ -93,7 +105,9 @@ function(ginkgo_create_cuda_test test_name)
PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:${GINKGO_CUDA_ARCH_FLAGS}>")
set_target_properties(${TEST_TARGET_NAME} PROPERTIES
OUTPUT_NAME ${test_name})

if (GINKGO_FAST_TESTS)
target_compile_definitions(${TEST_TARGET_NAME} PRIVATE GINKGO_FAST_TESTS)
endif()
if (GINKGO_CHECK_CIRCULAR_DEPS)
target_link_libraries(${TEST_TARGET_NAME} PRIVATE "${GINKGO_CIRCULAR_DEPS_FLAGS}")
endif()
Expand All @@ -108,6 +122,10 @@ function(ginkgo_create_hip_test test_name)
string(REPLACE "/" "_" TEST_TARGET_NAME "${REL_BINARY_DIR}/${test_name}")

set_source_files_properties(${test_name}.hip.cpp PROPERTIES HIP_SOURCE_PROPERTY_FORMAT TRUE)
set(GINKGO_TEST_HIP_DEFINES)
if (GINKGO_FAST_TESTS)
set(GINKGO_TEST_HIP_DEFINES -DGINKGO_FAST_TESTS)
endif()

# NOTE: With how HIP works, passing the flags `HIPCC_OPTIONS` etc. here
# creates a redefinition of all flags. This creates some issues with `nvcc`,
Expand All @@ -116,13 +134,13 @@ function(ginkgo_create_hip_test test_name)
hip_add_executable(${TEST_TARGET_NAME} ${test_name}.hip.cpp
# If `FindHIP.cmake`, namely `HIP_PARSE_HIPCC_OPTIONS` macro and
# call gets fixed, uncomment this.
# HIPCC_OPTIONS ${GINKGO_HIPCC_OPTIONS}
# NVCC_OPTIONS ${GINKGO_HIP_NVCC_OPTIONS}
# CLANG_OPTIONS ${GINKGO_HIP_CLANG_OPTIONS}
HIPCC_OPTIONS ${GINKGO_TEST_HIP_DEFINES} # ${GINKGO_HIPCC_OPTIONS}
# NVCC_OPTIONS ${GINKGO_TEST_HIP_DEFINES} ${GINKGO_HIP_NVCC_OPTIONS}
# CLANG_OPTIONS ${GINKGO_TEST_HIP_DEFINES} ${GINKGO_HIP_CLANG_OPTIONS}
)
else() # hcc/clang
hip_add_executable(${TEST_TARGET_NAME} ${test_name}.hip.cpp
HIPCC_OPTIONS ${GINKGO_HIPCC_OPTIONS}
HIPCC_OPTIONS ${GINKGO_HIPCC_OPTIONS} ${GINKGO_TEST_HIP_DEFINES}
NVCC_OPTIONS ${GINKGO_HIP_NVCC_OPTIONS}
CLANG_OPTIONS ${GINKGO_HIP_CLANG_OPTIONS}
)
Expand Down
4 changes: 4 additions & 0 deletions cuda/test/factorization/par_ilut_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class ParIlut : public ::testing::Test {
using ComplexCsr = gko::matrix::Csr<std::complex<value_type>, index_type>;

ParIlut()
#ifdef GINKGO_FAST_TESTS
: mtx_size(152, 231),
#else
: mtx_size(532, 423),
#endif
rand_engine(1337),
ref(gko::ReferenceExecutor::create()),
cuda(gko::CudaExecutor::create(0, ref))
Expand Down
17 changes: 12 additions & 5 deletions cuda/test/matrix/csr_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ class Csr : public ::testing::Test {
using ComplexVec = gko::matrix::Dense<std::complex<double>>;
using ComplexMtx = gko::matrix::Csr<std::complex<double>>;

Csr() : mtx_size(532, 231), rand_engine(42) {}
Csr()
#ifdef GINKGO_FAST_TESTS
: mtx_size(152, 231),
#else
: mtx_size(532, 231),
#endif
rand_engine(42)
{}

void SetUp()
{
Expand Down Expand Up @@ -464,10 +471,10 @@ TEST_F(Csr, AdvancedApplyToIdentityMatrixIsEquivalentToRef)
TEST_F(Csr, ApplyToComplexIsEquivalentToRef)
{
set_up_apply_data(std::make_shared<Mtx::automatical>());
auto complex_b = gen_mtx<ComplexVec>(231, 3, 1);
auto complex_b = gen_mtx<ComplexVec>(this->mtx_size[1], 3, 1);
auto dcomplex_b = ComplexVec::create(cuda);
dcomplex_b->copy_from(complex_b.get());
auto complex_x = gen_mtx<ComplexVec>(532, 3, 1);
auto complex_x = gen_mtx<ComplexVec>(this->mtx_size[0], 3, 1);
auto dcomplex_x = ComplexVec::create(cuda);
dcomplex_x->copy_from(complex_x.get());

Expand All @@ -481,10 +488,10 @@ TEST_F(Csr, ApplyToComplexIsEquivalentToRef)
TEST_F(Csr, AdvancedApplyToComplexIsEquivalentToRef)
{
set_up_apply_data(std::make_shared<Mtx::automatical>());
auto complex_b = gen_mtx<ComplexVec>(231, 3, 1);
auto complex_b = gen_mtx<ComplexVec>(this->mtx_size[1], 3, 1);
auto dcomplex_b = ComplexVec::create(cuda);
dcomplex_b->copy_from(complex_b.get());
auto complex_x = gen_mtx<ComplexVec>(532, 3, 1);
auto complex_x = gen_mtx<ComplexVec>(this->mtx_size[0], 3, 1);
auto dcomplex_x = ComplexVec::create(cuda);
dcomplex_x->copy_from(complex_x.get());

Expand Down
9 changes: 8 additions & 1 deletion cuda/test/matrix/diagonal_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ class Diagonal : public ::testing::Test {
using Dense = gko::matrix::Dense<ValueType>;
using ComplexDiag = gko::matrix::Diagonal<ComplexValueType>;

Diagonal() : mtx_size(532, 231), rand_engine(42) {}
Diagonal()
#ifdef GINKGO_FAST_TESTS
: mtx_size(152, 231),
#else
: mtx_size(532, 231),
#endif
rand_engine(42)
{}

void SetUp()
{
Expand Down
4 changes: 4 additions & 0 deletions cuda/test/solver/cb_gmres_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ class CbGmres : public ::testing::Test {

void initialize_data()
{
#ifdef GINKGO_FAST_TESTS
int m = 123;
#else
int m = 597;
#endif
int n = 43;
x = gen_mtx(m, n);
y = gen_mtx(default_krylov_dim_mixed, n);
Expand Down
4 changes: 4 additions & 0 deletions cuda/test/solver/gmres_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ class Gmres : public ::testing::Test {

void initialize_data(int nrhs = 43)
{
#ifdef GINKGO_FAST_TESTS
int m = 123;
#else
int m = 597;
#endif
x = gen_mtx(m, nrhs);
y = gen_mtx(gko::solver::default_krylov_dim, nrhs);
before_preconditioner = Mtx::create_with_config_of(x.get());
Expand Down
4 changes: 4 additions & 0 deletions hip/test/factorization/par_ilut_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class ParIlut : public ::testing::Test {
using ComplexCsr = gko::matrix::Csr<std::complex<value_type>, index_type>;

ParIlut()
#ifdef GINKGO_FAST_TESTS
: mtx_size(152, 231),
#else
: mtx_size(500, 700),
#endif
rand_engine(1337),
ref(gko::ReferenceExecutor::create()),
hip(gko::HipExecutor::create(0, ref))
Expand Down
17 changes: 12 additions & 5 deletions hip/test/matrix/csr_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ class Csr : public ::testing::Test {
using ComplexVec = gko::matrix::Dense<std::complex<double>>;
using ComplexMtx = gko::matrix::Csr<std::complex<double>>;

Csr() : mtx_size(532, 231), rand_engine(42) {}
Csr()
#ifdef GINKGO_FAST_TESTS
: mtx_size(152, 231),
#else
: mtx_size(532, 231),
#endif
rand_engine(42)
{}

void SetUp()
{
Expand Down Expand Up @@ -458,10 +465,10 @@ TEST_F(Csr, AdvancedApplyToIdentityMatrixIsEquivalentToRef)
TEST_F(Csr, ApplyToComplexIsEquivalentToRef)
{
set_up_apply_data(std::make_shared<Mtx::automatical>(hip));
auto complex_b = gen_mtx<ComplexVec>(231, 3, 1);
auto complex_b = gen_mtx<ComplexVec>(this->mtx_size[1], 3, 1);
auto dcomplex_b = ComplexVec::create(hip);
dcomplex_b->copy_from(complex_b.get());
auto complex_x = gen_mtx<ComplexVec>(532, 3, 1);
auto complex_x = gen_mtx<ComplexVec>(this->mtx_size[0], 3, 1);
auto dcomplex_x = ComplexVec::create(hip);
dcomplex_x->copy_from(complex_x.get());

Expand All @@ -475,10 +482,10 @@ TEST_F(Csr, ApplyToComplexIsEquivalentToRef)
TEST_F(Csr, AdvancedApplyToComplexIsEquivalentToRef)
{
set_up_apply_data(std::make_shared<Mtx::automatical>(hip));
auto complex_b = gen_mtx<ComplexVec>(231, 3, 1);
auto complex_b = gen_mtx<ComplexVec>(this->mtx_size[1], 3, 1);
auto dcomplex_b = ComplexVec::create(hip);
dcomplex_b->copy_from(complex_b.get());
auto complex_x = gen_mtx<ComplexVec>(532, 3, 1);
auto complex_x = gen_mtx<ComplexVec>(this->mtx_size[0], 3, 1);
auto dcomplex_x = ComplexVec::create(hip);
dcomplex_x->copy_from(complex_x.get());

Expand Down
9 changes: 8 additions & 1 deletion hip/test/matrix/diagonal_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ class Diagonal : public ::testing::Test {
using Dense = gko::matrix::Dense<ValueType>;
using ComplexDiag = gko::matrix::Diagonal<ComplexValueType>;

Diagonal() : mtx_size(532, 231), rand_engine(42) {}
Diagonal()
#ifdef GINKGO_FAST_TESTS
: mtx_size(152, 231),
#else
: mtx_size(532, 231),
#endif
rand_engine(42)
{}

void SetUp()
{
Expand Down
4 changes: 4 additions & 0 deletions hip/test/solver/cb_gmres_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ class CbGmres : public ::testing::Test {

void initialize_data()
{
#ifdef GINKGO_FAST_TESTS
int m = 123;
#else
int m = 597;
#endif
int n = 43;
x = gen_mtx(m, n);
y = gen_mtx(default_krylov_dim_mixed, n);
Expand Down
Loading

0 comments on commit c89c458

Please sign in to comment.