Results 1 to 4 of 4

Thread: UMACH not working anymore?

  1. #1
    Junior Member
    Join Date
    Mar 2006

    UMACH not working anymore?


    I've been using IMSL since 2002 with the Compaq Fortran compiler. I recently purchased the Intel 11.1 compiler bundled with IMSL. I managed to recompiled my code, but the UMACH() function doesn't seem to work anymore.
    I use to redirect the cluster analysis into a UNIT=12 Fortran file, BUT setting UMACH(-2,12) doesn't seem to do this anymore. THis use to work fine. What's strange is that the IMSL output decides to open its own fort.12 file, even though a file opened with UNIT=12 already exists. Here's part of the code below. What is wrong?

    !C Open file for subsequent output for later
    END IF
    #ifdef MYIMSL
    CALL UMACH(-2,12) ! redirect IMSL output into cluster.txt file... !IMSL
    write(12,*) ' '
    write(12,*)'************************************** **************************************'
    write(12,*)'>>>>>>>>>>>>>>>>>>>>>>>> START OF CLUSTER ANALYSIS <<<<<<<<<<<<<<<<<<<<<<<<<'
    write(12,*)'************************************** **************************************'
    write(12,*) ' '

  2. #2
    Senior Member mecej4's Avatar
    Join Date
    Dec 2009

    Re: UMACH not working?

    The version of IMSL that accompanied CVF provided only static libraries. Current versions of IMSL provide both static and dynamic libraries.

    You are probably running into the problems that you described because you are using (by choice or by default, depending on your setup) the DLL libraries. The associations between Fortran I/O unit numbers and files are not shared between your code and the IMSL DLLs.

    The simplest solution is to choose to use the static libraries, by using %LINK_FNL_STATIC% or %LINK_F90_STATIC% in the compiler invocation. If that is not acceptable, you need to figure out a way of making the IMSL DLLs associate unit-12 with the desired file, CLUSTER.TXT.

    Alternatively, use the -Qopenmp option with the Intel Fortran compiler

    For the reasons that I gave above, the following example code from the FNL-6 HTML documentation for UMACH does not work as described in the writeup if the DLL version of the library is used, unless the -Qopenmp option is given to the compiler.

          USE AMACH_INT
          USE UMACH_INT
          INTEGER     N, NUNIT
          REAL        X
    !                                      Set Parameter
          N = 0
          NUNIT = 9
          CALL UMACH (-3, NUNIT)
          X = AMACH(N)
    The result of running this code without the -Qopenmp option is two files: a zero-length file called CHECKERR and another file called FORT.9 that contains the output of the UMACH call.

  3. #3
    Junior Member
    Join Date
    Mar 2006

    UMACH static linking in MS VS2008?

    " by using %LINK_FNL_STATIC% or %LINK_F90_STATIC% in the compiler invocation"

    Okay, so how do I statically link IMSL libraries in MS VS2008?

  4. #4
    Senior Member
    Join Date
    Sep 2005
    There are a number of different ways of picking up the IMSL library at link time. Also, the location of the library file(s) is dependent on the environment you are on, as well as the compiler, and possibly the IMSL version. So you should look at the readme files in the notes directory and read the section on using it with Visual Studio. Also keep in mind that the version you have was likely done under Visual Studio 2005, not 2008, if so, you could possibly have compatibility problems.

    The easiest way to pick it up is to There are several ways to pick up the IMSL.lib file. Add it to your Solution explorer, add it as an Additional Dependency in the property menu, but perhaps the easiest is to use the supplied include files:

    include 'link_fnl_static.h'

    again, this is dependent on the IMSL version you have, some early versions did not have these. The shared syntax is: include 'link_fnl_shared.h'. If you do it this way you need to be aware of a couple of things:

    1. You have to add the directory that contains the .h file to the Project Property page, "Additional Include Directories". This is the way an IDE project picks up include files, the same as C++. And probably more important, linking statically requires that you add several more library files (many of them related to the license manager) to the project. For this reason, linking to the DLL version of the library is generally much easier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts