Refinement: time per stage - an NVTX range per call and one TIMING line per stage with its sum and calls
RefinementStage sums the time of each stage over a refinement (Refit and its parts, the evaluations and their X-ray, restraint, host and upload shares, the repulsion build, the riding hydrogens, the rungs) and logs it at debug level at the end; rugnux_refine_test -v shows it. No change to any result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu (cherry picked from commit 9491f54e0beccf36c65ebcec9afff90d08485f86) (cherry picked from commit 0ce206a88df960754476ce2f75ffaed90fbf3123)
This commit is contained in:
1 parent
07ae590e54
commit
24b1711d64
5 files changed
+123
-13
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <optional>
|
||||
|
||||
#include "gemmi/dencalc.hpp"
|
||||
#include "gemmi/it92.hpp"
|
||||
@@ -194,7 +195,11 @@ public:
|
||||
double Evaluate(const gemmi::Model &model, std::vector<std::array<double, 4>> *grad) override {
|
||||
SetAtoms(model);
|
||||
std::vector<std::array<float, 4>> g;
|
||||
const double value = engine_->Evaluate(grad != nullptr ? &g : nullptr);
|
||||
double value = 0;
|
||||
{
|
||||
const RefinementStage stage("gpu.evaluate");
|
||||
value = engine_->Evaluate(grad != nullptr ? &g : nullptr);
|
||||
}
|
||||
if (grad != nullptr) {
|
||||
grad->resize(g.size());
|
||||
for (size_t i = 0; i < g.size(); i++)
|
||||
@@ -213,7 +218,11 @@ public:
|
||||
for (size_t i = 0; i < xyzb.size(); i++)
|
||||
x[i] = {static_cast<float>(xyzb[i][0]), static_cast<float>(xyzb[i][1]), static_cast<float>(xyzb[i][2]),
|
||||
static_cast<float>(xyzb[i][3])};
|
||||
const double value = engine_->EvaluateRestraints(which, x, grad != nullptr ? &g : nullptr);
|
||||
double value = 0;
|
||||
{
|
||||
const RefinementStage stage("gpu.restraints");
|
||||
value = engine_->EvaluateRestraints(which, x, grad != nullptr ? &g : nullptr);
|
||||
}
|
||||
if (grad != nullptr) {
|
||||
grad->resize(g.size());
|
||||
for (size_t i = 0; i < g.size(); i++)
|
||||
@@ -235,6 +244,7 @@ private:
|
||||
|
||||
// The atoms' densities (made again only for the atoms whose B moved) and grid positions, to the device.
|
||||
void SetAtoms(const gemmi::Model &model) {
|
||||
std::optional<RefinementStage> stage("gpu.atoms_host");
|
||||
const std::vector<const gemmi::Atom *> atoms = Atoms(model);
|
||||
if (last_b_.size() != atoms.size()) {
|
||||
last_b_.assign(atoms.size(), NAN);
|
||||
@@ -250,6 +260,8 @@ private:
|
||||
const gemmi::Fractional f = cell_.fractionalize(atoms[i]->pos);
|
||||
pos[i] = {static_cast<float>(f.x * n3[0]), static_cast<float>(f.y * n3[1]), static_cast<float>(f.z * n3[2]), 0};
|
||||
}
|
||||
stage.reset();
|
||||
const RefinementStage upload("gpu.upload");
|
||||
engine_->SetAtoms(atoms_, pos);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user