Skip to content
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

foreach works with ShareReductionMethod::Union #310

Merged
merged 2 commits into from
Sep 23, 2021
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
16 changes: 8 additions & 8 deletions src/TiledArray/conversions/foreach.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <TiledArray/type_traits.h>
#include <TiledArray/util/function.h>

#include <algorithm>

/// Forward declarations
namespace Eigen {
template <typename>
Expand Down Expand Up @@ -277,8 +279,8 @@ inline std::
tiles.reserve(arg.pmap()->size());

// Construct a tensor to hold updated tile norms for the result shape.
TiledArray::Tensor<typename shape_type::value_type>
tile_norms(arg.trange().tiles_range(), 0);
TiledArray::Tensor<typename shape_type::value_type> tile_norms(
arg.trange().tiles_range(), 0);

// Construct the task function used to construct the result tiles.
madness::AtomicInt counter;
Expand Down Expand Up @@ -324,12 +326,10 @@ inline std::
detail::get_sparse_tile(index, args)...);
++task_count;
tiles.emplace_back(index, std::move(result_tile));
if (op_returns_void) // if Op does not evaluate norms, use the (scaled)
// norms of the first arg need max reduction here,
// hence c++17, until then just assert false
TA_ASSERT(false &&
"ShapeReductionMethod::Union not supported with "
"void-returning Op");
if (op_returns_void) // if Op does not evaluate norms, find max
// (scaled) norms of all args
tile_norms[index] =
std::max({arg_shape_data[index], args.shape().data()[index]...});
}
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/TiledArray/util/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
// The U.S. Government is granted a limited license as per AL 91-7.
//

#ifndef MPQC4_SRC_MPQC_UTIL_MISC_BUG_H_
#define MPQC4_SRC_MPQC_UTIL_MISC_BUG_H_
#ifndef TILEDARRAY_UTIL_BUG_H_
#define TILEDARRAY_UTIL_BUG_H_

#include <cassert>
#include <memory>
Expand Down Expand Up @@ -381,7 +381,7 @@ void launch_lldb_xterm();

} // namespace TiledArray

#endif // MPQC4_SRC_MPQC_UTIL_MISC_BUG_H_
#endif // TILEDARRAY_UTIL_BUG_H_

// Local Variables:
// mode: c++
Expand Down