Compiling and Linking Multithread Programs

To build a multithread application that uses the Fortran run-time libraries, specify the -threads (Linux* OS and Mac OS* X) or /threads (Windows* OS) 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 OS and Mac OS X:

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 OS) or libifcoremd.dylib (Mac OS X).

The following applies to Windows OS:

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 OS:

 

 

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

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

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

ifort /threads  mythread.f90 (Windows OS)

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

  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 Multithreadedor Multithread DLL(or their debug equivalents).
  6. Create the executable file by choosing Build Solution from the Build menu.