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

Commit b8eb64f

Browse files
authored
Add pipeline for NVHPC (#197)
1 parent d1b9567 commit b8eb64f

7 files changed

Lines changed: 96 additions & 35 deletions

File tree

.github/workflows/bvt-nvhpc.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
branch:
5+
type: string
6+
required: false
7+
8+
jobs:
9+
bvt-nvhpc:
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ inputs.branch }}
15+
16+
- name: install NVHPC 24.9
17+
run: |
18+
curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
19+
echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
20+
sudo apt-get update -y
21+
sudo apt-get install -y nvhpc-24-9
22+
23+
- name: build and run test with NVHPC 24.9
24+
run: |
25+
PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.9/compilers/bin:$PATH; export PATH
26+
cmake -B build-nv -DCMAKE_C_COMPILER=nvc -DCMAKE_CXX_COMPILER=nvc++ -DCMAKE_BUILD_TYPE=Release
27+
cmake --build build-nv -j
28+
ctest --test-dir build-nv -j
29+
30+
- name: run benchmarks
31+
run: |
32+
cd build-nv/benchmarks
33+
./msft_proxy_benchmarks --benchmark_min_warmup_time=0.1 --benchmark_min_time=0.1s --benchmark_repetitions=30 --benchmark_enable_random_interleaving=true --benchmark_report_aggregates_only=true --benchmark_format=json > benchmarking-results.json
34+
35+
- name: archive benchmarking results
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: benchmarking-results-nvhpc
39+
path: build-nv/benchmarks/benchmarking-results.json

.github/workflows/bvt-report.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ jobs:
2626
2727
- name: generate report
2828
run: |
29-
tools/report_generator/build/report_generator tools/report_generator/report-config.json ${{ github.sha }} artifacts benchmarking-report.md
29+
cat <<EOF > benchmarking-report.md
30+
## Benchmarking Report
31+
32+
- Generated for: [Microsoft "Proxy" library](https://github.com/microsoft/proxy)
33+
- Commit ID: [${{ github.sha }}](https://github.com/microsoft/proxy/commit/${{ github.sha }})
34+
- Generated at: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
35+
36+
EOF
37+
tools/report_generator/build/report_generator tools/report_generator/report-config.json
3038
3139
- name: archive benchmarking report
3240
uses: actions/upload-artifact@v4

.github/workflows/pipeline-ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ jobs:
2424
uses: ./.github/workflows/bvt-appleclang.yml
2525
name: Run BVT with AppleClang
2626

27+
run-bvt-nvhpc:
28+
uses: ./.github/workflows/bvt-nvhpc.yml
29+
name: Run BVT with NVHPC
30+
2731
report:
2832
uses: ./.github/workflows/bvt-report.yml
2933
name: Generate report
30-
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc, run-bvt-appleclang]
34+
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc, run-bvt-appleclang, run-bvt-nvhpc]

.github/workflows/pipeline-release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ jobs:
6565
with:
6666
branch: release/${{ github.event.inputs.version }}
6767

68+
run-bvt-nvhpc:
69+
needs: prepare-release
70+
name: Run BVT with NVHPC
71+
uses: ./.github/workflows/bvt-nvhpc.yml
72+
with:
73+
branch: release/${{ github.event.inputs.version }}
74+
6875
report:
6976
uses: ./.github/workflows/bvt-report.yml
7077
name: Generate report
71-
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc, run-bvt-appleclang]
78+
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc, run-bvt-appleclang, run-bvt-nvhpc]
7279

7380
draft-release:
7481
runs-on: windows-latest
75-
needs: [run-bvt-gcc, run-bvt-clang, run-bvt-msvc, run-bvt-appleclang]
82+
needs: report
7683
steps:
7784
- uses: actions/checkout@v3
7885
with:

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,12 @@ The "Proxy" library is a self-contained solution for runtime polymorphism in C++
164164

165165
## <a name="compiler-req">Minimum Requirements for Compilers</a>
166166

