# 
# PURPOSE:  MAKEFILE FOR GNU/Linux SPIDER using FFTW3 on 2 or more processors 
# 
# COMPILER: Portland Group F95 
# TARGET:   32 bit Pentium4 Xeon (Should also run on 64 bit Intel / x86_64 OK)
# IMAGES:   Optimal SPIDER image byte order: Big-endian (SGI) (Non-native) 
# USAGE:    make -f Makefile_linux_mp_intel_2013 
#
# NOTE:     Uses FFTW3 configured with: --enable-float --enable-openmp
# NOTE:     You may ignore any undefined QFFLAGS, QLFLAGS & SUFFIX
#
# PGI Compile/link flags
# -O2             : Invokes level 2 optimization (-O3 causes some run time problems with PGI compiler on SPIDER code)
# -Kieee          : Invokes strict IEEE floating calculations
# -mp             : Invokes multi processor support
# -tp p6          : Targets 32 bit Pentium Pro/II/III with 32 bit memory addresses, supports x87 FP
# -tp p7          : Targets 32 or 64 bit Pentium4 with 32 bit memory addresses, supports SSE1 & SSE2 FP
# -tp p7-64       : Targets 64 bit Pentium4 with 64 bit memory addresses, supports SSE1, SSE2 & SSE3 FP
# -tp x64         : Targets unified 64 bit AMD & Intel binaries (samoa)
# -tp k8-64e      : Targets AMD Opteron Revision E or AMD Turion (cluster)
# -Mipa=fast      : Invokes interprocedural analysis 
# -fast           : Selects appropriate set of flags usually including -O2 -Munroll -Mnoframe
# -fastsse        : Selects appropriate set of flags including SSE support and usually -O2 -Munroll -Mnoframe -Mvect=sse -Mcache_align 
# -pc 64          : Sets precision of FPU operations
# -mcmodel=medium : Allows use of >2GB data area 
# -Bstatic_pgi    : Uses static PGI libs but makes dynamic executable
# -Bstatic        : Static link 

AFLAGS   = r

SHELL    = /bin/sh

COMP     = /usr10/pgi/linux86/2013/bin/pgfortran

PGM      = spider

WHICH    = mp_intel

EXE      = $(PGM)_linux_$(WHICH)$(SUFFIX)

LIB      = $(EXE).a

FFLAGS   = -Bstatic -O2 -Mpreprocess -tp p7-32 -fastsse -Mipa=fast -Kieee -Minfo -mp=nonuma -byteswapio -DHAS_IEEE -DSP_MP -DSP_LIBFFTW3 -c  

LF       = -Bstatic -tp p7-32 -fastsse -Mipa=fast -mp=nonuma $(QLFLAGS) 

# Link with FFTW3 static libraries with threads and with math library
FFTWLIBDIR = ../fftw/fftw321-intel/lib
LINKLIBS   = -Bstatic -L$(FFTWLIBDIR) -lfftw3f -lfftw3f_threads -lm   

.PRECIOUS :  ../bin/$(EXE) $(LIB) 

include Makefile.inc

include Makebody.inc

