Skip to content

Commit

Permalink
Merge branch 'potrf-composition2' of github.com:therault/ttg into pot…
Browse files Browse the repository at this point in the history
…rf-composition2
  • Loading branch information
therault committed Oct 20, 2022
2 parents 645f932 + db27cc6 commit 9c1942b
Show file tree
Hide file tree
Showing 38 changed files with 1,648 additions and 603 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
CCACHE_DIR : ${{github.workspace}}/build/.ccache
CCACHE_COMPRESS : true
CCACHE_COMPRESSLEVEL : 6
OMPI_MCA_btl_vader_single_copy_mechanism : none
PARSEC_MCA_runtime_bind_threads : 0
BUILD_CONFIG : >
-G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
Expand All @@ -38,22 +40,30 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build

- name: Install prerequisite MacOS packages
if: ${{ matrix.os == 'macos-latest' }}
run: brew install ninja gcc@10 boost eigen open-mpi bison ccache

- name: Install prerequisites Ubuntu packages
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
sudo apt-get update
sudo apt-get install ninja-build g++-9 liblapack-dev libboost-dev libboost-serialization-dev libeigen3-dev openmpi-bin libopenmpi-dev libtbb-dev ccache
sudo apt-get -y install ninja-build g++-9 liblapack-dev libboost-dev libboost-serialization-dev libeigen3-dev openmpi-bin libopenmpi-dev libtbb-dev ccache flex bison cmake
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
cmake -E make_directory ${{github.workspace}}/build
- name: Install doxygen for Release test
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
if [ "${{matrix.build_type}}" = "Release" ]; then
sudo apt-get install libclang1-9 libclang-cpp9 graphviz fonts-liberation
sudo apt-get -y install libclang1-9 libclang-cpp9 graphviz fonts-liberation
cd ${{github.workspace}}/build
wget https://downloads.sourceforge.net/project/doxygen/rel-${DOXYGEN_VERSION}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
# using EFV's gdrive mirror of 1.9.2 to work around the unreliable sourceforge
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/AddTTGLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ macro(add_ttg_library)

target_include_directories(${_library} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # look in binary dir also for files preprocessed by configure_file
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/ExternalDependenciesVersions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ set(TTG_TRACKED_BOOST_VERSION 1.66)
set(TTG_TRACKED_CATCH2_VERSION 2.13.1)
set(TTG_TRACKED_CEREAL_VERSION 1.3.0)
set(TTG_TRACKED_MADNESS_TAG 851ef271858129c47a912a088cc833b085c382aa)
set(TTG_TRACKED_PARSEC_TAG 423ad3476b0533a40b0bf14cb2c7f4dadda915c8)
set(TTG_TRACKED_PARSEC_TAG f35ee04c3cb2d3a9d89713fab2e438b3fd871455)
set(TTG_TRACKED_BTAS_TAG ab866a760b72ff23053266bf46b87f19d3df44b7)
83 changes: 83 additions & 0 deletions cmake/modules/GetGitMetadata.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# SPDX-FileCopyrightText: 2022 Eduard Valeyev <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
#

#
# vgkit_cmake_git_revision() defines variable ${PROJECT_NAME_UPPER}_GIT_REVISION,
# where ${PROJECT_NAME_UPPER} is the upper-case version of ${PROJECT_NAME}, to
# the "long-form" GIT revision produced by `git rev-parse -q HEAD` command.
# N.B. If the variable is already defined will print a warning message but not change the value of
# ${PROJECT_NAME_UPPER}_GIT_REVISION
#
macro(vgkit_cmake_git_revision)
string(TOUPPER "${PROJECT_NAME}_GIT_REVISION" vgkit_cmake_git_revision_result)
if (DEFINED ${vgkit_cmake_git_revision_result})
message(WARNING "vgkit_cmake_git_revision() called for project ${PROJECT_NAME} but the result variable ${vgkit_cmake_git_revision_result} already defined; will not change its value")
else()
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
find_package(Git REQUIRED)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse -q HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE vgkit_cmake_git_revision_errcod
OUTPUT_VARIABLE ${vgkit_cmake_git_revision_result}
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT vgkit_cmake_git_revision_errcod EQUAL 0)
set(${vgkit_cmake_git_revision_result} "unknown")
endif()
unset(vgkit_cmake_git_revision_errcod)
else()
set(${vgkit_cmake_git_revision_result} "unknown")
endif()
else()
set(${vgkit_cmake_git_revision_result} "unknown")
endif()
endif()
unset(vgkit_cmake_git_revision_result)
endmacro()

