Commit b60b36d8 authored by breuera's avatar breuera

Added MPI support to the build script (+minor enhancements).

parent 39c72857
......@@ -96,8 +96,15 @@ env = Environment(variables=vars)
# generate help text
Help(vars.GenerateHelpText(env))
# handle unknown, maybe misspelled variables
unknownVariables = vars.UnknownVariables()
if unknownVariables:
print "*** The following build variables are unknown:", unknownVariables.keys()
Exit(1)
# valid solver for CUDA?
if env['parallelization'] == 'cuda' and env['solver'] != 'rusanov' and env['solver'] != 'fwave':
if env['parallelization'] in ['cuda', 'mpi_with_cuda'] and env['solver'] != 'rusanov' and env['solver'] != 'fwave':
print '** The "'+env['solver']+'" solver is not supported in CUDA.'
Exit(1)
......@@ -137,10 +144,13 @@ elif env['solver'] == 'augrie':
elif env['solver'] == 'hybrid':
env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=0'])
# set the precompiler flags for serial version
if env['parallelization'] in ['none', 'cuda']:
env.Append(CPPDEFINES=['NOMPI'])
# set the precompiler flags for CUDA
if env['parallelization'] == 'cuda':
if env['parallelization'] in ['cuda', 'mpi_with_cuda']:
env.Append(CPPDEFINES=['CUDA'])
env.Append(CPPDEFINES=['NOMPI'])
# set the directories for the CudaTool
if 'cudaToolkitDir' in env:
......@@ -149,11 +159,24 @@ if env['parallelization'] == 'cuda':
env['CUDA_SDK_PATH'] = env['cudaSDKDir']
env.Tool('CudaTool', toolpath = ['.'])
# set precompiler flag for nvcc
env.Append(NVCCFLAGS=' -DCUDA')
# set the compute capability of the cuda compiler (needs to be set after the CudaTool
env.Append(NVCCFLAGS=' --gpu-architecture=')
env.Append(NVCCFLAGS=env['computeCapability'])
# set the precompiler flags for MPI (CUDA)
if env['parallelization'] in ['mpi_with_cuda']:
env.Append(NVCCFLAGS=' -DUSEMPI')
# set the precompiler flags for MPI (C++)
if env['parallelization'] in ['mpi_with_cuda', 'mpi']:
env.Append(CPPDEFINES=['USEMPI'])
env['CXX'] = 'mpiCC.openmpi'
env['LINKERFORPROGRAMS'] = 'mpiCC.openmpi'
# set the precompiler flags and includes for netCDF
if env['writeNetCDF'] == True:
env.Append(CPPDEFINES=['WRITENETCDF'])
......
......@@ -29,7 +29,7 @@
Import('env')
# Code without CUDA
if env['parallelization'] not in ['cuda', 'cuda_with_mpi']:
if env['parallelization'] not in ['cuda', 'mpi_with_cuda']:
if env['solver'] != 'rusanov':
sourceFiles = ['SWE_WavePropagationBlock.cpp']
else:
......@@ -70,8 +70,11 @@ if env['parallelization'] in ['none', 'cuda']:
else:
print '** The selected configuration is not implemented.'
Exit(1)
elif env['parallelization'] in ['mpi_with_cuda', 'mpi']:
sourceFiles.append( ['examples/swe_mpi.cpp'] )
else:
print '** The selected configuration is not implemented.'
Exit(1)
# CPU compilation for sure
for i in sourceFiles:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment