Open tobiasko opened 1 month 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]
https://code.visualstudio.com/docs/csharp/package-management
https://learn.microsoft.com/en-us/nuget/consume-packages/install-use-packages-nuget-cli
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.
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]
To reproduce this in the .NET Docker SDK containers:
Run with either:
docker run --platform linux/amd64 --rm -it mcr.microsoft.com/dotnet/sdk:8.0
docker run --platform linux/arm64 --rm -it mcr.microsoft.com/dotnet/sdk:8.0
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.
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?
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
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.
dotnet publish -a x64 --os osx
generates a BLOB that runs on a ✅net8.0/osx-arm64 computer.
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()
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
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
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
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
To make the mac executable rawrr
run without signature (we could also look into buying these in the future) we should run
xattr -d com.apple.quarantine /path/to/binary
before trying the executable to remove the quarantine attribute and make it runnable.
It looks like the mono project is coming to its end and will be replaced by .NET core
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.