Skip to content

Commit 991d433

Browse files
nmalkapurambrdeyo
authored andcommitted
Fixing bugs in lmbench and hplinpack (#239)
* Fixing bugs in lmbench and hplinpack * resolving testcases * fixing sockperf server process exiting instruction from client * resolving comments * reverting changes for sockperf
1 parent 215235e commit 991d433

File tree

4 files changed

+104
-40
lines changed

4 files changed

+104
-40
lines changed

src/VirtualClient/VirtualClient.Actions.UnitTests/LMbench/LMbenchExecutorTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public void SetupDefaultBehavior()
3535
// workload is compiled using Make and has a build step that runs the memory test. This uses commands in the
3636
// 'scripts' folder.
3737
this.fixture.SetupWorkloadPackage("lmbench", expectedFiles: "linux-x64/scripts/allmem");
38+
this.fixture.SetupWorkloadPackage("lmbench", expectedFiles: "linux-x64/scripts/build");
39+
3840

3941
this.fixture.Parameters = new Dictionary<string, IConvertible>()
4042
{

src/VirtualClient/VirtualClient.Actions/LMbench/LMbenchExecutor.cs

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ namespace VirtualClient.Actions
99
using System.IO.Abstractions;
1010
using System.Linq;
1111
using System.Runtime.InteropServices;
12+
using System.Text.RegularExpressions;
1213
using System.Threading;
1314
using System.Threading.Tasks;
1415
using Microsoft.Extensions.DependencyInjection;
16+
using Microsoft.Extensions.FileSystemGlobbing.Internal;
1517
using Microsoft.Extensions.Logging;
18+
using Microsoft.Extensions.Options;
1619
using VirtualClient.Common;
1720
using VirtualClient.Common.Extensions;
1821
using VirtualClient.Common.Platform;
@@ -29,6 +32,7 @@ public class LMbenchExecutor : VirtualClientComponent
2932
private IFileSystem fileSystem;
3033
private ISystemManagement systemManagement;
3134
private string resultsDirectory;
35+
private string buildFilePath;
3236

3337
/// <summary>
3438
/// Constructor
@@ -57,6 +61,30 @@ public string TestedInstance
5761
}
5862
}
5963

64+
/// <summary>
65+
/// The compilerFlags that are used for make command in compiling LMbench.
66+
/// </summary>
67+
public string CompilerFlags
68+
{
69+
get
70+
{
71+
this.Parameters.TryGetValue(nameof(LMbenchExecutor.CompilerFlags), out IConvertible compilerFlags);
72+
return compilerFlags?.ToString();
73+
}
74+
}
75+
76+
/// <summary>
77+
/// Libraries that should be linked with a program during the linking phase of compilation of lmbench.
78+
/// </summary>
79+
public string LDLIBS
80+
{
81+
get
82+
{
83+
this.Parameters.TryGetValue(nameof(LMbenchExecutor.LDLIBS), out IConvertible ldlibs);
84+
return ldlibs?.ToString();
85+
}
86+
}
87+
6088
/// <summary>
6189
/// Executes LMbench
6290
/// </summary>
@@ -65,7 +93,7 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
6593
try
6694
{
6795
this.Cleanup();
68-
await this.ExecuteWorkloadAsync("make", "results", telemetryContext, cancellationToken).ConfigureAwait();
96+
await this.ExecuteWorkloadAsync("make", $"results {this.CompilerFlags}", telemetryContext, cancellationToken).ConfigureAwait();
6997

7098
using (IProcessProxy process = this.systemManagement.ProcessManager.CreateProcess("make", "see", this.LMbenchDirectory))
7199
{
@@ -118,6 +146,8 @@ await this.systemManagement.MakeFilesExecutableAsync(this.PlatformSpecifics.Comb
118146

119147
this.LMbenchDirectory = workloadPackage.Path;
120148
this.resultsDirectory = this.PlatformSpecifics.Combine(this.LMbenchDirectory, "results");
149+
this.buildFilePath = this.PlatformSpecifics.Combine(workloadPackage.Path, "scripts", "build");
150+
await this.ConfigureBuild(this.buildFilePath, cancellationToken);
121151
}
122152

123153
/// <summary>
@@ -138,6 +168,23 @@ protected override bool IsSupported()
138168
return isSupported;
139169
}
140170

171+
private async Task ConfigureBuild(string buildFilePath, CancellationToken cancellationToken)
172+
{
173+
if (!cancellationToken.IsCancellationRequested)
174+
{
175+
FileSystemExtensions.ThrowIfFileDoesNotExist(this.fileSystem.File, buildFilePath);
176+
string fileContent = await this.fileSystem.File.ReadAllTextAsync(buildFilePath, cancellationToken)
177+
.ConfigureAwait(false);
178+
179+
Regex regexPattern = new Regex(@"LDLIBS=(.*)");
180+
181+
fileContent = regexPattern.Replace(fileContent, $"LDLIBS=\"{this.LDLIBS}\"", 1);
182+
183+
await this.fileSystem.File.WriteAllTextAsync(buildFilePath, fileContent, cancellationToken)
184+
.ConfigureAwait(false);
185+
}
186+
}
187+
141188
private void CaptureMetrics(IProcessProxy process, EventContext telemetryContext, CancellationToken cancellationToken)
142189
{
143190
if (!cancellationToken.IsCancellationRequested)

src/VirtualClient/VirtualClient.Main/profiles/PERF-CPU-HPLINPACK.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
"Parameters": {
4444
"Scenario": "InstallRequiredLinuxPackagesForHPL",
4545
"Repositories-Apt": "ppa:ubuntu-toolchain-r/test",
46-
"Packages": "build-essential,linux-generic,libmpich-dev,libopenmpi-dev,libatlas-base-dev"
46+
"Packages-Apt": "build-essential,libmpich-dev,libopenmpi-dev,libatlas-base-dev",
47+
"Packages-Yum": "mpich-devel,openmpi-devel,atlas-devel",
48+
"Packages-Dnf": "mpich-devel,openmpi-devel,atlas-devel"
4749
}
4850
},
4951
{
Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,55 @@
11
{
2-
"Description": "LMbench Performance Workload",
3-
"MinimumExecutionInterval": "00:10:00",
4-
"Metadata": {
5-
"RecommendedMinimumExecutionTime": "(4-cores)=04:00:00,(16-cores)=10:00:00,(64-cores)=16:00:00",
6-
"SupportedPlatforms": "linux-x64,linux-arm64",
7-
"SupportedOperatingSystems": "CBL-Mariner,CentOS,Debian,RedHat,Suse,Ubuntu"
2+
"Description": "LMbench Performance Workload",
3+
"MinimumExecutionInterval": "00:10:00",
4+
"Metadata": {
5+
"RecommendedMinimumExecutionTime": "(4-cores)=04:00:00,(16-cores)=10:00:00,(64-cores)=16:00:00",
6+
"SupportedPlatforms": "linux-x64,linux-arm64",
7+
"SupportedOperatingSystems": "CBL-Mariner,CentOS,Debian,RedHat,Suse,Ubuntu"
8+
},
9+
"Parameters": {
10+
"CompilerName": "gcc",
11+
"CompilerVersion": "10",
12+
"CompilerFlags": "CPPFLAGS=\"-I /usr/include/tirpc\"",
13+
"LDLIBS": "-lm -ltirpc"
14+
},
15+
"Actions": [
16+
{
17+
"Type": "LMbenchExecutor",
18+
"Parameters": {
19+
"Scenario": "MemoryPerformance",
20+
"PackageName": "lmbench",
21+
"CompilerFlags": "$.Parameters.CompilerFlags",
22+
"LDLIBS": "$.Parameters.LDLIBS"
23+
}
24+
}
25+
],
26+
"Dependencies": [
27+
{
28+
"Type": "LinuxPackageInstallation",
29+
"Parameters": {
30+
"Scenario": "InstallLinuxPackages",
31+
"Packages-Apt": "libtirpc-dev",
32+
"Packages-Yum": "libtirpc-devel",
33+
"Packages-Dnf": "libtirpc-devel"
34+
}
835
},
9-
"Parameters": {
10-
"CompilerName": "gcc",
11-
"CompilerVersion": "10"
36+
{
37+
"Type": "CompilerInstallation",
38+
"Parameters": {
39+
"Scenario": "InstallCompiler",
40+
"CompilerName": "$.Parameters.CompilerName",
41+
"CompilerVersion": "$.Parameters.CompilerVersion"
42+
}
1243
},
13-
"Actions": [
14-
{
15-
"Type": "LMbenchExecutor",
16-
"Parameters": {
17-
"Scenario": "MemoryPerformance",
18-
"PackageName": "lmbench"
19-
}
20-
}
21-
],
22-
"Dependencies": [
23-
{
24-
"Type": "CompilerInstallation",
25-
"Parameters": {
26-
"Scenario": "InstallCompiler",
27-
"CompilerName": "$.Parameters.CompilerName",
28-
"CompilerVersion": "$.Parameters.CompilerVersion"
29-
}
30-
},
31-
{
32-
"Type": "DependencyPackageInstallation",
33-
"Parameters": {
34-
"Scenario": "InstallLMbenchPackages",
35-
"BlobContainer": "packages",
36-
"BlobName": "lmbench.1.0.0-2alpha8.zip",
37-
"PackageName": "lmbench",
38-
"Extract": true
39-
}
40-
}
41-
]
44+
{
45+
"Type": "DependencyPackageInstallation",
46+
"Parameters": {
47+
"Scenario": "InstallLMbenchPackages",
48+
"BlobContainer": "packages",
49+
"BlobName": "lmbench.1.0.0-2alpha8.zip",
50+
"PackageName": "lmbench",
51+
"Extract": true
52+
}
53+
}
54+
]
4255
}

0 commit comments

Comments
 (0)