Skip to content

Commit

Permalink
clang option; min gcc version
Browse files Browse the repository at this point in the history
  • Loading branch information
hokru committed Jun 17, 2018
1 parent 4366d8e commit 3d075e0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions INSTALL
@@ -1,6 +1,7 @@
REQUIREMENTS:
- Fortran 2008 compiler: gfortran (4.8,4.9, 6.3 tested) or ifort (V.15 tested)
- BLAS+LAPACK library
- gcc >=4.6 needed

modify the user settings for the Makefile.
Best support is for gfortran.
Expand Down
24 changes: 17 additions & 7 deletions Makefile
Expand Up @@ -23,6 +23,7 @@ PROG = ~/bin/xopt
USE_GNU=yes
#USE_PGI=no
#USE_INTEL=yes
#USE_CLANG=yes

# static/dynamic
DO_STATIC=yes
Expand All @@ -32,18 +33,17 @@ DO_STATIC=yes
FFLAGS= -O2

## set BLAS/LAPCK paths for optimized libraries
OPENBLAS = /usr/qc/OpenBLAS/
BLASLIB = -L$(OPENBLAS) -lopenblas -lpthread
OPENBLAS = /usr/qc/OpenBLAS.0.3_AVX/lib
MKLROOT = ${HOME}/miniconda3/

# MKLROOT = ${HOME}/miniconda3/
# BLASLIB = -L${MKLROOT}/lib/ -Wl,--no-as-needed -lmkl_rt -lpthread -lm -ldl # for 'new' single-dynamic MKL
# BLASLIB = -mkl=parallel # for ifort

### examples ###
# BLASLIB = -L${MKLROOT}/lib/ -Wl,--no-as-needed -lmkl_rt -lpthread -lm -ldl # for 'new' single-dynamic MKL
# BLASLIB = -L/local/intel_mkl -<see intel link advisor> # MKL explicit
# BLASLIB = /local/openblas_lib/lib/ -lopenblas # OpenBLAS (may need -lpthread)
BLASLIB = -L${OPENBLAS}/ -lopenblas -lpthread # OpenBLAS (may need -lpthread)
# BLASLIB = -L/usr/lib64 -llapack -lblas # native blas
# BLASLIB = -mkl=parallel # for ifort
# BLASLIB = -L$(OPENBLAS) -lopenblas -lpthread -lm -ldl -lgfortran # clang+openblas may need explicit linking

### EXTRALIBS (dftd3,gcp,lbfgs)
# set to "yes" after building them.
Expand Down Expand Up @@ -132,7 +132,7 @@ endif

##### GFORTRAN #########
ifeq ($(USE_GNU),yes)
FC = gfortran
FC = gfortran
DFLAGS+= -DGNU
FFLAGS+= -J$(MOD) -ffree-line-length-none
LIBS+= $(BLASLIB)
Expand All @@ -141,6 +141,16 @@ LIBS+= $(BLASLIB)
endif
endif

##### CLANG #########
ifeq ($(USE_CLANG),yes)
FC = clang
DFLAGS+= -DCLANG
FFLAGS+= -J$(MOD) -ffree-line-length-none
LIBS+= $(BLASLIB)
ifeq ($(DO_STATIC),yes)
FC+= -static
endif
endif

##### PGI FORTRAN #############
# PLEASE ADAPT THIS YOURSELF
Expand Down
16 changes: 15 additions & 1 deletion src/modules.F90
Expand Up @@ -3,7 +3,6 @@ module fiso
#ifdef GNU
use, intrinsic :: iso_fortran_env, only : &
stdin=> input_unit, stdout=>output_unit,stderr=>error_unit, & ! I/O units, replaces non-def 0,5,6
! r8=> REAL64, r4=>REAL32
i8=>INT64,i4=>INT32 , &
compiler_version ! nerdy info
! IEEE 754
Expand All @@ -12,6 +11,21 @@ module fiso
integer, parameter :: qp = SELECTED_REAL_KIND(33,4931)

integer, parameter :: io_debug=1111
#elif GNU_LEGACY # 4.5
integer, parameter :: r4 = SELECTED_REAL_KIND(6,37)
integer, parameter :: r8 = SELECTED_REAL_KIND(15,307)
integer, parameter :: qp = SELECTED_REAL_KIND(33,4931)
integer, parameter :: io_debug=1111
integer, parameter :: i4 = selected_int_kind(4)
integer, parameter :: i8 = selected_int_kind(8)
integer, parameter :: stdin =0
integer, parameter :: stdout =6
integer, parameter :: stderr= 5
contains
character(7) function compiler_version()
implicit none
compiler_version='legacy gnu'
end function
#else
! for cases that do not have yet compiler_version like ifort 15
use, intrinsic :: iso_fortran_env, only : &
Expand Down

0 comments on commit 3d075e0

Please sign in to comment.