Skip to content

Commit

Permalink
Implement NVIDIA HPC SDK (#62)
Browse files Browse the repository at this point in the history
* WIP First idea

Signed-off-by: Lucas Gracioso <[email protected]>

* Repo TODO warning

Signed-off-by: Lucas Gracioso <[email protected]>

* Rewrite NVHPC tools class

Signed-off-by: Lucas Gracioso <[email protected]>

* Remove unused include

Signed-off-by: Lucas Gracioso <[email protected]>

* Add NVHPC SDK repo

Signed-off-by: Lucas Gracioso <[email protected]>

* Update nvhpc.h, create ITool.h

Signed-off-by: Lucas Gracioso <[email protected]>

* Fix typo in NVIDIA brand

Signed-off-by: Vinícius Ferrão <[email protected]>

* Fix another typo in NVIDIA brand

Signed-off-by: Vinícius Ferrão <[email protected]>

---------

Signed-off-by: Lucas Gracioso <[email protected]>
Signed-off-by: Lucas Gracioso <[email protected]>
Signed-off-by: Vinícius Ferrão <[email protected]>
Co-authored-by: Vinícius Ferrão <[email protected]>
  • Loading branch information
lbgracioso and viniciusferrao committed Jul 1, 2024
1 parent c7c3b28 commit 6fad84a
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 23 deletions.
4 changes: 4 additions & 0 deletions example.answerfile.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ bmc_address=10.0.0.2
#bmc_password=admin
#bmc_serialport=0
#bmc_serialspeed=9600

# Optional: NVIDIA HPC SDK
#[nvhpc]
#enabled=0
8 changes: 8 additions & 0 deletions include/cloysterhpc/answerfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
#ifndef CLOYSTERHPC_ANSWERFILE_H_
#define CLOYSTERHPC_ANSWERFILE_H_

#include "cloysterhpc/tools/ITool.h"
#include "os.h"
#include <boost/asio.hpp>
#include <cloysterhpc/inifile.h>
#include <optional>
#include <utility>
#include <vector>

using boost::asio::ip::address;
Expand Down Expand Up @@ -76,6 +78,8 @@ class AnswerFile {
std::vector<AFNode> nodes;
};

std::vector<std::shared_ptr<ITool>> m_tools;

std::filesystem::path m_path;
inifile m_ini;

Expand All @@ -89,6 +93,9 @@ class AnswerFile {
void loadHostnameSettings();
void loadSystemSettings();
void loadNodes();
void loadTools();
void loadNVHPC();
bool checkEnabled(const std::string& section);
AFNode loadNode(const std::string& section);
AFNode validateNode(AFNode node);

Expand All @@ -115,6 +122,7 @@ class AnswerFile {
AFNodes nodes;

void loadFile(const std::filesystem::path& path);
std::vector<std::shared_ptr<ITool>> getTools();

AnswerFile();
explicit AnswerFile(const std::filesystem::path& path);
Expand Down
7 changes: 7 additions & 0 deletions include/cloysterhpc/repos/el8/cloyster.repo
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,11 @@ enabled=1
gpgcheck=1
gpgkey=https://obs.openhpc.community/projects/OpenHPC/public_key

[cloyster-nvhpc]
name=NVIDIA HPC SDK
baseurl=https://developer.download.nvidia.com/hpc-sdk/rhel/$basearch
enabled=1
gpgcheck=1
gpgkey=https://developer.download.nvidia.com/hpc-sdk/rhel/RPM-GPG-KEY-NVIDIA-HPC-SDK

)"
7 changes: 7 additions & 0 deletions include/cloysterhpc/repos/el9/cloyster.repo
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,11 @@ enabled=1
gpgcheck=1
gpgkey=https://obs.openhpc.community/projects/OpenHPC3/public_key

[cloyster-nvhpc]
name=NVIDIA HPC SDK
baseurl=https://developer.download.nvidia.com/hpc-sdk/rhel/$basearch
enabled=1
gpgcheck=1
gpgkey=https://developer.download.nvidia.com/hpc-sdk/rhel/RPM-GPG-KEY-NVIDIA-HPC-SDK

)"
30 changes: 30 additions & 0 deletions include/cloysterhpc/repos/offline/el8/RPM-GPG-KEY-NVIDIA-HPC-SDK
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
R"(-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)

mQINBGJYmlEBEACdGJ6pjuffnlGjIHnVteVfsVGHWNY5YB95fCKChP82pkqQsi1w
Hlj7XBIMLe8hKU6UbJCbqJr1w5aZ6LIcznSwW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Q704HKNfjKRHI7eT/++8msw3sYtUUVsRPUVevG5HZsRcN7YZTwb3MtzAx
7D3Rt9HvQbUUpxJ8vjFX/fLSKwGZM8MixiHHxViJ81K7/ZD0wRZO1z5jFKmS/JyF
UOQPaLGNE21C0mo+EFxFnjU7p1wGxpXe/mwtKGtCQVZKy+zVEymTXtgKlSVq6j3w
Pzq87l+zxipBdOI1eD2xfXTVmDsZgB5U9Mgq01Ca9C5a/fUOVw+eASSbKePk1QAG
EBPgqbmRYMosEQE1lwR+eX6iMkQ++fa9uUFW65ZtGXvtk7O7BayRXxoPydwtoh3V
U45D+bhTJcVY7h4p
=zQwq
-----END PGP PUBLIC KEY BLOCK-----
)"
30 changes: 30 additions & 0 deletions include/cloysterhpc/repos/offline/el9/RPM-GPG-KEY-NVIDIA-HPC-SDK
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
R"(-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)

