0

My C# program initiates a Parallel.For loop where the loop count is normally around 250. The loops contain functions which compare values against each other and add/remove values to/from Lists depending on the outcome. Some objects are also created and stored in Lists. It normally takes about 3 minutes for all loops to run.

On my 4-core Intel i7 6700K task manager shows 100% utilisation across all 8 threads. However, when I run the program on a 16-core AMD Ryzen 1950X, the utilisation only ever reaches 35%.

Both systems have 2x4GB of DDR4 2133 MHz RAM. The program uses about 800MB of RAM

What are the possible causes of the under-utilisation of the 16-core CPU?

Caustix
  • 569
  • 8
  • 26
  • 5
    Where's the program ? – Bilal Fazlani Feb 23 '18 at 15:48
  • How much of the CPU utilization on your i7 is being used by your process (not counting any OS operations, etc.)? It could have something to do with the Parallel.For only detecting your AMD processor's cores, instead of all the threads. – Kevin K. Feb 23 '18 at 15:52
  • The code is too long to post in the question, hence I summarised what kind of operations it does. It runs on Windows 10 64-bit – Caustix Feb 23 '18 at 15:52
  • On the i7 it consumes about 90% consistently, leaving the rest for other processes – Caustix Feb 23 '18 at 15:53
  • have you explicitly defined how many thread to use. using `parallelOptions.MaxDegreeOfParallelism`? – Maytham Fahmi Feb 23 '18 at 15:54
  • I haven't defined any parallelOptions. Everything is running at default. Strange thing is, another Parallel.For loop elsewhere in the program does happily use all threads, just not this specific loop – Caustix Feb 23 '18 at 15:56
  • I think I figured this problem out. I was causing the Garbage Collector to be called too frequently (I understand this runs on a single core). I rewrote the code to minimise the number of new objects being created per iteration and achieved 95-100% utilisation – Caustix Jul 10 '18 at 12:50

0 Answers0