Skip to content

Commit

Permalink
Adding CUDA support part 1 : Configuration for CUDA mode, calls to (c…
Browse files Browse the repository at this point in the history
…urrently) dummy CUDA functions. Please do not attemp

t to turn on the GPU_MODE until next commit
  • Loading branch information
EtienneBachmann committed Jan 14, 2015
1 parent 5d5f257 commit df0a2d8
Show file tree
Hide file tree
Showing 59 changed files with 2,533 additions and 80 deletions.
3 changes: 3 additions & 0 deletions DATA/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 4000.d0 # 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Gmsh_example_Stacey_MPI/Par_file_Gmsh_SqrCircles.in
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/LuoYang_fluid_solid_kernel/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Rayleigh_wave_no_crack/Par_file_Rayleigh_2D
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Rayleigh_wave_with_crack/Par_file_Rayleigh_2D
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Tape2007/Par_file_Tape2007_132rec_checker
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Tape2007/Par_file_Tape2007_onerec
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Tape2007_kernel/Par_file_Tape2007_onerec
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Tromp2005/Par_file_Tromp2005
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Tromp2005/Par_file_Tromp2005_s100
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/Tromp2005_kernel/Par_file_Tromp2005
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/acoustic_poroelastic/Par_file_acoustic_poroelastic
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/anisotropic_zinc_crystal/DATA/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/attenuation/Par_file_attenuation_2D
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/axisymmetric_case_AXISYM_option/Par_file_axisym
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/canyon/Par_file_canyon
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/global_Earth_ak135f/DATA/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/initial_plane_wave/Par_file_Slave
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/initial_plane_wave/Par_file_Slave_for
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/initial_plane_wave/Par_file_Slave_kernel
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/salt_dome_CUBIT_mesh/CPML_homogeneous/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/salt_dome_CUBIT_mesh/CPML_normal_solid_only/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/salt_dome_CUBIT_mesh/Stacey_homogeneous/Par_file
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
3 changes: 3 additions & 0 deletions EXAMPLES/semi_infinite_homo/Par_file_elastic_2D
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ ADD_PERIODIC_CONDITIONS = .false.
# horizontal periodicity distance for periodic conditions
PERIODIC_HORIZ_DIST = 0.3597d0

# set to true to use GPUs
GPU_MODE = .false.

#-----------------------------------------------------------------------------
# PARAMETERS FOR EXTERNAL MESHING

Expand Down
58 changes: 56 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,59 @@ LIB =

LINK = $(F90)


#######################################
####
#### CUDA
#### with configure: ./configure --with-cuda=cuda5 CUDA_FLAGS=.. CUDA_LIB=.. CUDA_INC=.. MPI_INC=.. ..
####
#######################################

@COND_CUDA_TRUE@CUDA = yes
@COND_CUDA_FALSE@CUDA = no

@COND_CUDA5_TRUE@CUDA5 = yes
@COND_CUDA5_FALSE@CUDA5 = 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@

@COND_CUDA_TRUE@NVCC = nvcc
@COND_CUDA_FALSE@NVCC = @CC@

# GPU architecture

# CUDA architecture / code version
# Fermi: -gencode=arch=compute_10,code=sm_10 not supported
# Tesla (default): -gencode=arch=compute_20,code=sm_20
# Geforce GT 650m: -gencode=arch=compute_30,code=sm_30
# Kepler (cuda5) : -gencode=arch=compute_35,code=sm_35
GENCODE_20 = -gencode=arch=compute_20,code=\"sm_20,compute_20\"
GENCODE_30 = -gencode=arch=compute_30,code=\"sm_30,compute_30\"
GENCODE_35 = -gencode=arch=compute_35,code=\"sm_35,compute_35\"

# 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)

# 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@@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_FALSE@NVCC_FLAGS = $(COND_MPI_CPPFLAGS)
@COND_CUDA_FALSE@NVCCLINK = $(NVCC) $(NVCC_FLAGS)


#######################################
####
#### directories
Expand Down Expand Up @@ -106,6 +159,7 @@ S_TOP = @top_srcdir@
SUBDIRS = \
meshfem2D \
shared \
cuda \
specfem2D \
auxiliaries \
$(EMPTY_MACRO)
Expand Down Expand Up @@ -151,8 +205,8 @@ help:
@echo "usage: make [executable]"
@echo ""
@echo "supported executables:"
@echo " xspecfem3D"
@echo " xmeshfem3D"
@echo " xspecfem2D"
@echo " xmeshfem2D"
@echo " xadj_seismogram"
@echo " xcheck_quality_external_mesh"
@echo " xconvolve_source_timefunction"
Expand Down
Loading

0 comments on commit df0a2d8

Please sign in to comment.