Monday, August 23, 2010

Testing Intel’s Parallel Studio

Part 1 – OpenMP

Intel claims to bring simplified “end-to-end parallelism to Microsoft Visual Studio C/C++ developers with Intel® Parallel Studio” [1].

I used a simple OpenMP parallel HelloWorld program to study this new tool which comes as an add-on to Visual Studio 2008.The program listing is enclosed in Figure 1.

   1:  #include <omp.h>
   2:  #include <stdio.h>
   3:  // a function to consume cpu time:
   4:  void consume() {
   5:      int i;
   6:      long n=100000000;
   7:      double s=0;
   8:      for (i=1;i<n;i++)
   9:          s+=(double)1/(double)i;
  10:  }
  11:   int main (int argc, char *argv[]) {
  12:     int th_id, nthreads=5;
  13:     omp_set_num_threads(nthreads);
  14:     #pragma omp parallel private(th_id)
  15:     {
  16:       th_id = omp_get_thread_num();
  17:       consume();
  18:       printf("Hello World from thread %d\n", th_id);
  19:       #pragma omp barrier
  20:       if ( th_id == 0 ) {
  21:         nthreads = omp_get_num_threads();
  22:         printf("There are %d threads\n",nthreads);
  23:       }
  24:     }
  25:     return 0;
  26:   }

Figure 1: A “HelloWorld” in C with OpenMP directives

After compiling the code I tested it with the Parallel Amplifier (Profiler).

My machine has two physical cores and since it uses hyper-threading it looks as if it has 4 cores. I executed the program with 4 threads. In Figure 2 a screen dump of the profiler is shown.


Figure 2: Visual Studio 2008 with Parallel Studio screen dump

Let’s zoom at lower right plot:


Figure 3: A summary plot of the CPU resources utilization

In Figure 3 we can see that there were 4 threads on 4 cores and the performance was  optimal.

I would however recommend everyone to repeat every execution several times since there is a large variability between runs and taking average  results might be a good idea.

Focusing now on the center of the Visual Studio screen, Figure 4,


Figure 4: The Intel Parallel Studio Profiler

one can see the actual profiler analysis which points to the bottleneck in the code, i.e. the function consume() in this case.

Of course there is a lot to go deeper but as a first impression Parallel Amplifier can be helpful for OpenMP applications (and TBB too). Now let’s see what about MPI.

Part 2 – MPI

Originally MPI was created for Distributed Memory systems but MPI can also be used on a single (SMP) machine, like OpenMP, by using multiple threads. I installed both MPICH2 and Microsoft HPC Pack 2008 SDK on my computer.

Both can be set inside Visual Studio [2]. MPI programs, by default, are being executed using mpiexec executable.

There is no problem to compile the code with Visual Studio and to run it from the command line, but this way Parallel Studio won’t be useful. Therefore, one must execute the program from inside Visual Studio. This is doable. One should insert the mpiexec and the number of processes, e.g. –n 4 to the right place in the project properties, see Figure 5.

imageFigure 5: Setting mpiexec and the number of tasks from inside Visual Studio.

But here is the catch: since mpiexec is already compiled, its source is not given and in addition it is not part of the built (project), Parallel Amplifier can not analyze the user program and it only “sees” the mpiexec and therefore it only reports about mpiexec cpu consumption, see Figure 6.


Figure 6: The profiler can not penetrate beyond mpiexec and dive into the user’s code.

Therefore unless mpiexec will somehow be skipped by Parallel Studio it looks that this tool can not help much to analyze MPI applications!

You are welcome to post your comments / corrections.


[1] Intel Parallel Studio home page:


Monday, August 02, 2010

Nvidia Nsight Installation Failed

I have a Windows 7 (64bits) OS with Visual Studio 2008 with SP1.
After starting  Parallel_Nsight_Host_Win64_1.0.10200 (Jul 2010) I got the following error message: “The required version of Visual Studio (2008 SP1) was not detected” – see screen capture:
I guess the problem is in the system registry of VS2008 which partly located  as a 32bit system and partly as a 64bit system and Nsight didn’t find what it expected.

 SP1 seems to be installed as can be seen in the image below:
It turned out that although SP1 is installed, it was not installed correctly.
After trying to reinstall SP1 I got the following error message:

