I have a small function in written Haskell with the following type:
foreign export ccall sget :: Ptr CInt -> CSize -> Ptr CSize -> IO (Ptr CInt)
I am calling this from multiple C++ threads running concurrently (via TBB). During this part of the execution of my program I can barely get a load average above 1.4 even though I'm running on a six-core CPU (12 logical cores). I therefore suspect that either the calls into Haskell all get funnelled through a single thread, or there is some significant synchronization going on.
I am not doing any such thing explicitly, all the function does is operate on the incoming data (after storing it into a Data.Vector.Storable), and return the result back as a newly allocated array (from Data.Marshal.Array).
Is there anything I need to do to fully enable concurrent calls like this?
I am using GHC 8.6.5 on Debian Linux (bullseye/testing), and I am compiling with -threaded -O2.
Looking forward to reading some advice,
Sebastian