mQINBGJYmlEBEACdGJ6pjuffnlGjIHnVteVfsVGHWNY5YB95fCKChP82pkqQsi1w
Hlj7XBIMLe8hKU6UbJCbqJr1w5aZ6LIcznSwWjVVhTb4wWm8zAO8t/HY/xSSSAYk
LMcq4U6R0pJ2cd1a5wfL8VwdwD2Buk0ZbfElTI+10cC0tAGM/5KHQF25Dv+ZGMzc
tjpepdFRlZHwPafRIDqsbJhTdGqodLYgQ3905aAtdMcUYLIcZZQ9Y6M1VWI/vPsM
j9XyJeZqoJUqA7UjUPP73vWDC/oaj4+Rrzntq6SaadCMyILW6tSEhD3AM/sAgRyZ
Do2SIuc1b8LFU+XgTaceZs2iPze225voEEhdOCAg1ECd/PAmSayGZcdCGAZOrbmC
saRpC6WC6UrgmDu1VS3bJecNGvvYenblBkOm4SO4GGGn3Yu8u4Rpkfk4qG/c9W3B
zrfcH7K5hFhgyzwYxQ3+/NJsVwY94PDw1HNfCsQkxrJRBNgTwPPOAhJNdQ7fkIvv
Bm/jGsbHUREO7inhZ9ppDom0/H9RpiJ2ZuiDy9DbUxIil/agiWXhk53Nn9v/5NUW
pAPFVTS+3N2/KKB2NBmjjRRtm/mvkB1dIXUxg+JUs38o15wRaQZCahiyZwMKiKZA
upuK4KwX18bInKTuv2P7aM2Ru9/IBx7ypqb2LIHP4NeBt7xT4jL786gDsQARAQAB
tA5OVklESUEgSFBDIFNES4kCOQQTAQIAIwUCYliaUQIbAwcLCQgHAwIBBhUIAgkK
CwQWAgMBAh4BAheAAAoJEHNDaokmSneWudwP/ApCXzETdFe1xGLbhQGhDuR97vMx
7e6yx4FAjuCeFiML7rBla7OgDKx5ywACjwP5aEzYqkRXR1dejEjh2HA7/seVL8aY
FH4f37W4WTdxFpxRYcmAvCM/VzXXo5zunx5c+owLYkUiKEX1Yw5VEx/h3/rjYi/w
BFNCoHP7fcw19F7gNaAhlk/l6hoBkwOv0uNOx/rAPmxaBoU4dxISsZdGnQFmKcei
7dQ5Op0CxegvRyXX/jo1RLbPp/o9J3La7A7U3whryy0P57iE7Wz/fwgxfECd00AV
U+ij+IMh1T67n+GkrieDyGAs/QfflClblaQfU4Cjb0+a66jFbqzn0fNBm48yXl7m
v1EqxufQ704HKNfjKRHI7eT/++8msw3sYtUUVsRPUVevG5HZsRcN7YZTwb3MtzAx
7D3Rt9HvQbUUpxJ8vjFX/fLSKwGZM8MixiHHxViJ81K7/ZD0wRZO1z5jFKmS/JyF
UOQPaLGNE21C0mo+EFxFnjU7p1wGxpXe/mwtKGtCQVZKy+zVEymTXtgKlSVq6j3w
Pzq87l+zxipBdOI1eD2xfXTVmDsZgB5U9Mgq01Ca9C5a/fUOVw+eASSbKePk1QAG
EBPgqbmRYMosEQE1lwR+eX6iMkQ++fa9uUFW65ZtGXvtk7O7BayRXxoPydwtoh3V
U45D+bhTJcVY7h4p
=zQwq
-----END PGP PUBLIC KEY BLOCK-----
)"
8 changes: 8 additions & 0 deletions include/cloysterhpc/repos/offline/gpgkeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ constexpr const char* GPG_KEY_ZABBIX_8 =
#include "cloysterhpc/repos/offline/el8/RPM-GPG-KEY-zabbix"
;

