Skip to content

Commit

Permalink
LRCC2 seems to work with water, but hangs in the singles equations ->…
Browse files Browse the repository at this point in the history
… need to run them in macrotasks to reduce communication
  • Loading branch information
fbischoff committed Aug 19, 2024
1 parent 63ef10b commit 917acf2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
10 changes: 8 additions & 2 deletions src/madness/chem/CC2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -701,12 +701,18 @@ CC2::iterate_lrcc2_pairs(World& world, const CC_vecfunction& cc2_s,
// if no function has been computed so far use the constant part (first iteration)
for (auto& pair : pair_vec) if (not pair.function().is_initialized()) pair.update_u(pair.constant_part);

for (const auto& p : pair_vec) p.constant_part.print_size("constant_part before iter");
for (const auto& p : pair_vec) p.function().print_size("u before iter");

// compute the coupling between the pair functions
if (world.rank()==0) print("computing local coupling in the universe");
Pairs<real_function_6d> coupling=compute_local_coupling(pair_vec, info);
auto coupling_vec=Pairs<real_function_6d>::pairs2vector(coupling,triangular_map);
reconstruct(world,coupling_vec);
for (auto& p : pair_vec) {
p.constant_part.reconstruct();
p.function().reconstruct();
}

if (info.parameters.debug()) print_size(world, coupling_vec, "couplingvector");

Expand Down Expand Up @@ -1099,7 +1105,7 @@ CC2::initialize_pairs(Pairs<CCPair>& pairs, const CCState ftype, const CalcType
pairs.insert(i, j, tmp);

} else if (ftype == EXCITED_STATE) {
name = std::to_string(int(excitation)) + "_" + name;
// name = std::to_string(int(excitation)) + "_" + name;
real_function_6d utmp = real_factory_6d(world);
const bool found = CCOPS.load_function(utmp, name);
if (found) restarted = true;
Expand All @@ -1116,7 +1122,7 @@ CC2::initialize_pairs(Pairs<CCPair>& pairs, const CCState ftype, const CalcType

tmp.constant_part = const_part;
pairs.insert(i, j, tmp);
CCPotentials::compute_excited_pair_energy(world, pairs(i, j), x, info);
// CCPotentials::compute_excited_pair_energy(world, pairs(i, j), x, info);
} else error("Unknown pairtype");
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/madness/chem/CCPotentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ class CCPotentials {
f.truncate();
f.print_size(name);
return true;
} else {
if (world.rank()==0) print("could not find function",name);
}
else return false;
return false;
}

/// Plotting (convenience)
Expand Down
19 changes: 13 additions & 6 deletions src/madness/world/cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,17 @@ class Cloud {
void print_size(World& universe) {

std::size_t memsize=0;
for (auto& item : container) memsize+=item.second.size();
std::size_t max_record_size=0;
for (auto& item : container) {
memsize+=item.second.size();
max_record_size=std::max(max_record_size,item.second.size());
}
std::size_t global_memsize=memsize;
std::size_t max_memsize=memsize;
std::size_t min_memsize=memsize;
universe.gop.sum(global_memsize);
universe.gop.max(max_memsize);
universe.gop.max(max_record_size);
universe.gop.min(min_memsize);

auto local_size=container.size();
Expand All @@ -207,13 +212,15 @@ class Cloud {
print("Cloud memory:");
print(" replicated:",is_replicated);
print("size of cloud (total)");
print(" number of records:",global_size);
print(" memory in GBytes: ",global_memsize*byte2gbyte);
print(" number of records: ",global_size);
print(" memory in GBytes: ",global_memsize*byte2gbyte);
print("size of cloud (average per node)");
print(" number of records:",double(global_size)/universe.size());
print(" memory in GBytes: ",global_memsize*byte2gbyte/universe.size());
print(" number of records: ",double(global_size)/universe.size());
print(" memory in GBytes: ",global_memsize*byte2gbyte/universe.size());
print("min/max of node");
print(" memory in GBytes: ",min_memsize*byte2gbyte,max_memsize*byte2gbyte);
print(" memory in GBytes: ",min_memsize*byte2gbyte,max_memsize*byte2gbyte);
print(" max record size in GBytes:",max_record_size*byte2gbyte);

}
}

Expand Down
20 changes: 10 additions & 10 deletions src/madness/world/worlddc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1867,8 +1867,8 @@ namespace madness
}
world->taskq.fence(); // just need LOCAL fence
wall1 = wall_time();
if (world->rank() == 0)
printf("time in op_inspector: %8.4fs\n", wall1 - wall0);
// if (world->rank() == 0)
// printf("time in op_inspector: %8.4fs\n", wall1 - wall0);
wall0 = wall1;

// total size over all threads
Expand All @@ -1891,8 +1891,8 @@ namespace madness
world->taskq.fence(); // just need LOCAL fence

wall1 = wall_time();
if (world->rank() == 0)
printf("time in op_executor: %8.4fs\n", wall1 - wall0);
// if (world->rank() == 0)
// printf("time in op_executor: %8.4fs\n", wall1 - wall0);
wall0 = wall1;
}
// VERify that the serialization worked!!
Expand All @@ -1919,8 +1919,8 @@ namespace madness
for (int i = 1; i < world->size(); ++i)
offsets[i] = offsets[i - 1] + sizes[i - 1];
size_t total_size = offsets.back() + sizes.back();
if (world->rank() == 0)
print("total_size", total_size);
// if (world->rank() == 0)
// print("total_size", total_size);

// print("time 4",wall_time());
// gather the vector of data v from each process to process 0
Expand All @@ -1932,8 +1932,8 @@ namespace madness
MPI_Gatherv(buf, local_size, MPI_BYTE, all_data, sizes.data(), offsets.data(), MPI_BYTE, 0, world->mpi.comm().Get_mpi_comm());

wall1 = wall_time();
if (world->rank() == 0)
printf("time in gather+gatherv: %8.4fs\n", wall1 - wall0);
// if (world->rank() == 0)
// printf("time in gather+gatherv: %8.4fs\n", wall1 - wall0);
wall0 = wall1;

delete[] buf;
Expand All @@ -1949,8 +1949,8 @@ namespace madness
localar.store(all_data, total_size);
ArchivePrePostImpl<localarchiveT, dcT>::postamble_store(localar);
wall1 = wall_time();
if (world->rank() == 0)
printf("time in final copy on node 0: %8.4fs\n", wall1 - wall0);
// if (world->rank() == 0)
// printf("time in final copy on node 0: %8.4fs\n", wall1 - wall0);

delete[] all_data;
}
Expand Down

0 comments on commit 917acf2

Please sign in to comment.