GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
OracleBatch.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
#ifndef GPR_POTENTIALS_ORACLEBATCH_H_
6
#define GPR_POTENTIALS_ORACLEBATCH_H_
7
8
#include <Eigen/Dense>
9
#include <string>
10
#include <vector>
11
12
#ifdef GPR_HAVE_MPI
13
#include <mpi.h>
14
#endif
15
34
namespace
pot
{
35
36
#ifdef GPR_HAVE_MPI
37
using
OracleBatchComm
= MPI_Comm;
38
#else
39
using
OracleBatchComm
= int;
40
#endif
41
43
OracleBatchComm
oracleBatchWorld
() noexcept;
44
46
struct
OracleBatchLayout
{
47
int
rank
= 0;
48
int
nprocs
= 1;
57
Eigen::Index
chunk
= 0;
61
int
owner_offset
= 0;
62
OracleBatchComm
comm
=
oracleBatchWorld
();
63
65
static
OracleBatchLayout
world
(Eigen::Index
chunk
= 0,
66
int
owner_offset
= 0);
67
};
68
70
int
oracleBatchOwner
(Eigen::Index point, Eigen::Index count,
71
const
OracleBatchLayout
& layout)
noexcept
;
72
74
std::vector<std::vector<Eigen::Index>>
ownedOracleGroups
(
75
Eigen::Index count,
const
OracleBatchLayout
& layout);
76
78
enum class
OracleBatchStatus
:
int
{
79
Ok
= 0,
81
Failed
= 1,
83
Restart
= 2,
85
WallClockLimit
= 3,
86
};
87
88
struct
OracleBatchOutcome
{
89
OracleBatchStatus
status
=
OracleBatchStatus::Ok
;
91
std::string
message
;
93
int
owner
= -1;
94
};
95
98
OracleBatchOutcome
agreeOracleBatchStatus
(
OracleBatchStatus
local_status,
99
const
std::string& local_message,
100
const
OracleBatchLayout
& layout);
101
106
void
allreduceOwnedOracleValues
(std::vector<double>& energies,
107
Eigen::MatrixXd& gradients,
108
const
OracleBatchLayout
& layout,
109
double
* communication_seconds =
nullptr
);
110
115
void
allreduceOwnedOracleMask
(std::vector<char>& accepted,
116
const
OracleBatchLayout
& layout);
117
118
}
// namespace pot
119
120
#endif
// GPR_POTENTIALS_ORACLEBATCH_H_
pot
Potential wrappers and the batched oracle interface.
Definition
ProblemSetUp.h:22
pot::allreduceOwnedOracleMask
void allreduceOwnedOracleMask(std::vector< char > &accepted, const OracleBatchLayout &layout)
Definition
OracleBatch.cpp:187
pot::OracleBatchStatus
OracleBatchStatus
What one rank reports about its groups before the value collectives.
Definition
OracleBatch.h:78
pot::OracleBatchStatus::Restart
@ Restart
The oracle asked for a session restart; takes precedence.
Definition
OracleBatch.h:83
pot::OracleBatchStatus::WallClockLimit
@ WallClockLimit
The enclosing search deadline expired; no further point may start.
Definition
OracleBatch.h:85
pot::OracleBatchStatus::Ok
@ Ok
Definition
OracleBatch.h:79
pot::OracleBatchStatus::Failed
@ Failed
A geometry was refused or a value was not finite; message set.
Definition
OracleBatch.h:81
pot::OracleBatchComm
int OracleBatchComm
Definition
OracleBatch.h:39
pot::oracleBatchWorld
OracleBatchComm oracleBatchWorld() noexcept
The communicator of the whole run, or the no-MPI placeholder.
Definition
OracleBatch.cpp:34
pot::agreeOracleBatchStatus
OracleBatchOutcome agreeOracleBatchStatus(OracleBatchStatus local_status, const std::string &local_message, const OracleBatchLayout &layout)
Definition
OracleBatch.cpp:93
pot::ownedOracleGroups
std::vector< std::vector< Eigen::Index > > ownedOracleGroups(Eigen::Index count, const OracleBatchLayout &layout)
The groups this rank evaluates, each one batch call, in point order.
Definition
OracleBatch.cpp:67
pot::oracleBatchOwner
int oracleBatchOwner(Eigen::Index point, Eigen::Index count, const OracleBatchLayout &layout) noexcept
Owner rank of one point of a batch of count points.
Definition
OracleBatch.cpp:57
pot::allreduceOwnedOracleValues
void allreduceOwnedOracleValues(std::vector< double > &energies, Eigen::MatrixXd &gradients, const OracleBatchLayout &layout, double *communication_seconds)
Definition
OracleBatch.cpp:138
pot::OracleBatchLayout
How a step's oracle points are shared out.
Definition
OracleBatch.h:46
pot::OracleBatchLayout::rank
int rank
Definition
OracleBatch.h:47
pot::OracleBatchLayout::nprocs
int nprocs
Definition
OracleBatch.h:48
pot::OracleBatchLayout::comm
OracleBatchComm comm
Definition
OracleBatch.h:62
pot::OracleBatchLayout::world
static OracleBatchLayout world(Eigen::Index chunk=0, int owner_offset=0)
The layout of the running communicator (rank 0 of 1 without MPI).
Definition
OracleBatch.cpp:43
pot::OracleBatchLayout::owner_offset
int owner_offset
Definition
OracleBatch.h:61
pot::OracleBatchLayout::chunk
Eigen::Index chunk
Definition
OracleBatch.h:57
pot::OracleBatchOutcome
Definition
OracleBatch.h:88
pot::OracleBatchOutcome::message
std::string message
The failing owner's message, identical on every rank.
Definition
OracleBatch.h:91
pot::OracleBatchOutcome::owner
int owner
The lowest rank that failed, or -1.
Definition
OracleBatch.h:93
pot::OracleBatchOutcome::status
OracleBatchStatus status
Definition
OracleBatch.h:89
gpr
potentials
OracleBatch.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf