Skip to content

Commit

Permalink
Fixing bugs in lmbench and hplinpack (#239)
Browse files Browse the repository at this point in the history
* Fixing bugs in lmbench and hplinpack

* resolving testcases

* fixing sockperf server process exiting instruction from client

* resolving comments

* reverting changes for sockperf
  • Loading branch information
nmalkapuram authored and brdeyo committed Jan 12, 2024
1 parent 215235e commit 991d433
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public void SetupDefaultBehavior()
// workload is compiled using Make and has a build step that runs the memory test. This uses commands in the
// 'scripts' folder.
this.fixture.SetupWorkloadPackage("lmbench", expectedFiles: "linux-x64/scripts/allmem");
this.fixture.SetupWorkloadPackage("lmbench", expectedFiles: "linux-x64/scripts/build");


this.fixture.Parameters = new Dictionary<string, IConvertible>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ namespace VirtualClient.Actions
using System.IO.Abstractions;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileSystemGlobbing.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using VirtualClient.Common;
using VirtualClient.Common.Extensions;
using VirtualClient.Common.Platform;
Expand All @@ -29,6 +32,7 @@ public class LMbenchExecutor : VirtualClientComponent
private IFileSystem fileSystem;
private ISystemManagement systemManagement;
private string resultsDirectory;
private string buildFilePath;

/// <summary>
/// Constructor
Expand Down Expand Up @@ -57,6 +61,30 @@ public string TestedInstance
}
}

/// <summary>
/// The compilerFlags that are used for make command in compiling LMbench.
/// </summary>
public string CompilerFlags
{
get
{
this.Parameters.TryGetValue(nameof(LMbenchExecutor.CompilerFlags), out IConvertible compilerFlags);
return compilerFlags?.ToString();
}
}

/// <summary>
/// Libraries that should be linked with a program during the linking phase of compilation of lmbench.
/// </summary>
public string LDLIBS
{
get
{
this.Parameters.TryGetValue(nameof(LMbenchExecutor.LDLIBS), out IConvertible ldlibs);
return ldlibs?.ToString();
}
}

/// <summary>
/// Executes LMbench
/// </summary>
Expand All @@ -65,7 +93,7 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
try
{
this.Cleanup();
await this.ExecuteWorkloadAsync("make", "results", telemetryContext, cancellationToken).ConfigureAwait();
await this.ExecuteWorkloadAsync("make", $"results {this.CompilerFlags}", telemetryContext, cancellationToken).ConfigureAwait();

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

this.LMbenchDirectory = workloadPackage.Path;
this.resultsDirectory = this.PlatformSpecifics.Combine(this.LMbenchDirectory, "results");
this.buildFilePath = this.PlatformSpecifics.Combine(workloadPackage.Path, "scripts", "build");
await this.ConfigureBuild(this.buildFilePath, cancellationToken);
}

/// <summary>
Expand All @@ -138,6 +168,23 @@ protected override bool IsSupported()
return isSupported;
}

private async Task ConfigureBuild(string buildFilePath, CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
{
FileSystemExtensions.ThrowIfFileDoesNotExist(this.fileSystem.File, buildFilePath);
string fileContent = await this.fileSystem.File.ReadAllTextAsync(buildFilePath, cancellationToken)
.ConfigureAwait(false);

Regex regexPattern = new Regex(@"LDLIBS=(.*)");

fileContent = regexPattern.Replace(fileContent, $"LDLIBS=\"{this.LDLIBS}\"", 1);

await this.fileSystem.File.WriteAllTextAsync(buildFilePath, fileContent, cancellationToken)
.ConfigureAwait(false);
}
}

private void CaptureMetrics(IProcessProxy process, EventContext telemetryContext, CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"Parameters": {
"Scenario": "InstallRequiredLinuxPackagesForHPL",
"Repositories-Apt": "ppa:ubuntu-toolchain-r/test",
"Packages": "build-essential,linux-generic,libmpich-dev,libopenmpi-dev,libatlas-base-dev"
"Packages-Apt": "build-essential,libmpich-dev,libopenmpi-dev,libatlas-base-dev",
"Packages-Yum": "mpich-devel,openmpi-devel,atlas-devel",
"Packages-Dnf": "mpich-devel,openmpi-devel,atlas-devel"
}
},
{
Expand Down
89 changes: 51 additions & 38 deletions src/VirtualClient/VirtualClient.Main/profiles/PERF-MEM-LMBENCH.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
{
"Description": "LMbench Performance Workload",
"MinimumExecutionInterval": "00:10:00",
"Metadata": {
"RecommendedMinimumExecutionTime": "(4-cores)=04:00:00,(16-cores)=10:00:00,(64-cores)=16:00:00",
"SupportedPlatforms": "linux-x64,linux-arm64",
"SupportedOperatingSystems": "CBL-Mariner,CentOS,Debian,RedHat,Suse,Ubuntu"
"Description": "LMbench Performance Workload",
"MinimumExecutionInterval": "00:10:00",
"Metadata": {
"RecommendedMinimumExecutionTime": "(4-cores)=04:00:00,(16-cores)=10:00:00,(64-cores)=16:00:00",
"SupportedPlatforms": "linux-x64,linux-arm64",
"SupportedOperatingSystems": "CBL-Mariner,CentOS,Debian,RedHat,Suse,Ubuntu"
},
"Parameters": {
"CompilerName": "gcc",
"CompilerVersion": "10",
"CompilerFlags": "CPPFLAGS=\"-I /usr/include/tirpc\"",
"LDLIBS": "-lm -ltirpc"
},
"Actions": [
{
"Type": "LMbenchExecutor",
"Parameters": {
"Scenario": "MemoryPerformance",
"PackageName": "lmbench",
"CompilerFlags": "$.Parameters.CompilerFlags",
"LDLIBS": "$.Parameters.LDLIBS"
}
}
],
"Dependencies": [
{
"Type": "LinuxPackageInstallation",
"Parameters": {
"Scenario": "InstallLinuxPackages",
"Packages-Apt": "libtirpc-dev",
"Packages-Yum": "libtirpc-devel",
"Packages-Dnf": "libtirpc-devel"
}
},
"Parameters": {
"CompilerName": "gcc",
"CompilerVersion": "10"
{
"Type": "CompilerInstallation",
"Parameters": {
"Scenario": "InstallCompiler",
"CompilerName": "$.Parameters.CompilerName",
"CompilerVersion": "$.Parameters.CompilerVersion"
}
},
"Actions": [
{
"Type": "LMbenchExecutor",
"Parameters": {
"Scenario": "MemoryPerformance",
"PackageName": "lmbench"
}
}
],
"Dependencies": [
{
"Type": "CompilerInstallation",
"Parameters": {
"Scenario": "InstallCompiler",
"CompilerName": "$.Parameters.CompilerName",
"CompilerVersion": "$.Parameters.CompilerVersion"
}
},
{
"Type": "DependencyPackageInstallation",
"Parameters": {
"Scenario": "InstallLMbenchPackages",
"BlobContainer": "packages",
"BlobName": "lmbench.1.0.0-2alpha8.zip",
"PackageName": "lmbench",
"Extract": true
}
}
]
{
"Type": "DependencyPackageInstallation",
"Parameters": {
"Scenario": "InstallLMbenchPackages",
"BlobContainer": "packages",
"BlobName": "lmbench.1.0.0-2alpha8.zip",
"PackageName": "lmbench",
"Extract": true
}
}
]
}

0 comments on commit 991d433

Please sign in to comment.