Skip to content

Commit

Permalink
updates configuration files to have similar setup as in 3D versions; …
Browse files Browse the repository at this point in the history
…uses FLAGS_CHECK instead of DEF_FFLAGS to define user compilation flags
  • Loading branch information
danielpeter committed Nov 16, 2015
1 parent bb31d9f commit 2040646
Show file tree
Hide file tree
Showing 12 changed files with 564 additions and 282 deletions.
71 changes: 52 additions & 19 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,24 @@ FCFLAGS = @FCFLAGS@
MPIFC = @MPIFC@
MPILIBS = @MPILIBS@

DEF_FFLAGS = @DEF_FFLAGS@ -I${SETUP}
FLAGS_CHECK = @FLAGS_CHECK@

FCFLAGS_f90 = @FCFLAGS_f90@ -I${SETUP}

FC_MODEXT = @FC_MODEXT@
FC_MODDIR = @FC_MODDIR@

FCCOMPILE_CHECK =@FCENV@ ${FC} ${FCFLAGS} $(FLAGS_CHECK)

MPIFCCOMPILE_CHECK =@FCENV@ ${MPIFC} ${FCFLAGS} $(FLAGS_CHECK)

CC = @CC@
CFLAGS = @CFLAGS@ $(CPPFLAGS) -I${SETUP}
CPPFLAGS = @CPPFLAGS@ $(COND_MPI_CPPFLAGS)

FC_MODEXT = @FC_MODEXT@
FC_MODDIR = @FC_MODDIR@
# all linker flags
MPILIBS += @LDFLAGS@ @LIBS@

LIB =
LINK = $(F90)

#######################################
####
Expand All @@ -67,8 +74,20 @@ LINK = $(F90)
#######################################

## serial or parallel
@COND_MPI_TRUE@F90 = $(MPIFC) $(FCFLAGS) @FC_DEFINE@USE_MPI @FC_DEFINE@USE_SCOTCH -I"@SCOTCH_INCLUDEDIR@" $(MPILIBS)
@COND_MPI_FALSE@F90 = $(FC) $(FCFLAGS)
@COND_MPI_TRUE@MPI = yes
@COND_MPI_FALSE@MPI = no

@COND_MPI_TRUE@FCLINK = $(MPIFCCOMPILE_CHECK)
@COND_MPI_FALSE@FCLINK = $(FCCOMPILE_CHECK)

@COND_MPI_TRUE@COND_MPI_CPPFLAGS = -DWITH_MPI
@COND_MPI_FALSE@COND_MPI_CPPFLAGS =

MPI_INCLUDES = @MPI_INCLUDES@

# fortran compiler setting
@COND_MPI_TRUE@F90 = $(MPIFCCOMPILE_CHECK) @FC_DEFINE@USE_MPI
@COND_MPI_FALSE@F90 = $(FCCOMPILE_CHECK)

#######################################
####
Expand All @@ -79,12 +98,17 @@ LINK = $(F90)
USE_BUNDLED_SCOTCH = @USE_BUNDLED_SCOTCH@

SCOTCH_DIR = @SCOTCH_DIR@
SCOTCH_INCLUDEDIR = @SCOTCH_INCLUDEDIR@
SCOTCH_INCDIR = @SCOTCH_INCLUDEDIR@
SCOTCH_LIBDIR = @SCOTCH_LIBDIR@

SCOTCH_INC = -I${SCOTCH_INCDIR}
SCOTCH_LIBS = -L${SCOTCH_LIBDIR} -lscotch -lscotcherr

@COND_MPI_TRUE@F90 += @FC_DEFINE@USE_SCOTCH $(SCOTCH_INC)

## scotch libraries
@COND_MPI_TRUE@LIB += -L"@SCOTCH_LIBDIR@" -lscotch -lscotcherr
@COND_MPI_FALSE@LIB +=
@COND_MPI_TRUE@MPILIBS += ${SCOTCH_LIBS}
@COND_MPI_FALSE@MPILIBS +=

#######################################
####
Expand All @@ -103,12 +127,16 @@ SCOTCH_LIBDIR = @SCOTCH_LIBDIR@
@COND_CUDA6_TRUE@CUDA6 = yes
@COND_CUDA6_FALSE@CUDA6 = no

# CUDA compilation with linking
@COND_CUDA_PLUS_TRUE@CUDA_PLUS = yes
@COND_CUDA_PLUS_FALSE@CUDA_PLUS = no

# default cuda libraries
# runtime library -lcudart -lcuda and -lcublas needed

