1 2# $Id$ 3# 4 5# Common definitions for all makefiles ... these can be overridden 6# either in each makefile by putting additional definitions below the 7# include statement, or on the command line 8 9# 10# TOPDIR points to your top-level directory that contains 11# src, lib, config, ... (SRCDIR, etc., are derived from TOPDIR) 12# Do a setenv for NWCHEM_TOP to be the top level directory 13# 14# RELEASE is empty for the development branch of NWChem and is the 15# version number for releases. If RELEASE is not empty and if NWCHEM_TOP 16# does not already contain the value of RELEASE, it is appended with 17# a hyphen to NWCHEM_TOP in order to derive the directory path TOPDIR. 18 19# For development tree 20#RELEASE := 21# For current release tree 22RELEASE := 7.0.2 23 24# 25 26ifndef NWCHEM_TOP 27#error1: 28#$(info ) 29#$(info You must define NWCHEM_TOP in your environment to be the path) 30#$(info of the top level nwchem directory ... something like) 31#$(info setenv NWCHEM_TOP /msrc/home/elvis/nwchem) 32#$(info ) 33#$(error ) 34NWCHEM_TOP= $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))| \ 35 sed -e 's/\/src.*//' ) 36endif 37 38# Select the old (pre-autotools version of GA) by uncommenting the next line. 39# The value of OLD_GA does not matter -- it is detected as an ifdef only. 40#OLD_GA = y 41 42# 43# Do a setenv for NWCHEM_TARGET to be the machine and NWCHEM_TARGET_CPU the CPU to build for 44# 45# NWCHEM_TARGET : 46# CYGNUS (Windows under Cygwin tools) 47# IBM 48# LINUX NWCHEM_TARGET_CPU : 49# nothing for X86 (e.g. do not set this) 50# POWERPC for MkLinux 51# SOLARIS NWCHEM_TARGET_CPU : not defined or ULTRA 52# LAPI NWCHEM_TARGET_CPU : P2SC 53# (uses thread safe libraries and LAPI) 54# 55# 56 57ifndef NWCHEM_TARGET 58 UNAME_S := $(shell uname -s) 59 ifeq ($(UNAME_S),Linux) 60 NWCHEM_TARGET=LINUX64 61 else ifeq ($(UNAME_S),Darwin) 62 NWCHEM_TARGET=MACX64 63 else 64error2: 65$(info ) 66$(info You must define NWCHEM_TARGET in your environment to be the name) 67$(info of the machine you wish to build for ... for example) 68$(info setenv NWCHEM_TARGET SOLARIS) 69$(info Known targets are SOLARIS, ...) 70$(info See the INSTALL instructions for a complete list) 71$(error ) 72 endif 73endif 74 75ifneq ($(NWCHEM_TARGET),$(findstring $(NWCHEM_TARGET), LINUX64 LINUX MACX MACX64 CATAMOUNT CYGWIN64 CYGNUYS CYGWIN BGL BGP BGQ HPUX HPUX64 IBM IBM64 LAPI LAPI64 PURESOLARIS SOLARIS SOLARIS64 SGI_N32 SGITFP)) 76error20: 77$(info ) 78 $(info unrecognized NWCHEM_TARGET value $(NWCHEM_TARGET)) 79$(info ) 80 $(error ) 81endif 82 83 TARGET := $(NWCHEM_TARGET) 84 TOPDIR := $(NWCHEM_TOP) 85ifeq (,$(RELEASE)) 86 CODE_BRANCH := Development 87else 88 CODE_BRANCH := $(RELEASE) 89endif 90 91#dummy: 92# @echo NWCHEM_TOP=$(NWCHEM_TOP) RELEASE=$(RELEASE) TOPDIR=$(TOPDIR) 93 94 SRCDIR := $(TOPDIR)/src 95ifndef NWCHEM_TARGET_CPU 96 LIBDIR := $(TOPDIR)/lib/$(NWCHEM_TARGET) 97 BINDIR := $(TOPDIR)/bin/$(NWCHEM_TARGET) 98else 99 LIBDIR := $(TOPDIR)/lib/$(NWCHEM_TARGET)_$(NWCHEM_TARGET_CPU) 100 BINDIR := $(TOPDIR)/bin/$(NWCHEM_TARGET)_$(NWCHEM_TARGET_CPU) 101endif 102 INCDIR := $(TOPDIR)/src/include 103 CNFDIR := $(TOPDIR)/src/config 104 105 ifdef EXTERNAL_GA_PATH 106#check if ga-config is there 107 ifeq ("$(wildcard ${EXTERNAL_GA_PATH}/bin/ga-config)","") 108 $(info ) 109 $(info invalid EXTERNAL_GA_PATH) 110 $(info ga-config not found) 111 $(info ) 112 $(error ) 113 endif 114#check if f77 was enabled 115 GA_HAS_F77 = $(shell ${EXTERNAL_GA_PATH}/bin/ga-config --enable-f77 | awk '/yes/ {print "Y"}') 116 ifneq ($(GA_HAS_F77),Y) 117 $(info NWChem requires Global Arrays built with Fortran support) 118 $(error ) 119 endif 120#check peigs interface 121 GA_HAS_PEIGS = $(shell ${EXTERNAL_GA_PATH}/bin/ga-config --use_peigs | awk '/1/ {print "Y"}') 122 GA_HAS_SCALAPACK = $(shell ${EXTERNAL_GA_PATH}/bin/ga-config --use_scalapack | awk '/1/ {print "Y"}') 123 ifneq ($(GA_HAS_PEIGS),Y) 124 ifneq ($(GA_HAS_SCALAPACK),Y) 125 $(info NWChem requires Global Arrays built with either Peigs or Scalapack support) 126 $(error ) 127 endif 128 endif 129#check blas size 130 GA_BLAS_SIZE = $(shell ${EXTERNAL_GA_PATH}/bin/ga-config --blas_size) 131 ifndef BLAS_SIZE 132 BLAS_SIZE=8 133 endif 134 ifneq ($(BLAS_SIZE),$(GA_BLAS_SIZE)) 135 $(info ) 136 $(info NWChem requires Global Arrays built with same BLAS size ) 137 $(info you asked BLAS_SIZE=${BLAS_SIZE}) 138 $(info Global Arrays was built with BLAS size=${GA_BLAS_SIZE}) 139 $(info ) 140 $(error ) 141 endif 142 GA_PATH=$(EXTERNAL_GA_PATH) 143 else 144 GA_PATH=$(NWCHEM_TOP)/src/tools/install 145 endif 146 ifeq ($(BLAS_SIZE),4) 147 USE_64TO32=y 148 endif 149 150# 151# Define LIBPATH to be paths for libraries that you are linking in 152# from precompiled sources and are not building now. These libraries 153# will be searched AFTER anything you are building now. 154# e.g. LIBPATH = -L/msrc/proj/mss/lib 155# 156 LIBPATH = 157ifdef OLD_GA 158 LIBPATH = -L$(SRCDIR)/tools/lib/$(TARGET) 159else 160#case guard against case when tools have not been compiled yet 161 ifeq ("$(wildcard ${GA_PATH}/bin/ga-config)","") 162 LIBPATH = -L$(SRCDIR)/tools/install/lib 163 else 164 GA_LDFLAGS= $(shell ${GA_PATH}/bin/ga-config --ldflags ) 165#extract GA libs location from last word in GA_LDLFLAGS 166 LIBPATH := $(word $(words ${GA_LDFLAGS}),${GA_LDFLAGS}) 167 ifdef EXTERNAL_GA_PATH 168 LIBPATH += -L$(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib) 169 endif 170 endif 171endif 172 173# 174# Define INCPATH to be directories to get includes for 175# libraries that you are not building now. These directories 176# will be searched AFTER anything you are building now. 177# 178INCPATH = 179ifdef OLD_GA 180 INCPATH = -I$(SRCDIR)/tools/include 181else 182#case guard against case when tools have not been compiled yet 183 ifeq ("$(wildcard ${GA_PATH}/bin/ga-config)","") 184 INCPATH = -I$(SRCDIR)/tools/install/include 185 else 186 GA_CPPFLAGS= $(shell ${GA_PATH}/bin/ga-config --cppflags ) 187 INCPATH := $(word $(words ${GA_CPPFLAGS}),${GA_CPPFLAGS}) 188 ifdef EXTERNAL_GA_PATH 189 INCPATH += -I$(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include) 190 endif 191 endif 192endif 193 194# These subdirectories will build the core, or supporting libraries 195# that are required by all NWChem modules. The include directory is 196# first to insure that all include files will be properly installed 197# prior to trying to compile anything. 198# 199# The core libraries are usually rather platform-dependent and are 200# specified below. Use of MPI requires substituting the tcgmsg-mpi 201# wrapper for the normal tcgmsg library. 202# the 2 following environmental variables are need for linking 203# LIBMPI - represents the name of mpi library (with -l) 204# MPI_LIB - represents the path to the mpi library 205#LIBMPI = -lmpich 206#MPI_LIB= /usr/local/lib 207 208#JN: under the new structure, tools should be listed first as 209# their header files are needed for dependency analysis of 210# other NWChem modules 211ifdef BUILD_OPENBLAS 212NW_CORE_SUBDIRS += libext 213#bail out if BLASOPT or LAPACK_LIB or BLAS_LIB are defined by user 214ifneq ($(or $(BLASOPT),$(LAPACK_LIB),$(BLAS_LIB)),) 215$(info ) 216$(info You must unset) 217$(info BLASOPT ,LAPACK_LIB and BLAS_LIB) 218$(info when using BUILD_OPENBLAS ) 219$(info ) 220$(error ) 221endif 222 BLASOPT=-L$(NWCHEM_TOP)/src/libext/lib -lnwc_openblas 223 LAPACK_LIB=$(BLASOPT) 224 BLAS_LIB=$(BLASOPT) 225endif 226ifdef BUILD_SCALAPACK 227NW_CORE_SUBDIRS += libext 228 ifneq ($(or $(SCALAPACK),$(SCALAPACK_LIB)),) 229$(info ) 230$(info You must unset) 231$(info SCALAPACK and SCALAPACK_LIB) 232$(info when using BUILD_SCALAPACK ) 233$(info ) 234$(error ) 235endif 236 SCALAPACK=-L$(NWCHEM_TOP)/src/libext/lib -lnwc_scalapack 237endif 238ifdef BUILD_MPICH 239NW_CORE_SUBDIRS += libext 240 PATH := $(NWCHEM_TOP)/src/libext/bin:$(PATH) 241 MPI_INCLUDE = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include) 242 MPI_LIB = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib) 243 LIBMPI = $(shell PATH=$(NWCHEM_TOP)/src/libext/bin:$(PATH) $(NWCHEM_TOP)/src/tools/guess-mpidefs --libmpi) 244endif 245ifndef EXTERNAL_GA_PATH 246NW_CORE_SUBDIRS += tools 247endif 248NW_CORE_SUBDIRS += include basis geom inp input \ 249 pstat rtdb task symmetry util peigs perfm bq cons $(CORE_SUBDIRS_EXTRA) 250 251# Include the modules to build defined by 'make nwchem_config' at top level 252 253include $(CNFDIR)/nwchem_config.h 254# 255 256# Finally, we can set the full list of interesting directories, which 257# is what most makefile will care about. 258 259NWSUBDIRS = $(NW_CORE_SUBDIRS) $(NW_MODULE_SUBDIRS) 260 261BUILDING_PYTHON = $(filter $(NWSUBDIRS),python) 262########################################################## 263# # 264# Should NOT need to modify below here unless porting to # 265# a new machine or changing compiler options # 266# # 267########################################################## 268 269# Each machine dependent section should define the following as necessary. 270# (defaults if any in parentheses) 271# 272# FC = path to Fortran compiler (f77) 273# CC = path to ANSI C compiler (cc) 274# AS = path to the assembler (as) 275# AR = path to archive builder (ar) 276# CPP = path to ANSI-like C preprocessor (cpp) 277# RANLIB = path to ranlib or something harmless if not required 278# SHELL = path to the Bourne Shell 279# MAKE = DON\'T define this ... it will break the passing of command 280# arguments. Simply use the correct path to GNU make on the 281# command line and all will work just dandy. 282# MAKEFLAGS = options to GNU make ... -j controls no. of threads used 283# for parallel builds. --no-print-directory says be quiet about 284# changing directory. 285# INSTALL = command to install an executable when it is built 286# 287# C/FOPTIONS = essential compiler options independent of optimization level 288# C/FOPTIONS should not usually be overridden on the command line 289# C/FDEBUG = compiler flags to enable enable debugging and used for 290# all routines not vital for performance (OBJ in makelib.h) 291#C/FOPTIMIZE = compiler flags to enable optimization for important routines. 292# (OBJ_OPTIMIZE in makelib.h) 293# 294# C/FDEBUG and C/FOPTIMIZE can be overridden on the command 295# line to change the optimization level for routines normally 296# compiled with them. 297# 298# EXPLICITF = undefined if the Fortran compiler runs .F files thru .f 299# Otherwise set it to anything and define FCONVERT to be a 300# command to make $< (which will be a .F file) into $*.f 301# 302# FCONVERT = command to convert a .F into a .f 303# 304# LDOPTIONS = additional options to be passed to the linker (LDFLAGS is 305# built from this and the library path info). LDOPTIONS is 306# the best way to add to the link command. 307# 308# ARFLAGS = options for AR (ru) 309# 310# DEFINES = C preprocessor defines for both C and Fortran 311# 312# CORE_LIBS = List of libraries and paths for libraries in addition 313# to the LIBDIR and LIBPATH options. 314# 315# CORE_SUBDIRS_EXTRA = List of additional directories (e.g., BLAS) that 316# are needed on this machine. 317# MODULE_SUBDIRS_EXTRA = List of additional directories (e.g., stepper) that 318# are needed for top-level modules on this machine. 319# (Should not normally be used) 320# 321# The following are defined for all machines at the bottom of this file 322# 323# C/FFLAGS = all options to the C/Fortran compilers (note CPPFLAGS are 324# separate). These comprise C/FOPTIONS and C/FOPT. 325# INCLUDES = C preprocessor include paths for both C and Fortran. 326# In princpile this could be machine dependent but is not yet. 327# CPPFLAGS = options to C preprocessor that both C and Fortran will use. 328# This comprises the includes and defines. 329# LDFLAGS = options for the linker. Currently paths from LIBDIR and 330# LIBPATH. 331# 332# NWCHEM_TARGET_CPU environment variable is used to select compiler flags 333# optimal for given CPU. The following values are recognized on particular 334# platforms: 335# 336# NWCHEM_TARGET NWCHEM_TARGET_CPU 337# LAPI P2SC 338# 339 340 341# 342# Establish some required defaults which may need overriding 343# for some machines 344 345 SHELL = /bin/sh 346 ARFLAGS = r 347 FDEBUG = -g 348 CDEBUG = -g 349 AR = ar 350 FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f 351 352ifdef OLD_GA 353 CORE_LIBS = -lnwcutil -lpario -lglobal -lma -lpeigs -lperfm -lcons -lbq -lnwcutil 354else 355 CORE_LIBS = -lnwcutil -lga -larmci -lpeigs -lperfm -lcons -lbq -lnwcutil 356endif 357 358 ifdef USE_INTEGER4 359 integer4: 360 @echo 361 @echo USE_INTEGER4 option no longer supported 362 @echo please do not set it 363 @echo 364 @exit 1 365 endif 366 367# -U option needed for introducing timestamps in libraries 368# see https://bugzilla.redhat.com/show_bug.cgi?id=1195883 (RedHat backtracked) 369# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798913 370# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798804 (Debian did not backtrack) 371# USE_ARUR = $(shell rm -f aru.tmp;ar -U > aru.tmp 2>&1; head -1 aru.tmp| awk ' /no operation/ {print "Y";exit};{print "N"}'; rm -f aru.tmp) 372 USE_ARUR = $(shell rm -f aru.tmp;ar --help > aru.tmp 2>&1; grep U aru.tmp| awk ' /ctual timest/ {print "Y";exit};'; rm -f aru.tmp) 373 ifeq ($(USE_ARUR),Y) 374 ARFLAGS = rU 375 endif 376 377# strip long paths when FC and/or CC are set from user 378 ifneq ($(FC),f77) 379 _FC = $(notdir $(FC)) 380 endif 381 ifneq ($(CC),cc) 382 _CC = $(notdir $(CC)) 383 endif 384 385# 386# Machine specific stuff 387# 388 389ifeq ($(TARGET),SOLARIS) 390 SHELL := $(NICE) /bin/sh 391 RANLIB = echo 392 MAKEFLAGS = -j 2 --no-print-directory 393 INSTALL = echo $@ is built 394 # 395 # You can use either the f77 or f90 compiler BUT if using f90 396 # you\'ll need to specify -DINTEGER_1='integer*1' in the selci 397 # and util makefiles. 398 # 399 CC = cc 400 FC = f77 401 402 # Don\'t need this if using the SUN performance library 403 # need for BLASOPT business because of lapack and other possible missing entries 404 ifndef BLASOPT 405 CORE_SUBDIRS_EXTRA = blas lapack 406 endif 407 408 DEFINES = -DSOLARIS -DNOAIO 409 # Note that WS6 does not optimize robustly and if using this you must 410 # - put "-nodpend -xvector=no" on FOPTIONS after -fast 411 # - remove "-fsimple=2 -depend -xvector=yes" from FOPTIMIZE. 412 # - remove -lmvec from CORELIBS 413 # to get link with sunperf, type BLASOPT="-xlic_lib=sunperf" 414 # 415 # These options are set for WS5 416 417 ifeq ($(CC),fcc) 418 # Fujitsu SPARC systems (thanks to Herbert Fruchtl) 419 COPTIONS = -Kdalign 420 COPTIMIZE = -Kfast_GP=2 421 DEFINES += -DFUJITSU_SOLARIS 422 endif 423 424 ifeq ($(FC),frt) 425 # Fujitsu SPARC systems (thanks to Herbert Fruchtl) 426 # Fujitsu with Parallelnavi compilers 427 # If using Fujitsu compilers on Sun hardware, replace -Kfast_GP=2 with 428 # -Kfast 429 DEFINES += -DFUJITSU_SOLARIS -DEXTNAME 430 FOPTIONS = -Kdalign -w -fw -X9 431 FOPTIMIZE = -Kfast_GP=2 432 FDEBUG= 433 LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS) $(FOPTIMIZE) 434 else 435 FOPTIONS = -stackvar -dalign 436 FOPTIMIZE = -fast -O5 -fsimple=2 -depend -xvector=yes 437 FDEBUG = -g -O1 -nodepend 438 LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS) 439 endif 440 441 ifeq ($(FC),frt) 442 CORE_LIBS += -SSL2 443 else 444 LDOPTIONS = -xildoff 445 CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas -lmvec 446 endif 447 448 449 EXTRA_LIBS = -ldl 450 # this creates a static executable 451 #EXTRA_LIBS = -Bdynamic -ldl -lXext -lnsl -Bstatic 452 453 454 ifeq ($(BUILDING_PYTHON),python) 455 # Both tk/tcl and BLT need X11 (common) 456 EXTRA_LIBS += -lX11 457 endif 458 459 #end of solaris 460endif 461 462ifeq ($(TARGET),SOLARIS64) 463# 464# Sun running Solaris 64-bit ... NEEDS WORKSHOP 6.1 or later compilers 465# due to bugs in earlier compilers. Also cannot yet use sunperf due to 466# the braindead naming of the 64-bit interface. 467# 468# You can use either the f77 or f90 compiler BUT if using f90 469# you will need to specify -DINTEGER_1='integer*1' in the selci 470# and util makefiles. 471# 472 473 SHELL := $(NICE) /bin/sh 474 CORE_SUBDIRS_EXTRA = blas lapack 475 CC = cc 476 FC = f77 477 DEFINES = -DSOLARIS -DNOAIO -DSOLARIS64 478 DEFINES += -DEXT_INT 479 480 COPTIMIZE = -O 481 RANLIB = echo 482 MAKEFLAGS = -j 2 --no-print-directory 483 INSTALL = echo $@ is built 484 485 ifeq ($(CC),fcc) 486 # Fujitsu SPARC systems (thanks to Herbert Fruchtl) 487 COPTIONS = -Kdalign -KV9FMADD 488 COPTIMIZE = -Kfast_GP=2 -KV9FMADD 489 DEFINES += -DFUJITSU_SOLARIS 490 else 491 # SUN/Solaris options for WS6.1 492 COPTIONS = -xarch=v9 -dalign 493 endif 494 495 ifeq ($(FC),frt) 496 # Fujitsu SPARC systems (thanks to Herbert Fruchtl) 497 # Fujitsu with Parallelnavi compilers 498 # If using Fujitsu compilers on Sun hardware, replace -Kfast_GP=2 with 499 # -Kfast 500 DEFINES += -DFUJITSU_SOLARIS -DEXTNAME 501 FOPTIONS = -Kdalign -w -fw -X9 -KV9FMADD 502 ifdef USE_I4FLAGS 503 FOPTIONS += -CcdLL8 504 else 505 FOPTIONS += -CcdLL8 -CcdII8 506 endif 507 FOPTIMIZE = -Kfast_GP=2 -KV9FMADD 508 FDEBUG= 509 else 510 # SUN/Solaris f77 options 511 FOPTIONS = -stackvar -fast -nodepend -xvector=no -xarch=v9a 512 ifdef USE_I4FLAGS 513 FOPTIONS += -xtypemap=real:64,double:64,integer:32 514 else 515 FOPTIONS += -xtypemap=real:64,double:64,integer:64 516 endif 517 FOPTIMIZE = -g -O5 518 FDEBUG = -g -O1 519 endif 520 521 LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS) 522 ifeq ($(FC),frt) 523 LDOPTIONS = -SSL2 524 CORE_LIBS += -lnwclapack -lnwcblas 525 else 526 LDOPTIONS = -xs -xildoff 527 ifdef BLASOPT 528 CORE_LIBS += $(BLASOPT) -lmvec 529 else 530 CORE_LIBS += -lnwclapack -lnwcblas -lmvec 531 endif 532 CORE_LIBS += -lsocket -lrpcsvc -lnsl 533 EXTRA_LIBS = -ldl -lfsu 534 endif 535 #end of solaris 536endif 537 538ifeq ($(TARGET),PURESOLARIS) 539 @echo DEPRECATED 540 @exit 541endif 542 543ifeq ($(TARGET),FUJITSU_VPP) 544 @echo DEPRECATED 545 @exit 546endif 547 548ifeq ($(TARGET),FUJITSU_VPP64) 549 @echo DEPRECATED 550 @exit 551endif 552 553ifeq ($(TARGET),cray-sv2) 554 @echo DEPRECATED 555 @exit 556endif 557 558ifeq ($(TARGET),CRAY-T3E) 559 @echo DEPRECATED 560 @exit 561endif 562 563ifeq ($(TARGET),SGITFP) 564 @echo DEPRECATED 565 @exit 566endif 567 568ifeq ($(TARGET),SGI_N32) 569 @echo DEPRECATED 570 @exit 571endif 572 573ifeq ($(TARGET),HPUX) 574# 575# HPUX 11.0 576# 577# removed reference to MLIB since 8.3 version of MLIB 578# does not support +ppu 579# 580 581 CORE_SUBDIRS_EXTRA = blas lapack 582 MAKEFLAGS = -j 1 --no-print-directory 583 CPP = /lib/cpp -P 584 CC = cc 585 FC = f90 586 LDOPTIONS = -g -Wl,+vallcompatwarnings +U77 587 LDOPTIONS += +DA2.0 +DS2.0 +O2 588 LDOPTIONS += +O2 589 LINK.f = f90 $(LDFLAGS) 590 CORE_LIBS += $(BLASOPT) -lnwclapack -lnwcblas -lm 591 FDEBUG = -g 592 FOPTIONS = +ppu -Wl,-a,archive 593 COPTIONS = -Aa -D_HPUX_SOURCE +e 594 FOPTIMIZE = +O2 +Onolimit 595 FOPTIMIZE += +DA2.0 +DS2.0a +Odataprefetch +Onofltacc +Onoinitcheck 596 FOPTIMIZE += +Oprocelim +Oentrysched +Ofastaccess 597 FVECTORIZE = +Oall +Onofltacc 598 COPTIMIZE = -O 599 RANLIB = echo 600 601 DEFINES = -DHPUX -DEXTNAME 602 ifeq ($(BUILDING_PYTHON),python) 603 # needed if python was compiled with gcc (common) 604 EXTRA_LIBS += -L/usr/local/lib/gcc-lib/hppa1.0-hp-hpux11.00/2.8.0 -lgcc 605 endif 606 607endif 608 609ifeq ($(TARGET),HPUX64) 610# 611# HPUX 11.0 612# 613 614 CORE_SUBDIRS_EXTRA = blas lapack 615 _CPU = $(shell uname -m ) 616 MAKEFLAGS = -j 1 --no-print-directory 617 CPP = /lib/cpp -P 618 CC = cc 619 FC = f90 620 LDOPTIONS = -Wl,+vallcompatwarnings +U77 621 CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas -lm 622 CDEBUG = 623 FDEBUG = -g 624 FOPTIONS = +ppu #+U77 625 COPTIONS = -Aa -D_HPUX_SOURCE +e 626 ifeq ($(_CPU),ia64) 627 FOPTIONS += +DD64 +DSitanium2 +Ofltacc=relaxed +Olibcalls +Onolimit +FPD 628 COPTIONS += +DD64 629 FOPTIMIZE = +O2 630 FVECTORIZE = +Ofast +O3 +Onoptrs_to_globals +Oloopblock 631 FDEBUG = +Ofast 632 else 633 FOPTIONS += +DA2.0W 634 COPTIONS += +DA2.0W 635 FOPTIMIZE = +O2 636 FVECTORIZE = +Oall +Onofltacc 637 endif 638 639 COPTIMIZE = -O 640 RANLIB = echo 641 642 DEFINES = -DHPUX -DEXTNAME -DHPUX64 643 ifdef USE_I4FLAGS 644 else 645 FOPTIONS += +i8 646 endif 647 DEFINES += -DEXT_INT 648 649endif 650 651 652 653 654ifeq ($(TARGET),IBM) 655# 656# IBM AIX 657# 658 659 CORE_SUBDIRS_EXTRA = lapack blas 660 FC = xlf 661 ifeq ($(FC),xlf) 662 _FC=xlf 663 endif 664 CC = xlc 665 ARFLAGS = urs 666 RANLIB = echo 667 MAKEFLAGS = -j 5 --no-print-directory 668 INSTALL = @echo $@ is built 669 CPP = /usr/lib/cpp -P 670 671 FOPTIONS = -qEXTNAME -qnosave -qalign=4k -qxlf77=leadzero 672# -qinitauto=FF 673 COPTIONS = 674# -qstrict required with -O3 (according to Edo) 675# -qfloat=rsqrt gives faster square roots (off by -qstrict) 676# -qfloat=fltint gives faster real-integer conversion (off by -qstrict) 677# -qhot seems to break a lot of things so don\'t ever use it 678 FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000 -qarch=auto -qtune=auto -NS2048 679 ifdef RSQRT 680 FOPTIMIZE += -qfloat=rsqrt:fltint 681 endif 682 COPTIMIZE = -O -qarch=auto -qtune=auto 683 ifdef USE_GPROF 684 FOPTIONS += -pg 685 LDOPTIONS += -pg 686 endif 687 ifdef USE_DEBUG 688 FOPTIONS += -g 689 LDOPTIONS += -g 690 endif 691 692 DEFINES = -DIBM -DAIX -DEXTNAME 693 CORE_LIBS += $(BLASOPT) 694 ifdef USE_ESSL 695 DEFINES += -DESSL 696 CORE_LIBS += -lessl 697 endif 698 699 LIBPATH += -L/usr/lib 700 701 LDOPTIONS += -bmaxstack:0x60000000 -bmaxdata:0x60000000 -bloadmap:nwchem.lapi_map 702 CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas \ 703 -brename:.daxpy_,.daxpy \ 704 -brename:.dcopy_,.dcopy \ 705 -brename:.ddot_,.ddot \ 706 -brename:.dgemm_,.dgemm \ 707 -brename:.dgemv_,.dgemv \ 708 -brename:.dgesv_,.dgesv \ 709 -brename:.dgetrf_,.dgetrf \ 710 -brename:.dgetrs_,.dgetrs \ 711 -brename:.dlaset_,.dlaset \ 712 -brename:.dpotrf_,.dpotrf \ 713 -brename:.dpotri_,.dpotri \ 714 -brename:.dscal_,.dscal \ 715 -brename:.dspsvx_,.dspsvx \ 716 -brename:.idamax_,.idamax \ 717 -brename:.dswap_,.dswap \ 718 -brename:.dger_,.dger \ 719 -brename:.dtrsm_,.dtrsm \ 720 -brename:.dnrm2_,.dnrm2 \ 721 -brename:.dtrmm_,.dtrmm \ 722 -brename:.drot_,.drot \ 723 -brename:.dasum_,.dasum \ 724 -brename:.dtrmv_,.dtrmv \ 725 -brename:.dspmv_,.dspmv \ 726 -brename:.dspr_,.dspr \ 727 -brename:.dsyrk_,.dsyrk \ 728 -brename:.dsyr2k_,.dsyr2k \ 729 -brename:.dsymv_,.dsymv \ 730 -brename:.lsame_,.lsame \ 731 -brename:.xerbla_,.xerbla \ 732 -brename:.zgemm_,.zgemm \ 733 -brename:.dsyr2_,.dsyr2 \ 734 -brename:.dznrm2_,.dznrm2 \ 735 -brename:.zaxpy_,.zaxpy \ 736 -brename:.zcopy_,.zcopy \ 737 -brename:.zdotc_,.zdotc \ 738 -brename:.zdscal_,.zdscal \ 739 -brename:.zgemv_,.zgemv \ 740 -brename:.zgerc_,.zgerc \ 741 -brename:.zhemv_,.zhemv \ 742 -brename:.zher2_,.zher2 \ 743 -brename:.zher2k_,.zher2k \ 744 -brename:.zscal_,.zscal \ 745 -brename:.zswap_,.zswap \ 746 -brename:.ztrmm_,.ztrmm \ 747 -brename:.ztrmv_,.ztrmv \ 748 -brename:.izamax_,.izamax 749# -brename:.zherk_,.zherk \ 750# -brename:.zhemm_,.zhemm \ 751# -brename:.ztrsm_,.ztrsm \ 752# -brename:.dtrsv_,.dtrsv \ 753# -brename:.ztrsv_,.ztrsv 754# -brename:.dsymm_,.dsymm \ 755# 756 757 ##comment out from dtrmm_ inclusive 758 759 EXPLICITF = TRUE 760# 761endif 762 763ifeq ($(TARGET),IBM64) 764# 765# IBM AIX 64-bit 766# tested on ecs1 May 10 2000 AIX 4.3.3.10 767# does not run on AIX 4.3.2.1 (skunkworks) 768# 769 ifeq ($(LAPACK_LIB),) 770 CORE_SUBDIRS_EXTRA += lapack 771 endif 772 ifeq ($(BLAS_LIB),) 773 CORE_SUBDIRS_EXTRA += blas 774 endif 775 FC = xlf 776 ifeq ($(FC),xlf) 777 _FC=xlf 778 endif 779 CC = xlc 780 AR = ar -X 64 781 RANLIB = echo 782 MAKEFLAGS = -j 11 --no-print-directory 783 INSTALL = @echo $@ is built 784 CPP = /usr/lib/cpp -P 785 786 FOPTIONS = -qEXTNAME -qnosave -qalign=4k -q64 -qxlf77=leadzero 787 COPTIONS = -q64 788 FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000 -qarch=auto -qtune=auto 789 RSQRT=y 790 FDEBUG = -O2 -qmaxmem=8192 791 ifdef RSQRT 792 FOPTIMIZE += -qfloat=rsqrt:fltint 793 endif 794 XLF8= $(shell /usr/bin/lslpp -l xlfcmp 2>&1|grep COMM|head -n 1| awk ' / [8-9]./ {print "Y"};/[ ][1][0-9]./ {print "Y"}') 795 ifdef XLF8 796 FVECTORIZE= -O3 -qstrict -qtune=auto -qarch=auto -qcache=auto -qalign=natural \ 797 -qnozerosize -qlargepage -qnozerosize -qipa=level=2 798 #old FOPTIMIZE = -O4 -NQ40000 -NT80000 -qarch=auto -qtune=auto 799 FOPTIMIZE = -O3 -qarch=auto -qtune=auto 800 #adding -qstrict to fix linking problem for v10.1 801 FOPTIMIZE += -qstrict# -qipa -qhot -qlargepage -qessl 802 FOPTIONS += -blpdata 803 FOPTIMIZE += -qfloat=rsqrt:fltint 804 FVECTORIZE += -qfloat=rsqrt:fltint 805 endif 806 COPTIMIZE = -O -qmaxmem=8192 807 808 DEFINES = -DIBM -DAIX -DEXTNAME 809 DEFINES += -DCHKUNDFLW 810 LIBPATH += -L/usr/lib -L/lib 811 ifdef USE_I4FLAGS 812 FOPTIONS += -qintsize=4 813 else 814 FOPTIONS += -qintsize=8 815 endif 816 DEFINES += -DEXT_INT 817 ifdef USE_GPROF 818 FOPTIONS += -pg 819 LDOPTIONS += -pg 820 endif 821 ifdef USE_DEBUG 822 FOPTIONS += -g 823 LDOPTIONS += -g 824 endif 825 LDOPTIONS += -bloadmap:nwchem.ibm64map -bbigtoc # bigtoc requires bmaxdata 826 LDOPTIONS += -bmaxstack:0x80000000 -bmaxdata:0x200000000 # this limits MA to 8GB 827 ifeq ($(LAPACK_LIB),) 828 CORE_LIBS += -lnwclapack 829 endif 830 CORE_LIBS += $(BLASOPT) 831 ifeq ($(BLAS_LIB),) 832 CORE_LIBS += -lnwcblas 833 endif 834 XLFBREN = y 835 836 837 EXPLICITF = TRUE 838# 839endif 840 841 842ifeq ($(TARGET),LAPI) 843# 844 CORE_SUBDIRS_EXTRA = lapack blas 845 FC = mpxlf_r 846 ifdef OLDXLF 847 FC += -qnohpf 848 endif 849 CC = mpcc_r 850 ARFLAGS = urs 851 RANLIB = echo 852 MAKEFLAGS = -j 1 --no-print-directory 853 INSTALL = @echo $@ is built 854 CPP = /usr/lib/cpp -P 855 MPILIB = 856 LARGE_FILES = YES 857 858 LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -qalign=4k -g 859 LINK.f = mpcc_r $(LDFLAGS) 860 FOPTIONS = -qEXTNAME -qnosave -qalign=4k -qxlf77=leadzero 861 ifdef USE_GPROF 862 FOPTIONS += -pg 863 LDOPTIONS += -pg 864 endif 865 ifdef USE_DEBUG 866 FOPTIONS += -g 867 LDOPTIONS += -g 868 endif 869 # -qinitauto=7F # note that grad_force breaks with this option 870 COPTIONS = 871 FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000 -NS10000 -qipa=level=2 872 ifdef RSQRT 873 FOPTIMIZE += -qfloat=rsqrt:fltint 874 endif 875 COPTIMIZE = -O 876 FC += -qarch=auto -qtune=auto -qcache=auto -qthreaded 877 CC += -qarch=auto -qtune=auto -qcache=auto 878 879 880 DEFINES = -DLAPI -DSP1 -DAIX -DEXTNAME 881 DEFINES += -DCHKUNDFLW 882 883 USE_ESSL = YES 884 ifdef USE_ESSL 885 CORE_LIBS += -lessl 886 endif 887 ifdef USE_PESSL 888 DEFINES += -DESSL 889 CORE_LIBS += -lpessl -lblacs 890 endif 891 # Need ESSL before our own BLAS library but still need our 892 # own stuff for misc. missing routines 893 894 CORE_LIBS += -lnwclapack -lnwcblas 895 896 LDOPTIONS += -bloadmap:nwchem.lapimap -bbigtoc 897 LDOPTIONS += -bmaxstack:0x60000000 -bmaxdata:0x60000000 # needed because of bigtoc 898 899 EXPLICITF = TRUE 900# 901endif 902 903ifeq ($(TARGET),LAPI64) 904# 905 CORE_SUBDIRS_EXTRA = lapack blas 906 FC = mpxlf_r 907 CC = mpcc_r 908 ARFLAGS = urs 909 RANLIB = echo 910 MAKEFLAGS = -j 3 --no-print-directory 911 INSTALL = @echo $@ is built 912 CPP = /usr/lib/cpp -P 913 MPILIB = 914 LARGE_FILES = YES 915 916 LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -q64 -bloadmap:nwchem.lapi64_map $(LAPI64LIBS) 917 LINK.f = mpxlf_r $(LDFLAGS) 918 919 FOPTIONS = -qEXTNAME -qnosave -q64 -qalign=4k -qxlf77=leadzero -qthreaded 920 AR = ar -X 64 921 COPTIONS = -q64 922 FOPTIMIZE = -O3 -qstrict -NQ40000 -NT80000 923 FOPTIMIZE += -qarch=auto -qtune=auto -qcache=auto 924 ifdef RSQRT 925 FOPTIMIZE += -qfloat=rsqrt:fltint 926 endif 927 COPTIMIZE = -O 928 XLF8= $(shell xlf -qversion 2>&1|grep Version|head -1| awk ' / [8-9]./ {print "Y"};/[ ][1][0-9]./ {print "Y"}') 929 XLF10 = $(shell xlf -qversion 2>&1|grep Version|head -1| awk ' / 10./ {print "Y"}') 930 XLF11 = $(shell xlf -qversion 2>&1|grep Version|head -1| awk ' / 11./ {print "Y"}') 931 ifdef XLF8 932 FVECTORIZE= -O3 -qstrict -qtune=auto -qarch=auto -qcache=auto -qalign=natural \ 933 -qnozerosize -qlargepage -qnozerosize -qipa=level=2 934 FOPTIMIZE = -O4 -NQ40000 -NT80000 -qarch=auto -qtune=auto 935 FOPTIMIZE += -qipa -qhot -qlargepage -qessl 936 FOPTIONS += -blpdata 937 FOPTIMIZE += -qfloat=rsqrt:fltint 938 FVECTORIZE += -qfloat=rsqrt:fltint 939 endif 940 941 DEFINES = -DLAPI64 -DEXTNAME -DLAPI -DSP1 -DAIX 942 DEFINES += -DCHKUNDFLW 943 ifdef USE_I4FLAGS 944 FOPTIONS += -qintsize=4 945 else 946 FOPTIONS += -qintsize=8 947 endif 948 DEFINES += -DEXT_INT 949 CORE_LIBS += $(BLASOPT) -lnwclapack -lnwcblas 950 LDOPTIONS += -bloadmap:nwchem.lapi64map -bbigtoc 951 LDOPTIONS += -bmaxstack:0x80000000 -bmaxdata:0x80000000 # needed because of bigtoc 952 # LDOPTIONS += -bmaxstack:0xe0000000 -bmaxdata:0xe0000000 # this for large memory 953 XLFBREN = y 954 955 EXPLICITF = TRUE 956# 957endif 958 959ifeq ($(TARGET),MACX) 960 FC = gfortran 961 _FC = gfortran 962 # 963 # MacOSX 964 # 965 ifdef USE_VECLIB 966 CORE_SUBDIRS_EXTRA = blas 967 else 968 CORE_SUBDIRS_EXTRA = blas lapack 969 endif 970 _CPU = $(shell machine ) 971 FC = gfortran 972 INSTALL = @echo nwchem is built 973 RANLIB = ranlib 974 MAKEFLAGS = -j 1 --no-print-directory 975 DEFINES =-DMACX 976 COPTIONS = -m32 977 FOPTIONS = -m32 978 CFLAGS_FORGA = -m32 979 FFLAGS_FORGA = -m32 980 981 # required for mpich2 3.x and clang 982 DEFINES +=-DMPICH_NO_ATTR_TYPE_TAGS 983 CFLAGS_FORGA +=-DMPICH_NO_ATTR_TYPE_TAGS 984 985 ifeq ($(FC),xlf) 986 _FC=xlf 987 XLFMAC=y 988 FOPTIONS = -qextname -qfixed -qnosave -qalign=4k 989 FOPTIONS += -NQ40000 -NT80000 -NS2048 -qmaxmem=8192 -qxlf77=leadzero 990 FOPTIMIZE= -O3 -qstrict -qarch=auto -qtune=auto -qcache=auto -qcompact 991 ifdef RSQRT 992 FOPTIMIZE += -qfloat=rsqrt:fltint 993 endif 994 FVECTORIZE += $(FOPTIMIZE) -qunroll=yes 995 FDEBUG= -O2 -qcompact 996 DEFINES +=-DXLFLINUX -DCHKUNDFLW 997 FOPTIONS += $(INCLUDES) -WF,"$(DEFINES)" $(shell echo $(LIB_DEFINES) | sed -e "s/-D/-WF,-D/g" | sed -e 's/\"/\\\"/g' | sed -e "s/\'/\\\'/g") 998 endif 999 ifeq ($(FC),g77) 1000#g77, only decent one form Fink http://fink.sf.net 1001#gcc version 3.4 20031015 (experimental) 1002 _G77V33= $(shell g77 -v 2>&1|egrep spec|head -n 1|awk ' /3.3/ {print "Y"}') 1003 FDEBUG= -O1 -g 1004 FOPTIONS = -fno-second-underscore -fno-globals -Wno-globals 1005 FOPTIMIZE = -O3 -fno-inline-functions -funroll-loops 1006 FOPTIMIZE += -falign-loops=16 -falign-jumps=16 -falign-functions=16 1007 FOPTIMIZE += -ffast-math -mpowerpc-gpopt 1008 FOPTIMIZE += -maltivec 1009 ifeq ($(_G77V33),Y) 1010 FOPTIONS += -fno-force-mem 1011 FOPTIMIZE += -fno-force-mem 1012 endif 1013 ifeq ($(_CPU),ppc970) 1014#G5 1015 FOPTIMIZE += -mtune=970 -mcpu=970 -mpowerpc64 1016 endif 1017 ifeq ($(_CPU),ppc7450) 1018#G4 1019 FOPTIMIZE += -mtune=7450 -mcpu=7450 1020 endif 1021 endif 1022 FDEBUG = -g -O1 1023 ifeq ($(FC),gfortran) 1024 _FC=gfortran 1025#gcc version 4.2.0 200512 (experimental) 1026 LINK.f = gfortran -m32 $(LDFLAGS) 1027 FDEBUG = -O0 -g 1028 FOPTIMIZE = -O2 -ffast-math -Wuninitialized 1029 DEFINES += -DGFORTRAN 1030 GNUMAJOR=$(shell $(_FC) -dM -E - < /dev/null 2> /dev/null | grep __GNUC__ |cut -c18-) 1031 ifdef GNUMAJOR 1032 GNUMINOR=$(shell $(_FC) -dM -E - < /dev/null 2> /dev/null | egrep __GNUC_MINOR | cut -c24) 1033 GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true) 1034 GNU_GE_4_8 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 8 \) ] && echo true) 1035 GNU_GE_6 = $(shell [ $(GNUMAJOR) -ge 6 ] && echo true) 1036 endif 1037 ifeq ($(GNU_GE_4_6),true) 1038 DEFINES += -DGCC46 1039 endif 1040 ifeq ($(GNU_GE_4_8),true) 1041 FDEBUG += -fno-aggressive-loop-optimizations 1042 FOPTIMIZE +=-fno-aggressive-loop-optimizations 1043 FOPTIONS +=-fno-aggressive-loop-optimizations 1044 FFLAGS_FORGA += -fno-aggressive-loop-optimizations 1045 1046 FOPTIONS += -Warray-bounds 1047 endif 1048 ifeq ($(GNU_GE_6),true) 1049 FOPTIMIZE += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1050 FOPTIONS += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1051 FDEBUG += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1052 endif 1053 ifdef USE_OPENMP 1054 FOPTIONS += -fopenmp 1055 LDOPTIONS += -fopenmp 1056 DEFINES += -DUSE_OPENMP 1057 ifdef USE_OPENMP_TASKS 1058 DEFINES += -DUSE_OPENMP_TASKS 1059 endif 1060 endif 1061 ifeq ($(_CPU),ppc970) 1062#G5 1063 FVECTORIZE = -ffast-math -O2 -ftree-vectorize 1064 FVECTORIZE += -ftree-vectorizer-verbose=1 1065 FOPTIMIZE += -mtune=970 -mcpu=970 -mpowerpc64 1066 FVECTORIZE += -mtune=970 -mcpu=970 -mpowerpc64 1067 endif 1068 ifeq ($(_CPU),ppc7450) 1069#G4 1070 FVECTORIZE = -ffast-math -O2 -ftree-vectorize 1071 FVECTORIZE += -ftree-vectorizer-verbose=1 1072 FOPTIMIZE += -fprefetch-loop-arrays #-ftree-loop-linear 1073 FOPTIMIZE += -mtune=7450 -mcpu=7450 1074 endif 1075 ifeq ($(_CPU),i486) 1076#gcc version 4.2.0 200608 (experimental) 1077# FOPTIONS= -malign-double# this break with gfort 4.2 and later http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29562 1078 FOPTIMIZE+= -funroll-all-loops -mtune=native 1079 FVECTORIZE=-O3 -ffast-math -mtune=native -mfpmath=sse -msse3 -ftree-vectorize -ftree-vectorizer-verbose=1 -fprefetch-loop-arrays -funroll-all-loops 1080# FOPTIMIZE=-O1 1081# FVECTORIZE=-O1 1082 endif 1083 ifdef USE_F2C 1084#possible segv with use of zdotc (e.g. with GOTO BLAS) 1085#http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178 1086 FOPTIONS += -ff2c -fno-second-underscore 1087 endif 1088 DEFINES += -DCHKUNDFLW -DGCC4 1089 endif 1090 ifeq ($(FC),ifort) 1091 _FC=ifort 1092#ifort 9.1 1093# LINK.f = ifort $(LDFLAGS) 1094 FOPTIONS += -align -mp1 -w -g #-vec-report1 1095 ifdef USE_GPROF 1096 FOPTIONS += -qp 1097 endif 1098 ifdef USE_DEBUG 1099 FOPTIONS += -g 1100 endif 1101 FOPTIMIZE = -O3 -prefetch -unroll 1102 FDEBUG=-O0 -g 1103 DEFINES += -DIFCLINUX 1104 endif 1105 ifeq ($(CC),xlc) 1106 COPTIONS += -qlanglvl=extended 1107 else 1108 COPTIONS += -Wall #-no-cpp-precomp 1109 COPTIMIZE = -g -O2 1110 endif 1111 ifdef USE_GPROF 1112 FOPTIONS += -pg 1113 LDOPTIONS += -pg 1114 COPTIONS += -pg 1115 endif 1116 ifdef USE_DEBUG 1117 FOPTIONS += -g 1118 LDOPTIONS += -g 1119 COPTIONS += -g 1120 endif 1121ifdef USE_VECLIB 1122 CORE_LIBS += $(BLASOPT) -Wl,-framework -Wl,vecLib -lnwcblas 1123else 1124 CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas 1125endif 1126 ifeq ($(FC),xlf) 1127 LDOPTIONS = -Wl,-multiply_defined -Wl,warning 1128 else 1129# _GCC4= $(shell gcc -v 2>&1|egrep spec|head -n 1|awk ' / 3./ {print "N";exit}; / 2./ {print "N";exit};{print "Y"}') 1130 _GCC4= $(shell $(CC) -dM -E - < /dev/null | egrep __VERS | cut -c22|awk ' /3/ {print "N";exit}; /2/ {print "N";exit};{print "Y"}') 1131 ifeq ($(_GCC4),Y) 1132# EXTRA_LIBS += 1133 else 1134 EXTRA_LIBS += -lm -lcc_dynamic 1135 endif 1136 endif 1137 endif 1138# 1139 _V104=$(shell uname -v 2>&1|awk ' /Version 7./ {print "N";exit}; /Version 8./ {print "Y";exit}') 1140 ifeq ($(_V104),Y) 1141 EXTRA_LIBS +=-lSystemStubs 1142 1143 1144endif 1145ifeq ($(TARGET),MACX64) 1146 1147 ifeq ($(FC),f77) 1148 FC = gfortran 1149 _FC = gfortran 1150 endif 1151 ifeq ($(FC),$(findstring $(FC),gfortran gfortran-4 gfortran-5 gfortran-6 gfortran-7 gfortran-8 gfortran-9 gfortran-10 gfortran-11 gfortran-12)) 1152 _FC = gfortran 1153 endif 1154# 1155# MacOSX 64bit 1156# 1157ifdef USE_VECLIB 1158 ifdef USE_64TO32 1159 CORE_SUBDIRS_EXTRA = 1160 else 1161 vecliberr: 1162 @echo The Apple supplied vector math library does not support 8-byte integers 1163 @echo You must also set USE_64TO32 and do a "make 64_to_32" to change the source code 1164 @exit 1 1165 endif 1166else 1167 ifeq ($(BLAS_LIB),) 1168 CORE_SUBDIRS_EXTRA += blas 1169 endif 1170 ifeq ($(LAPACK_LIB),) 1171 CORE_SUBDIRS_EXTRA += lapack 1172 endif 1173endif 1174 1175 INSTALL = @echo nwchem is built 1176 RANLIB = ranlib 1177# MAKEFLAGS = -j 1 --no-print-directory 1178 DEFINES = -DMACX 1179 DEFINES += -DEXT_INT 1180 LINK.f = $(FC) $(LDFLAGS) -Wl,-flat_namespace 1181 GOTCLANG= $(shell $(CC) -dM -E - </dev/null 2> /dev/null |grep __clang__|head -1|cut -c19) 1182 ifeq ($(GOTCLANG),1) 1183 COPTIONS += -fPIC 1184 endif 1185 1186 ifeq ($(_FC),gfortran) 1187#gcc version 1188 FOPTIONS = -cpp #-Wextra #-Wunused #-ffast-math 1189 ifdef USE_I4FLAGS 1190 else 1191 FOPTIONS += -fdefault-integer-8 1192 endif 1193 FOPTIMIZE = -O2 -ffast-math -Wuninitialized 1194 DEFINES += -DGFORTRAN -DGCC4 1195# 1196 FOPTIMIZE+= -funroll-all-loops -mtune=native 1197 FVECTORIZE=-O3 -ffast-math -mtune=native -mfpmath=sse -msse3 -ftree-vectorize -ftree-vectorizer-verbose=1 -fprefetch-loop-arrays -funroll-all-loops 1198 GNUMAJOR=$(shell $(_FC) -dM -E - < /dev/null 2> /dev/null | grep __GNUC__ |cut -c18-) 1199 ifneq ($(strip $(GNUMAJOR)),) 1200 GNUMINOR=$(shell $(_FC) -dM -E - < /dev/null 2> /dev/null | egrep __GNUC_MINOR | cut -c24) 1201 GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true) 1202 GNU_GE_4_8 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 8 \) ] && echo true) 1203 GNU_GE_6 = $(shell [ $(GNUMAJOR) -ge 6 ] && echo true) 1204 GNU_GE_8 = $(shell [ $(GNUMAJOR) -ge 8 ] && echo true) 1205 ifeq ($(GNU_GE_4_6),true) 1206 DEFINES += -DGCC46 1207 endif 1208 ifeq ($(GNU_GE_4_8),true) 1209 FDEBUG += -fno-aggressive-loop-optimizations 1210 FOPTIMIZE +=-fno-aggressive-loop-optimizations 1211 FOPTIONS +=-fno-aggressive-loop-optimizations 1212 FFLAGS_FORGA += -fno-aggressive-loop-optimizations 1213 FOPTIONS += -Warray-bounds 1214 endif # GNU_GE_4_8 1215 ifeq ($(GNU_GE_6),true) 1216 FOPTIMIZE += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1217 FOPTIONS += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1218 FDEBUG += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1219 endif 1220 endif # GNUMAJOR 1221 1222 ifeq ($(GNU_GE_8),true) 1223 FOPTIONS += -std=legacy 1224 endif 1225 ifdef USE_OPENMP 1226 FOPTIONS += -fopenmp 1227 LDOPTIONS += -fopenmp 1228 DEFINES += -DUSE_OPENMP 1229 ifdef USE_OPENMP_TASKS 1230 DEFINES += -DUSE_OPENMP_TASKS 1231 endif 1232 endif 1233 ifdef USE_FPE 1234 FOPTIONS += -ffpe-trap=invalid,zero,overflow -fbacktrace 1235 endif 1236 endif # gfortran 1237 ifdef USE_GPROF 1238 FOPTIONS += -pg 1239 LDOPTIONS += -pg 1240 COPTIONS += -pg 1241 endif 1242 ifdef USE_DEBUG 1243 FOPTIONS += -g 1244 LDOPTIONS += -g 1245 COPTIONS += -g 1246 endif 1247ifdef USE_VECLIB 1248 CORE_LIBS += $(BLASOPT) -Wl,-framework -Wl,vecLib -lnwcblas 1249else 1250 ifeq ($(LAPACK_LIB),) 1251 CORE_LIBS += -lnwclapack 1252 endif 1253 CORE_LIBS += $(BLASOPT) 1254 ifeq ($(BLAS_LIB),) 1255 CORE_LIBS += -lnwcblas 1256 endif 1257endif 1258 ifeq ($(FC),ifort) 1259 _IFCV11= $(shell ifort -logo 2>&1|egrep "Version "|head -n 1|sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 11) {print "Y";exit}}') 1260 _IFCV12= $(shell ifort -logo 2>&1|egrep "Version "|head -n 1|sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 12) {print "Y";exit}}') 1261 _IFCV14= $(shell ifort -logo 2>&1|egrep "Version "|head -n 1|sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 14) {print "Y";exit}}') 1262 _IFCV15ORNEWER=$(shell ifort -logo 2>&1|egrep "Version "|head -n 1 | sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 15) {print "Y";exit}}') 1263 _IFCV17=$(shell ifort -logo 2>&1|egrep "Version "|head -n 1 | sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 17) {print "Y";exit}}') 1264 DEFINES += -DIFCV8 -DIFCLINUX 1265 ifdef USE_I4FLAGS 1266 else 1267 FOPTIONS += -i8 1268 endif 1269 FOPTIONS += -fpp -g -no-save-temps 1270 FDEBUG = -O2 -g 1271 FOPTIMIZE = -O3 -xHost 1272 ifdef USE_OPENMP 1273 ifeq ($(_IFCV15ORNEWER), Y) 1274 FOPTIONS += -qopenmp 1275 LDOPTIONS += -qopenmp 1276 else 1277 FOPTIONS += -openmp 1278 LDOPTIONS += -openmp 1279 endif 1280 DEFINES += -DUSE_OPENMP 1281 ifdef USE_OPENMP_TASKS 1282 DEFINES += -DUSE_OPENMP_TASKS 1283 endif 1284 endif 1285 ifdef USE_FPE 1286 FOPTIONS += -fpe0 -traceback #-fp-model precise 1287 endif 1288 ifdef USE_NOSIMD 1289 FOPTIONS += -no-simd 1290 endif 1291 ifeq ($(_IFCV11),Y) 1292 # The MKL option is available since Intel 11.1. 1293 # TODO: Test minor version number above when major=11. 1294 # https://software.intel.com/en-us/articles/using-mkl-in-intel-compiler-mkl-qmkl-options 1295 ifndef BLASOPT 1296 ifndef USE_INTERNALBLAS 1297 # When user requests OpenMP, MKL should use it, otherwise not (to avoid oversubscription). 1298 ifdef USE_OPENMP 1299 BLASOPT = -mkl=parallel 1300 else 1301 BLASOPT = -mkl=sequential 1302 endif 1303 endif 1304 endif 1305 endif 1306 ifeq ($(_IFCV11),Y) 1307#next 2 lines needed for fp accuracy 1308 FDEBUG += -fp-model source 1309 ifeq ($(_IFCV12),Y) 1310 FOPTIONS += -fimf-arch-consistency=true 1311 endif 1312 endif 1313 endif 1314 1315 ifdef USE_CCDYNAMIC 1316 EXTRA_LIBS += -lm -lcc_dynamic 1317 endif 1318 1319# required for mpich2 3.x and clang 1320 COPTIONS +=-DMPICH_NO_ATTR_TYPE_TAGS 1321# 1322 1323endif 1324 1325 1326ifeq ($(TARGET),$(findstring $(TARGET),LINUX CYGNUS CYGWIN)) 1327# 1328# 1329# Linux or Cygwin under Windows running on an x86 using g77 1330# 1331 NICE = nice -n 2 1332 SHELL := $(NICE) /bin/sh 1333 CORE_SUBDIRS_EXTRA = blas lapack 1334 CC = gcc 1335 RANLIB = ranlib 1336 MAKEFLAGS = -j 1 --no-print-directory 1337 INSTALL = @echo $@ is built 1338 CPP = gcc -E -nostdinc -undef -P 1339 FCONVERT = (/bin/cp $< /tmp/$$$$.c; \ 1340 $(CPP) $(CPPFLAGS) /tmp/$$$$.c | sed '/^$$/d' > $*.f; \ 1341 /bin/rm -f /tmp/$$$$.c) || exit 1 1342 1343 FC=gfortran 1344 ifeq ($(FC),f77) 1345 FC = gfortran 1346 _FC = gfortran 1347 endif 1348 ifeq ($(FC),$(findstring $(FC),gfortran gfortran-4 gfortran-5 gfortran-6 gfortran-7 gfortran-8 gfortran-9 gfortran-10 gfortran-11 gfortran-12 i686-w64-mingw32.static-gfortran)) 1349 _FC = gfortran 1350 endif 1351 ifeq ($(CC),$(findstring $(CC),gcc gcc-4 gcc-5 gcc-6 gcc-7 gcc-8 gcc-9 gcc-10 gcc-11 gcc-12 i686-w64-mingw32.static-gcc)) 1352 ifneq ($(CC),cc) 1353 _CC = gcc 1354 endif 1355 endif 1356 1357 LINUXCPU = $(shell uname -m |\ 1358 awk ' /sparc/ { print "sparc" }; /i*86/ { print "x86" }; /ppc*/ { print "ppc"}; /arm*/ { print "arm"}; /mips*/ { print "mips"} ' ) 1359 1360 GOTMINGW32= $(shell $(CC) -dM -E - </dev/null 2> /dev/null |grep MINGW32|cut -c21) 1361 ifeq ($(GOTMINGW32),1) 1362 ifdef USE_OPENMP 1363 errorompming: 1364 @echo 1365 @echo " MinGW environment does not support OpenMP" 1366 @echo " Please unset USE_OPENMP" 1367 @echo 1368 endif 1369 endif 1370 1371 1372 DEFINES = -DLINUX 1373 1374 FOPTIMIZE = -O2 1375 COPTIONS = -Wall 1376 COPTIMIZE = -g -O2 1377 ifeq ($(_FC),gfortran) 1378 FOPTIONS = # -Wextra -Wunused 1379 FOPTIMIZE += -ffast-math -Wuninitialized 1380 DEFINES += -DGFORTRAN 1381 GNUMAJOR=$(shell $(_FC) -dM -E - < /dev/null 2> /dev/null | grep __GNUC__ |cut -c18-) 1382 ifdef GNUMAJOR 1383 GNUMINOR=$(shell $(FC) -dM -E - < /dev/null 2> /dev/null | egrep __VERS | cut -c24) 1384 GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 \) ] && echo true) 1385 GNU_GE_4_8 = $(shell [ $(GNUMAJOR) -gt 4 -o \( $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 8 \) ] && echo true) 1386 GNU_GE_6 = $(shell [ $(GNUMAJOR) -ge 6 ] && echo true) 1387 GNU_GE_8 = $(shell [ $(GNUMAJOR) -ge 8 ] && echo true) 1388 ifeq ($(GNU_GE_4_6),true) 1389 ifdef USE_FPE 1390 FOPTIONS += -ffpe-trap=invalid,zero,overflow -fbacktrace 1391 endif 1392 DEFINES += -DGCC46 1393 endif 1394 ifeq ($(GNU_GE_4_8),true) 1395 FDEBUG +=-O2 -g -fno-aggressive-loop-optimizations 1396 FOPTIMIZE +=-fno-aggressive-loop-optimizations 1397 FFLAGS_FORGA += -fno-aggressive-loop-optimizations 1398 endif 1399 ifeq ($(GNU_GE_6),true) 1400 FOPTIMIZE += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1401 FOPTIONS += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1402 FDEBUG += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 1403 endif 1404 endif 1405 endif 1406 ifeq ($(GNU_GE_8),true) 1407 FOPTIONS += -std=legacy 1408 endif 1409 1410ifeq ($(LINUXCPU),x86) 1411 ifeq ($(TARGET),CYGNUS) 1412 DEFINES += -DCYGNUS 1413 endif 1414 ifeq ($(TARGET),CYGWIN) 1415 DEFINES += -DCYGWIN -DCYGNUS 1416 endif 1417 1418 _CPU = $(shell uname -m ) 1419 1420 ifeq ($(FC),g77) 1421 _G77V33= $(shell g77 -v 2>&1|egrep spec|head -n 1|awk ' /3.3/ {print "Y"}') 1422 FOPTIONS += -fno-second-underscore 1423 FOPTIONS += -fno-f90 -ffixed-line-length-72 -ffixed-form 1424 FOPTIMIZE += -O2 -malign-double -finline-functions 1425 COPTIONS += -Wall -malign-double 1426 COPTIMIZE += -g -O2 1427 FOPTIONS += -malign-double -fno-globals -Wno-globals -fno-silent #-Wunused 1428 FOPTIMIZE += -Wuninitialized -ffast-math -funroll-loops -fstrength-reduce 1429 FOPTIMIZE += -fno-move-all-movables -fno-reduce-all-givs 1430 FOPTIMIZE += -fforce-addr 1431# see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13037 1432# for atomscf/orderd.f (bug report by Kirill Smelkov) 1433 ifeq ($(_G77V33),Y) 1434 FOPTIONS += -fno-force-mem 1435 FOPTIMIZE += -fno-force-mem 1436 else 1437 FOPTIMIZE += -fforce-mem 1438 endif 1439endif 1440 1441 ifeq ($(GOTMINGW32),1) 1442 _CPU=i786 1443 else 1444 ifeq ($(_CPU),i686) 1445 _GOTSSE2= $(shell cat /proc/cpuinfo | egrep sse2 | tail -n 1 | awk ' /sse2/ {print "Y"}') 1446 ifeq ($(_GOTSSE2),Y) 1447 _CPU=i786 1448 endif 1449 endif 1450 endif 1451 1452 ifeq ($(_CPU),i786) 1453# COPTIONS = -march=i686 1454 ifdef USE_GCC31 1455 FDEBUG=-O1 -g 1456 COPTIMIZE +=-march=pentium4 -mcpu=pentium4 #-msse2 -mfpmath=sse 1457# COPTIMIZE +=-fprefetch-loop-arrays -minline-all-stringops -fexpensive-optimizations 1458 FOPTIMIZE +=-march=pentium4 -mcpu=pentium4# -msse2 -mfpmath=sse 1459# FOPTIMIZE +=-fprefetch-loop-arrays -minline-all-stringops -fexpensive-optimizations 1460 else 1461# FOPTIMIZE += -march=i686 1462# COPTIONS = -Wall -march=i686 -malign-double 1463 COPTIONS = -Wall -malign-double 1464 endif 1465 else 1466 ifneq ($(_CPU),x86) 1467# COPTIONS += -march=$(_CPU) 1468# FOPTIONS += -march=$(_CPU) 1469 endif 1470 endif 1471 ifeq ($(_CPU),k7) 1472 FOPTIONS = -fno-second-underscore 1473 COPTIONS = -Wall -malign-double 1474 ifdef USE_GCC31 1475 FOPTIONS += -march=athlon 1476 COPTIONS += -march=athlon 1477 else 1478 FOPTIONS += -march=k6 1479 COPTIONS += -march=k6 1480 endif 1481 endif 1482 1483 ifeq ($(FC),pgf77) 1484 DEFINES += -DPGLINUX 1485# added -Kieee to get dlamc1 to work on pgf77 3.1-3 EA Jun 8th 2000 1486 FOPTIONS = -Mdalign -Minform,warn -Mnolist -Minfo=loop -Munixlogical -Kieee 1487 ifeq ($(_CPU),i586) 1488 FOPTIONS += -tp p5 1489 endif 1490 ifeq ($(_CPU),i686) 1491 FOPTIONS += -tp p6 -Mvect=prefetch 1492 endif 1493 ifeq ($(_CPU),i786) 1494 FOPTIONS += -tp piv -Mcache_align -Mvect=prefetch 1495 endif 1496 FOPTIMIZE = -O2 -Mvect=assoc,cachesize:262144 -Munroll -Mnoframe 1497 endif 1498# _FC=g77 1499 ifeq ($(FC),ifc) 1500 _FC=ifc 1501 endif 1502 ifeq ($(FC),ifort) 1503 _FC=ifc 1504 endif 1505 ifeq ($(_FC),ifc) 1506 FOPTIONS = -align -mp1 -w -g #-vec-report1 1507 ifdef USE_GPROF 1508 FOPTIONS += -qp 1509 endif 1510 ifdef USE_DEBUG 1511 FOPTIONS += -g 1512 endif 1513 _IFCV7= $(shell ifort -v 2>&1|egrep "Version "|head -n 1|awk '/7./ {print "Y"; exit}') 1514 ifneq ($(_IFCV7),Y) 1515 DEFINES+= -DIFCV8 1516 ifeq ($(FC),ifc) 1517 FOPTIONS += -quiet 1518 endif 1519 endif 1520 ifdef USE_FPE 1521 FOPTIONS += -fpe-all=0 -traceback #-fp-model precise 1522 endif 1523 1524 FOPTIMIZE = -O3 -prefetch -unroll 1525 ifeq ($(_CPU),i586) 1526 FOPTIMIZE += -tpp5 -xi # this are for PentiumII 1527 endif 1528 ifeq ($(_CPU),k7) 1529 FOPTIMIZE += -xM # this are for Athlon 1530 endif 1531 ifeq ($(_CPU),i686) 1532 FOPTIMIZE += -tpp6 -xK # this are for PentiumIII 1533 endif 1534 ifeq ($(_CPU),i786) 1535 FOPTIMIZE += -tpp7 -xW # this are for PentiumIV 1536 endif 1537 DEFINES += -DIFCLINUX 1538 ifneq ($(_IFCV7),Y) 1539 FOPTIMIZE += -ansi_alias- 1540 endif 1541 endif 1542 ifeq ($(_FC),gfortran) 1543 LINK.f = gfortran $(LDFLAGS) 1544 ifneq ($(_CPU),arm) 1545 FOPTIONS += -m32 1546 COPTIONS += -m32 1547 CFLAGS_FORGA += -m32 1548 FFLAGS_FORGA += -m32 1549 endif 1550 ifdef USE_OPENMP 1551 FOPTIONS += -fopenmp 1552 LDOPTIONS += -fopenmp 1553 DEFINES += -DUSE_OPENMP 1554 ifdef USE_OPENMP_TASKS 1555 DEFINES += -DUSE_OPENMP_TASKS 1556 endif 1557 endif 1558 FOPTIMIZE += -O2 -ffast-math -Wuninitialized 1559 ifeq ($(_CPU),i786) 1560 FOPTIONS += -march=pentium4 -mtune=pentium4 1561 FVECTORIZE = $(FOPTIMIZE) -O3 -ftree-vectorize 1562 FVECTORIZE += -ftree-vectorizer-verbose=1 1563# FOPTIMIZE += -fprefetch-loop-arrays -ftree-loop-linear 1564 else 1565 FOPTIONS += -ffloat-store 1566 endif 1567 ifdef USE_F2C 1568#possible segv with use of zdotc (e.g. with GOTO BLAS) 1569#http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178 1570 FOPTIONS += -ff2c -fno-second-underscore 1571 endif 1572 FDEBUG += -g -O0 1573 DEFINES += -DCHKUNDFLW -DGCC4 1574 endif 1575 1576 ifeq ($(CC),icc) 1577 COPTIONS = -mp1 -w -g #-vec-report1 1578 COPTIMIZE = -O3 -unroll 1579 ifeq ($(_CPU),i586) 1580 COPTIMIZE += -tpp5 -xi # this are for PentiumII 1581 endif 1582 ifeq ($(_CPU),i686) 1583 COPTIMIZE += -tpp6 -xK # this are for PentiumIII 1584 endif 1585 ifeq ($(_CPU),i786) 1586 COPTIMIZE += -tpp7 -xW # this are for PentiumIV 1587 endif 1588 endif 1589endif 1590 1591 ifeq ($(LINUXCPU),ppc) 1592# this are for PowerPC 1593# Tested on SLES 9 1594# Feb 7th 2005 1595# xlf v9.1 1596# xlc v7.0 1597# gcc-3.2.3-42 1598 ifeq ($(FC),xlf) 1599 _FC=xlf 1600 endif 1601 ifeq ($(FC),blrts_xlf) 1602 _FC=xlf 1603 endif 1604 ifeq ($(_FC),xlf) 1605 FOPTIONS = -q32 -qextname -qfixed 1606 FOPTIONS += -NQ40000 -NT80000 -NS2048 -qmaxmem=8192 -qxlf77=leadzero 1607 FOPTIMIZE= -O3 -qstrict -qfloat=fltint 1608 ifeq ($(FC),blrts_xlf) 1609 FOPTIMIZE+= -qarch=440 -qtune=440 1610 else 1611 FOPTIMIZE+= -qarch=auto -qtune=auto 1612 endif 1613 FDEBUG= -O2 -g 1614# EXPLICITF = TRUE 1615 DEFINES += -DXLFLINUX 1616 CPP=/usr/bin/cpp -P -C -traditional 1617 endif 1618 ifeq ($(FC),g77) 1619 FOPTIONS = -fno-second-underscore -fno-globals -Wno-globals 1620 FOPTIMIZE = -g -O2 1621 endif 1622 ifeq ($(CC),xlc) 1623 _CC=xlc 1624 endif 1625 ifeq ($(CC),blrts_xlc) 1626 _CC=xlc 1627 endif 1628 ifeq ($(_CC),xlc) 1629 COPTIONS += -q32 -qlanglvl=extended 1630 else 1631 COPTIONS = -Wall 1632 COPTIMIZE = -g -O2 1633 endif 1634 LDOPTIONS += -Wl,--relax #-v 1635 endif 1636 1637 LINK.f = $(FC) $(FOPTIONS) $(LDFLAGS) 1638ifeq ($(LINUXCPU),x86) 1639 ifeq ($(FC),pgf77) 1640 LDOPTIONS += -g -Wl,--export-dynamic 1641 EXTRA_LIBS += -lm 1642 else 1643 ifeq ($(_FC),ifc) 1644 ifneq ($(_IFCV7),Y) 1645 EXTRA_LIBS += 1646 else 1647 EXTRA_LIBS += -Vaxlib 1648 endif 1649 ifeq ($(_CPU),i786) 1650 EXTRA_LIBS += -lsvml 1651 endif 1652 EXTRA_LIBS += #-static 1653 LDOPTIONS = -g -Wl,--export-dynamic 1654 else 1655 ifeq ($(GOTMINGW32),1) 1656 LDOPTIONS += -g -O0 1657 EXTRA_LIBS += -lwsock32 1658 else 1659 LDOPTIONS = -Xlinker --export-dynamic 1660# LDOPTIONS = --Xlinker -O -Xlinker -static 1661 EXTRA_LIBS += -lm 1662 endif 1663 endif 1664 endif 1665endif 1666#EXTRA_LIBS +=-lefence # link against Electricfence 1667 1668CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas 1669 1670# end of Linux, Cygnus 1671endif 1672 1673ifneq ($(TARGET),LINUX) 1674ifeq ($(TARGET),$(findstring $(TARGET),LINUX64 CYGWIN64 CATAMOUNT)) 1675 GOTMINGW64=$(shell $(CC) -dM -E - </dev/null 2> /dev/null |grep MINGW64|cut -c21) 1676ifeq ($(GOTMINGW64),1) 1677 _CPU = x86_64 1678else 1679 _CPU = $(shell uname -m ) 1680endif 1681#ifeq ($(NWCHEM_TARGET),LINUX64) 1682 ifeq ($(FC),g77) 1683 g7764: 1684 @echo 1685 @echo g77 not supported on 64-bit Linux 1686 @echo please use supported gompilers 1687 @echo 1688 @exit 1 1689 endif 1690 ifeq ($(FC),ftn) 1691 _FC=pgf90 1692 ifeq ($(PE_ENV),PGI) 1693 _FC=pgf90 1694 _CC=pgcc 1695 endif 1696 ifeq ($(PE_ENV),INTEL) 1697 _FC=ifort 1698 _CC=icc 1699 endif 1700 ifeq ($(PE_ENV),GNU) 1701 _FC=gfortran 1702 _CC=gcc 1703 endif 1704 ifeq ($(PE_ENV),CRAY) 1705 _FC=crayftn 1706 _CC=craycc 1707 endif 1708 DEFINES += -DCRAYXT -DNOIO 1709 USE_NOIO=1 1710 endif 1711 ifeq ($(CC),gcc) 1712 _CC=gcc 1713 endif 1714 ifeq ($(CC),pgcc) 1715 _CC=pgcc 1716 endif 1717 ifeq ($(CC),icc) 1718 _CC=icc 1719 endif 1720 ifeq ($(FC),pgf90) 1721 _FC=pgf90 1722 endif 1723 ifeq ($(FC),pgf77) 1724 _FC=pgf90 1725 endif 1726 ifeq ($(FC),ifc) 1727 _FC=ifort 1728 endif 1729 ifeq ($(FC),ifort) 1730 _FC=ifort 1731 endif 1732 ifeq ($(FC),ifx) 1733 _FC=ifort 1734 endif 1735 ifeq ($(FC),$(findstring $(FC),gfortran gfortran-4 gfortran-5 gfortran6 gfortran-6 gfortran-7 gfortran7 gfortran-8 gfortran8 gfortran-9 gfortran9 gfortran-10 gfortran10 gfortran-11 gfortran-12 i686-w64-mingw32.static-gfortran x86_64-w64-mingw32-gfortran-win32)) 1736 _FC= gfortran 1737 endif 1738 ifeq ($(CC),$(findstring $(CC),gcc gcc-4 gcc-5 gcc6 gcc-6 gcc-7 gcc7 gcc-8 gcc8 gcc-9 gcc9 gcc-10 gcc10 gcc-11 gcc-12 i686-w64-mingw32.static-gcc x86_64-w64-mingw32-gcc-win32)) 1739 ifneq ($(CC),cc) 1740 _CC= gcc 1741 endif 1742 endif 1743 ifeq ($(FC),gfortran) 1744 _FC=gfortran 1745 endif 1746 ifeq ($(FC),armflang) 1747 _FC=armflang 1748 USE_FLANG=1 1749 endif 1750 ifeq ($(FC),flang) 1751 _FC=gfortran 1752 USE_FLANG=1 1753 endif 1754 ifeq ($(CC),clang) 1755 _CC=gcc 1756 endif 1757 ifeq ($(FC),$(findstring $(FC),xlf2008_r xlf_r xlf xlf90 xlf90_r)) 1758 _FC=xlf 1759 endif 1760 ifndef _FC 1761 FC=gfortran 1762 _FC=gfortran 1763 endif 1764 ifndef _CC 1765 _CC=gcc 1766 endif 1767 FOPTIMIZE = -O2 1768 ifeq ($(_CPU),aarch64) 1769 DONTHAVEM64OPT=Y 1770 endif 1771 ifeq ($(_CPU),mips64) 1772 DONTHAVEM64OPT=Y 1773 COPTIONS = -mabi=64 1774 FOPTIONS = -mabi=64 1775 FFLAGS_FORGA = -mabi=64 1776 CFLAGS_FORGA = -mabi=64 1777 endif 1778 ifeq ($(_CC),gcc) 1779 ifneq ($(DONTHAVEM64OPT),Y) 1780 COPTIONS = -m64 1781 endif 1782 endif 1783 GOTCLANG= $(shell $(_CC) -dM -E - </dev/null 2> /dev/null |grep __clang__|head -1|cut -c19) 1784 ifeq ($(GOTCLANG),1) 1785 COPTIONS += -fPIC 1786 endif 1787 GOTFREEBSD= $(shell uname -o 2>&1|awk ' /FreeBSD/ {print "1";exit}') 1788 ifeq ($(GOTFREEBSD),1) 1789 DEFINES +=-DMPICH_NO_ATTR_TYPE_TAGS 1790# LDOPTIONS +=-Wl,-rpath=/usr/local/lib/gcc7 1791 LDOPTIONS += $(shell mpif90 -show 2>&1 |cut -d " " -f 2) 1792 endif 1793 ifeq ($(_FC),gfortran) 1794 ifneq ($(DONTHAVEM64OPT),Y) 1795 FOPTIONS = -m64 1796 endif 1797 COPTIONS += -Wall 1798 ifdef USE_FPE 1799 FOPTIONS += -ffpe-trap=invalid,zero,overflow -fbacktrace 1800 else 1801 FOPTIONS += -ffast-math #-Wunused 1802 endif 1803 FOPTIMIZE += -Wuninitialized 1804 DEFINES += -DGFORTRAN 1805 DEFINES += -DCHKUNDFLW -DGCC4 1806 ifeq ($(USE_FLANG),1) 1807 GNU_GE_4_6=true 1808 FOPTIONS+=-mcmodel=medium 1809 FOPTIONS+=-mcmodel=medium -fno-backslash 1810 COPTIONS+=-mcmodel=medium 1811 CFLAGS_FORGA = -mcmodel=medium 1812 FFLAGS_FORGA = -mcmodel=medium 1813 else 1814 GNUMAJOR=$(shell $(FC) -dM -E - < /dev/null 2> /dev/null | grep __GNUC__ |cut -c18-) 1815 ifdef GNUMAJOR 1816 GNUMINOR=$(shell $(FC) -dM -E - < /dev/null 2> /dev/null | egrep __GNUC_MINOR | cut -c24) 1817 GNU_GE_4_6 = $(shell [ $(GNUMAJOR) -gt 4 ] || [ $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 6 ] && echo true) 1818 GNU_GE_4_8 = $(shell [ $(GNUMAJOR) -gt 4 ] || [ $(GNUMAJOR) -eq 4 -a $(GNUMINOR) -ge 8 ] && echo true) 1819 endif 1820 GNU_GE_6 = $(shell [ $(GNUMAJOR) -ge 6 ] && echo true) 1821 GNU_GE_8 = $(shell [ $(GNUMAJOR) -ge 8 ] && echo true) 1822 GNU_GE_10 = $(shell [ $(GNUMAJOR) -ge 10 ] && echo true) 1823 endif 1824 ifeq ($(GNU_GE_4_6),true) 1825 DEFINES += -DGCC46 1826 endif 1827 ifeq ($(GNU_GE_4_8),true) 1828 ifeq ($(_CPU),ppc64le) 1829 FDEBUG =-O0 -g 1830 else 1831 FDEBUG =-O2 -g 1832 endif 1833 FDEBUG +=-fno-aggressive-loop-optimizations 1834 FOPTIMIZE +=-fno-aggressive-loop-optimizations 1835 FFLAGS_FORGA += -fno-aggressive-loop-optimizations 1836 FOPTIONS += -Warray-bounds 1837 else 1838 FOPTIONS += -Wuninitialized # -Wextra -Wunused 1839 endif 1840 ifeq ($(GNU_GE_8),true) 1841 FOPTIONS += -std=legacy 1842 endif 1843 ifdef USE_OPENMP 1844 FOPTIONS += -fopenmp 1845 LDOPTIONS += -fopenmp 1846 DEFINES += -DUSE_OPENMP 1847 ifdef USE_OPENMP_TASKS 1848 DEFINES += -DUSE_OPENMP_TASKS 1849 endif 1850 ifdef USE_OFFLOAD 1851 DEFINES +=-DUSE_F90_ALLOCATABLE -DOPENMP_OFFLOAD -DUSE_OFFLOAD -DUSE_OMP_TEAMS_DISTRIBUTE 1852 endif 1853 endif 1854 endif 1855 ifeq ($(_FC),gfortran) 1856 ifdef USE_I4FLAGS 1857#does not exists 1858# FOPTIONS += -fdefault-integer-4 1859 else 1860 FOPTIONS += -fdefault-integer-8 1861 endif 1862 else ifeq ($(_FC),crayftn) 1863 ifdef USE_I4FLAGS 1864 FOPTIONS += -s integer32 1865 else 1866 FOPTIONS += -s integer64 1867 endif 1868 else 1869 ifdef USE_I4FLAGS 1870 FOPTIONS += -i4 1871 else 1872 FOPTIONS += -i8 1873 endif 1874 endif 1875 DEFINES += -DEXT_INT 1876# MAKEFLAGS = -j 1 --no-print-directory 1877 ifeq ($(BLAS_LIB),) 1878 CORE_SUBDIRS_EXTRA += blas 1879 endif 1880 ifeq ($(LAPACK_LIB),) 1881 CORE_SUBDIRS_EXTRA += lapack 1882 endif 1883 RANLIB = echo 1884 DEFINES += -DLINUX -DLINUX64 1885 1886 ifeq ($(_CPU),ia64) 1887# Itanium 1888# g77 not working 1889# i4 not working 1890# 1891 1892 FC=ifort 1893 CC=gcc 1894 DEFINES += -DLINUXIA64 1895 COPTIMIZE = -O1 1896 ifdef USE_SHARED 1897 FOPTIONS+= -fPIC 1898 endif 1899 1900 ifeq ($(FC),ifort) 1901 _IFCV9= $(shell ifort -v 2>&1|egrep "Version "|head -n 1|awk '/9./ {print "Y"}; /10./ {print "Y"; exit}') 1902 _IFCV81= $(shell ifort -v 2>&1|egrep "Version "|head -n 1|awk ' /8.1/ {print "Y";exit}; /9./ {print "Y"; exit}; /10./ {print "Y"; exit}') 1903 _IFCV8= $(shell ifort -v 2>&1|egrep "Version "|head -n 1|awk ' /8./ {print "Y";exit}; /9./ {print "Y"; exit}; /10./ {print "Y"; exit}') 1904 ifeq ($(_IFCV8),Y) 1905 DEFINES+= -DIFCV8 1906# FOPTIONS += -quiet 1907 endif 1908 ifeq ($(_IFCV81),Y) 1909 DEFINES+= -DIFCV81 1910 endif 1911 ITANIUMNO = $(shell cat /proc/cpuinfo | egrep family | head -n 1 2>&1 | awk ' /Itanium 2/ { print "-tpp2"; exit };/Itanium/ { print "-tpp1"}') 1912 FOPTIONS += -auto -w -ftz $(ITANIUMNO) 1913 ifdef USE_GPROF 1914 FOPTIONS += -qp 1915 endif 1916 ifdef USE_DEBUG 1917 FOPTIONS += -g 1918 endif 1919 ifeq ($(_IFCV8),Y) 1920 FOPTIONS+= -check nobounds -align dcommons -fpe1 1921 FOPTIONS+= -warn truncated_source 1922 else 1923 FOPTIONS+= -align 1924 endif 1925 DEFINES += -DIFCLINUX 1926 FVECTORIZE = -noalign -O3 -pad -mP2OPT_hlo_level=2 1927 FOPTIMIZE = -O3 -pad -mP2OPT_hlo_level=2 #-mP2OPT_align_array_to_cache_line=TRUE 1928 ifeq ($(_IFCV81),Y) 1929# FOPTIMIZE+= -IPF_fp_relaxed # breaks nwdft/xc/xc_pw91lda 1930 endif 1931 ifeq ($(_IFCV8),Y) 1932# EXTRA_LIBS += -quiet 1933 FDEBUG = -g -O2 1934 else 1935 EXTRA_LIBS += -Vaxlib 1936 FDEBUG = -g -O2 1937 endif 1938 ifeq ($(_IFCV9),Y) 1939 FOPTIONS+= -fltconsistency 1940 endif 1941 ifdef USE_GPROF 1942 EXTRA_LIBS += -qp 1943 endif 1944 LDOPTIONS = -Qoption,link,--relax # -Qoption,link,-Bstatic 1945 ifeq ($(BUILDING_PYTHON),python) 1946 LDOPTIONS += -Qoption,link,--export-dynamic 1947 EXTRA_LIBS += -lutil 1948 endif 1949 LDOPTIONS += $(FDEBUG) 1950 LINK.f = ifort $(LDFLAGS) 1951 else 1952 noefc: 1953 @echo 1954 @echo Please do not set FC on linux/ia64 1955 @echo the makefile will use the Intel compiler 1956 @echo 1957 @exit 1 1958 endif 1959 ifdef USE_SHARED 1960 COPTIONS += -fPIC 1961 endif 1962 1963# CORE_LIBS += $(BLASOPT) -lnwclapack -lnwcblas 1964endif # end of ia32 bit 1965 ifeq ($(_CPU),x86_64) 1966# 1967#edo MAKEFLAGS = -j 2 --no-print-directory 1968 COPTIMIZE = -O1 1969 ifeq ($(NWCHEM_TARGET),CYGWIN64) 1970 DEFINES += -DCYGWIN -DCYGNUS 1971 endif 1972ifeq ($(NWCHEM_TARGET),CATAMOUNT) 1973 FC=pgf90 1974 CC=gcc 1975endif 1976 1977 ifeq ($(_FC),ifort) 1978 _GOTSSE3= $(shell cat /proc/cpuinfo | egrep sse3 | tail -n 1 | awk ' /sse3/ {print "Y"}') 1979 _GOTSSE42= $(shell cat /proc/cpuinfo | egrep sse4_2 | tail -n 1 | awk ' /sse4_2/ {print "Y"}') 1980 _GOTAVX= $(shell cat /proc/cpuinfo | egrep avx | tail -n 1 | awk ' /avx/ {print "Y"}') 1981 _GOTAVX2= $(shell cat /proc/cpuinfo | egrep fma | tail -n 1 | awk ' /fma/ {print "Y"}') 1982 _GOTAVX512F= $(shell cat /proc/cpuinfo | egrep avx512f | tail -n 1 | awk ' /avx512f/ {print "Y"}') 1983 _IFCE = $(shell ifort -V 2>&1 |head -1 |awk ' /64/ {print "Y";exit};') 1984 _IFCV7= $(shell ifort -v 2>&1|egrep "Version "|head -n 1|awk ' /7./ {print "Y";exit}') 1985 _IFCV11= $(shell ifort -logo 2>&1|egrep "Version "|head -n 1|sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 11) {print "Y";exit}}') 1986 _IFCV12= $(shell ifort -logo 2>&1|egrep "Version "|head -n 1|sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 12) {print "Y";exit}}') 1987 _IFCV14= $(shell ifort -logo 2>&1|egrep "Version "|head -n 1|sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 14) {print "Y";exit}}') 1988 _IFCV15ORNEWER=$(shell ifort -logo 2>&1|egrep "Version "|head -n 1 | sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 15) {print "Y";exit}}') 1989 _IFCV17=$(shell ifort -logo 2>&1|egrep "Version "|head -n 1 | sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 17) {print "Y";exit}}') 1990 _IFCV18=$(shell ifort -logo 2>&1|egrep "Version "|head -n 1 | sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 18) {print "Y";exit}}') 1991# Intel EM64T is required 1992 ifneq ($(_IFCE),Y) 1993 defineFCE: 1994 @echo 1995 @echo " " ifort missing or not suitable x86_64 CPUs 1996 @echo 1997 @exit 1 1998 endif 1999 ifneq ($(_IFCV7),Y) 2000# to get EM64T 2001# Intel 8.1 is required 2002 else 2003 @echo ifort 8.1 is required for x86_64 CPUs 2004 @exit 1 2005 endif 2006 FDEBUG= -O2 -g 2007 FOPTIMIZE = -O3 -unroll -ip 2008 FOPTIONS += -align -fpp 2009 ifdef USE_OFFLOAD 2010 EXPLICITF = TRUE 2011 CPP=fpp -P 2012 endif 2013# might be not need and the root cause for https://github.com/nwchemgit/nwchem/issues/255 2014# CPP=fpp -P 2015 ifeq ($(_IFCV15ORNEWER), Y) 2016# fpp seems to get lost with ifort 15 in the offload bit 2017# only use EXPLICITF for offload because otherwise we want debugging to be easy 2018# FOPTIONS += -Qoption,fpp,-P -Qoption,fpp,-c_com=no -allow nofpp_comments 2019 ifdef USE_OPTREPORT 2020 FOPTIONS += -qopt-report-file=stderr 2021 FOPTIONS += -qopt-report=3 -qopt-report-phase=vec,cg,loop,ipo 2022 ifeq ($(_IFCV17), Y) 2023 FOPTIONS += -qopt-report-annotate-position=both 2024 endif 2025 FOPTIONS += -qopt-report-file=stderr 2026 endif 2027#to avoid compiler crashes on simd directive. e.g .Version 15.0.2.164 Build 20150121 2028 ifdef USE_NOSIMD 2029 FOPTIONS += -no-simd 2030 endif 2031 ifdef USE_OPENMP 2032 FOPTIONS += -qopenmp 2033 ifdef USE_OPTREPORT 2034 FOPTIONS += -qopt-report-phase=openmp 2035 endif 2036 DEFINES+= -DUSE_OPENMP 2037 ifdef USE_OPENMP_TASKS 2038 DEFINES += -DUSE_OPENMP_TASKS 2039 endif 2040 else 2041 FOPTIONS += -qno-openmp 2042 endif 2043 else 2044 FOPTIONS += -vec-report6 2045 ifdef USE_OPENMP 2046 FOPTIONS += -openmp 2047 FOPTIONS += -openmp-report2 2048 DEFINES+= -DUSE_OPENMP 2049 ifdef USE_OPENMP_TASKS 2050 DEFINES += -DUSE_OPENMP_TASKS 2051 endif 2052 endif 2053 endif 2054 ifdef USE_VTUNE 2055 ifeq ($(VTUNE_AMPLIFIER_XE_DIR),) 2056 $(info USE_VTUNE requires VTUNE_AMPLIFIER_XE_DIR to be set) 2057 $(error ) 2058 endif 2059 COPTIONS += -I$(VTUNE_AMPLIFIER_XE_DIR)/include 2060 FOPTIONS += -DUSE_VTUNE 2061 LDOPTIONS += -L$(VTUNE_AMPLIFIER_XE_DIR)/lib64 2062 EXTRA_LIBS += -littnotify 2063 endif 2064 ifdef USE_OPENMP 2065 ifeq ($(_IFCV15ORNEWER), Y) 2066 FOPTIONS += -qno-openmp-offload 2067 else 2068 ifeq ($(_IFCV14), Y) 2069 FOPTIONS += -no-openmp-offload 2070 endif 2071 endif 2072 endif 2073 DEFINES+= -DIFCV8 -DIFCLINUX 2074 ifeq ($(FC),ifc) 2075 FOPTIONS += -quiet 2076 endif 2077 ifdef USE_FPE 2078 FOPTIONS += -fpe0 -traceback #-fp-model precise 2079 endif 2080 ifeq ($(_IFCV11),Y) 2081#next 2 lines needed for fp accuracy 2082 FDEBUG += -fp-model source 2083 ifeq ($(_IFCV12),Y) 2084 FOPTIONS += -fimf-arch-consistency=true 2085 endif 2086 ifdef USE_KNL 2087 FOPTIMIZE += -xMIC-AVX512 2088#illegal instr? FOPTIONS += -qopt-assume-safe-padding 2089 FOPTIONS += -align array64byte 2090 DEFINES+= -DINTEL_64ALIGN 2091 else 2092# FOPTIMIZE += -xHost 2093#crazy simd options 2094 ifeq ($(_IFCV17), Y) 2095 ifeq ($(_GOTAVX512F),Y) 2096 FOPTIMIZE += -axCORE-AVX512 2097 else ifeq ($(_GOTAVX2),Y) 2098 FOPTIMIZE += -axCORE-AVX2 2099 else ifeq ($(_GOTAVX),Y) 2100 FOPTIMIZE += -axAVX 2101 else ifeq ($(_GOTSSE42),Y) 2102 FOPTIMIZE += -axSSE4.2 2103 endif 2104 endif 2105 endif 2106 FOPTIONS += -finline-limit=250 2107 else 2108 ifeq ($(_GOTSSE3),Y) 2109 FOPTIMIZE += -xP -no-prec-div 2110 else 2111 FOPTIMIZE += -tpp7 -ip 2112 FOPTIMIZE += -xW 2113 endif 2114 endif 2115 2116 2117 # configuration options for MEMKIND library on Intel Xeon Phi processors 2118 ifdef USE_FASTMEM 2119 ifdef MEMKIND_PATH 2120 FASTMEM_OPTIONS_LD += -L$(MEMKIND_PATH) 2121 endif 2122 ifdef USE_MEMKIND_TBB 2123 FASTMEM_OPTIONS_LD += -L$(TBB_PATH) 2124 endif 2125 FASTMEM_OPTIONS_LD += -lmemkind 2126 ifdef USE_MEMKIND_TBB 2127 FASTMEM_OPTIONS_LD += -ltbbmalloc 2128 endif 2129 EXTRA_LIBS += $(FASTMEM_OPTIONS_LD) 2130 # we need to use ALLOCATABLE data for MEMKIND 2131 DEFINES += -DUSE_F90_ALLOCATABLE -DUSE_FASTMEM 2132 endif 2133 2134 endif # _FC = ifort (i think) 2135# 2136 ifeq ($(_FC),pgf90) 2137 FOPTIONS += -Mdalign -Mllalign -Kieee 2138# FOPTIONS += -tp k8-64 2139# FOPTIONS += -Ktrap=fp 2140 FOPTIMIZE = -O3 -fastsse -Mnounroll -Minfo=loop -Mipa=fast 2141 FVECTORIZE = -fast -fastsse -O3 -Mipa=fast 2142 FDEBUG = -g -O2 2143 DEFINES += -DCHKUNDFLW -DPGLINUX 2144 ifdef USE_OPENMP 2145 FOPTIONS += -mp -Minfo=mp 2146 LDOPTIONS += -mp 2147 DEFINES += -DUSE_OPENMP 2148 ifdef USE_OPENMP_TASKS 2149 DEFINES += -DUSE_OPENMP_TASKS 2150 endif 2151 endif 2152 ifeq ($(FC),ftn) 2153 LINK.f = ftn $(LDFLAGS) $(FOPTIONS) 2154 endif 2155 ifeq ($(NWCHEM_TARGET),CATAMOUNT) 2156 LINK.f = ftn $(LDFLAGS) $(FOPTIONS) 2157 endif 2158 endif 2159 ifeq ($(FC),pathf90) 2160#pathscale 1.3 compiler 2161# tested Sep 30 2004 on RH AW3 2162 FOPTIONS += -cpp -Wp,-P 2163 FOPTIONS += -fno-second-underscore -fixedform 2164 FOPTIONS += -align64 2165# FOPTIONS += -LANG:heap_allocation_threshold=0 2166 FOPTIMIZE = -O3 -OPT:Ofast:IEEE_arith=1:IEEE_NaN_inf=ON:Olimit=12000:ro=1:fold_reassociate=ON#:div_split=OFF:fast_nint=OFF 2167 FVECTORIZE = -O3 -OPT:Ofast:ro=1 -fno-math-errno 2168 DEFINES += -DCHKUNDFLW -DPSCALE 2169 FDEBUG = -g -O1 2170 LDOPTIONS = -Wl,--warn-once -Wl,--relax 2171 endif 2172 ifeq ($(_CC),pgcc) 2173# COPTIONS = -O 2174 endif 2175 ifeq ($(_CC),icc) 2176 ICCV15ORNEWER=$(shell icc -V 2>&1|egrep "Version "|head -n 1 | sed 's/.*Version \([0-9][0-9]\).*/\1/' | awk '{if ($$1 >= 15) {print "Y";exit}}') 2177 ifdef USE_KNL 2178 COPTIONS += -xMIC-AVX512 -ftz 2179 DEFINES+= -DINTEL_64ALIGN 2180 else 2181# COPTIONS += -xHost -ftz 2182 COPTIONS += -ftz 2183 endif 2184 ifeq ($(ICCV15ORNEWER), Y) 2185 ifdef USE_OPTREPORT 2186 COPTIONS += -qopt-report-phase=vec -qopt-report-file=stderr 2187 endif 2188 ifdef USE_OPENMP 2189 COPTIONS += -qopenmp 2190 ifdef USE_OPTREPORT 2191 COPTIONS += -qopt-report-phase:openmp 2192 endif 2193 endif 2194 else 2195 COPTIONS += -vec-report=1 2196 ifdef USE_OPENMP 2197 COPTIONS += -openmp 2198 COPTIONS += -openmp-report=2 2199 endif 2200 endif 2201 COPTIMIZE = -O3 2202 COPTIMIZE += -ip -no-prec-div 2203 endif 2204 ifeq ($(_CC),gcc) 2205 COPTIONS += -O3 -funroll-loops -ffast-math 2206 ifdef USE_OPENMP 2207 COPTIONS += -fopenmp 2208 endif 2209 endif 2210 ifdef USE_GCC34 2211 COPTIONS += -march=k8 -mtune=k8 2212 endif 2213# CORE_LIBS += $(BLASOPT) -lnwclapack -lnwcblas 2214 ifdef USE_GPROF 2215 ifeq ($(NWCHEM_TARGET),CATAMOUNT) 2216 FOPTIONS += -Mprof=func#,lines 2217 LDOPTIONS += -Mprof=func#,lines 2218 COPTIONS += -O2 -finstrument-functions 2219 else 2220 FOPTIONS += -pg 2221 COPTIONS += -pg 2222 LDOPTIONS += -pg 2223 LDFLAGS += -pg 2224 endif 2225 endif 2226 ifdef USE_DEBUG 2227 FOPTIONS += -g 2228 COPTIONS += -g 2229 LDOPTIONS += -g 2230 LDFLAGS += -g 2231 endif 2232 2233 ifeq ($(_FC),gfortran) 2234#gcc version 4.1.0 20050525 (experimental) 2235 ifdef USE_GPROF 2236 FOPTIONS += -pg 2237 COPTIONS += -pg 2238 LDOPTIONS += -pg 2239 LDFLAGS += -pg 2240 endif 2241 ifdef USE_DEBUG 2242 FOPTIONS += -g 2243 COPTIONS += -g 2244 LDOPTIONS += -g 2245 LDFLAGS += -g 2246 endif 2247 LINK.f = $(FC) $(LDFLAGS) 2248 FOPTIMIZE += -O3 2249 FOPTIMIZE += -mfpmath=sse # 2250 ifeq ($(GNU_GE_6),true) 2251 FOPTIMIZE += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 2252 FOPTIONS += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 2253 FDEBUG += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 2254 endif 2255 2256 ifndef USE_FPE 2257 FOPTIMIZE += -ffast-math #2nd time 2258 endif 2259 ifneq ($(FC),flang) 2260 FOPTIMIZE += -fprefetch-loop-arrays #-ftree-loop-linear 2261 endif 2262 ifeq ($(GNU_GE_4_8),true) 2263 FOPTIMIZE += -ftree-vectorize 2264 ifdef USE_OPTREPORT 2265 FOPTIMIZE += -fopt-info-vec 2266 endif 2267 endif 2268 2269 FDEBUG += -g -O 2270 ifdef USE_F2C 2271#possible segv with use of zdotc (e.g. with GOTO BLAS) 2272#http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20178 2273 FOPTIONS += -ff2c -fno-second-underscore 2274 endif 2275 ifeq ($(GNU_GE_4_6),true) 2276 FOPTIMIZE += -mtune=native 2277 FOPTIONS += -finline-functions 2278 endif 2279# FVECTORIZE += -ftree-vectorize -ftree-vectorizer-verbose=1 2280 ifdef USE_FPE 2281 FOPTIONS += -ffpe-trap=invalid,zero,overflow -fbacktrace 2282 endif 2283 ifeq ($(GOTMINGW64),1) 2284 EXTRA_LIBS += -lwsock32 2285 endif 2286 else 2287 endif 2288 ifeq ($(_FC),crayftn) 2289 # Jeff: Cray Fortran supports preprocessing as of version 8.2.2 (at least) 2290 EXPLICITF = FALSE 2291 CPP = /usr/bin/cpp -P -C -traditional 2292 CPPFLAGS += -DCRAYFORTRAN -DUSE_POSIXF 2293 FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f 2294 # USE_POSIXF is required because getlog is provided (GNU extension) 2295 FOPTIONS += -Ktrap=fp# -DCRAYFORTRAN -DUSE_POSIXF 2296 FDEBUG = -g 2297 FOPTIMIZE = -O2 -O scalar3,thread0,vector2,ipa2 #-rdm 2298 endif 2299 ifeq ($(_FC),craycc) 2300 COPTIONS = -O 2301 endif 2302endif 2303 2304ifeq ($(_CPU),$(findstring $(_CPU),aarch64)) 2305 2306 ifeq ($(_CC),gcc) 2307 COPTIONS += -O3 -funroll-loops -ffast-math 2308 ifdef USE_OPENMP 2309 COPTIONS += -fopenmp 2310 endif 2311 endif 2312 2313 ifeq ($(_CC),armclang) 2314 COPTIONS += -O3 -funroll-loops -mcpu=native -armpl 2315 ifdef USE_OPENMP 2316 COPTIONS += -fopenmp 2317 endif 2318 endif 2319 2320 ifeq ($(_FC),gfortran) 2321 ifdef USE_GPROF 2322 FOPTIONS += -pg 2323 COPTIONS += -pg 2324 LDOPTIONS += -pg 2325 LDFLAGS += -pg 2326 endif 2327 LINK.f = $(FC) $(LDFLAGS) 2328 FOPTIMIZE += -O3 2329 ifeq ($(GNU_GE_6),true) 2330 FOPTIMIZE += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 2331 FOPTIONS += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 2332 FDEBUG += -fno-tree-dominator-opts # solvation/hnd_cosmo_lib breaks 2333 endif 2334 2335 FOPTIMIZE += -fprefetch-loop-arrays #-ftree-loop-linear 2336 ifeq ($(GNU_GE_4_8),true) 2337 FOPTIMIZE += -ftree-vectorize -fopt-info-vec 2338 endif 2339 2340 FDEBUG += -g -O 2341 2342 ifeq ($(GNU_GE_4_6),true) 2343 FOPTIMIZE += -mtune=native 2344 FOPTIONS += -finline-functions 2345 endif 2346 ifndef USE_FPE 2347 FOPTIMIZE += -ffast-math #2nd time 2348 endif 2349 ifdef USE_FPE 2350 FOPTIONS += -ffpe-trap=invalid,zero,overflow -fbacktrace 2351 endif 2352 endif # end of gfortran 2353 2354 ifeq ($(FC),armflang) 2355 2356 ifdef USE_SHARED 2357 FOPTIONS+= -fPIC 2358 endif 2359 2360 DEFINES += -DARMFLANG 2361 LINK.f = $(FC) $(LDFLAGS) 2362 FOPTIMIZE = -O3 -Mfma -ffp-contract=fast -fno-backslash 2363 ifeq ($(V),1) 2364 $(info ARMFLANG FOPTIMIZE = ${FOPTIMIZE}) 2365 endif 2366 2367 FDEBUG += -g -O 2368 FOPTIMIZE += -mtune=native -armpl 2369 2370 ifndef USE_FPE 2371 FOPTIMIZE += -ffast-math #2nd time 2372 endif 2373 ifdef USE_FPE 2374 FOPTIONS += -ffpe-trap=invalid,zero,overflow -fbacktrace 2375 endif 2376 endif 2377endif # end of aarch64 2378 2379ifeq ($(_CPU),$(findstring $(_CPU), ppc64 ppc64le)) 2380# Tested on Red Hat Enterprise Linux AS release 3 (Taroon Update 3) 2381# Tested on SLES 9 2382# Feb 5th 2005 2383# xlf v9.1 2384# xlc v7.0 2385# gcc-3.2.3-42 2386 2387#gfortran become default FC=xlf 2388# CC=gcc 2389 ifeq ($(CC),xlc) 2390 COPTIONS += -q64 -qlanglvl=extended 2391 else 2392#this for gcc/cc 2393 COPTIONS += -m64 -O 2394 endif 2395 ifeq ($(_FC),xlf) 2396#RSQRT=y breaks intchk QA 2397 FOPTIONS = -q64 -qextname -qfixed #-qnosave #-qalign=4k 2398 FOPTIONS += -NQ40000 -NT80000 -qmaxmem=8192 -qxlf77=leadzero 2399 ifdef USE_GPROF 2400 FOPTIONS += -pg 2401 LDOPTIONS += -pg 2402 endif 2403 ifdef USE_DEBUG 2404 FOPTIONS += -g 2405 LDOPTIONS += -g 2406 endif 2407 FOPTIMIZE= -O3 -qstrict -qcache=auto 2408#qarch and qtune break trobsa.F with xlf 15.1.2 2409# FOPTIMIZE+= -qarch=auto -qtune=auto 2410 FDEBUG= -O2 -g 2411# XLFMAC=y 2412 DEFINES += -DXLFLINUX -DCHKUNDFLW 2413 ifdef USE_OPENMP 2414 DEFINES += -DUSE_OPENMP 2415 FOPTIONS += -qsmp=omp 2416 ifdef USE_OFFLOAD 2417 DEFINES +=-DUSE_F90_ALLOCATABLE -DOPENMP_OFFLOAD -DUSE_OFFLOAD -DUSE_OMP_TEAMS_DISTRIBUTE 2418 OFFLOAD_FOPTIONS = -qtgtarch=sm_70 -qoffload 2419 LDOPTIONS += -qoffload -lcudart -L$(NWC_CUDAPATH) 2420 endif 2421 endif 2422 ifdef USE_I4FLAGS 2423 FOPTIONS += -qintsize=4 2424 else 2425 FOPTIONS += -qintsize=8 2426 endif 2427 endif 2428# CORE_LIBS += $(BLASOPT) -lnwclapack -lnwcblas 2429# EXTRA_LIBS += -dynamic-linker /lib64/ld64.so.1 -melf64ppc -lxlf90_r -lxlopt -lxlomp_ser -lxl -lxlfmath -ldl -lm -lc -lgcc -lm 2430 endif 2431 ifeq ($(_FC),pgf90) 2432 FOPTIONS += -Mcache_align # -Kieee 2433# FOPTIMIZE = -O3 -Mnounroll -Minfo=loop -Mipa=fast 2434 FOPTIMIZE = -fast -O3 -Mvect=simd -Munroll -Minfo=loop # -Mipa=fast 2435 FVECTORIZE = -fast -O3 #-Mipa=fast 2436 FDEBUG = -g -O2 2437 DEFINES += -DCHKUNDFLW -DPGLINUX 2438 ifdef USE_OPENMP 2439 FOPTIONS += -mp -Minfo=mp 2440 LDOPTIONS += -mp 2441 DEFINES += -DUSE_OPENMP 2442 ifdef USE_OPENMP_TASKS 2443 DEFINES += -DUSE_OPENMP_TASKS 2444 endif 2445 endif 2446 endif 2447 2448ifeq ($(NWCHEM_TARGET),CATAMOUNT) 2449 DEFINES += -DCATAMOUNT 2450endif 2451 2452 # Jeff: FreeBSD does not link libm automatically with flang 2453 ifeq ($(USE_FLANG),1) 2454 EXTRA_LIBS += -lm 2455 endif 2456 2457endif 2458endif 2459#endof of LINUX64 2460 2461ifeq ($(TARGET),$(findstring $(TARGET),BGL BGP BGQ)) 2462# 2463 CORE_SUBDIRS_EXTRA = lapack blas 2464 ARFLAGS = urs 2465 INSTALL = @echo $@ is built 2466 CPP=/usr/bin/cpp -P -C -traditional 2467 LDOPTIONS = -Wl,--relax 2468 2469 DEFINES = -DLINUX 2470 FDEBUG = -g 2471 COPTIMIZE = -g 2472 FOPTIMIZE = -g 2473 FOPTIONS = -g 2474 DEFINES += -DCHKUNDFLW 2475 2476#for BGL 2477 ifeq ($(TARGET),BGL) 2478 EXPLICITF = TRUE 2479 DEFINES += -DBGML -DBGL 2480 FC = blrts_xlf 2481 CC = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-gcc 2482 AR = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-ar 2483 AS = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-as 2484 RANLIB = $(BGCOMPILERS)/powerpc-bgl-blrts-gnu-ranlib 2485 DEFINES += -DXLFLINUX -DBGL 2486 FOPTIMIZE += -qarch=440 -qtune=440 -qfloat=rsqrt:fltint 2487 FOPTIONS = -qEXTNAME -qxlf77=leadzero -NQ40000 -NT80000 -NS2048 -qmaxmem=8192 2488 endif 2489 2490#for BGP 2491 ifeq ($(TARGET),BGP) 2492 EXPLICITF = TRUE 2493 DEFINES += -DDCMF -DBGP 2494 FC = mpixlf77_r 2495 CC = mpicc 2496 AR = powerpc-bgp-linux-ar 2497 AS = powerpc-bgp-linux-as 2498 RANLIB = powerpc-bgp-linux-ranlib 2499 DEFINES += -DXLFLINUX 2500 FOPTIONS = -qEXTNAME -qxlf77=leadzero -NQ40000 -NT80000 -NS2048 -qmaxmem=8192 2501 FOPTIONS += -O3 -qstrict -qthreaded -qnosave -qalign=4k 2502 FOPTIMIZE += -O3 -qarch=450d -qtune=450 -qcache=auto -qunroll=auto -qfloat=rsqrt:fltint 2503 XLF11 = $(shell bgxlf -qversion 2>&1|grep Version|head -1| awk ' / 11./ {print "Y"}') 2504 endif 2505 2506#for BGQ 2507 ifeq ($(TARGET),BGQ) 2508 DEFINES += -DPAMI -DBGQ 2509 DEFINES += -DEAFHACK -DNOFSCHECK 2510 AR = powerpc64-bgq-linux-ar 2511 AS = powerpc64-bgq-linux-as 2512 RANLIB = powerpc64-bgq-linux-ranlib 2513 2514 #FC = mpif77 2515 FC = mpixlf77_r 2516 _FC = xlf 2517 2518 ifeq ($(FC),mpif77) 2519 CC = mpicc 2520 DEFINES += -DGFORTRAN -DGCC4 2521 2522 FOPTIONS += -g -funderscoring -Wuninitialized 2523 FOPTIMIZE += -O3 -ffast-math 2524 FDEBUG += -O1 -g 2525 2526 # EXT_INT means 64-bit integers are used 2527 DEFINES += -DEXT_INT 2528ifndef USE_I4FLAGS 2529 FOPTIONS += -fdefault-integer-8 2530endif 2531 2532 # linking ESSL is painful with gfortran 2533 CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas 2534 2535 # Here is an example for ALCF: 2536 # IBMCMP_ROOT=${IBM_MAIN_DIR} 2537 # BLAS_LIB=/soft/libraries/alcf/current/xl/BLAS/lib 2538 # LAPACK_LIB=/soft/libraries/alcf/current/xl/LAPACK/lib 2539 # ESSL_LIB=/soft/libraries/essl/current/essl/5.1/lib64 2540 # XLF_LIB=${IBMCMP_ROOT}/xlf/bg/14.1/bglib64 2541 # XLSMP_LIB=${IBMCMP_ROOT}/xlsmp/bg/3.1/bglib64 2542 # XLMASS_LIB=${IBMCMP_ROOT}/xlmass/bg/7.3/bglib64 2543 # MATH_LIBS="-L${XLMASS_LIB} -lmass -L${LAPACK_LIB} -lnwclapack \ 2544 -L${ESSL_LIB} -lesslsmpbg -L${XLF_LIB} -lxlf90_r \ 2545 -L${XLSMP_LIB} -lxlsmp -lxlopt -lxlfmath -lxl \ 2546 -Wl,--allow-multiple-definition" 2547 # Note that ESSL _requires_ USE_64TO32 on Blue Gene 2548 endif 2549 2550 ifeq ($(FC),mpixlf77_r) 2551 EXPLICITF = TRUE 2552 _FC = xlf 2553 CC = mpixlc_r 2554 DEFINES += -DXLFLINUX 2555 XLF11 = $(shell bgxlf -qversion 2>&1|grep Version|head -1| awk ' / 11./ {print "Y"}') 2556 XLF14 = $(shell bgxlf -qversion 2>&1|grep Version|head -1| awk ' / 14./ {print "Y"}') 2557 2558 # EXT_INT means 64-bit integers are used 2559 DEFINES += -DEXT_INT 2560 2561 ifdef USE_I4FLAGS 2562 FOPTIONS = -qintsize=4 2563 ifeq ($(BLAS_SIZE),8) 2564 @echo "You cannot use BLAS with 64b integers when" 2565 @echo "the compiler generates 32b integers (USE_I4FLAGS)!" 2566 @exit 1 2567 endif # BLAS_SIZE 2568 else 2569 FOPTIONS = -qintsize=8 2570 ifeq ($(BLAS_SIZE),4) 2571 ifneq ($(USE_64TO32),y) 2572 @echo "You cannot use BLAS with 32b integers when" 2573 @echo "the compiler generates 64b integers unless" 2574 @echo "you do the 64-to-32 conversion!" 2575 @exit 1 2576 endif # USE_64TO32 2577 endif # BLAS_SIZE 2578 endif # USE_I4FLAGS 2579 2580 FDEBUG = -g -qstrict -O3 2581 FOPTIONS += -g -qEXTNAME -qxlf77=leadzero 2582 FOPTIONS += -qthreaded -qnosave # -qstrict 2583# FOPTIMIZE += -g -O3 -qarch=qp -qtune=qp -qcache=auto -qunroll=auto -qfloat=rsqrt 2584 FOPTIMIZE += -O3 -qarch=qp -qtune=qp -qsimd=auto -qhot=level=1 -qprefetch -qunroll=yes #-qnoipa 2585 FOPTIMIZE += -qreport -qsource -qlistopt -qlist # verbose compiler output 2586 2587 # ESSL dependencies should be provided by XLF linker 2588 CORE_LIBS += -lnwclapack $(BLASOPT) -lnwcblas 2589 endif 2590 2591 endif # end BGQ 2592 2593 2594endif 2595 2596 2597################################################################### 2598# All machine dependent sections should be above here, otherwise # 2599# some of the definitions below will be 'lost' # 2600################################################################### 2601ifeq ($(BUILDING_PYTHON),python) 2602ifdef PYTHONVERSION 2603 GOTPYTHON := $(shell command -v python$(PYTHONVERSION) 2> /dev/null) 2604ifndef GOTPYTHON 2605errorpythonXY: 2606$(info ) 2607$(info python$(PYTHONVERSION) not found in your PATH) 2608$(info ) 2609$(error ) 2610 endif 2611# check presence of python?-config 2612 GOT_PYTHONCONFIG := $(shell command -v python$(PYTHONVERSION)-config 2> /dev/null) 2613else 2614#try python3 first, then python 2615 GOTPYTHON3 := $(shell command -v python3 2> /dev/null) 2616 GOTPYTHON2 := $(shell command -v python2 2> /dev/null) 2617 GOTPYTHON := $(shell command -v python 2> /dev/null) 2618 ifdef GOTPYTHON3 2619 PYTHONVERSION=$(shell python3 -V 2>&1 |cut -c 8-10) 2620 else ifdef GOTPYTHON2 2621 PYTHONVERSION=$(shell python2 -V 2>&1 |cut -c 8-10) 2622 else ifdef GOTPYTHON 2623#last try at python2 2624 PYTHONVERSION=$(shell python -V 2>&1 |cut -c 8-10) 2625 else 2626errorpython3: 2627$(info ) 2628$(info Neither python2 nor python3 found in your PATH)$ 2629$(info ) 2630$(error ) 2631 endif 2632# check presence of python?-config 2633 GOT_PYTHONCONFIG := $(shell command -v python$(PYTHONVERSION)-config 2> /dev/null) 2634 ifndef GOT_PYTHONCONFIG 2635 ifdef GOTPYTHON3 2636 GOT_PYTHONCONFIG := $(shell command -v python3-config 2> /dev/null) 2637 else ifdef GOTPYTHON2 2638 GOT_PYTHONCONFIG := $(shell command -v python2-config 2> /dev/null) 2639 else ifdef GOTPYTHON 2640 GOT_PYTHONCONFIG := $(shell command -v python-config 2> /dev/null) 2641 endif 2642 endif 2643 endif 2644ifndef GOT_PYTHONCONFIG 2645errorpythonconfig:$ 2646$(info ) 2647$(info python-config not found in your PATH) 2648$(info Please install the packages) 2649PYMAJOR:=$(word 1, $(subst ., ,$(PYTHONVERSION))) 2650$(info python$(PYMAJOR)-dev (Ubuntu/Debian) or) 2651$(info python$(PYMAJOR)-devel (Redhat/Fedora/Centos)) 2652$(info ) 2653$(error ) 2654endif 2655#ifdef USE_PYTHONCONFIG 2656PYMAJOR:=$(word 1, $(subst ., ,$(PYTHONVERSION))) 2657 PYMINOR:=$(word 2, $(subst ., ,$(PYTHONVERSION))) 2658 PYGE38:=$(shell [ $(PYMAJOR) -ge 3 -a $(PYMINOR) -ge 8 ] && echo true) 2659 ifeq ($(PYGE38),true) 2660 PYCFG= python$(PYTHONVERSION)-config --ldflags --embed 2661 ifeq ($(shell uname -s),Darwin) 2662 PYCFG += | sed -e "s/-lintl //" 2663 endif 2664 else 2665 PYCFG = python$(PYTHONVERSION)-config --ldflags 2666 endif 2667 EXTRA_LIBS += -lnwcutil $(shell $(PYCFG)) 2668else 2669ifndef PYTHONLIBTYPE 2670 PYTHONLIBTYPE=a 2671endif 2672ifndef PYTHONCONFIGDIR 2673 PYTHONCONFIGDIR=config 2674endif 2675#endif #USE_PYTHONCONFIG 2676endif 2677# 2678###### 2679#PAPI# 2680###### 2681 2682ifdef USE_PAPI 2683 DEFINES += -DUSE_PAPI 2684 ifndef PAPI_LIB 2685 papierror1: 2686 echo You must define PAPI_LIB in your environment to be the path 2687 @echo of your PAPI library installation ... something like 2688 @echo setenv PAPI_LIB ~/papi/lib 2689 @exit 1 2690 endif 2691 ifndef PAPI_INCLUDE 2692 papierror2: 2693 @echo You must define PAPI_INCLUDE in your environment to be the path 2694 @echo of your PAPI headers installation ... something like 2695 @echo setenv PAPI_INCLUDE ~/papi/include 2696 @exit 1 2697 endif 2698 ifndef LIBPAPI 2699 LIBPAPI = -lpapi 2700 endif 2701 CORE_LIBS += -L$(PAPI_LIB) $(LIBPAPI) 2702 INCPATH += -I$(PAPI_INCLUDE) 2703endif 2704ifdef USE_YFLOP 2705 ifndef USE_64TO32 2706 yfloperr: 2707 @echo You must define USE_64TO32 in your environment 2708 @echo to use the USE_YFLOP env. variable 2709 @echo 2710 @exit 1 2711 endif 2712 DEFINES += -DUSE_YFLOP 2713endif 2714 2715# 2716ifdef USE_FDIST 2717 DEFINES += -DFDIST 2718endif 2719 2720#_USE_SCALAPACK = $(shell cat ${NWCHEM_TOP}/src/tools/build/config.h | awk ' /HAVE_SCALAPACK 1/ {print "Y"}') 2721#case guard against case when tools have not been compiled yet 2722 ifeq ("$(wildcard ${GA_PATH}/bin/ga-config)","") 2723 else 2724_USE_SCALAPACK = $(shell ${GA_PATH}/bin/ga-config --use_scalapack| awk ' /1/ {print "Y"}') 2725endif 2726 2727ifeq ($(_USE_SCALAPACK),Y) 2728 DEFINES += -DSCALAPACK 2729 ifeq ($(XLFBREN),y) 2730 CORE_LIBS += -brename:.iceil_,.iceil \ 2731 -brename:.blacs_pinfo_,.blacs_pinfo \ 2732 -brename:.blacs_get_,.blacs_get \ 2733 -brename:.blacs_gridinit_,.blacs_gridinit \ 2734 -brename:.blacs_gridinfo_,.blacs_gridinfo \ 2735 -brename:.blacs_gridexit_,.blacs_gridexit \ 2736 -brename:.indxg2p_,.indxg2p \ 2737 -brename:.descinit_,.descinit \ 2738 -brename:.numroc_,.numroc \ 2739 -brename:.pdlamch_,.pdlamch \ 2740 -brename:.pdsyev_,.pdsyev \ 2741 -brename:.pdsyevd_,.pdsyevd \ 2742 -brename:.pdsyevx_,.pdsyevx \ 2743 -brename:.pdsygvx_,.pdsygvx \ 2744 -brename:.pdpotri_,.pdpotri \ 2745 -brename:.pdpotrf_,.pdpotrf \ 2746 -brename:.pdpotrs_,.pdpotrs \ 2747 -brename:.pdgetrf_,.pdgetrf \ 2748 -brename:.pdgetrs_,.pdgetrs 2749 endif 2750endif 2751CORE_LIBS += $(ELPA) $(SCALAPACK) $(SCALAPACK_LIB) 2752 2753ifdef USE_64TO32 2754 CORE_LIBS += -l64to32 2755 NWSUBDIRS += 64to32blas 2756endif 2757ifdef BLASOPT 2758 CORE_LIBS += $(BLASOPT) 2759endif 2760ifeq ($(LAPACK_LIB),) 2761 CORE_LIBS += -lnwclapack 2762else 2763 CORE_LIBS += $(LAPACK_LIB) 2764endif 2765ifeq ($(BLAS_LIB),) 2766 CORE_LIBS += -lnwcblas 2767else 2768 CORE_LIBS += $(BLAS_LIB) 2769endif 2770 2771ifdef BLASOPT 2772BLAS_SUPPLIED=Y 2773endif 2774ifdef BLAS_LIB 2775BLAS_SUPPLIED=Y 2776endif 2777ifndef BLAS_SUPPLIED 2778 ifndef USE_INTERNALBLAS 2779 errordgemm: 2780 $(info ) 2781 $(info NWChem's Performance is degraded by not setting BLASOPT) 2782 $(info Please consider using ATLAS, GotoBLAS2, OpenBLAS, Intel MKL,) 2783 $(info IBM ESSL, AMD ACML, etc. to improve performance.) 2784 $(info If you decide to not use a fast implementation of BLAS/LAPACK,) 2785 $(info please define USE_INTERNALBLAS=y and the internal Netlib will be used.) 2786 endif 2787else 2788 ifndef LAPACK_LIB 2789 errorlap1: 2790 $(error Please define LAPACK_LIB if you have defined BLASOPT or BLAS_LIB) 2791 endif 2792endif 2793 2794ifdef USE_NOIO 2795 DEFINES += -DNOIO -DEAFHACK 2796endif 2797 2798 2799ifdef USE_SUBGROUPS 2800 DEFINES += -DGANXTVAL -DUSE_SUBGROUPS 2801 #turn off peigs for now 2802else 2803 ifneq ($(GOTMINGW64),1) 2804 DEFINES += -DPARALLEL_DIAG 2805 endif 2806endif 2807################################################################### 2808# All machine dependent sections should be above here, otherwise # 2809# some of the definitions below will be 'lost' # 2810################################################################### 2811#the new GA uses ARMCI library 2812ifdef OLD_GA 2813 CORE_LIBS += -larmci 2814else 2815 ifeq ($(ARMCI_NETWORK),ARMCI) 2816 ifdef EXTERNAL_ARMCI_PATH 2817 CORE_LIBS += -L$(EXTERNAL_ARMCI_PATH)/lib -larmci 2818 else 2819 CORE_LIBS += -larmci 2820 endif 2821 else 2822 CORE_LIBS += 2823 endif 2824endif 2825 2826# MPI version requires tcgmsg-mpi library 2827 2828ifdef USE_MPI 2829 #ifeq ($(FC),$(findstring $(FC),mpifrt mpfort mpif77 mpxlf mpif90 ftn scorep-ftn)) 2830 ifeq ($(FC),$(findstring $(FC), ftn scorep-ftn)) 2831 LIBMPI = 2832 MPI_INCLUDE = 2833 MPI_LIB = 2834 else 2835 ifndef MPI_INCLUDE 2836 # check if mpif90 is present 2837 MPIF90YN = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include) 2838 ifeq ($(MPIF90YN),mpif90notfound) 2839 errormpif90: 2840$(info ) 2841$(info mpif90 not found. Please add its location to PATH) 2842$(info e.g. export PATH=/usr/local/bin:/usr/lib64/openmpi/bin:...) 2843$(info ) 2844 endif 2845 MPI_INCLUDE = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_include) 2846 endif 2847 ifndef MPI_LIB 2848 MPI_LIB = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --mpi_lib) 2849 endif 2850 ifndef LIBMPI 2851 LIBMPI = $(shell $(NWCHEM_TOP)/src/tools/guess-mpidefs --libmpi) 2852 endif 2853 endif 2854 ifdef MPI_LIB 2855 CORE_LIBS += $(patsubst -L-L%,-L%,-L$(MPI_LIB)) 2856 endif 2857 ifdef OLD_GA 2858 CORE_LIBS += -ltcgmsg-mpi $(LIBMPI) 2859 else 2860 CORE_LIBS += $(LIBMPI) 2861 endif 2862 else 2863 ifdef OLD_GA 2864 CORE_LIBS += -ltcgmsg 2865 else 2866 CORE_LIBS += 2867 endif 2868endif 2869 2870 2871# FFTW3 library inclusion 2872ifdef USE_FFTW3 2873 ifndef LIBFFTW3 2874 LIBFFTW3 = -lfftw3 2875 endif 2876 ifdef FFTW3_LIB 2877 CORE_LIBS += -L$(FFTW3_LIB) 2878 endif 2879 CORE_LIBS += $(LIBFFTW3) 2880endif 2881 2882 2883# FEFF library inclusion 2884ifdef USE_FEFF 2885 ifndef LIBFEFF 2886 LIBFEFF = -lfeff 2887 endif 2888 ifdef FEFF_LIB 2889 CORE_LIBS += -L$(FEFF_LIB) 2890 endif 2891 CORE_LIBS += $(LIBFEFF) 2892endif 2893 2894 2895 2896# slurm libraries for remaining wall time under slurm resource manager 2897 2898ifdef SLURM 2899 EXTRA_LIBS += $(SLURMOPT) 2900endif 2901 2902ifdef USE_SIMINT 2903ifndef SIMINT_HOME 2904SIMINT_HOME=$(NWCHEM_TOP)/src/NWints/simint/libsimint_source/simint_install 2905endif 2906 ifdef SIMINT_LIB64 2907 EXTRA_LIBS += -L$(SIMINT_HOME)/lib64 -lnwc_simint 2908 else 2909 EXTRA_LIBS += -L$(SIMINT_HOME)/lib -lnwc_simint 2910 endif 2911endif 2912 2913# CUDA 2914ifndef CUDA 2915 CUDA = nvcc 2916endif 2917ifdef TCE_CUDA 2918 DEFINES += -DTCE_CUDA 2919 CORE_LIBS += $(CUDA_LIBS) 2920 EXTRA_LIBS += -lstdc++ 2921 ifdef USE_TTLG 2922 EXTRA_LIBS += -lcublas 2923 endif 2924 ifeq ($(_CC),pgcc) 2925 COPTIONS += -acc 2926 endif 2927endif 2928 2929ifndef HIP 2930 HIP = hipcc 2931endif 2932ifdef TCE_HIP 2933 DEFINES += -DTCE_HIP $(shell hipconfig --cpp_config) 2934 CORE_LIBS += $(HIP_LIBS) 2935 EXTRA_LIBS += -lstdc++ 2936endif 2937 2938ifdef USE_F90_ALLOCATABLE 2939 DEFINES += -DUSE_F90_ALLOCATABLE 2940endif 2941 2942# lower level libs used by communication libraries 2943#case guard against case when tools have not been compiled yet 2944# ifeq ("$(wildcard ${GA_PATH}/bin/ga-config)","") 2945# else 2946COMM_LIBS= $(shell ${GA_PATH}/bin/ga-config --network_ldflags) 2947COMM_LIBS += $(shell ${GA_PATH}/bin/ga-config --network_libs) 2948#comex bit 2949#COMM_LIBS += $(shell [ -e ${NWCHEM_TOP}/src/tools/build/comex/config.h ] && grep LIBS\ = ${NWCHEM_TOP}/src/tools/build/comex/Makefile|grep -v _LIBS| cut -b 8-) -lpthread 2950COMM_LIBS += $(shell [ -e ${GA_PATH}/bin/comex-config ] && ${GA_PATH}/bin/comex-config --libs) -lpthread 2951ifdef COMM_LIBS 2952 CORE_LIBS += $(COMM_LIBS) 2953endif 2954#endif 2955ifdef USE_LINUXAIO 2956 CORE_LIBS += -lrt 2957endif 2958 2959# g++ GNU compatibility (might go away) 2960#CORE_LIBS += -lstdc++ 2961 2962EXTRA_LIBS += $(CONFIG_LIBS) 2963CORE_LIBS += $(EXTRA_LIBS) 2964 2965 2966ifdef OPTIMIZE 2967 FFLAGS = $(FOPTIONS) $(FOPTIMIZE) 2968 CFLAGS = $(COPTIONS) $(COPTIMIZE) 2969else 2970# Need FDEBUG after FOPTIONS on SOLARIS to correctly override optimization 2971 FFLAGS = $(FOPTIONS) $(FDEBUG) 2972 CFLAGS = $(COPTIONS) $(CDEBUG) 2973endif 2974 INCLUDES = -I. $(LIB_INCLUDES) -I$(INCDIR) $(INCPATH) 2975 CPPFLAGS = $(INCLUDES) $(DEFINES) $(LIB_DEFINES) 2976 LDFLAGS = $(LDOPTIONS) -L$(LIBDIR) $(LIBPATH) 2977 LIBS = $(NW_MODULE_LIBS) $(CORE_LIBS) 2978 2979# I think this will work everywhere, but it might have to become 2980# machine-dependent 2981 2982MKDIR = mkdir 2983 2984# 2985# Define known suffixes mostly so that .p files don\'t cause pc to be invoked 2986# 2987V = 0 2988ACTUAL_FC := $(FC) 2989NWFC_0 = @echo "Compiling $<..."; $(ACTUAL_FC) 2990NWFC_1 = $(ACTUAL_FC) 2991NWFC = $(NWFC_$(V)) 2992ACTUAL_CC := $(CC) 2993NWCC_0 = @echo "Compiling $<..."; $(ACTUAL_CC) 2994NWCC_1 = $(ACTUAL_CC) 2995NWCC = $(NWCC_$(V)) 2996.SUFFIXES: 2997.SUFFIXES: .o .s .F .f .c .cpp 2998 2999ifndef FLINT 3000 3001ifdef EXPLICITF 3002# 3003# Needed on machines where FC does not preprocess .F files 3004# with CPP to get .f files 3005# 3006# These rules apply to make-ing of files in specfic directories 3007.SUFFIXES: 3008.SUFFIXES: .o .s .F .f .c 3009 3010.F.o: 3011 @echo Converting $*.F '->' $*.f 3012 @$(FCONVERT) 3013 $(NWFC) -c $(FFLAGS) $*.f 3014 @$(RM) $*.f 3015 3016.F.f: 3017 @echo Converting $*.F '->' $*.f 3018 @$(FCONVERT) 3019.f.o: 3020 $(FC) -c $(FFLAGS) $< 3021endif 3022# 3023# More explicit rules to avoid infinite recursion, to get dependencies, and 3024# for efficiency. CRAY does not like -o with -c. 3025# 3026# These rules apply to make-ing of files in with respect to library files 3027# both these rules and the rules above are needed. 3028(%.o): %.F 3029ifdef EXPLICITF 3030 @echo Converting $< '->' $*.f 3031 @$(FCONVERT) 3032 $(FC) -c $(FFLAGS) $*.f 3033ifndef NWCHEM_KEEPF 3034 @/bin/rm -f $*.f 3035endif 3036else 3037ifeq ($(XLFMAC),y) 3038 $(FC) -c $(FFLAGS) $(INCLUDES) -WF,"$(DEFINES)" $(shell echo $(LIB_DEFINES) | sed -e "s/-D/-WF,-D/g" | sed -e 's/\"/\\"/g') $< 3039else 3040 $(NWFC) -c $(FFLAGS) $(CPPFLAGS) $< 3041endif 3042endif 3043 3044(%.o): %.f 3045 $(NWFC) -c $(FFLAGS) $< 3046 3047(%.o): %.c 3048 $(NWCC) -c $(CPPFLAGS) $(CFLAGS) -o $% $< 3049 3050ifdef GPU_ARCH 3051 CUDA_ARCH = -arch=$(GPU_ARCH) 3052else 3053 CUDA_ARCH = -arch=sm_35 3054endif 3055 3056ifdef TCE_CUDA 3057ifdef USE_TTLG 3058CUDA_VERS_GE8=$(shell nvcc --version|egrep rel| awk '/release 9/ {print "Y";exit}; /release 8/ {print "Y";exit};{print "N"}') 3059 ifeq ($(CUDA_VERS_GE8),N) 3060 CUDA_FLAGS = -O3 -Xcompiler -std=c++11 -DNOHTIME -Xptxas --warn-on-spills $(CUDA_ARCH) 3061 else 3062 CUDA_FLAGS = -O3 -std=c++11 -DNOHTIME -Xptxas --warn-on-spills $(CUDA_ARCH) 3063 endif 3064(%.o): %.cu 3065 $(CUDA) -c -DTCE_CUDA $(CUDA_FLAGS) $(CUDA_INCLUDE) -I$(NWCHEM_TOP)/src/tce/ttlg/includes -o $% $< 3066else 3067(%.o): %.cu 3068 $(CUDA) -c -DTCE_CUDA $(CUDA_FLAGS) $(CUDA_INCLUDE) -o $% $< 3069endif 3070endif 3071 3072ifdef TCE_HIP 3073(%.o): %.hip.cpp 3074 $(HIP) -c -DTCE_HIP -fno-gpu-rdc -o $% $< 3075endif 3076 3077(%.o): %.o 3078 3079# Preceding line has a tab to make an empty rule 3080 3081# a .F.f rule is needed for any system target where the default .F.f rule does not work 3082# AND the EXPLICITF is not already true. Right now this is only LINUX with g77 3083 ifneq ($(_FC),xlf) 3084ifeq ($(TARGET),LINUX) 3085.F.f: 3086 $(FC) -c $(FFLAGS) -E $(CPPFLAGS) $< -o $*.f 3087endif 3088 endif 3089 3090# else for ifndef Flint 3091else 3092# ------------- 3093 3094# First time thru you need the -L... option. Next time remove it 3095# and move the library file name to the last but one argument and add -g 3096ifeq ($(FLINT),1) 3097.F.o:; flint $(CPPFLAGS) -L $(SRCDIR)/nwchem.lbt $< 3098 3099.f.o:; flint $(CPPFLAGS) -L $(SRCDIR)/nwchem.lbt $< 3100else 3101.F.o:; flint $(CPPFLAGS) -g -f -u $(SRCDIR)/nwchem.lbt $< 3102 3103.f.o:; flint $(CPPFLAGS) -g -f -u $(SRCDIR)/nwchem.lbt $< 3104endif 3105 3106endif 3107