From 86f0dcac2519494c4529b2d85b5adb0f3e029d94 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Sun, 18 Jun 2023 21:37:50 -0500 Subject: [PATCH 1/2] update csharp infra --- .github/dotnet.sh | 2 +- .github/workflows/bench.yml | 2 + README.md | 16 ++-- bench/bench_csharp.yaml | 2 + bench/bench_csharp_native_aot.yaml | 4 +- bench/bench_csharp_preview.yaml | 124 +++++++++++++++-------------- 6 files changed, 81 insertions(+), 69 deletions(-) diff --git a/.github/dotnet.sh b/.github/dotnet.sh index 086a0e1fd..1d4a6e191 100755 --- a/.github/dotnet.sh +++ b/.github/dotnet.sh @@ -3,4 +3,4 @@ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc sudo apt-add-repository https://packages.microsoft.com/ubuntu/22.04/prod sudo apt-get update -sudo apt-get install -y libmsquic zlib1g-dev +sudo apt-get install -y libmsquic zlib1g-dev clang diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 83e12e62f..33c11d9e1 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -25,6 +25,8 @@ jobs: codon, cpp, csharp, + csharp_preview, + csharp_native_aot, crystal, d, dart, diff --git a/README.md b/README.md index 7fee271e2..2c1de20b0 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ _Current benchmarks problems and their implementations are from [The Computer La [podman](https://podman.io/getting-started/installation) (or [docker](https://www.docker.com/) by changing `docker_cmd: podman` to `docker_cmd: docker` in `bench/bench.yaml`) +unzip + ## Build _The 1st step is to build source code from various of lanuages_ @@ -72,9 +74,9 @@ _The 1st step is to build source code from various of lanuages_ ```bash cd bench # To build a subset -dotnet run -p tool -- --task build --langs lisp go --problems nbody helloworld --force-rebuild +dotnet run --project tool -- --task build --langs lisp go --problems nbody helloworld --force-rebuild # To build all -dotnet run -p tool -- --task build +dotnet run --project tool -- --task build ``` ## Test @@ -84,9 +86,9 @@ _The 2nd step is to test built binaries to ensure the correctness of their imple ```bash cd bench # To test a subset -dotnet run -p tool -- --task test --langs lisp go --problems nbody helloworld +dotnet run --project tool -- --task test --langs lisp go --problems nbody helloworld # To test all -dotnet run -p tool -- --task test +dotnet run --project tool -- --task test ``` ## Bench @@ -96,16 +98,16 @@ _The 3rd step is to generate benchmarks_ ```bash cd bench # To bench a subset -dotnet run -p tool -- --task bench --langs lisp go --problems nbody helloworld +dotnet run --project tool -- --task bench --langs lisp go --problems nbody helloworld # To bench all -dotnet run -p tool -- --task bench +dotnet run --project tool -- --task bench ``` _For usage_ ```bash cd bench -dotnet run -p tool -- -h +dotnet run --project tool -- -h BenchTool Main function diff --git a/bench/bench_csharp.yaml b/bench/bench_csharp.yaml index 7a20ebbee..e675b9937 100644 --- a/bench/bench_csharp.yaml +++ b/bench/bench_csharp.yaml @@ -35,7 +35,9 @@ problems: - name: regex-redux source: - 5.cs + - 5-m.cs - 6.cs + - 6-m.cs - name: mandelbrot source: - 1.cs diff --git a/bench/bench_csharp_native_aot.yaml b/bench/bench_csharp_native_aot.yaml index f0a73cb7f..db9ea1e12 100644 --- a/bench/bench_csharp_native_aot.yaml +++ b/bench/bench_csharp_native_aot.yaml @@ -1,4 +1,4 @@ -lang: csharp +lang: csharp_native_aot problems: - name: helloworld source: @@ -34,7 +34,9 @@ problems: - name: regex-redux source: - 5.cs + - 5-m.cs - 6.cs + - 6-m.cs - name: mandelbrot source: - 1.cs diff --git a/bench/bench_csharp_preview.yaml b/bench/bench_csharp_preview.yaml index a75a858e7..b0804bdf2 100644 --- a/bench/bench_csharp_preview.yaml +++ b/bench/bench_csharp_preview.yaml @@ -1,68 +1,72 @@ -lang: csharp -enabled: false +lang: csharp_preview problems: - # - name: helloworld - # source: - # - 1.cs - # - name: binarytrees - # source: - # - 1.cs - # - name: merkletrees - # source: - # - 1.cs - # - 2.cs - # - name: nbody - # source: - # - 8.cs - # - 9.cs - # - name: spectral-norm - # source: - # - 3.cs - # - name: pidigits - # source: - # - 1.cs - # - name: edigits - # source: - # - 1.cs - # - name: fannkuch-redux - # source: - # # - 9.cs - # - name: fasta - # source: - # - 5.cs - # - name: knucleotide - # source: - # - 6.cs + - name: helloworld + source: + - 1.cs + - name: binarytrees + source: + - 1.cs + - name: merkletrees + source: + - 1.cs + - 2.cs + - name: nbody + source: + - 8.cs + - 9.cs + - name: spectral-norm + source: + - 3.cs + - name: pidigits + source: + - 1.cs + - name: edigits + source: + - 1.cs + - name: fannkuch-redux + source: + # - 9.cs + - name: fasta + source: + - 5.cs + - name: knucleotide + source: + - 6.cs - name: regex-redux source: - 5.cs - # - 5p.cs - # - name: mandelbrot - # source: - # - 1.cs - # - 2.cs - # - 3.cs - # - name: json-serde - # source: - # - 1.cs - # - 2.cs - # - name: coro-prime-sieve - # source: - # - 1.cs + - 5-m.cs + - 6.cs + - 6-m.cs + - name: mandelbrot + source: + - 1.cs + - 2.cs + - 3.cs + - name: json-serde + source: + - 1.cs + - 2.cs + - name: coro-prime-sieve + source: + - 1.cs - name: http-server source: + - 1.cs + - 2.cs + - 2-http2.cs - 2-http3.cs - # - name: nsieve - # source: - # - 1.cs - # - 2.cs - # - name: lru - # source: - # - 1.cs - # - 2.cs - # - name: secp256k1 - # source: - # - 1.cs + - name: nsieve + source: + - 1.cs + - 2.cs + - name: lru + source: + - 1.cs + - 2.cs + - name: secp256k1 + source: + - 1.cs compiler_version_command: compiler_version_regex: runtime_version_parameter: @@ -73,10 +77,10 @@ environments: compiler: dotnet version: 7 compiler_version_command: dotnet --version - docker: mcr.microsoft.com/dotnet/sdk:7.0 + docker: mcr.microsoft.com/dotnet/sdk:8.0-preview # docker_volumns: # - /tmp/.nuget/packages:/root/.nuget/packages include: dotnet_preview - build: dotnet publish -c Release -r linux-x64 -f net7 --self-contained true -p:PublishSingleFile=true -o out # -p:PublishReadyToRun=true + build: dotnet publish -c Release -r linux-x64 -f net8 --self-contained true -p:PublishSingleFile=true -o out # -p:PublishReadyToRun=true out_dir: out run_cmd: app From 9ff3601b5fb5ea259b203ac6efbd644ffa61c1d1 Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Thu, 21 Sep 2023 17:54:36 -0600 Subject: [PATCH 2/2] update --- bench/bench_csharp_preview.yaml | 2 +- .../Linux/procfs/Interop.ProcFsStat.TryReadStatusFile.cs | 2 +- bench/tool/Linux/procfs/Interop.ProcFsStat.cs | 2 +- bench/tool/ProcessUtils.cs | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bench/bench_csharp_preview.yaml b/bench/bench_csharp_preview.yaml index b0804bdf2..62cbfda2b 100644 --- a/bench/bench_csharp_preview.yaml +++ b/bench/bench_csharp_preview.yaml @@ -77,7 +77,7 @@ environments: compiler: dotnet version: 7 compiler_version_command: dotnet --version - docker: mcr.microsoft.com/dotnet/sdk:8.0-preview + docker: mcr.microsoft.com/dotnet/sdk:8.0 # docker_volumns: # - /tmp/.nuget/packages:/root/.nuget/packages include: dotnet_preview diff --git a/bench/tool/Linux/procfs/Interop.ProcFsStat.TryReadStatusFile.cs b/bench/tool/Linux/procfs/Interop.ProcFsStat.TryReadStatusFile.cs index 31665444b..566bcac13 100644 --- a/bench/tool/Linux/procfs/Interop.ProcFsStat.TryReadStatusFile.cs +++ b/bench/tool/Linux/procfs/Interop.ProcFsStat.TryReadStatusFile.cs @@ -14,7 +14,7 @@ internal static partial class Interop { - internal static partial class procfs + internal static partial class ProcFs { internal const string RootPath = "/proc/"; private const string StatusFileName = "/status"; diff --git a/bench/tool/Linux/procfs/Interop.ProcFsStat.cs b/bench/tool/Linux/procfs/Interop.ProcFsStat.cs index efa96a3e0..a5b2d06ea 100644 --- a/bench/tool/Linux/procfs/Interop.ProcFsStat.cs +++ b/bench/tool/Linux/procfs/Interop.ProcFsStat.cs @@ -13,7 +13,7 @@ internal static partial class Interop { - internal static partial class procfs + internal static partial class ProcFs { private const string ExeFileName = "/exe"; private const string CmdLineFileName = "/cmdline"; diff --git a/bench/tool/ProcessUtils.cs b/bench/tool/ProcessUtils.cs index ab3371257..be4216032 100644 --- a/bench/tool/ProcessUtils.cs +++ b/bench/tool/ProcessUtils.cs @@ -215,12 +215,12 @@ private static async Task> GetImmediateChildProcessIdsLinuxAsy long totalMemoryBytes = 0; if (s_isLinux) { - if (procfs.TryReadStatFile(pid, out procfs.ParsedStat stat)) + if (ProcFs.TryReadStatFile(pid, out ProcFs.ParsedStat stat)) { m.CpuTimeUser = TicksToTimeSpanLinux(stat.utime + stat.cutime); m.CpuTimeKernel = TicksToTimeSpanLinux(stat.stime + stat.cstime); isChildProcessCpuTimeCounted = stat.cutime > 0 || stat.cstime > 0; - if (procfs.TryReadStatusFile(pid, out procfs.ParsedStatus status)) + if (ProcFs.TryReadStatusFile(pid, out ProcFs.ParsedStatus status)) { totalMemoryBytes = (long)status.VmRSS; } @@ -276,14 +276,14 @@ private static async Task> GetImmediateChildProcessIdsLinuxAsy m.CpuTimeKernel += cp.PrivilegedProcessorTime; totalMemoryBytes += cp.WorkingSet64; } - else if (procfs.TryReadStatFile(cp.Id, out procfs.ParsedStat cpstat)) + else if (ProcFs.TryReadStatFile(cp.Id, out ProcFs.ParsedStat cpstat)) { if (!isChildProcessCpuTimeCounted) { m.CpuTimeUser += TicksToTimeSpanLinux(cpstat.utime); m.CpuTimeKernel += TicksToTimeSpanLinux(cpstat.stime); } - if (procfs.TryReadStatusFile(cp.Id, out procfs.ParsedStatus cpstatus)) + if (ProcFs.TryReadStatusFile(cp.Id, out ProcFs.ParsedStatus cpstatus)) { totalMemoryBytes += (long)cpstatus.VmRSS; }