From b138a67d4201d9bc57f1737cfbeb263b1d1fb5db Mon Sep 17 00:00:00 2001 From: Eric Phipps Date: Fri, 14 Jun 2024 16:39:30 -0600 Subject: [PATCH 1/2] Fix Cuda warning in debug builds --- src/Genten_DistTensorContext.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Genten_DistTensorContext.hpp b/src/Genten_DistTensorContext.hpp index 30d01f64af..79e721bbe6 100644 --- a/src/Genten_DistTensorContext.hpp +++ b/src/Genten_DistTensorContext.hpp @@ -314,12 +314,15 @@ bool weightsAreSame(const KtensorT&) { #else template bool weightsAreSame(const KtensorT &u) { - const ttb_indx wspan = u.weights().values().span(); + auto w = u.weights(); + const ttb_indx wspan = w.values().span(); if (!isValueSame(wspan)) { return false; } + auto w_h = create_mirror_view(w); + deep_copy(w_h, w); for (std::size_t i = 0; i < wspan; ++i) { - if (!isValueSame(u.weights(i))) { + if (!isValueSame(w_h[i])) { return false; } } From 9523cdbbac099982e596b9c39a58a080bb390226 Mon Sep 17 00:00:00 2001 From: Eric Phipps Date: Fri, 14 Jun 2024 16:40:07 -0600 Subject: [PATCH 2/2] Fix MPI error in some CUDA-aware MPI implementations --- src/Genten_Pmap.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Genten_Pmap.hpp b/src/Genten_Pmap.hpp index 87eeb059b3..b47c49795d 100644 --- a/src/Genten_Pmap.hpp +++ b/src/Genten_Pmap.hpp @@ -164,7 +164,10 @@ class ProcessorMap { static_assert(std::is_arithmetic::value, "subGridAllReduce requires something like a double, or int"); - MPI_Reduce(send.data(), recv.data(), send.span(), + scalar_type2* recv_data = nullptr; + if (sub_grid_rank_[i] == root) + recv_data = recv.data(); + MPI_Reduce(send.data(), recv_data, send.span(), DistContext::toMpiType(), convertOp(op), root, sub_maps_[i]); }