Friday, April 21, 2017

compiling fortran with lapack and blas and openmp using Absoft compiler for windows

I download a testing version of Absoft Pro Fortran 2017. I install the compiler and the libraries. Then  I compile using "Development Command Prompt (64 bit)".

I could not easily find how to link to Lapack and Blas provided by the installer. The right options after studying the examples are

Y:\save\progs\parallel_inverse>f95 -openmp -O3 -s -deploy-dlls -m64 -mcmodel=medium pGDsingle.F90 refblas.lib reflapack.lib

The option -s uses the heap (and not the stack) but it is unclear to me if this handles memory in the most efficient way. Alternatively, I can use something like  -stack:500000000 to increase the stack. See here.

The option -openmp reads openmp directives.

The option -deploy-dlls puts the right dll's in the same place as the executable.

The option -m64 tell the compiler to create a 64 bit executable and

-mcmodel=medium to store using 64 bit adresses (both are needed), so that the memory used can be quite large

 It works well:

Y:\save\progs\parallel_inverse>pGDsingle.exe
 nanim,nsnpp
5000 50000
   5000  50000
 Z=rnd()
 y=Z(Z'x)
     LAPACK MKL dgemv #threads=    2    2 Elapsed omp_get_time:     0.3580
     LAPACK MKL dgemv #threads=    2    2 Elapsed omp_get_time:     0.5620
 meanG=   12501.1274661639
 GG=ZZ'
    Dgemm MKL #threads=     2    2 Elapsed omp_get_time:  5463.3270
 meanG=   12501.1274661626
 GG=GG/(tr/n)
 GG=0.95GG+0.05I
 GG^-1
    Inverse LAPACK MKL dpotrf/i #threads=    2    2 Elapsed omp_get_time:  1045.0340