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) ...@@ -96,8 +96,15 @@ env = Environment(variables=vars)
# generate help text # generate help text
Help(vars.GenerateHelpText(env)) 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? # 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.' print '** The "'+env['solver']+'" solver is not supported in CUDA.'
Exit(1) Exit(1)
...@@ -137,10 +144,13 @@ elif env['solver'] == 'augrie': ...@@ -137,10 +144,13 @@ elif env['solver'] == 'augrie':
elif env['solver'] == 'hybrid': elif env['solver'] == 'hybrid':
env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=0']) 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 # 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=['CUDA'])
env.Append(CPPDEFINES=['NOMPI'])
# set the directories for the CudaTool # set the directories for the CudaTool
if 'cudaToolkitDir' in env: if 'cudaToolkitDir' in env:
...@@ -150,10 +160,23 @@ if env['parallelization'] == 'cuda': ...@@ -150,10 +160,23 @@ if env['parallelization'] == 'cuda':
env.Tool('CudaTool', toolpath = ['.']) 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 # set the compute capability of the cuda compiler (needs to be set after the CudaTool
env.Append(NVCCFLAGS=' --gpu-architecture=') env.Append(NVCCFLAGS=' --gpu-architecture=')
env.Append(NVCCFLAGS=env['computeCapability']) 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 # set the precompiler flags and includes for netCDF
if env['writeNetCDF'] == True: if env['writeNetCDF'] == True:
env.Append(CPPDEFINES=['WRITENETCDF']) env.Append(CPPDEFINES=['WRITENETCDF'])
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
Import('env') Import('env')
# Code without CUDA # 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': if env['solver'] != 'rusanov':
sourceFiles = ['SWE_WavePropagationBlock.cpp'] sourceFiles = ['SWE_WavePropagationBlock.cpp']
else: else:
...@@ -70,8 +70,11 @@ if env['parallelization'] in ['none', 'cuda']: ...@@ -70,8 +70,11 @@ if env['parallelization'] in ['none', 'cuda']:
else: else:
print '** The selected configuration is not implemented.' print '** The selected configuration is not implemented.'
Exit(1) Exit(1)
elif env['parallelization'] in ['mpi_with_cuda', 'mpi']:
sourceFiles.append( ['examples/swe_mpi.cpp'] )
else: else:
print '** The selected configuration is not implemented.' print '** The selected configuration is not implemented.'
Exit(1)
# CPU compilation for sure # CPU compilation for sure
for i in sourceFiles: 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