167-
| Family | Minimum version | Required flags |
168-
| ------ | --------------- | -------------- |
169-
| clang | 15.0.0 | -std=c++20 |
170-
| gcc | 11.2 | -std=c++20 |
171-
| MSVC | 19.30 | /std:c++20 |
167+
| Family | Minimum version | Required flags |
168+
| ---------- | --------------- | -------------- |
169+
| GCC | 11.2 | -std=c++20 |
170+
| Clang | 15.0.0 | -std=c++20 |
171+
| MSVC | 19.30 | /std:c++20 |
172+
| NVIDIA HPC | 24.1 | -std=c++20 |
172173

173174
## Build and Run Tests with CMake
174175

@@ -182,9 +183,10 @@ ctest --test-dir build -j
182183

183184
## Related Resources
184185

186+
- November, 2024: [Analyzing the Performance of the “Proxy” Library](https://devblogs.microsoft.com/cppblog/analyzing-the-performance-of-the-proxy-library/)
187+
- September, 2024: [Announcing the Proxy 3 Library for Dynamic Polymorphism](https://devblogs.microsoft.com/cppblog/announcing-the-proxy-3-library-for-dynamic-polymorphism/)
185188
- April, 2024: [Published ISO C++ proposal P3086R2: Proxy: A Pointer-Semantics-Based Polymorphism Library](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3086r2.pdf)
186189
- August, 2022: [proxy: Runtime Polymorphism Made Easier Than Ever](https://devblogs.microsoft.com/cppblog/proxy-runtime-polymorphism-made-easier-than-ever/)
187-
- September, 2024: [Announcing the Proxy 3 Library for Dynamic Polymorphism](https://devblogs.microsoft.com/cppblog/announcing-the-proxy-3-library-for-dynamic-polymorphism/)
188190

189191
## Contributing
190192

tools/report_generator/main.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
#include <cstdio>
5-
#include <chrono>
65
#include <filesystem>
76
#include <format>
87
#include <fstream>
@@ -15,19 +14,19 @@
1514
#include <nlohmann/json.hpp>
1615

1716
struct EnvironmentInfo {
18-
std::string Name;
1917
std::string Description;
18+
std::string Path;
2019

2120
friend void to_json(nlohmann::json& j, const EnvironmentInfo& e) {
2221
j = nlohmann::json{
23-
{"Name", e.Name},
24-
{"Description", e.Description}
22+
{"Description", e.Description},
23+
{"Path", e.Path}
2524
};
2625
}
2726

2827
friend void from_json(const nlohmann::json& j, EnvironmentInfo& e) {
29-
j.at("Name").get_to(e.Name);
3028
j.at("Description").get_to(e.Description);
29+
j.at("Path").get_to(e.Path);
3130
}
3231
};
3332

@@ -54,13 +53,15 @@ struct MetricInfo {
5453
struct ReportConfig {
5554
std::string TargetName;
5655
double YellowIndicatorThreshold;
56+
std::string OutputPath;
5757
std::vector<EnvironmentInfo> Environments;
5858
std::vector<MetricInfo> Metrics;
5959

6060
friend void to_json(nlohmann::json& j, const ReportConfig& rc) {
6161
j = nlohmann::json{
6262
{"TargetName", rc.TargetName},
6363
{"YellowIndicatorThreshold", rc.YellowIndicatorThreshold},
64+
{"OutputPath", rc.OutputPath},
6465
{"Environments", rc.Environments},
6566
{"Metrics", rc.Metrics}
6667
};
@@ -69,6 +70,7 @@ struct ReportConfig {
6970
friend void from_json(const nlohmann::json& j, ReportConfig& rc) {
7071
j.at("TargetName").get_to(rc.TargetName);
7172
j.at("YellowIndicatorThreshold").get_to(rc.YellowIndicatorThreshold);
73+
j.at("OutputPath").get_to(rc.OutputPath);
7274
j.at("Environments").get_to(rc.Environments);
7375
j.at("Metrics").get_to(rc.Metrics);
7476
}
@@ -96,7 +98,7 @@ std::unordered_map<std::string, double> Parse(const std::filesystem::path& file)
9698
return result;
9799
}
98100

99-
void GenerateReport(const std::filesystem::path& config_path, const std::string& commit_id, const std::filesystem::path& source, const std::filesystem::path& output) {
101+
void GenerateReport(const std::filesystem::path& config_path) {
100102
ReportConfig config;
101103
{
102104
nlohmann::json obj;
@@ -109,17 +111,11 @@ void GenerateReport(const std::filesystem::path& config_path, const std::string&
109111
std::vector<std::unordered_map<std::string, double>> benchmarks;
110112
benchmarks.reserve(config.Environments.size());
111113
for (auto& environment : config.Environments) {
112-
benchmarks.push_back(Parse(source / std::format("benchmarking-results-{}", environment.Name) / "benchmarking-results.json"));
114+
benchmarks.push_back(Parse(environment.Path));
113115
}
114116
std::ofstream out;
115117
out.exceptions(std::ios_base::failbit | std::ios_base::badbit);
116-
out.open(output, std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
117-
out << "## Benchmarking Report\n";
118-
out << "\n";
119-
out << "- Generated for: [Microsoft \"Proxy\" library](https://github.com/microsoft/proxy)\n";
120-
out << "- Commit ID: [" << commit_id << "](https://github.com/microsoft/proxy/commit/" << commit_id << ")\n";
121-
out << "- Generated at: " << std::format("{:%FT%TZ}", std::chrono::utc_clock::now()) << "\n";
122-
out << "\n";
118+
out.open(config.OutputPath, std::ios_base::out | std::ios_base::app | std::ios_base::binary);
123119
out << "| |";
124120
for (auto& environment : config.Environments) {
125121
out << " " << environment.Description << " |";
@@ -162,12 +158,12 @@ void GenerateReport(const std::filesystem::path& config_path, const std::string&
162158
}
163159

164160
int main(int argc, char** argv) {
165-
if (argc != 5) {
166-
puts("Usage: report_generator <config file path> <commit ID> <benchmarking results directory> <output file path>");
161+
if (argc != 2) {
162+
puts("Usage: report_generator <config file path>");
167163
return 0;
168164
}
169165
try {
170-
GenerateReport(argv[1], argv[2], argv[3], argv[4]);
166+
GenerateReport(argv[1]);
171167
} catch (const std::exception& e) {
172168
fprintf(stderr, "An error occurred: %s\n", e.what());
173169
return 1;

tools/report_generator/report-config.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
{
22
"TargetName": "`proxy`",
33
"YellowIndicatorThreshold": 5.0,
4+
"OutputPath": "benchmarking-report.md",
45
"Environments": [
56
{
6-
"Name": "msvc",
7-
"Description": "MSVC on Windows Server 2022 (x64)"
7+
"Description": "MSVC on Windows Server 2022 (x64)",
8+
"Path": "artifacts/benchmarking-results-msvc/benchmarking-results.json"
89
},
910
{
10-
"Name": "gcc",
11-
"Description": "GCC on Ubuntu 24.04 (x64)"
11+
"Description": "GCC on Ubuntu 24.04 (x64)",
12+
"Path": "artifacts/benchmarking-results-gcc/benchmarking-results.json"
1213
},
1314
{
14-
"Name": "clang",
15-
"Description": "Clang on Ubuntu 24.04 (x64)"
15+
"Description": "Clang on Ubuntu 24.04 (x64)",
16+
"Path": "artifacts/benchmarking-results-clang/benchmarking-results.json"
1617
},
1718
{
18-
"Name": "appleclang",
19-
"Description": "Apple Clang on macOS 15 (ARM64)"
19+
"Description": "Apple Clang on macOS 15 (ARM64)",
20+
"Path": "artifacts/benchmarking-results-appleclang/benchmarking-results.json"
21+
},
22+
{
23+
"Description": "Nvidia HPC on Ubuntu 24.04 (x64)",
24+
"Path": "artifacts/benchmarking-results-nvhpc/benchmarking-results.json"
2025
}
2126
],
2227
"Metrics": [

0 commit comments

Comments
 (0)