fgcz / rawrr

Access Orbitrap data in R lang using C# mono assembly - bioconductor package
https://bioconductor.org/packages/rawrr/
54 stars 9 forks source link

end of mono #75

Open tobiasko opened 4 weeks ago

tobiasko commented 4 weeks ago

It looks like the mono project is coming to its end and will be replaced by .NET core

The [Mono Project (mono/mono)](https://github.com/mono/mono) (‘original mono’) has been an important part of the .NET ecosystem since it was launched in 2001. Microsoft became the steward of the Mono Project when it acquired Xamarin in 2016.

The last major release of the Mono Project was in July 2019, with minor patch releases since that time. The last patch release was February 2024.

We are happy to announce that the WineHQ organization will be taking over as the stewards of the Mono Project upstream at [wine-mono / Mono · GitLab (winehq.org)](https://gitlab.winehq.org/wine-mono/mono). Source code in existing [mono/mono](https://github.com/mono/mono) and other repos will remain available, although repos may be archived. Binaries will remain available for up to four years.

Microsoft maintains a modern fork of [Mono runtime in the dotnet/runtime repo](https://github.com/dotnet/runtime/tree/main/src/mono) and has been progressively moving workloads to that fork. That work is now complete, and we recommend that active Mono users and maintainers of Mono-based app frameworks migrate to [.NET](https://github.com/dotnet/core) which includes work from this fork.

We want to recognize that the Mono Project was the first .NET implementation on Android, iOS, Linux, and other operating systems. The Mono Project was a trailblazer for the .NET platform across many operating systems. It helped make cross-platform .NET a reality and enabled .NET in many new places and we appreciate the work of those who came before us.

Thank you to all the Mono developers!

Looking at https://github.com/thermofisherlsms/RawFileReader/tree/main/Libs/NetCore/Net8

makes me think that the CommonCore have meanwhile been tested for .NET 8.

https://dotnet.microsoft.com/en-us/download/dotnet/8.0

Maybe one should plan migrating the C# code part of rawrr to .NET 8 before it's time to say: Mono RIP.

cpanse commented 1 week ago

there seems to be an issue with net8.0/osx-arm64 https://github.com/thermofisherlsms/RawFileReader/issues/3

Libs/NetCore/Net8/Assemblies/ work on: ✅net8.0/osx-x64 and
net8.0/linux-x64

when building on net8.0/osx-arm64:

CSC : warning CS8012: Referenced assembly 'ThermoFisher.CommonCore.RawFileReader, Version=8.0.6.0, Culture=neutral, PublicKeyToken=1aef06afb5abd953' targets a different processor. [/Users/cp/Downloads/rawrrassembly/rawrr.csproj]
cpanse commented 4 days ago

Docu

Adding the source

cp@xerxes:~/src/github/thermofisherlsms/RawFileReader/ExampleProgram/NetCore/ > dotnet nuget add source /Users/cp/src/github/thermofisherlsms/RawFileReader/Libs/NetCore/Net8/
Package source with Name: Package source 1 added successfully.

Publish the example code

this steps fail on arm64 while working on x64 arch

cp@xerxes:~/src/github/thermofisherlsms/RawFileReader/ExampleProgram/NetCore/ > dotnet publish -a arm64
  Determining projects to restore...
  Restored /Users/cp/src/github/thermofisherlsms/RawFileReader/ExampleProgram/NetCore/RawFileReaderExample.csproj (in 148 ms).
CSC : warning CS8012: Referenced assembly 'ThermoFisher.CommonCore.MassPrecisionEstimator, Version=8.0.6.0, Culture=neutral, PublicKeyToken=1aef06afb5abd953' targets a different processor. [
/Users/cp/src/github/thermofisherlsms/RawFileReader/ExampleProgram/NetCore/RawFileReaderExample.csproj]
CSC : warning CS8012: Referenced assembly 'ThermoFisher.CommonCore.RawFileReader, Version=8.0.6.0, Culture=neutral, PublicKeyToken=1aef06afb5abd953' targets a different processor. [/Users/cp
/src/github/thermofisherlsms/RawFileReader/ExampleProgram/NetCore/RawFileReaderExample.csproj]
leoschwarz commented 4 days ago

To reproduce this in the .NET Docker SDK containers:

Run with either:

The commands:

mkdir -p /work && cd /work
git clone --depth=1 https://github.com/thermofisherlsms/RawFileReader.git
cd RawFileReader/ExampleProgram/NetCore 
dotnet nuget add source /work/RawFileReader/Libs/NetCore/Net8/
wget https://github.com/fgcz/rawrr/blob/devel/inst/extdata/sample.raw?raw=true -O sample.raw
dotnet run sample.raw

It passes with the amd64 contanier, but fails with arm64.

tobiasko commented 4 days ago

For my understanding: You can't even compile Jims example code on apple silicon? On all other platforms it works? Even on macOS with an intel processor?

cpanse commented 4 days ago

For my understanding: You can't even compile Jims example code on apple silicon? On all other platforms it works? Even on macOS with an intel processor?

correct

leoschwarz commented 3 days ago

The reason it worked with mono but not dotnet core is that mono does not support macOS ARM and runs in x86_64 emulation mode always. For dotnet core we tried to build native binaries which does not work as we saw, as currently the libraries are only available for x86_64.

cpanse commented 2 days ago

dotnet publish -a x64 --os osx generates a BLOB that runs on a ✅net8.0/osx-arm64 computer.

cpanse commented 2 days ago
install.packages("https://fgcz-ms.uzh.ch/~cpanse/rawrr/rawrr_1.15.1.tar.gz")
library(rawrr)

## make rawrr use a dotnet generates a BLOB
RAWRRDOTNET <<- "Have Fun"

rawrr::installRawrrExe()

rawrr::sampleFilePath() |> readFileHeader()
rawrr::sampleFilePath() |> readIndex() |> tail()
rawrr::sampleFilePath() |> readSpectrum(1) |> tail()
cpanse commented 2 days ago

rbenchmark

Apple M3 Max macOS Sequoia

                   test replications elapsed relative user.self sys.self
6 dotnet-readFileHeader           10  33.454    3.323     0.010    0.010
4      dotnet-readIndex           10  49.946    4.961     0.388    0.626
5   dotnet-readSpectrum           10  13.672    1.358     2.114    0.065
3   mono-readFileHeader           10  10.067    1.000     0.011    0.015
1        mono-readIndex           10  22.726    2.257     0.383    0.586
2     mono-readSpectrum           10  13.203    1.312     2.020    0.070

AMD EPYC 7742 64-Core Processor - SMP Debian 5.10.209-2

                   test replications elapsed relative user.self sys.self
6 dotnet-readFileHeader           10  51.181    4.125     0.052    0.021
4      dotnet-readIndex           10  79.742    6.426     1.647    0.959
5   dotnet-readSpectrum           10  23.508    1.894     4.688    0.526
3   mono-readFileHeader           10  12.409    1.000     0.057    0.018
1        mono-readIndex           10  39.640    3.194     1.454    0.792
2     mono-readSpectrum           10  22.604    1.822     5.809    0.404

11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz - SMP PREEMPT_DYNAMIC Debian 6.11.2-1

                   test replications elapsed relative user.self sys.self
6 dotnet-readFileHeader           10  28.116    6.208     0.017    0.011
4      dotnet-readIndex           10  39.203    8.656     0.761    0.481
5   dotnet-readSpectrum           10  11.096    2.450     2.891    0.013
3   mono-readFileHeader           10   4.529    1.000     0.027    0.000
1        mono-readIndex           10  16.766    3.702     0.464    0.223
2     mono-readSpectrum           10   8.866    1.958     2.526    0.049

benchmark code snippet

library(ExperimentHub)
eh <- ExperimentHub::ExperimentHub()
EH4547 <- normalizePath(eh[["EH4547"]])

(rawfile <- paste0(EH4547, ".raw"))
if (!file.exists(rawfile)){
  file.copy(EH4547, rawfile)
}

(rawfile -> f)

install.packages("https://fgcz-ms.uzh.ch/~cpanse/rawrr/rawrr_1.15.1.tar.gz")
library(rawrr)
RAWRRDOTNET <<- "Have Fun"

library(rbenchmark)

message("Starting the benchmark ...")

start.time <- Sys.time()

benchmark("mono-readIndex" = {
            if (exists('RAWRRDOTNET')) { rm (RAWRRDOTNET) }
            rawrr::readIndex(f) -> idx.mono
          },
          "mono-readSpectrum" = {
            if (exists('RAWRRDOTNET')) { rm (RAWRRDOTNET) }
            rawrr::readSpectrum(f, 1:1000) -> spectra.mono
          },
          "mono-readFileHeader" = {
            if (exists('RAWRRDOTNET')) { rm (RAWRRDOTNET) }
            rawrr::readFileHeader(f) -> header.mono
          },
          "dotnet-readIndex" = {
            RAWRRDOTNET <- "FUN"
            rawrr::readIndex(f) -> idx.dotnet
          },
          "dotnet-readSpectrum" = {
            RAWRRDOTNET <- "FUN"
            rawrr::readSpectrum(f, 1:1000) -> spectra.dotnet
          },
          "dotnet-readFileHeader" = {
            RAWRRDOTNET <- "FUN"
            rawrr::readFileHeader(f) -> header.dotnet
          },
          replications = 10,
          columns = c("test", "replications", "elapsed",
                      "relative", "user.self", "sys.self")) -> rv