Skip to content

Commit

Permalink
removes device block for project task
Browse files Browse the repository at this point in the history
Signed-off-by: nileshChaturvedi <nilesh.chaturvedi@stonybrook.edu>
  • Loading branch information
nileshchat committed Jun 10, 2024
1 parent b6c87e5 commit 931ee69
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions examples/madness/mrattg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,47 +124,6 @@ auto make_project(functorT& f,
return ttg::make_tt(F, edges(fuse(refine, ctl)), edges(refine, result), name, {"control"}, {"refine", "result"});
}

/* below is a preliminary attempt at a device version, needs revisiting */
#if 0
/// Returns an std::unique_ptr to the object
template <typename functorT, typename T, size_t K, Dimension NDIM>
auto make_project_device(functorT& f,
const T thresh, /// should be scalar value not complex
ctlEdge<NDIM>& ctl, rnodeEdge<T, K, NDIM>& result, const std::string& name = "project") {
auto F = [f, thresh](const Key<NDIM>& key, std::tuple<ctlOut<NDIM>, rnodeOut<T, K, NDIM>>& out) {
FunctionReconstructedNode<T, K, NDIM> node(key); // Our eventual result
auto& coeffs = node.coeffs; // Need to clean up OO design
bool is_leaf;

if (key.level() < initial_level(f)) {
for (auto child : children(key)) ttg::sendk<0>(child, out);
coeffs = T(1e7); // set to obviously bad value to detect incorrect use
is_leaf = false;
} else if (is_negligible<functorT, T, NDIM>(f, Domain<NDIM>::template bounding_box<T>(key),
truncate_tol(key, thresh))) {
coeffs = T(0.0);
is_leaf = true;
} else {
auto node_view = ttg::make_view(node, ttg::ViewScope::Out); // no need to move node onto the device
auto is_leaf_view = ttg::make_view(is_leaf, ttg::ViewScope::Out);
co_await ttg::device::wait_views{};
fcoeffs<functorT, T, K>(f, key, thresh,
node_view.get_device_ptr<0>(),
is_leaf_view.get_device_ptr<0>()); // cannot deduce K
co_await ttg::device::wait_kernel{};
if (!is_leaf) {
for (auto child : children(key)) ttg::sendk<0>(child, out); // should be broadcast ?
}
}
node.is_leaf = is_leaf;
ttg::send<1>(key, node, out); // always produce a result
};
ctlEdge<NDIM> refine("refine");
return ttg::make_tt(F, edges(fuse(refine, ctl)), edges(refine, result), name, {"control"}, {"refine", "result"});
}
#endif // 0


namespace detail {
template <typename T, size_t K, Dimension NDIM>
struct tree_types {};
Expand Down Expand Up @@ -478,7 +437,7 @@ void test0() {
if (ttg::default_execution_context().rank() == 0) {
std::cout << "Is everything connected? " << connected << std::endl;
std::cout << "==== begin dot ====\n";
std::cout << ttg::Dot()(start.get()) << std::endl;
std::cout << ttg::Dot(false)(start.get()) << std::endl;
std::cout << "==== end dot ====\n";

// This kicks off the entire computation
Expand Down Expand Up @@ -529,7 +488,7 @@ void test1() {
if (ttg::default_execution_context().rank() == 0) {
std::cout << "Is everything connected? " << connected << std::endl;
std::cout << "==== begin dot ====\n";
std::cout << ttg::Dot()(start.get()) << std::endl;
std::cout << ttg::Dot(false)(start.get()) << std::endl;
std::cout << "==== end dot ====\n";

// This kicks off the entire computation
Expand Down

0 comments on commit 931ee69

Please sign in to comment.