I checked the log file:
Exe (C:\Users\telzur\AppData\Local\Temp\Microsoft Visual Studio 2008 SP1\VC_x86Runtime.exe) succeeded.[8/6/2010, 18:34:11] (IronSpigot::ExeInstallerBase::PerformAction) Log File: dd_VC_x86RuntimeMSI18CE.txt[8/6/2010, 18:34:11] (IronSpigot::ExeInstallerBase::PerformAction) Log File: dd_VC_x86RuntimeUI18CE.txt
[8/6/2010, 18:34:11] Action complete
[8/6/2010, 18:34:11] (IronSpigot::RegKeyT::Evaluate) RegKey: HKLM\SOFTWARE\Microsoft\VisualStudio\9.0 exists.
[8/6/2010, 18:34:11] Exists evaluated to true
[8/6/2010, 18:34:11] (IronSpigot::ExeInstallerBase::ExeInstallerBase) Created new ExePerformer for Exe item[8/6/2010, 18:34:11] (IronSpigot::CartmanExeInstallerBase::CartmanExeInstallerBase) Created new CartmanExePerformer for Exe item[8/6/2010, 18:34:11] (IronSpigot::CartmanExeInstaller::CartmanExeInstaller) In CartmanExeInstaller::CartmanExeInstaller[8/6/2010, 18:34:11] (IronSpigot::CompositePerformerBaseT >::PerformAction) Created new ExePerformer for Exe item
[8/6/2010, 18:34:11] (IronSpigot::CartmanExeInstallerBase::PreCreateProcess) In PreCreateProcess [8/6/2010, 18:34:11] (IronSpigot::CartmanExeInstallerBase::PreCreateProcess) m_pSetupWatcher->Connect succeeded [8/6/2010, 18:34:11] (IronSpigot::ExeInstallerBase::Launch) Launching CreateProcess with command line = VC_x64Runtime.exe /q /progress CartmanSetupExeWatcher3841249730 [8/6/2010, 18:34:12] (IronSpigot::CartmanExeInstallerBase::PostCreateProcess) PostCreateProcess succeeded [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::PerformAction) Exe log file(s) : [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::PerformAction) C:\Users\telzur\AppData\Local\Temp\dd_VC_x64RuntimeMSI18FC.txt [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::PerformAction) C:\Users\telzur\AppData\Local\Temp\dd_VC_x64RuntimeUI18FC.txt [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::PerformAction) Exe (C:\Users\telzur\AppData\Local\Temp\Microsoft Visual Studio 2008 SP1\VC_x64Runtime.exe) succeeded. [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::PerformAction) Log File: dd_VC_x64RuntimeMSI18FC.txt [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::PerformAction) Log File: dd_VC_x64RuntimeUI18FC.txt
[8/6/2010, 18:34:22] Action complete
[8/6/2010, 18:34:22] (IronSpigot::RegKeyT::Evaluate) RegKey: HKLM\SOFTWARE\Microsoft\VisualStudio\9.0 exists.
[8/6/2010, 18:34:22] Exists evaluated to true
[8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::ExeInstallerBase) Created new ExePerformer for Exe item[8/6/2010, 18:34:22] (IronSpigot::CartmanExeInstallerBase::CartmanExeInstallerBase) Created new CartmanExePerformer for Exe item[8/6/2010, 18:34:22] (IronSpigot::CartmanExeInstaller::CartmanExeInstaller) In CartmanExeInstaller::CartmanExeInstaller[8/6/2010, 18:34:22] (IronSpigot::CompositePerformerBaseT >::PerformAction) Created new ExePerformer for Exe item
[8/6/2010, 18:34:22] (IronSpigot::CartmanExeInstallerBase::PreCreateProcess) In PreCreateProcess [8/6/2010, 18:34:22] (IronSpigot::CartmanExeInstallerBase::PreCreateProcess) m_pSetupWatcher->Connect succeeded [8/6/2010, 18:34:22] (IronSpigot::ExeInstallerBase::Launch) Launching CreateProcess with command line = VC_IA64Runtime.exe /q /progress CartmanSetupExeWatcher2516872804 [8/6/2010, 18:34:22] (IronSpigot::CartmanExeInstallerBase::PostCreateProcess) PostCreateProcess succeeded [8/6/2010, 18:34:31] (IronSpigot::ExeInstallerBase::PerformAction) C:\Users\telzur\AppData\Local\Temp\Microsoft Visual Studio 2008 SP1\VC_IA64Runtime.exe - Exe installer's log file/hint (%temp%\dd_VC_IA64Runtime*.txt|%temp%\..\dd_VC_IA64Runtime*.txt) does not exist or is invalid. [8/6/2010, 18:34:31] (IronSpigot::ExeInstallerBase::PerformAction) Exe (C:\Users\telzur\AppData\Local\Temp\Microsoft Visual Studio 2008 SP1\VC_IA64Runtime.exe) failed with 0x80070643 - Fatal error during installation. . [8/6/2010, 18:34:31] (IronSpigot::ExeInstallerBase::PerformAction) PerformOperation on exe returned exit code 1603 (translates to HRESULT = 0x80070643)
[8/6/2010, 18:34:31] Action complete
[8/6/2010, 18:34:31] (IronSpigot::LogUtils::LogFinalResult) Final Result: Installation failed with error code: (0x80070643), Fatal error during installation.

Then I searched the internet for similar error reports. Thanks to this post from Pieter's Blog I decided to follow his advice and to uninstall VS2008 Remote Debugger, then I reinstalled SP1 and this time with success!
This allowed me to finally install Nvidia Nsight: