Skip to content

Commit

Permalink
make Range-V3 mandatory + bump its tag to 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Jun 19, 2024
1 parent b4c8804 commit beed33c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 52 deletions.
10 changes: 2 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ option(TA_TRACE_GLOBAL_COMM_STATS "Enable tracing of communication stats of glob
add_feature_info(TASK_TRACE_DEBUG TA_TRACE_GLOBAL_COMM_STATS "Debug communication stats of global objects (DistEval's and DIstributedStorage) TiledArray")
set(TILEDARRAY_ENABLE_GLOBAL_COMM_STATS_TRACE ${TA_TRACE_GLOBAL_COMM_STATS})

option(TA_RANGEV3 "Enable Range-V3 library" OFF)
add_feature_info(TA_RANGEV3 TA_RANGEV3 "Range-V3 ranges library")

option(TA_TTG "Enable search/build of TTG library" OFF)
add_feature_info(TA_TTG TA_TTG "TTG library")

Expand Down Expand Up @@ -310,6 +307,7 @@ endif()
if(ENABLE_HIP)
include(external/hip.cmake)
endif()
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchRangeV3.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchMADWorld.cmake)
if (TA_TTG)
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchTTG.cmake)
Expand Down Expand Up @@ -347,11 +345,7 @@ if(CCACHE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C++")
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}" CACHE STRING "Compiler launcher to use for compiling C")
endif(CCACHE)
# 2. range-v3
if (TA_RANGEV3)
include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchRangeV3.cmake)
endif(TA_RANGEV3)
# 3. TTG
# 2. TTG
# N.B. make sure TA configures MADNESS correctly
#if (TA_TTG)
# include(${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchTTG.cmake)
Expand Down
3 changes: 1 addition & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Both methods are supported. However, for most users we _strongly_ recommend to b
- Boost.Container: header-only
- Boost.Test: header-only or (optionally) as a compiled library, *only used for unit testing*
- Boost.Range: header-only, *only used for unit testing*
- [Range-V3](https://github.com/ericniebler/range-v3.git) -- a Ranges library that served as the basis for Ranges component of C++20 and later.
- [BTAS](http://github.com/ValeevGroup/BTAS), tag 4e8f5233aa7881dccdfcc37ce07128833926d3c2 . If usable BTAS installation is not found, TiledArray will download and compile
BTAS from source. *This is the recommended way to compile BTAS for all users*.
- [MADNESS](https://github.com/m-a-d-n-e-s-s/madness), tag 8788aea9758bfe6479cc23d39e6c77b7528009db .
Expand Down Expand Up @@ -74,7 +75,6 @@ Optional prerequisites:
- [scalapackpp](https://github.com/wavefunction91/scalapackpp.git) -- a modern C++ (C++17) wrapper for ScaLAPACK (tag 6397f52cf11c0dfd82a79698ee198a2fce515d81); pulls and builds the following additional prerequisite
- [blacspp](https://github.com/wavefunction91/blacspp.git) -- a modern C++ (C++17) wrapper for BLACS
- Python3 interpreter -- to test (optionally-built) Python bindings
- [Range-V3](https://github.com/ericniebler/range-v3.git) -- a Ranges library that served as the basis for Ranges component of C++20; only used for some unit testing of the functionality anticipated to be supported by future C++ standards.
- [TTG](https://github.com/TESSEorg/ttg.git) -- C++ implementation of the Template Task Graph programming model for fine-grained flow-graph composition of distributed memory programs (tag 3fe4a06dbf4b05091269488aab38223da1f8cb8e).

Many of these dependencies can be installed with a package manager,
Expand Down Expand Up @@ -416,7 +416,6 @@ support may be added.
* `TA_ASSERT_POLICY` -- Set to `TA_ASSERT_IGNORE` to disable `TA_ASSERT` assertions, `TA_ASSERT_THROW` to cause `TA_ASSERT` assertions to throw, `TA_ASSERT_ABORT` to cause `TA_ASSERT` assertions to abort. The default is `TA_ASSERT_IGNORE` if CMake uses a single-configuration generator and`CMAKE_BUILD_TYPE` is set to `Release` or `MinSizeRel`, else the default is `TA_ASSERT_THROW`.
* `BUILD_TESTING` -- Set of `OFF` to disable building unit tests. The default is `ON`.
* `TA_TRACE_TASKS` -- Set to `ON` to enable tracing of MADNESS tasks using custom task tracer. Note that standard profilers/tracers are generally useless (except in the trivial cases) with MADWorld-based programs since the submission context of tasks is not captured by standard tracing tools; this makes it impossible in a nontrivial program to attribute tasks to source code. WARNING: task tracing his will greatly increase the memory requirements. [Default=OFF].
* `TA_RANGEV3` -- Set to `ON` to find or fetch the Range-V3 library and enable additional tests of TA components with constructs anticipated to be supported in the future. [Default=OFF].
* `TA_TTG` -- Set to `ON` to find or fetch the TTG library. [Default=OFF].
* `TA_SIGNED_1INDEX_TYPE` -- Set to `OFF` to use unsigned 1-index coordinate type (default for TiledArray 1.0.0-alpha.2 and older). The default is `ON`, which enables the use of negative indices in coordinates.
* `TA_MAX_SOO_RANK_METADATA` -- Specifies the maximum rank for which to use Small Object Optimization (hence, avoid the use of the heap) for metadata. The default is `8`.
Expand Down
5 changes: 5 additions & 0 deletions cmake/tiledarray-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ include(CMakeFindDependencyMacro)

@Boost_CONFIG_FILE_CONTENTS@

if (NOT TARGET range-v3::range-v3)
get_filename_component(range-v3_DIR "@range-v3_CONFIG@" DIRECTORY)
find_dependency(range-v3 QUIET REQUIRED HINTS "${range-v3_DIR}")
endif(NOT TARGET range-v3::range-v3)

if (NOT TARGET BTAS::BTAS)
get_filename_component(BTAS_DIR "@BTAS_CONFIG@" DIRECTORY)
find_dependency(BTAS 1.0.0 QUIET CONFIG REQUIRED HINTS "${BTAS_DIR}")
Expand Down
4 changes: 2 additions & 2 deletions external/versions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ set(TA_TRACKED_UMPIRE_PREVIOUS_TAG v2023.06.0)
set(TA_TRACKED_SCALAPACKPP_TAG 6397f52cf11c0dfd82a79698ee198a2fce515d81)
set(TA_TRACKED_SCALAPACKPP_PREVIOUS_TAG 711ef363479a90c88788036f9c6c8adb70736cbf )

set(TA_TRACKED_RANGEV3_TAG 2e0591c57fce2aca6073ad6e4fdc50d841827864)
set(TA_TRACKED_RANGEV3_PREVIOUS_TAG dbdaa247a25a0daa24c68f1286a5693c72ea0006)
set(TA_TRACKED_RANGEV3_TAG 0.12.0)
set(TA_TRACKED_RANGEV3_PREVIOUS_TAG 2e0591c57fce2aca6073ad6e4fdc50d841827864)

set(TA_TRACKED_TTG_URL https://github.com/TESSEorg/ttg)
set(TA_TRACKED_TTG_TAG 3fe4a06dbf4b05091269488aab38223da1f8cb8e)
Expand Down
7 changes: 2 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,8 @@ target_include_directories(${executable} PRIVATE
# is too late to do this here; must set TA_ERROR=throw if want to run unit tests
target_compile_definitions(${executable} PRIVATE TILEDARRAY_NO_USER_ERROR_MESSAGES=1
MADNESS_DISPLAY_EXCEPTION_BREAK_MESSAGE=0)
# optional dependencies
if (TARGET range-v3::range-v3)
target_link_libraries(${executable} PRIVATE range-v3::range-v3)
target_compile_definitions(${executable} PRIVATE TILEDARRAY_HAS_RANGEV3=1)
endif (TARGET range-v3::range-v3)
# always test range-v3
target_link_libraries(${executable} PRIVATE range-v3::range-v3)

# Add targets
add_test(tiledarray/unit/build "${CMAKE_COMMAND}" --build ${PROJECT_BINARY_DIR} --target ${executable})
Expand Down
4 changes: 0 additions & 4 deletions tests/block_range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

#include <TiledArray/util/eigen.h>
#include <boost/range/combine.hpp>
#ifdef TILEDARRAY_HAS_RANGEV3
#include <range/v3/view/zip.hpp>
#endif

#include "TiledArray/block_range.h"
#include "range_fixture.h"
Expand Down Expand Up @@ -229,14 +227,12 @@ BOOST_AUTO_TEST_CASE(block) {
BlockRange br2(r, boost::combine(lobounds, upbounds));
BOOST_CHECK_EQUAL(br2, bref);

#ifdef TILEDARRAY_HAS_RANGEV3
// using zipped ranges of bounds (using Ranges-V3)
// need to #include <range/v3/view/zip.hpp>
BOOST_CHECK_NO_THROW(
BlockRange br3(r, ranges::views::zip(lobounds, upbounds)));
BlockRange br3(r, ranges::views::zip(lobounds, upbounds));
BOOST_CHECK_EQUAL(br3, bref);
#endif

// using nested initializer_list
BOOST_CHECK_NO_THROW(BlockRange br4(r, {{0, 4}, {1, 6}, {2, 8}}));
Expand Down
2 changes: 0 additions & 2 deletions tests/expressions_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@

#include <TiledArray/util/eigen.h>
#include <boost/range/combine.hpp>
#ifdef TILEDARRAY_HAS_RANGEV3
#include <range/v3/view/zip.hpp>
#endif

#include <TiledArray/config.h>

Expand Down
20 changes: 5 additions & 15 deletions tests/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

#include <TiledArray/util/eigen.h>
#include <boost/range/combine.hpp>
#ifdef TILEDARRAY_HAS_RANGEV3
#include <range/v3/view/zip.hpp>
#endif

#include <numeric>
#include <sstream>
Expand Down Expand Up @@ -169,10 +167,8 @@ BOOST_AUTO_TEST_CASE(constructors) {
BOOST_REQUIRE_NO_THROW(Range r2(p2, f2)); // uses index containers
BOOST_REQUIRE_NO_THROW(
Range r(boost::combine(p2, f2))); // uses zipped range of p2 and f2
#ifdef TILEDARRAY_HAS_RANGEV3
BOOST_REQUIRE_NO_THROW(
Range r(ranges::views::zip(p2, f2))); // uses zipped range of p2 and f2
#endif

BOOST_CHECK_THROW(Range r2(f2, p2), Exception); // lobound > upbound
Range r2(p2, f2);
Expand All @@ -190,11 +186,9 @@ BOOST_AUTO_TEST_CASE(constructors) {
Range should_be_copy_of_r2(
boost::combine(p2, f2)); // uses zipped range of p2 and f2
BOOST_CHECK_EQUAL(r2, should_be_copy_of_r2);
#ifdef TILEDARRAY_HAS_RANGEV3
Range should_be_another_copy_of_r2(
ranges::views::zip(p2, f2)); // uses zipped range of p2 and f2
BOOST_CHECK_EQUAL(r2, should_be_another_copy_of_r2);
#endif

// test the rest of bound-based ctors
{
Expand Down Expand Up @@ -243,10 +237,8 @@ BOOST_AUTO_TEST_CASE(constructors) {
// uses zipped bounds
Range r7(boost::combine(std::vector{0, 1, 2}, std::array{4, 6, 8}));
BOOST_CHECK_EQUAL(ref, r7);
#ifdef TILEDARRAY_HAS_RANGEV3
// Range r8(ranges::views::zip(std::array{0, 1, 2}, std::vector{4, 6, 8}));
// BOOST_CHECK_EQUAL(ref, r8);
#endif
// Range r8(ranges::views::zip(std::array{0, 1, 2}, std::vector{4, 6,
// 8})); BOOST_CHECK_EQUAL(ref, r8);

// zipped bounds with Eigen vectors
{
Expand Down Expand Up @@ -278,11 +270,9 @@ BOOST_AUTO_TEST_CASE(constructors) {
Range r14(boost::combine(iv({0, 1, 2}), iv(iv({0, 1, 2}) + iv(4, 5, 6))));
BOOST_CHECK_EQUAL(ref, r14);

#ifdef TILEDARRAY_HAS_RANGEV3
// this requires Eigen ~3.4 (3.3.90 docs suggest it should be sufficient)
// Range r15(ranges::views::zip(iv(0, 1, 2), iv(4, 6, 8)));
// BOOST_CHECK_EQUAL(ref, r15);
#endif
// this requires Eigen ~3.4 (3.3.90 docs suggest it should be sufficient)
// Range r15(ranges::views::zip(iv(0, 1, 2), iv(4, 6, 8)));
// BOOST_CHECK_EQUAL(ref, r15);
}

// container::svector as bounds
Expand Down
10 changes: 0 additions & 10 deletions tests/sparse_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
*/

#include <boost/range/combine.hpp>
#ifdef TILEDARRAY_HAS_RANGEV3
#include <range/v3/view/zip.hpp>
#endif

#include "TiledArray/sparse_shape.h"
#include "sparse_shape_fixture.h"
Expand Down Expand Up @@ -350,12 +348,10 @@ BOOST_AUTO_TEST_CASE(block) {
sparse_shape.block(boost::combine(lower, upper)));
auto result3 = sparse_shape.block(boost::combine(lower, upper));
BOOST_CHECK_EQUAL(result, result3);
#ifdef TILEDARRAY_HAS_RANGEV3
BOOST_REQUIRE_NO_THROW(
sparse_shape.block(ranges::views::zip(lower, upper)));
auto result4 = sparse_shape.block(ranges::views::zip(lower, upper));
BOOST_CHECK_EQUAL(result, result4);
#endif
} else {
// Check that block throws an exception with a bad block range
BOOST_CHECK_TA_ASSERT(sparse_shape.block(lower, upper),
Expand Down Expand Up @@ -447,13 +443,11 @@ BOOST_AUTO_TEST_CASE(block_scale) {
sparse_shape.block(boost::combine(lower, upper), factor));
auto result3 = sparse_shape.block(boost::combine(lower, upper), factor);
BOOST_CHECK_EQUAL(result, result3);
#ifdef TILEDARRAY_HAS_RANGEV3
BOOST_REQUIRE_NO_THROW(
sparse_shape.block(ranges::views::zip(lower, upper), factor));
auto result4 =
sparse_shape.block(ranges::views::zip(lower, upper), factor);
BOOST_CHECK_EQUAL(result, result4);
#endif

} else {
// Check that block throws an exception with a bad block range
Expand Down Expand Up @@ -548,13 +542,11 @@ BOOST_AUTO_TEST_CASE(block_perm) {
sparse_shape.block(boost::combine(lower, upper), perm));
auto result3 = sparse_shape.block(boost::combine(lower, upper), perm);
BOOST_CHECK_EQUAL(result, result3);
#ifdef TILEDARRAY_HAS_RANGEV3
BOOST_REQUIRE_NO_THROW(
sparse_shape.block(ranges::views::zip(lower, upper), perm));
auto result4 =
sparse_shape.block(ranges::views::zip(lower, upper), perm);
BOOST_CHECK_EQUAL(result, result4);
#endif

} else {
// Check that block throws an exception with a bad block range
Expand Down Expand Up @@ -653,13 +645,11 @@ BOOST_AUTO_TEST_CASE(block_scale_perm) {
auto result3 =
sparse_shape.block(boost::combine(lower, upper), factor, perm);
BOOST_CHECK_EQUAL(result, result3);
#ifdef TILEDARRAY_HAS_RANGEV3
BOOST_REQUIRE_NO_THROW(
sparse_shape.block(ranges::views::zip(lower, upper), factor, perm));
auto result4 =
sparse_shape.block(ranges::views::zip(lower, upper), factor, perm);
BOOST_CHECK_EQUAL(result, result4);
#endif

} else {
// Check that block throws an exception with a bad block range
Expand Down
4 changes: 0 additions & 4 deletions tests/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
*/

#include <boost/range/combine.hpp>
#ifdef TILEDARRAY_HAS_RANGEV3
#include <range/v3/view/zip.hpp>
#endif

#include <iterator>
#include "TiledArray/math/gemm_helper.h"
Expand Down Expand Up @@ -709,9 +707,7 @@ BOOST_AUTO_TEST_CASE(block) {
// need to #include <boost/range/combine.hpp>
BOOST_CHECK_NO_THROW(s.block(boost::combine(lobound, upbound)));

#ifdef TILEDARRAY_HAS_RANGEV3
BOOST_CHECK_NO_THROW(s.block(ranges::views::zip(lobound, upbound)));
#endif

auto sview0 = s.block(lobound, upbound);
BOOST_CHECK(sview0.range().includes(lobound));
Expand Down

0 comments on commit beed33c

Please sign in to comment.