CUDA_FLAGS = @CUDA_FLAGS@
CUDA_INC = @CUDA_CPPFLAGS@ -I${SETUP}
CUDA_LINK = @CUDA_LDFLAGS@ @CUDA_LIBS@ -lcudart -lstdc++
CUDA_LINK = @CUDA_LDFLAGS@ @CUDA_LIBS@

@COND_CUDA_TRUE@NVCC = nvcc
@COND_CUDA_FALSE@NVCC = @CC@
Expand All @@ -131,18 +159,18 @@ GENCODE_37 = -gencode=arch=compute_37,code=\"sm_37\"
# CUDA version 5.x
@COND_CUDA_TRUE@@COND_CUDA5_TRUE@GENCODE = $(GENCODE_35)
# CUDA version 4.x
@COND_CUDA_TRUE@@COND_CUDA5_FALSE@GENCODE = $(GENCODE_20)
@COND_CUDA_TRUE@@COND_CUDA_PLUS_FALSE@GENCODE = $(GENCODE_20)

# CUDA flags and linking
@COND_CUDA_TRUE@NVCC_FLAGS_BASE = $(CUDA_FLAGS) $(CUDA_INC) $(COND_MPI_CPPFLAGS)
@COND_CUDA_TRUE@@COND_CUDA5_TRUE@NVCC_FLAGS = $(NVCC_FLAGS_BASE) -DCUDA $(GENCODE) -ftz=true
@COND_CUDA_TRUE@@COND_CUDA5_FALSE@NVCC_FLAGS = $(NVCC_FLAGS_BASE) -DCUDA -DUSE_OLDER_CUDA4_GPU $(GENCODE)
@COND_CUDA_TRUE@NVCC_FLAGS_BASE = $(CUDA_FLAGS) $(CUDA_INC) $(MPI_INCLUDES) $(COND_MPI_CPPFLAGS)
@COND_CUDA_TRUE@@COND_CUDA_PLUS_TRUE@NVCC_FLAGS = $(NVCC_FLAGS_BASE) -dc -DCUDA $(GENCODE) -ftz=true
@COND_CUDA_TRUE@@COND_CUDA_PLUS_FALSE@NVCC_FLAGS = $(NVCC_FLAGS_BASE) -DCUDA -DUSE_OLDER_CUDA4_GPU $(GENCODE)

@COND_CUDA_TRUE@@COND_CUDA5_TRUE@NVCCLINK_BASE = $(NVCC) $(CUDA_INC) $(COND_MPI_CPPFLAGS) -DCUDA
@COND_CUDA_TRUE@@COND_CUDA5_TRUE@NVCCLINK = $(NVCCLINK_BASE) -dlink $(GENCODE)
@COND_CUDA_TRUE@@COND_CUDA5_FALSE@NVCCLINK = $(NVCCLINK_BASE) -DUSE_OLDER_CUDA4_GPU $(GENCODE)
@COND_CUDA_TRUE@@COND_CUDA_PLUS_TRUE@NVCCLINK_BASE = $(NVCC) $(CUDA_INC) $(MPI_INCLUDES) $(COND_MPI_CPPFLAGS) -DCUDA
@COND_CUDA_TRUE@@COND_CUDA_PLUS_TRUE@NVCCLINK = $(NVCCLINK_BASE) -dlink $(GENCODE)
@COND_CUDA_TRUE@@COND_CUDA_PLUS_FALSE@NVCCLINK = $(NVCCLINK_BASE) -DUSE_OLDER_CUDA4_GPU $(GENCODE)

@COND_CUDA_FALSE@NVCC_FLAGS = $(COND_MPI_CPPFLAGS)
@COND_CUDA_FALSE@NVCC_FLAGS = $(MPI_INCLUDES) $(COND_MPI_CPPFLAGS)
@COND_CUDA_FALSE@NVCCLINK = $(NVCC) $(NVCC_FLAGS)


Expand Down Expand Up @@ -230,10 +258,15 @@ help:
@echo " xmeshfem2D"
@echo ""
@echo "additional executables:"
@echo "- auxiliary executables: [make aux]"
@echo " xadj_seismogram"
@echo " xcheck_quality_external_mesh"
@echo " xconvolve_source_timefunction"
@echo ""
@echo "- sensitivity kernel postprocessing tools: [make postprocess]"
@echo " xcombine_sem"
@echo " xsmooth_sem"
@echo ""


.PHONY: all default backup clean realclean help
Expand Down
Loading

0 comments on commit 2040646

Please sign in to comment.