constexpr const char* GPG_KEY_NVHPCSDK_8 =
#include "cloysterhpc/repos/offline/el8/RPM-GPG-KEY-NVIDIA-HPC-SDK"
;

// EL9 KEYS
constexpr const char* GPG_KEY_ALMA_9 =
#include "cloysterhpc/repos/offline/el9/RPM-GPG-KEY-AlmaLinux"
Expand Down Expand Up @@ -104,3 +108,7 @@ constexpr const char* GPG_KEY_RPMFUSIONUPDATES_9 =
constexpr const char* GPG_KEY_ZABBIX_9 =
#include "cloysterhpc/repos/offline/el9/RPM-GPG-KEY-zabbix"
;

constexpr const char* GPG_KEY_NVHPCSDK_9 =
#include "cloysterhpc/repos/offline/el9/RPM-GPG-KEY-NVIDIA-HPC-SDK"
;
52 changes: 29 additions & 23 deletions include/cloysterhpc/repos/offline/gpgtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum class AddonType {
oneAPI,
OpenHPC,
Zabbix,
RPMFusionUpdates
RPMFusionUpdates,
NvidiaHPCSDK
};

enum class Platform { el8, el9 };
Expand All @@ -34,27 +35,31 @@ class GPGVerifier {

public:
GPGVerifier()
: m_gpg_keys{
{ AddonType::beegfs, { Platform::el8, GPG_KEY_BEEGFS_8 }},
{ AddonType::beegfs, { Platform::el9, GPG_KEY_BEEGFS_9 }},
{ AddonType::ELRepo, { Platform::el8, GPG_KEY_ELREPO_8 }},
{ AddonType::ELRepo, { Platform::el9, GPG_KEY_ELREPO_9 }},
{ AddonType::EPEL, { Platform::el8, GPG_KEY_EPEL_8 }},
{ AddonType::EPEL, { Platform::el9, GPG_KEY_EPEL_9 }},
{ AddonType::Grafana, { Platform::el8, GPG_KEY_GRAFANA_8 }},
{ AddonType::Grafana, { Platform::el9, GPG_KEY_GRAFANA_9 }},
{ AddonType::influxData, { Platform::el8, GPG_KEY_INFLUXDATA_8 }},
{ AddonType::influxData, { Platform::el9, GPG_KEY_INFLUXDATA_9 }},
{ AddonType::oneAPI, { Platform::el8, GPG_KEY_ONEAPI_8 }},
{ AddonType::oneAPI, { Platform::el9, GPG_KEY_ONEAPI_9 }},
{ AddonType::OpenHPC, { Platform::el8, GPG_KEY_OPENHPC_8 }},
{ AddonType::OpenHPC, { Platform::el9, GPG_KEY_OPENHPC_9 }},
{ AddonType::RPMFusionUpdates, { Platform::el8, GPG_KEY_RPMFUSIONUPDATES_8 }},
{ AddonType::RPMFusionUpdates, { Platform::el9, GPG_KEY_RPMFUSIONUPDATES_9 }},
{ AddonType::Zabbix, { Platform::el8, GPG_KEY_ZABBIX_8 }},
{ AddonType::Zabbix, { Platform::el9, GPG_KEY_ZABBIX_9 }}
}
{}
: m_gpg_keys { { AddonType::beegfs,
{ Platform::el8, GPG_KEY_BEEGFS_8 } },
{ AddonType::beegfs, { Platform::el9, GPG_KEY_BEEGFS_9 } },
{ AddonType::ELRepo, { Platform::el8, GPG_KEY_ELREPO_8 } },
{ AddonType::ELRepo, { Platform::el9, GPG_KEY_ELREPO_9 } },
{ AddonType::EPEL, { Platform::el8, GPG_KEY_EPEL_8 } },
{ AddonType::EPEL, { Platform::el9, GPG_KEY_EPEL_9 } },
{ AddonType::Grafana, { Platform::el8, GPG_KEY_GRAFANA_8 } },
{ AddonType::Grafana, { Platform::el9, GPG_KEY_GRAFANA_9 } },
{ AddonType::influxData, { Platform::el8, GPG_KEY_INFLUXDATA_8 } },
{ AddonType::influxData, { Platform::el9, GPG_KEY_INFLUXDATA_9 } },
{ AddonType::oneAPI, { Platform::el8, GPG_KEY_ONEAPI_8 } },
{ AddonType::oneAPI, { Platform::el9, GPG_KEY_ONEAPI_9 } },
{ AddonType::OpenHPC, { Platform::el8, GPG_KEY_OPENHPC_8 } },
{ AddonType::OpenHPC, { Platform::el9, GPG_KEY_OPENHPC_9 } },
{ AddonType::RPMFusionUpdates,
{ Platform::el8, GPG_KEY_RPMFUSIONUPDATES_8 } },
{ AddonType::RPMFusionUpdates,
{ Platform::el9, GPG_KEY_RPMFUSIONUPDATES_9 } },
{ AddonType::Zabbix, { Platform::el8, GPG_KEY_ZABBIX_8 } },
{ AddonType::Zabbix, { Platform::el9, GPG_KEY_ZABBIX_9 } },
{ AddonType::NvidiaHPCSDK, { Platform::el8, GPG_KEY_NVHPCSDK_8 } },
{ AddonType::NvidiaHPCSDK, { Platform::el9, GPG_KEY_NVHPCSDK_9 } } }
{
}

std::vector<std::pair<Platform, std::string>> getGPGKeys(AddonType type)
{
Expand All @@ -68,7 +73,8 @@ class GPGVerifier {
return result;
}

bool verifyGPGKey(AddonType type, Platform platform, const std::string& gpgKey)
bool verifyGPGKey(
AddonType type, Platform platform, const std::string& gpgKey)
{
auto range = m_gpg_keys.equal_range(type);
for (auto it = range.first; it != range.second; ++it) {
Expand Down
21 changes: 21 additions & 0 deletions include/cloysterhpc/tools/ITool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Created by Lucas Gracioso <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef CLOYSTERHPC_ITOOL_H_
#define CLOYSTERHPC_ITOOL_H_

#include "cloysterhpc/functions.h"
#include "cloysterhpc/services/log.h"

class ITool {
protected:
[[maybe_unused]] virtual void configure() = 0;

public:
virtual ~ITool() = default;
virtual void install() = 0;
};

#endif // CLOYSTERHPC_ITOOL_H_
19 changes: 19 additions & 0 deletions include/cloysterhpc/tools/nvhpc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Created by Lucas Gracioso <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef CLOYSTERHPC_NVHPC_H_
#define CLOYSTERHPC_NVHPC_H_

#include <cloysterhpc/tools/ITool.h>

class NVhpc : public ITool {
private:
void configure() override;

public:
void install() override;
};

#endif // CLOYSTERHPC_NVHPC_H_
21 changes: 21 additions & 0 deletions src/answerfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "cloysterhpc/answerfile.h"
#include "cloysterhpc/services/log.h"
#include "cloysterhpc/tools/nvhpc.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <magic_enum.hpp>
Expand Down Expand Up @@ -38,6 +39,7 @@ void AnswerFile::loadOptions()
loadHostnameSettings();
loadSystemSettings();
loadNodes();
loadTools();
}

address AnswerFile::convertStringToAddress(const std::string& addr)
Expand Down Expand Up @@ -294,6 +296,25 @@ AnswerFile::AFNode AnswerFile::validateNode(AnswerFile::AFNode node)
return node;
}

bool AnswerFile::checkEnabled(const std::string& section)
{
return m_ini.exists(section, "enabled")
&& m_ini.getValue(section, "enabled") == "1";
}

void AnswerFile::loadTools() { loadNVHPC(); }

void AnswerFile::loadNVHPC()
{
if (!checkEnabled("nvhpc")) {
return;
}

m_tools.emplace_back(std::make_shared<NVhpc>());
}

std::vector<std::shared_ptr<ITool>> AnswerFile::getTools() { return m_tools; }

#ifdef BUILD_TESTING
#include <cloysterhpc/tests.h>

Expand Down
4 changes: 4 additions & 0 deletions src/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ void Cluster::fillData(const std::string& answerfilePath)
setProvisioner(Provisioner::xCAT);
m_headnode.setOS(nodeOS);

for (const auto& tool : answerfile.getTools()) {
tool->install();
}

LOG_TRACE("Configure Nodes")
for (auto node : answerfile.nodes.nodes) {

Expand Down
14 changes: 14 additions & 0 deletions src/tools/nvhpc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Created by Lucas Gracioso <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

#include "cloysterhpc/tools/nvhpc.h"

void NVhpc::install()
{
LOG_TRACE("Installing NVIDIA HPC SDK");
cloyster::runCommand("dnf -y install nvhpc-24.3");
}

void NVhpc::configure() {};

0 comments on commit 6fad84a

Please sign in to comment.