Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit c0c56f0

Browse files
committed
Adding OFED option
1 parent 7825697 commit c0c56f0

4 files changed

Lines changed: 47 additions & 1 deletion

File tree

include/cloysterhpc/models/answerfile.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ class AnswerFile {
156156
std::filesystem::path key_file;
157157
};
158158

159+
struct AFOFED {
160+
std::string version = "latest";
161+
bool enabled = false;
162+
};
163+
159164
std::filesystem::path m_path;
160165
inifile m_ini;
161166

@@ -268,6 +273,7 @@ class AnswerFile {
268273
void loadNodes();
269274
void loadTools();
270275
void loadNVHPC();
276+
void loadOFED();
271277

272278
void dumpNodes();
273279

@@ -343,6 +349,7 @@ class AnswerFile {
343349
AFSystem system;
344350
AFNodes nodes;
345351
AFPostfix postfix;
352+
AFOFED ofed;
346353

347354
/**
348355
* @brief Loads the answer file from the specified path.

include/cloysterhpc/ofed.h

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#include <cloysterhpc/functions.h>
1010

11+
#include <utility>
12+
13+
1114
/**
1215
* @class OFED
1316
* @brief A class representing the OpenFabrics Enterprise Distribution (OFED).
@@ -24,16 +27,40 @@ class OFED {
2427
*/
2528
enum class Kind { Inbox, Mellanox, Oracle };
2629

30+
template <Kind K>
31+
struct OFEDVersion;
32+
33+
template <>
34+
struct OFEDVersion<Kind::Inbox> {
35+
int major, minor;
36+
};
37+
38+
template<>
39+
struct OFEDVersion<Kind::Mellanox> {
40+
std::string version;
41+
};
42+
2743
private:
2844
Kind m_kind { Kind::Inbox };
45+
std::string m_version = "latest";
46+
OFEDVersion<T> m_ofedVersion;
2947

3048
public:
3149
OFED() = default;
32-
explicit OFED(Kind kind);
50+
OFED(Kind kind, std::string version)
51+
: m_kind(kind)
52+
, m_version(std::move(version))
53+
{}
54+
OFED(Kind kind)
55+
: m_kind(kind)
56+
{}
3357

3458
void setKind(Kind kind);
3559
[[nodiscard]] Kind getKind() const;
3660

61+
void setVersion(std::string&& value) { m_version = std::move(value); }
62+
[[nodiscard]] std::string getVersion() const { return m_version; }
63+
3764
/**
3865
* @brief Installs the OFED software package.
3966
*

src/models/answerfile.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void AnswerFile::loadOptions()
4949
loadNodes();
5050
loadTools();
5151
loadPostfix();
52+
loadOFED();
5253
}
5354

5455
void AnswerFile::dumpNetwork(
@@ -607,6 +608,16 @@ void AnswerFile::loadPostfix()
607608
postfix.key_file = m_ini.getValue("postfix", "smtpd_tls_key_file", false);
608609
}
609610

611+
void AnswerFile::loadOFED()
612+
{
613+
auto value = m_ini.getValue("system", "ofed");
614+
if (value != "") {
615+
LOG_DEBUG("OFED enabled, {}", value)
616+
ofed.enabled = true;
617+
ofed.version = value;
618+
}
619+
}
620+
610621
};
611622

612623
#ifdef BUILD_TESTING

src/models/cluster.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ void Cluster::setProvisioner(Cluster::Provisioner provisioner)
211211
std::optional<OFED> Cluster::getOFED() const { return m_ofed; }
212212

213213
void Cluster::setOFED(OFED::Kind kind) { m_ofed = OFED(kind); }
214+
void Cluster::setOFED(OFED::Kind kind, const std::string& version) { m_ofed = OFED(kind, version); }
214215

215216
std::optional<std::unique_ptr<QueueSystem>>& Cluster::getQueueSystem()
216217
{

0 commit comments

Comments
 (0)