#
# vgkit_cmake_git_description() defines variable ${PROJECT_NAME_UPPER}_GIT_DESCRIPTION,
# where ${PROJECT_NAME_UPPER} is the upper-case version of ${PROJECT_NAME}, to
# the human-readable form produced by `git describe --dirty` command.
# If the variable is already defined will print a warning message but not change the value of
# ${PROJECT_NAME_UPPER}_GIT_DESCRIPTION
#
macro(vgkit_cmake_git_description)
string(TOUPPER "${PROJECT_NAME}_GIT_DESCRIPTION" vgkit_cmake_git_description_result)
if (DEFINED ${vgkit_cmake_git_description_result})
message(WARNING "vgkit_cmake_git_description() called for project ${PROJECT_NAME} but the result variable ${vgkit_cmake_git_description_result} already defined; will not change its value")
else()
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
find_package(Git REQUIRED)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE vgkit_cmake_git_description_errcod
OUTPUT_VARIABLE ${vgkit_cmake_git_description_result}
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT vgkit_cmake_git_description_errcod EQUAL 0)
set(${vgkit_cmake_git_description_errcod} "unknown")
endif()
unset(vgkit_cmake_git_description_errcod)
else()
set(${vgkit_cmake_git_description_errcod} "unknown")
endif()
else()
set(${vgkit_cmake_git_description_errcod} "unknown")
endif()
endif()
unset(vgkit_cmake_git_description_errcod)
endmacro()

#
# vgkit_cmake_git_metadata() invokes vgkit_cmake_git_revision and vgkit_cmake_git_description
#
macro(vgkit_cmake_git_metadata)
vgkit_cmake_git_revision()
vgkit_cmake_git_description()
endmacro()
7 changes: 4 additions & 3 deletions doc/dox/user/examples/distributed.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <ttg.h>
#include <ttg/serialization/std/pair.h>
#include <ttg/util/hash/std/pair.h>

