I'm having the following problem:
I've changed my application to process some statistics using multi-thread. But when I use the iCChecker it says that I'm only using one core.
I copied a part of the source code of my software. As you can see, I'm using multi-thread.
Dim thread_PopulateSaldoHeader As New System.Threading.Thread(AddressOf PopulateSaldoHeader)
Dim thread_PopulateVendasHeader As New System.Threading.Thread(AddressOf PopulateVendasHeader)
Dim thread_LoadMyCustomers As New System.Threading.Thread(AddressOf LoadMyCustomers)
Dim thread_LoadRecebimentos As New System.Threading.Thread(AddressOf LoadRecebimentos)
Dim thread_MeusRecebimentos As New System.Threading.Thread(AddressOf MeusRecebimentos)
Dim thread_LoadPagamentos As New System.Threading.Thread(AddressOf LoadPagamentos)
Dim thread_PopulateMyForCast As New System.Threading.Thread(AddressOf PopulateMyForCast)
Dim thread_PopulateForCastGeral As New System.Threading.Thread(AddressOf PopulateForCastGeral)
Perhaps what is happening is:
This processing occurs in an assembly, not in the executable (that the ichecker is scanning). I'm thinking that the problem is that the iCChecker doesn't "look" at what is happening to the DLL (assembly) (where the multi-thread occurs).
Does that make any sense? How can I fix it?
Is this code in Java? What command line are you using to launch iCChecker with your application? (Could the iCChecker be measuring the JVM or runtime system, which is not threaded, rather than your application?) How long does the application take when running without the checker? Does your system have more than one core?
Two things come to mind. First, the threaded code you have in your application isn't getting executed while the checker is monitoring the system. iCChecker doesn't look into the libraries you are using, it monitors the process you start and watches the resources that are used by that process.If the monitoring stops before the portion of your code that is threaded begins to execute, then you will not see any concurrency.
Second, your threaded tasks are so fast that the overhead for setting up the threads/tasks overshadows the execution time for any of the spawned threads.
Try writing a very simple application with the same libraries you use in your current application. Spawn 4 to 8 threads that executes a simple task like counting the factors (found by brute force testing of eachpossible divisor)of integers across a large range, say 100 million to 200 million. Anything that takes 30-60 seconds to execute should work. (Try running the code in serial to see how long it would take without concurrency.) Then run iCChecker against this application. If all threads are launched at the same time, there should be a significant amount of time that is running in parallel.If you don't see this, then there may be something wrong with the tool installation or maybe the DLL you are using. If the serial time and the concurrent time are the same, you are probably not using any additional cores even if there are multiple threads running.
There are some other performance issues that may be the cause, but you first need to ensure that you can get some parallel execution on your system and the parallelism can be registered with the iCChecker tool.
I confirmed with theIntel Concurrency Checkerengineers that there are noextra stepsneeded with a Visual Basic .NET* application. You should just point it to your main process, and it will see all the CPU usage for all the threads, no matter what libraries it is using.
I also got a couple more suggestions:
1) It's important that the Concurrency Checker take the measurements during a period of time when the app is actually demonstrating concurrency. So, make sure that the app is busy executing portions of the code that are expected to be parallel before clicking on Start in the Intel Concurrency Checker.
2) Concurrency Checker takes measurements during a 30-second period of time, so you need to have the app continuing to execute parallel code for that entire 30-second period. If the app doesnt normally continue to execute parallel code for at least 30 seconds, another option is to shorten the time of the assessment, as follows:To change the length of the assessment time, you must edit the file iCChecker\bin\config\config.dat (using an application such as Notepad) and replace the "30" in the line "DURATION_SECS = 30" with the number of seconds you would like to use instead.
So please take those steps to make sure the Intel Concurrency Checker is seeing your parallelism, as well as trying the experiment that Clay suggested.
Intel Software Network Support
Intel is a registered trademark of Intel Corporation or its subsidiaries in the United States and other countries.
*Other names and brands may be claimed as the property of others.