Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure FSI to use gcServer #5502

Closed
cartermp opened this issue Aug 14, 2018 · 7 comments
Closed

Configure FSI to use gcServer #5502

cartermp opened this issue Aug 14, 2018 · 7 comments
Labels
Area-FSI Area-VS-FSI VS window and commands for F# Interactive Feature Request
Milestone

Comments

@cartermp
Copy link
Contributor

Inspired by #5381

In some situations gcServer may result in much more throughput for large sets of data being executed in FSI. This should be configurable in settings independently of an IDE, but should also have an option in VS.

@cartermp cartermp added Feature Request Area-FSI Area-VS-FSI VS window and commands for F# Interactive labels Aug 14, 2018
@nhirschey
Copy link
Contributor

nhirschey commented Aug 14, 2018

For context adding illustration of GC consequences when transforming a 30 gigabyte file on disk into an array of records, showing the ~linear speedup on an 18 core cpu.

   let getRecords samplePeriod = 
        sasFile.Observations // SAS file loaded via type provider
        |> Seq.toArray
        |> Array.Parallel.choose(fun obs ->
            match inSamplePeriod samplePeriod obs with
            | true -> Some (parseSas obs) // converts SAS file row to record type
            | false -> None)
 
    GC.Collect()
    // Timings based on running below line
    let x = getRecords samplePeriod

@cartermp cartermp added this to the Unknown milestone Aug 25, 2018
@dsyme
Copy link
Contributor

dsyme commented Jun 23, 2020

I'm going over open FSI issues.

So the conclusion here was that we decided not to take the change in #5381, and we are using this issue to track the work that is necessary?

Also, is the situation here the same with .NET Core?

@cartermp
Copy link
Contributor Author

Yeah this one's for @KevinRansom to think a little more about

@KevinRansom
Copy link
Member

I'm not sure what the situation is with gcServer and DotNETCore it's going to require some research.

@nhirschey
Copy link
Contributor

Thanks for checking in on this. It is still an issue in .NET Core and it has an enormous impact on PSeq and Array.Parallel data processing performance.

  1. Currently, .NET Core fsi is still only distributed with workstation GC. To allow gcServer on .NET Core fsi the fsi.runtimeconfig.json (windows) or dotnet.runtimeconfig.json (mac/Linux) file needs to be edited. More details here.

  2. On a related multi-core fsi note, I noticed that at least on windows the .NET Core fsi is restricted to 1 CPU group, which limits fsi on dual processor and > 64 virtual core CPUs. I have successfully modified fsiAnyCpu.exe.config to use all CPUs inside Visual Studio (enabling GCCpuGroup), but I didn't find the right runtime options to get dotnet fsi working across all CPU groups; not sure if it's possible. I think this is the proper reference.

@nhirschey
Copy link
Contributor

Here's a reproducible example using dotnet fsi from ionide, Microsoft (R) F# Interactive version 11.0.0.0 for F# 5.0.

#time 

let x = 
    [| 1.0 .. 10_000_000.0 |]
    |> Array.groupBy(fun x -> x % 100.0)

System.GC.Collect() 

// Timings are based on running this code below only

for i = 1 to 10 do
    x 
    |> Array.Parallel.map(fun (_, xs) -> 
        xs 
        |> Array.map string
        |> Array.map float
        |> Array.sum) 

// .NET Core GcServer: Real: 00:00:00.998, CPU: 00:00:49.921, GC gen0: 1, gen1: 1, gen2: 1
// .NET Core GcWorkstation: Real: 00:00:20.170, CPU: 00:02:42.296, GC gen0: 773, gen1: 273, gen2: 7

@vzarytovskii
Copy link
Member

I think we do that now:

cat /usr/local/share/dotnet/sdk/8.0.100/FSharp/*.runtimeconfig.json | grep "GC.Server"
      "System.GC.Server": true,
      "System.GC.Server": true,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-FSI Area-VS-FSI VS window and commands for F# Interactive Feature Request
Projects
Archived in project
Development

No branches or pull requests

5 participants