Dear ROOT devs,
I am trying to invoke ROOT using C# threads in Windows.
The programs I wanted to execute are a set of scripts. In command line they look as below:
root.exe -l -b -q myscript_0.C
root.exe -l -b -q myscript_1.C
root.exe -l -b -q myscript_2.C
root.exe -l -b -q myscript_3.C
I want to use a C# program to start all these as separate processes using threads so that I can utilize all the CPU cores in my machine.
When i run these commands sequentially one by one, everything works fine.
But, when i use 4 threads, sometimes it works and sometimes one or two fails. The error Windows give me is “The root.exe has stopped working”.
Is this a known issue? Is there any other way to achieve the same utilization? Could you please let me know?
I am using ROOT 5.22.
why do you need to use threads? Can’t you “just” spawn these programs, i.e. use whatever corresponds to CreateProcess() in C#?
I have no idea why root would fail for some of your cases; you will need to attach the debugger (VisualStudio) and let us know. It might help to wait a bit between spawning the root.exe sub-processes.
And just so you know: the optimal way of using ROOT in parallel is by using PROOF. It’s not just optimal, it’s also dead simple: root.cern.ch/drupal/content/proo … proof-lite
Thank you for the reply.
It uses, processes in C#. I mentioned threads, because each process is created by different threads of another runtime.
I wrote two simple programs, one in C# and one in Java to invoke root.exe concurrently.
In both of them, few root processes fail once in a while.
Then, I copied the entire root directory multiple times so that I have multiple root instances in my machine. I used the same programs to call different root.exes in different directories concurrently and it works fine.
So it seems, that some locking mechanism exists which use files in root.
I cannot use PROOF, because the application should work on a Windows cluster.
Could you please help.
can you send a backtrace of where it crashes?