Compiling and Linking Multithread Programs

To build a multithread application that uses the Fortran run-time libraries, specify the -threads (Linux* and Mac OS*) or /threads (Windows*) compiler option from the command line. For Windows systems, you can use also use the Microsoft integrated development environment (IDE), as described later in this topic.

You must also link with the correct library files.

The following applies to Linux and Mac OS systems:

To create statically linked multithread programs, link with the static library named libifcoremt.a.  To use shared libraries, link your application with libifcoremd.so (Linux) or libifcoremd.dylib (Mac OS).

The following applies to Windows systems:

To create statically linked multithread programs, link with the re-entrant support library LIBIFCOREMT.LIB. To use shared libraries, use the shared LIBIFCOREMD.DLL library, which also re-entrant, and is referenced by linking your application with the LIBIFCOREMD.LIB import library.

Programs built with LIBIFCOREMT.LIB do not share Fortran run-time library code or data with any dynamic-link libraries they call. You must link with LIBIFCOREMD.LIB if you plan to call a DLL.

Additional Notes for Windows systems:

 

To compile and link your multithread program from the command line:

  1. Make sure  your IA32ROOT or IA64ROOT (Linux and Mac OS) or  LIB (Windows) environment variable points to the directory containing your library files.
  2. Compile and link the program with the -threads (Linux and Mac OS) or /threads (Windows) compiler option.
    For example:

ifort -threads mythread.f90 (Linux and Mac OS)

ifort /threads  mythread.f90 (Windows)

To compile and link your multithread program using the IDE (Windows):

  1. Create a new project by clicking File > New > Project.
  2. Click Intel Fortran Projects in the left pane (as shown above) to display the Intel Fortran project types. Choose the  project type.
  3. Add the file containing the source code to the project.
  4. From the Project menu, select Properties.
    The Property Pages dialog box appears.
  5. Choose the Fortran folder, Libraries category, and set the Runtime Library to Multithreaded or Multithread DLL (or their debug equivalents).
  6. Create the executable file by choosing Build Solution from the Build menu.