const double threshold = 100.0;
using Key2 = std::pair<int, int>;
Expand Down Expand Up @@ -35,7 +36,7 @@ int main(int argc, char **argv) {
ttg::Edge<int, double> C_A("C(k)->A(k)");

auto wc(ttg::make_tt(c, ttg::edges(B_C), ttg::edges(C_A), "C", {"From B"}, {"to A"}));

/**! \link TT::set_input_reducer() */wc->set_input_reducer/**! \endlink */<0>([](double &a, const double &b) { a += b; });

auto wa(ttg::make_tt([&](const int &k, const double &input, std::tuple<ttg::Out<Key2, double>> &out) {
Expand Down Expand Up @@ -67,8 +68,8 @@ int main(int argc, char **argv) {
/**
* \example distributed.cc
* This is the iterative diamond DAG with variable number of inputs using the reducing
* terminals of Template Task Graph, adapted to run in distributed: iteratively, a reducing
* diamond of data-dependent width is run, until the amount of data gathered at the bottom
* terminals of Template Task Graph, adapted to run in distributed: iteratively, a reducing
* diamond of data-dependent width is run, until the amount of data gathered at the bottom
* of the diamond exceeds a given threshold. First and last tasks of each diamond are run
* on rank 0, while the tasks inside the diamond are distributed between the ranks in a
* round-robin fashion.
Expand Down
17 changes: 8 additions & 9 deletions doc/dox/user/examples/iterative.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <ttg.h>
#include <ttg/serialization/std/pair.h>
#include <ttg/util/hash/std/pair.h>

const double threshold = 100.0;
using Key2 = std::pair<int, int>;
Expand All @@ -13,26 +14,23 @@ namespace std {

static void a(const int &k, const double &input, std::tuple<ttg::Out<Key2, double>> &out) {
ttg::print("Called task A(", k, ")");
/**! \link ttg::send() */ ttg::send/**! \endlink */<0>(Key2{k, 0}, 1.0 + input, out);
/**! \link ttg::send() */ ttg::send/**! \endlink */<0>(Key2{k, 1}, 2.0 + input, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<0>(Key2{k, 0}, 1.0 + input, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<0>(Key2{k, 1}, 2.0 + input, out);
}

static void b(const Key2 &key, const double &input, std::tuple<ttg::Out<int, double>, ttg::Out<int, double>> &out) {
ttg::print("Called task B(", key, ") with input data ", input);
if (std::get<1>(key) == 0)
/**! \link ttg::send() */
ttg::send/**! \endlink */<0>(std::get<0>(key), input + 1.0, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<0>(std::get<0>(key), input + 1.0, out);
else
/**! \link ttg::send() */
ttg::send/**! \endlink */<1>(std::get<0>(key), input + 1.0, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<1>(std::get<0>(key), input + 1.0, out);
}

static void c(const int &k, const double &b0, const double &b1, std::tuple<ttg::Out<int, double>> &out) {
ttg::print("Called task C(", k, ") with inputs ", b0, " from B(", k, " 0) and ", b1, " from B(", k, " 1)");
if (b0 + b1 < threshold) {
ttg::print(" ", b0, "+", b1, "<", threshold, " so continuing to iterate");
/**! \link ttg::send() */
ttg::send/**! \endlink */<0>(k + 1, b0 + b1, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<0>(k + 1, b0 + b1, out);
} else {
ttg::print(" ", b0, "+", b1, ">=", threshold, " so stopping the iterations");
}
Expand All @@ -47,7 +45,8 @@ int main(int argc, char **argv) {
ttg::Edge<int, double> C_A("C(k)->A(k)");

auto wa(ttg::make_tt(a, ttg::edges(C_A), ttg::edges(A_B), "A", {"from C"}, {"to B"}));
auto wb(ttg::make_tt(b, ttg::edges(A_B), ttg::edges(B_C0, B_C1), "B", {"from A"}, {"to 1st input of C", "to 2nd input of C"}));
auto wb(ttg::make_tt(b, ttg::edges(A_B), ttg::edges(B_C0, B_C1), "B", {"from A"},
{"to 1st input of C", "to 2nd input of C"}));
auto wc(ttg::make_tt(c, ttg::edges(B_C0, B_C1), ttg::edges(C_A), "C", {"From B", "From B"}, {"to A"}));

ttg::make_graph_executable(wa);
Expand Down
31 changes: 17 additions & 14 deletions doc/dox/user/examples/reducing.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <ttg.h>
#include <ttg/serialization/std/pair.h>
#include <ttg/util/hash/std/pair.h>

const double threshold = 100.0;
using Key2 = std::pair<int, int>;
Expand All @@ -13,15 +14,14 @@ namespace std {

static void b(const Key2 &key, const double &input, std::tuple<ttg::Out<int, double>> &out) {
ttg::print("Called task B(", key, ") with input data ", input);
/**! \link ttg::send() */ ttg::send/**! \endlink */<0>(std::get<0>(key), input + 1.0, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<0>(std::get<0>(key), input + 1.0, out);
}

static void c(const int &k, const double &sum, std::tuple<ttg::Out<int, double>> &out) {
ttg::print("Called task C(", k, ") with input ", sum);
if (sum < threshold) {
ttg::print(" ", sum, "<", threshold, " so continuing to iterate");
/**! \link ttg::send() */
ttg::send/**! \endlink */<0>(k + 1, sum, out);
/**! \link ttg::send() */ ttg::send /**! \endlink */<0>(k + 1, sum, out);
} else {
ttg::print(" ", sum, ">=", threshold, " so stopping the iterations");
}
Expand All @@ -35,17 +35,20 @@ int main(int argc, char **argv) {
ttg::Edge<int, double> C_A("C(k)->A(k)");

auto wc(ttg::make_tt(c, ttg::edges(B_C), ttg::edges(C_A), "C", {"From B"}, {"to A"}));

/**! \link TT::set_input_reducer() */wc->set_input_reducer/**! \endlink */<0>([](double &a, const double &b) { a += b; });

auto wa(ttg::make_tt([&](const int &k, const double &input, std::tuple<ttg::Out<Key2, double>> &out) {
ttg::print("Called task A(", k, ")");
wc->set_argstream_size<0>(k, k+1);
for(int i = 0; i < k+1; i++) {
/**! \link ttg::send() */
ttg::send/**! \endlink */<0>(Key2{k, i}, 1.0 + k + input, out);
}
}, ttg::edges(C_A), ttg::edges(A_B), "A", {"from C"}, {"to B"}));
/**! \link TT::set_input_reducer() */ wc->set_input_reducer /**! \endlink */<0>(
[](double &a, const double &b) { a += b; });

auto wa(ttg::make_tt(
[&](const int &k, const double &input, std::tuple<ttg::Out<Key2, double>> &out) {
ttg::print("Called task A(", k, ")");
wc->set_argstream_size<0>(k, k + 1);
for (int i = 0; i < k + 1; i++) {
/**! \link ttg::send() */
ttg::send /**! \endlink */<0>(Key2{k, i}, 1.0 + k + input, out);
}
},
ttg::edges(C_A), ttg::edges(A_B), "A", {"from C"}, {"to B"}));

auto wb(ttg::make_tt(b, ttg::edges(A_B), ttg::edges(B_C), "B", {"from A"}, {"to C"}));

Expand All @@ -64,6 +67,6 @@ int main(int argc, char **argv) {
* \example reducing.cc
* This is the iterative diamond DAG with variable number of inputs using the reducing
* terminals of Template Task Graph: iteratively, a reducing diamond of data-dependent
* width is run, until the amount of data gathered at the bottom of the diamond exceeds
* width is run, until the amount of data gathered at the bottom of the diamond exceeds
* a given threshold.
*/
3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ endif (TARGET MADworld)
add_ttg_executable(wavefront-wf wavefront/wavefront-wf.cc SINGLERANKONLY)
add_ttg_executable(wavefront-wf2 wavefront/wavefront-wf2.cc SINGLERANKONLY)
add_ttg_executable(wavefront-df wavefront/wavefront-df.cc)
add_ttg_executable(wavefront-pull wavefront/wavefront-pull.cc LINK_LIBRARIES MADworld)
add_ttg_executable(fw-apsp floyd-warshall/floyd_warshall.cc LINK_LIBRARIES MADworld SINGLERANKONLY)

add_ttg_executable(helloworld helloworld/helloworld.cpp)
add_ttg_executable(simplegenerator simplegenerator/simplegenerator.cc RUNTIMES "mad")

if(TARGET DPLASMA::dplasma)
add_ttg_executable(testing_dpotrf potrf/testing_dpotrf.cc LINK_LIBRARIES lapackpp DPLASMA::dplasma MADworld)
Expand Down
32 changes: 14 additions & 18 deletions examples/floyd-warshall/floyd_warshall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace ttg;

#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

struct Key {
// ((I, J), K) where (I, J) is the tile coordinate and K is the iteration number
Expand Down Expand Up @@ -81,8 +82,8 @@ namespace std {
};
} // namespace std

class Initiator : public TT<int, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
Initiator> {
class Initiator
: public TT<int, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>, Initiator> {
using baseT = typename Initiator::ttT;

public:
Expand Down Expand Up @@ -112,10 +113,11 @@ class Initiator : public TT<int, std::tuple<Out<Key, void>, Out<Key, void>, Out<
}
};

class FuncA : public TT<Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>,
Out<Key, void>, Out<Key, void>>,
FuncA, ttg::typelist<void>> {
class FuncA
: public TT<
Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncA, ttg::typelist<void>> {
using baseT = typename FuncA::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -204,11 +206,8 @@ class FuncA : public TT<Key,
}
};

class FuncB
: public TT<
Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncB, ttg::typelist<void, void>> {
class FuncB : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncB, ttg::typelist<void, void>> {
using baseT = typename FuncB::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -295,11 +294,8 @@ class FuncB
}
};

class FuncC
: public TT<
Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncC, ttg::typelist<void, void>> {
class FuncC : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncC, ttg::typelist<void, void>> {
using baseT = typename FuncC::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -386,8 +382,8 @@ class FuncC
}
};

class FuncD : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncD, ttg::typelist<void, void, void>> {
class FuncD : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>, FuncD,
ttg::typelist<void, void, void>> {
using baseT = typename FuncD::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down
1 change: 1 addition & 0 deletions examples/floyd-warshall/floyd_warshall_df.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace ttg;

#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

#include "../blockmatrix.h"
#include "ttg/util/bug.h"
Expand Down
Loading

0 comments on commit 9c1942b

Please sign in to comment.