Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

OpenMP functionality

Nicholas_C_
Beginner
1,406 Views

Hi,

I'm having trouble getting parallel processing working on Windows platforms. My software package is written in Fortran 95 and uses OpenMP directives for parallelization on SMP architectures. Compiling static binaries for deployment on Linux platforms works correctly in parallel, however on Windows it does not.

I can successfully compile a static binary without OpenMP directives, which works on other machines correctly (in serial, of course). A static binary with OpenMP runs fine in parallel on the machine where I compiled it, moving to other machines requires the runtime libraries (static OpenMP compilation has been removed from the 2013 version of the compiler http://software.intel.com/sites/default/files/article/251098/release-notes-f-2013-w-en-u3.pdf). Following this guide (http://software.intel.com/en-us/articles/redistributable-libraries-for-intel-c-and-visual-fortran-composer-xe-2013-for-windows), I have tried using both the merge module or the redistributable package on a fresh windows install (tried both Win7 and XP). In both cases, the binary runs and claims to be using multiple threads (omp_get_num_threads), however it does not execute over multiple cores like it does on the compilation machine.

Does anyone have experience with such circumstances that could help me with this one? All my Googling results in suggestions relating to old versions where static OpenMP compilation was possible....

Cheers,
Nick

0 Kudos
7 Replies
Roland_W_Intel1
Employee
1,406 Views

It sounds like you are doing everything right.  What is OMP_NUM_THREADS set to?  By default it should be the number of processors visible to the operating system.  If it's not, set it as such.

Roland

0 Kudos
Steven_L_Intel1
Employee
1,406 Views

Regarding static builds, even if you ask for the static libraries ("Multithreaded"), the OpenMP library is DLL-only.

As Roland says, the default of OpenMP is to use the number of processors as viewed by the OS. The environment variable he mentions isn't set by default, but you can set it if you want to override the default. It might be useful to see the value returned from a call to OMP_GET_NUM_THREADS. What are all the build options being used? In particular, you aren't using the OpenMP "stubs" library perhaps?

How do you know that the program isn't using all the cores? What did you use to determine that?

0 Kudos
Nicholas_C_
Beginner
1,406 Views

Thanks for the replies, Roland and Steve.

I've had another crack, using a another fresh VM with the redist packages and now it seems to be working. Perhaps it was an incorrect environment variable, I'm not sure. It's so odd, given that I'd been trying for months with fresh VM's and using the redist and merge modules...

I wasn't using the "stubs" library. The OMP_GET_NUM_THREADS call was telling me the correct number of cores were in use, however when looking at the task manager it was clear that only one core was in use (i.e. 25% processor usage on a quad-core system, etc.).

Any way, problem solved. Cheers, Nick

0 Kudos
Steven_L_Intel1
Employee
1,406 Views

It could simply be that the program was not entering parallel regions. Intel VTune Amplifier XE can show you how the program executes across the cores over time.

0 Kudos
Nicholas_C_
Beginner
1,406 Views

Dear all,

This problem is most definitely not solved. Abruptly, parallel processing has now stopped on both the compile machine and other machines with the redist packages installed. Linux and MacOS platforms seem to be unaffected. The parallel part of the code has not changed and the code still thinks it is using multiple threads.

I don't remember linking 'cycles of the moon' into my code, but this is Windows, so I might be wrong....

Anyone have any answers? I will start playing with VTune to see if this sheds any light on the situation, although I shouldn't need to as everything works fine on Linux.

Nick

0 Kudos
John_Campbell
New Contributor II
1,406 Views

Nick,

Why don't you try a simple example in the windows environment to confirm that OpenMP is being successfully implemented.
I am attaching two simple examples I have that (hopefully) confirm multiple threads are being used.
This should check if OpenMP is working in your windows environment.

John

0 Kudos
Nicholas_C_
Beginner
1,406 Views

Hi John,

Thanks for the test code - my code also does something similar, but I've run it regardless. See attached file. The VM has 8 cores and there are 8 threads used in this example...

Next step?

Cheers, Nick

 

EDIT: I just saw the second example and I can confirm that it works. I also realized I was doing something daft with the input to my own code and now I can see that it works again. This time was simply a case of user folly. Thanks for the help and sorry for crying wolf.

0 Kudos
Reply